Adventure-Terraria-Server-Project / AdvancedCircuits-Plugin

Advanced Circuits Plugin for Terraria Server API and TShock.
GNU General Public License v3.0
8 stars 8 forks source link

Powerable Boulders #9

Closed CoderCow closed 11 years ago

CoderCow commented 11 years ago

Boulders should start rolling to the direction of the sending component when signaled.

Modifiers: 1 - The Boulder rolls to the opposite direction.

ghost commented 11 years ago

What is to happen if a boulder receives two simultaneous signals from either direction? Should it stay put? In fact, that could be pretty neat, as it would allow for traps where two players must synchronise their movement.

CoderCow commented 11 years ago

This would require a Boulder to be delayed before it actually starts rolling so it could be cancelled because a rolling Boulder could never receive a signal. But, one could build an an appropriate circuit for that already so I see no use in implementing this.

ghost commented 11 years ago

This is true, but it seems to me like the question still stands: what happens if the boulder receives two simultaneous signals from two disparate directions?

Now, I don't know how the signals are done by the game, and perhaps there are no such things as simultaneous signals, and if so I withdraw my question. Feel free to enlighten me!

CoderCow commented 11 years ago

Two simultaneous signals are impossible to receive as signals in AC don't travel with speed, they are instant - one signal would always reach the Boulder before the other, and if that one is 1 the Boulder would start rolling, making it impossible for it to receive another signal to stop it again.

ghost commented 11 years ago

That signals are instant I was already privy to, but suppose one and the same component is sending the two signals, like so:

A split signal

Forgive my persistence, by the way, I only seek understanding.

CoderCow commented 11 years ago

Actually one branch would be processed first, after that the other one. As that one branch is being processed first it would already prepare the Boulder to roll, even though the circuit did not finished processing all branches yet. As the Boulder is already prepared for rolling, the other branch would be unable to signal the Boulder again.

Same thing goes for other components, if let's say a Dart Trap received 1, the arrow will be fired, no matter if there's a 0 signal following after that in the same circuit processing.

ghost commented 11 years ago

Ah, OK. Thanks for clearing that up!