Inject code/stuff into Entities Hooks without overwriting them

Hello, im looking for a way to put code / functions into an Entities Hook without overwriting the Hook itself… So the Entity will still work.

What i want to do:
im working on an script for the mod ACF, that allows turbines to have Thrust, and Jet Flame effects.
I cant edit the acf files itself, because my addon (acfe) is like a addon for and addon (acf)

Example. I got an acf_engine Entity, its having 2 Wire Inputs “Active” and “Throttle”.
Now i add a third input, using: Wire_CreateInputs(Entity, {“Active”, “Throttle”, “FlameEffects”})

Now when one of the inputs is triggered, the Entity Hook “TriggerInput” is getting called
Well, for “Active” and “Throttle”, theres code within the Hook to manage what to do.
But how do i check, if FlameEffects is triggered?
When i do**: Entity.TriggerInput = function(iname, value) …stuff for Input “FlameEffects”… the Active and Throttle part doesnt work, because ive overwritten the Hook.



(“Entity” is the acf_engine currently used)

I’m not sure I completely understand, but maybe you could try storing the old ent hook that you’ve overwritten, rewrite it how you want, and then call the old hook.


Entity.oldtriggerinput = Entity.TriggerInput

Entity.TriggerInput = function(self, iname, value, ..) -- other args i'm missing
    -- stuff
    self.oldtriggerinput(self, iname, value, ..)  -- same args

Wow, it worked. thank you. I hope the performance loss isnt that high doing it like this.