Open tavurth opened 1 year ago
I don't really see how this makes things any better, and to me it significantly reduces readability, and a workaround you're missing is to make a local var in your script with the object you want and access it removing the lengthy $node access
This would also cause confusion for functions that are named like setters but aren't setters, like ones in servers, which don't have associated properties, and functions that take multiple arguments
It'd be relatively straightforward to make the generated setter functionality in GDScript do this, but for general functions that happen to look like a property setter you'd have to do this manually, which would be a massive undertaking
And if it's not done uniformly it'd be very confusing and cause people to report it as bugs
Perhaps then supporting some system to override basic gdscript types would help with this.
In that way we could release this as a gdextension or gdscript addon
Override what basic types and in what way?
Override what basic types and in what way?
Override all _setters
for example.
Currently I can do this in GDscript
, but at the same time it will require me to disable that warning on anyone who installs that plugin.
Perhaps there would be an easier way to override every setter, instead of re-writing them with super
in GDScript
Describe the project you are working on
Any project
Describe the problem or limitation you are having in your project
I quite often find myself doing the following:
However in my own scripts I would have set up these setter functions to always
return self
at the end.This could simplify the script above as follows:
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I don't have to have bulky text lookups in my code.
I don't have to
@onready var
assign something if it's only used a few times in the code.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
This would be GDScript core
Is there a reason why this should be core and not an add-on in the asset library?
I don't see any way to do this with an addon, I just wanted to start this discussion.