![]() |
default class
I've heard it suggested before to release the default stuff to servers so they can edit it... but I'm not sure if we'll ever see that.
So what I suggest is a class called default that is created with the server. All functions created in this class are ran BEFORE the default functions. This way, we can overwrite default functions ourselves, to maybe make custom systems more backwards compatible. For example, if I make the function: function say2(txt) { player.chat = txt; } in the default class, all say2 functions will instead set the player's chat to the text rather than open a sign. I'm not sure how possible this is, or what kind of security risks there are, but just thought I'd see what others thought. |
This sorta makes everything complicated, because then scripters have to learn to expect different functionality for what should be "built-in functions" across different servers. It is also probably way too easy to break a lot of existing code very quickly also by making a mistake in such a class. Built-in functions should be kept the way they are.
|
Quote:
Quote:
I'm against it simply because of the way GScript is. In a fully object oriented situation, you'd have something like: PHP Code:
Something similar would just be odd with how GS2 is now. |
I do not really see what you are gaining there. It is not like C where you want to override standard library functions used by other libraries, you could just always go and edit scripts to call mySay2() which will do whatever you want anyway. :\
There is probably going to be a performance cost here that does not seem worth the gain. |
Such a global class is partially a problem because of how function pointers are working. Such a global class could become quite large, seeing the size of some Control-NPCs. In my opinion it's better if the object is joining the needed classes at the beginning or end of the script so that you can easily see where functions are borrowed from. This is of course some problem when using existing levels where you would have to patch each single npc to use the new function.
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 11:20 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.