Skip to content

Call Node#71

Open
ch0m5 wants to merge 55 commits intonagidev:mainfrom
ch0m5:call_node
Open

Call Node#71
ch0m5 wants to merge 55 commits intonagidev:mainfrom
ch0m5:call_node

Conversation

@ch0m5
Copy link
Copy Markdown
Contributor

@ch0m5 ch0m5 commented Oct 14, 2024

Addition of the Node "CallNode", which reads a .gd file in order to call static methods from it. It works with any type of method, using whichever arguments and returns, with few exceptions, such as the inability to handle default arguments for Dictionaries and Arrays.

The nature of this Node and the way their methods are called force them to be static methods, however modifications could be made in the future so this isn't needed and calls can be made methods inside autoloads that aren't necessarily static.

Carles Homs and others added 30 commits October 7, 2024 21:20
… type of the data Type that is required for said argument.
@ch0m5
Copy link
Copy Markdown
Contributor Author

ch0m5 commented Oct 14, 2024

Showcase of CallNode use case and various functionalities:

CallNodeShowcase.mp4

(Red background on the text are due to Early Warning system not being able to parse variables, although once parsed they are valid.)
image

@ch0m5
Copy link
Copy Markdown
Contributor Author

ch0m5 commented Oct 15, 2024

Added last-minute upgrade so that calls from Autoloads are possible.

In a nutshell, if a Call is made in-game (not in-Editor) the system checks root's children's scripts and if one matches the Call's assigned script (resource path matches), the method is called from that Node instead that the Script Resource itself.

(There may be a more efficient way to do this, particularly directly accessing the Autoload rather than searching among root's children, but I haven't found it in the time I've dedicated to this.)

This means that CallNodes can now be set to call non-static methods, as long as there's an Autoload (or any child of root for that matter) that has an instance of that Script attached.

Note that multiple Autoloads with the same Script is not supported. It could be, but it was kind of a headache (specially regarding an Early Warning to inform the user of potential bugs in-Editor) and I considered too much of a niche use-case to get on it, but such an upgrade could be added in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants