Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 1-tick pulses causing delayers to get stuck in the on state #663

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

lolbinarycat
Copy link
Contributor

Fixes #656

i believe the cause of this bug is a chain of events as such:

  • delayer receives effector_on, and starts a timer
  • delayer receives effector_off, however the node has not been updated somehow (perhaps due to caching somewhere), and thus this is dropped
  • delayer swaps node into on state

this may be caused by an underlying bug somewhere in the action queue, but simply changing the unpowered state so it also responds to power off events seems to do the trick just fine.

@lolbinarycat lolbinarycat changed the title fix 1-tick pulses causing delayers to get stuck on fix 1-tick pulses causing delayers to get stuck in the on state Dec 19, 2023
@SmallJoker
Copy link
Member

How can I reproduce the issue to then test this PR's fix?

@SmallJoker
Copy link
Member

2024-01-06 12:43:08: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '??' in callback environment_Step(): MT/builtin/common/item_s.lua:229: bad argument #1 to '__index' (string expected, got nil)
2024-01-06 12:43:08: ERROR[Main]: stack traceback:
2024-01-06 12:43:08: ERROR[Main]: 	[C]: in function '__index'
2024-01-06 12:43:08: ERROR[Main]: 	MT/builtin/common/item_s.lua:229: in function <MT/builtin/common/item_s.lua:228>
2024-01-06 12:43:08: ERROR[Main]: 	[C]: in function 'swap_node'
2024-01-06 12:43:08: ERROR[Main]: 	MT/mods/mesecons/mesecons_delayer/init.lua:20: in function 'action_off'
2024-01-06 12:43:08: ERROR[Main]: 	MT/mods/mesecons/mesecons/internal.lua:207: in function <MT/mods/mesecons/mesecons/internal.lua:200>
2024-01-06 12:43:08: ERROR[Main]: 	MT/mods/mesecons/mesecons/actionqueue.lua:137: in function 'execute'
2024-01-06 12:43:08: ERROR[Main]: 	MT/mods/mesecons/mesecons/actionqueue.lua:111: in function <MT/mods/mesecons/mesecons/actionqueue.lua:73>
2024-01-06 12:43:08: ERROR[Main]: 	MT/builtin/common/register.lua:26: in function <MT/builtin/common/register.lua:12>

when placing an inverter into the indicated location:
error reproducer

@lolbinarycat
Copy link
Contributor Author

@SmallJoker thanks, should be fixed now!

@SmallJoker
Copy link
Member

@lolbinarycat Thank you. I can no longer reproduce that error. However, I'd still like to know which circuit bug this PR aims to fix. Where can I see the change in behaviour?

@lolbinarycat
Copy link
Contributor Author

@SmallJoker i didn't find a 100% reliable way to replicate it, but what i did was make a 1 tick piston clock (a sticky piston with a switch on its face, then use wire to connect the switch to the piston), then take a line from the clock to the back of a delayer.

if you destroy the wire directly behind the delayer with the correct timing, the delayer will get stuck in the "on" position despite there being no wire leading into it. also when i was doing that i was also intentionally lagging the game, which may or may not be required.

after this change, i was unable to replicate the bug with this method.

@SmallJoker
Copy link
Member

The singleplayer server tick is a bit too fast for this type of oscillator. OpenAL is not too happy about it. However, with this setup I did reproduce the bug and the PR does indeed fix it.

grafik

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge in a few days unless there are objections.

@SmallJoker SmallJoker merged commit 5978043 into minetest-mods:master Jan 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants