Context: I installed a train mod for fabric 1.16.5. The mod currently comes with what's called a "Platform Screen Doors", which will open with the train door at the same time.
I am currently trying to play an custom sound with command block when the Platform Screen Door is opened. But since it does not emit any redstone signal, I have used an observer shown below: (Command block not shown)
This by itself works as intended, where the observer would lit up for 1 tick, delay for 1 redstone tick, then repeat as long as the door is opened.
But I want it to only trigger the command block once, then wait for x seconds before it's allowed to be triggered again.
My thoughts would be to lock the repeater once it's activated, go through a bunch of repeater (for delay), then unlock it, but I can't think of how can I let it unlock by itself.
UPDATE: Hacked my way through it, but I doubt it will be reliable on long runs.
Essentially once the observer is triggered, it will:
- Lock the repeater
- Trigger the command block for playsound
- Go through a lot of repeaters (So I can delay it for 20s)
- Set "block1" (The pink square) to air to unlock the repeater.
- Delay for a bit, then set block1 back to redstone dust for the next use.
Though I still can't think of how can I delay it for 20s without a lot repeaters, I don't want to use Piston + hopper as it creates sounds I also have no idea how reliable setblock command really is Sorry I usually don't touch redstone stuff, any suggestion appreciated!