How can I trigger other block's action via modded block?

#1
The title pretty much describes my problem.

I'd like to make to make a sensor mod ... i've figured out how I can detect things but i just cant figure out how to trigger other blocks.
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#2
Just an assembly decompiler on "Assembly-CSharp.dll" and see if there are any methods on the blocks you want to activate that you can call. You could also try to override MKey and somehow feed into that.
 
#4
So... your advise was very helpful ... I managed to shoot a cannon via my sensor block (via calling the "Shoot" method from the Cannonblock). Soon I noticed that not every block has such a method which is why i wanted to try your second suggestion (overriding MKey). After trying quite a few things I figured the most promising thing to do is to create a new KeyInputController which I can control from my script. Either I didnt get what this controller does or i just implemented it wrong ... probably both.

What do you think about that? Could this approach work? If not could you specify what you meant by "override MKey and somehow feed into that"? I'm kinda stuck :(

Thank you
 
Last edited:
Top