minetest-mods / mesecons

Mod for Minetest that adds digital circuitry [=Minecraft redstone]
https://mesecons.net
Other
211 stars 121 forks source link

[Bug] Some sort of update skipping weirdness #642

Open VorTechnix opened 1 year ago

VorTechnix commented 1 year ago

image Those lights should not be powered.

image To replicate the issue just build this setup and flip the switch on and off.

When the piston connects the wire to the diode in the same tick that the diode turns off light blocks in the circuit get set to on until the circuit is updated again. (Note: the Mese lines aren't powered though)

Desour commented 1 year ago

Can reproduce.

I've measured (with https://github.com/Desour/meseconometer) the signals (number is in server-steps, C is input (switch), B is output (lamps)):

[93.0,"C","on"],
[126.0,"C","off"],
[127.0,"B","on"],
[128.0,"B","off"],

As you can see, there's a 1-step pulse when the switch is turned off.

The issue doesn't happen when you place a diode gate between the lamp and the lamp signal.

My guess at what happens is that the wire is already off when the lightstones' action_on is called. So, when the wire goes off, the lightstone is still off and won't receive the event.

Maybe this could be fixed if we didn't differentiate between off and on effectors.

numberZero commented 1 year ago

As you can see, there's a 1-step pulse when the switch is turned off.

Apparently 1-tick pulses were always problematic... see my note in #536 2.5 years ago: “<...> outputs a pulse 2 Mesecon ticks long. Sharper (1-tick) pulse is possible but while e.g. gates and movestones work well with that, lamps and pistons don’t”.