I’m currently building out the level system for a game that will rely heavily on machines, placed in the level, that need to interact with other machines. Examples of these machines include input machines: switches, buttons, sensors; logic machines: timers, logic gates, signal delayers; and output machines: flamethrowers, saws, doors.
An example of a level interaction might be: A switch has a timer as its activation target, when it’s switched on, it will activate the timer. After the timer is finished, it will activate a set of doors to begin closing.
What would the most efficient way be to assign a machine a list of “activation targets” (other machines) and then have it be able to efficiently call a function on those targets?
In theory, I imagine the best way to do this would be to give each instanced machine a unique identifier and then give every machine an
activation_targetsarray that contains the id’s of every machine it wants to activate when X condition is met. I also assume for performance reasons, when a level is loaded, every machine with activation targets should find and then store the paths of the machines in the list.
The difficulty I’m having, is figuring out how to do this in godot with it’s instanced scene system as I’m rather new to the engine.