Tracing a redstone signal back to who triggered it

Discussion in 'Plugin Development' started by kyle1320, Sep 1, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    kyle1320

    Say a block gets powered by redstone. I need to find out the player who sent the signal to power it. I figured you could do this by listening for lever flips and button presses then tracing the redstone line and seeing if it goes into the block, but redstone can get pretty abstract (Say someone steps on a pressure plate that powers a piston to push a block over a torch that then powers the block..) What would be the easiest way to do this? Is there any source code I can take a look at? Thanks
     
  2. I've thought about this before. I came to the same conclusion as you.
    It's pretty freaking hard to trace it back to a player.

    I don't know of any code. But if there is code.... it could never be perfectly accurate.
     
  3. Offline

    andf54

    It's not that complicated at second glance. (Totally complicated at first glance:p)

    When a button/switch is triggered then use recursive methods (tag me and ask if you don’t know what those are) and collect all blocks that can be affected by redstone (wire, pistons, blocks near pistons, redstone torches) into an array and store it for the player.

    Listen to redstone events and check if the changed block is in one of those lists.
    If it is then the player is responsible.
     
    blackwolf12333 likes this.
Thread Status:
Not open for further replies.

Share This Page