Not logged inOpenClonk Forum
Up Topic Basic functionality for switches

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Sven2
Looks great (assuming you tested the scenarios and the legacy call to SetStoneDoor). Some suggestions:
* The name Library_Mechanism isn't very descriptive. dictionary.com defines mechanism as "a system of parts working together in a machine" (i.e. Switch+Door combined could be a mechanism). I think you could simply call it Library_SwitchTarget? After all, the set-function in the switch is also called SetSwitchTarget.
* You have the function to flip the input in the target. I think it would be more convenient to have it in the switch instead. That way, you can have multiple switches control the same door, but using different directions.
* You do two callbacks when flipping the switch (OnInputSignalChanged and OnInputSignalSet). Remember that the first callback may have deleted the object. You should check for that.

Btw: While code reorganization is fine, I think it would be way cooler to have something new that the player can see! (like wires to connect switches and targets). See e.g. here: working backwards.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill