The trap will only activate when the red wire is cut. You could of course wire this up to something else as well, like explosives.
Here's a play-by-play of what's going on:
0. The dummy engine outputs a signal once every frame.
1. The red wire gets tripped.
2. The red wire switches the lamp on the faulty gate ON and changes the lamp on the not faulty logic gate.
3. The state of the not faulty gate has changed, so it outputs a signal on blue.
4. The blue wire switches the lamp on the faulty gate OFF and hits the faulty lamp.
5. The faulty lamp of the faulty gate was hit, but the only other lamp is OFF, so it generates a signal with a 0% chance.
6. Nothing happens.
But when the red wire is broken:
1. The red wire gets tripped.
2. The red wire switches changes the lamp on the not faulty logic gate. (The one on the faulty gate got disconnected.)
3. The state of the not faulty gate has changed, so it outputs a signal on blue.
4. The blue wire switches the lamp on the faulty gate ON and hits the faulty lamp.
5. The faulty lamp of the faulty gate was hit, and the only other lamp is ON, so it generates a signal with a 100% chance.
6. The green wire gets triggered, it resets the lamp on the faulty gate to OFF and activates the trap.
You can find out more about the operation of logic gates here:
https://forums.terraria.org/index.p...operations-smoke-and-how-to-prevent-it.44020/