godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Add a Logic node to simulate a script on another node without actually attaching a script to it

Open Shadowblitz16 opened this issue 1 year ago • 2 comments

Describe the project you are working on

A mario game.

Describe the problem or limitation you are having in your project

Currently scripts are attached to a node which means if you add additional nodes in a tool script or remove a script from a node at runtime, you either leave dangling nodes or you break the interface, meaning code that calls a property or method on that script breaks.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The idea is to move logic to be part of the scene rather then the filesystem, kinda like built in scripts but with more features.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Basically it would be a engine node type called Logic and would basically be a node that simulates a script on another node without actually having a script attached to it.

It wouldn't store it in a resource but would be fully embedded into the logic node itself. Which means it would be a alternative to a built in script.

It would also be able to register the target node or scene as a engine type. Which means no scripts to be detached.

It would be a child of the scene instead of part of the root. Which means it wouldn't be exposed in parent scenes.

It would support running as a tool script.

It would support multiple script per scene or node. Which means it would act as sort of a component.

It would support exporting signals and properties to the target node or scene.

If this enhancement will not be used often, can it be worked around with a few lines of script?

If implemented correctly, it would probably be used more then scripts currently

Is there a reason why this should be core and not an add-on in the asset library?

It helps us build better composite scenes.

Shadowblitz16 avatar Mar 11 '25 15:03 Shadowblitz16

This sounds like a godot engine next major version change? Is it possible to reduce scope?

fire avatar Mar 12 '25 20:03 fire

I don't know, I just listed what my use cases were.

Shadowblitz16 avatar Mar 13 '25 22:03 Shadowblitz16