mt-mods / pipeworks

Pipeworks is a mod for Minetest allowing the crafting and usage of pipes and tubes
Other
15 stars 22 forks source link

Detector tube stuck in ON state on game exit. #65

Open Alatarius opened 1 year ago

Alatarius commented 1 year ago

I thought is was mesecons issue that their wires weren't conducting. When I'm in creative mode, everything works fine but when I go to regular mode everything stops conducting.

mesecons responded with: "It doesn’t stop conducting. A detector pipe is stuck in the “on” state, jamming the wire effectively (Mesecon devices act on off→on transition typically which can’t happen if the wire is constantly on). And it doesn’t depend on creative mode, it gets stuck if it is on when you exit the game. Report to pipeworks.

creative mode: https://drive.google.com/file/d/1GCf9V3lWBIx2eyI0z8xBqISHziSIJmJC/view?usp=share_link regular mode: https://drive.google.com/file/d/1_YVn_vsLVFYp-1UIUWACOWqZOgRJPZbR/view?usp=share_link

[edit] I am using the current version of pipeworks as of this writing playing minetest_game on current version (5.7.0)

mods installed are digilines, mesecons and pipeworks

S-S-X commented 1 year ago

I am using the current version of pipeworks as of this writing

Current version as in latest from ContentDB? https://content.minetest.net/packages/mt-mods/pipeworks/ Or latest from master branch of this repository? bd5a423

Seems like ContentDB version is bit old already, I guess we should update it anyway, seems like it is db6d1bd And how much been changed since then? A lot: https://github.com/mt-mods/pipeworks/compare/db6d1bd..master

Alatarius commented 1 year ago

Yes, that's the one. [edit 2] I just installed the pipeworks from ContentDB yeterday.

[edit] I'm just an end user and know nothing about code. There were so many files and bits of code my brain just exploded. lol, is there a simple file I can just install?

S-S-X commented 1 year ago

Yes, that's the one.

So ContentDB? I mean installed directly through Minetest content tab, not downloaded from GitHub?

is there a simple file I can just install?

For simple file, yes you can try to install latest from GitHub but I think we should anyway make new release to ContentDB too.

If you want to try and download latest version from github you can use this link: https://github.com/mt-mods/pipeworks/archive/refs/heads/master.zip

Then unzip that package into your minetest mods directory replacing existing pipeworks directory there (you have to move old pipeworks directory out or just delete it first).

After you've done there should be similar files in minetest/mods/pipeworks what there were before replacing it with latest version from GitHub.

Reminder, you can do that but you do not have to do that

We'll try to make new release soon so if you want to wait a bit then updated version will be soon available through Minetest content tab.

Alatarius commented 1 year ago

I downloaded it through the content tab on mt originally and I just installed the version you linked above and I still have the same issue.

S-S-X commented 1 year ago

Mesecons and Digilines seem to be fairly recent versions on ContentDB, only Pipeworks was very old version there.

I guess we have to test this bit more but can you confirm it gets stuck in on-state even if there's no mesecons wires or mesecons devices connected to detector tube when you leave game? I mean if you have only regular tubes and mesecon tube but no other active devices connected.

S-S-X commented 1 year ago

https://github.com/minetest-mods/mesecons/issues/641

Alatarius commented 1 year ago

I have the detector tube connected to the stack/item injectors when I exit. I built an automated furnace system for ores and foods

[edit] The detector tubes are connected with the mesecon wires so that it will continually pass a signal to the injectors to perpetually run.

[edit 2] I attached an image so you can see the setup smelter

numberZero commented 1 year ago

can you confirm it gets stuck in on-state even if there's no mesecons wires or mesecons devices connected to detector tube when you leave game?

I can. It does. On latest master (bd5a42356bc20a71dac5d11ea04deb4fa6246d0e) too (with mesecons [release=17623] and digilines [release=16482] from ContentDB if that matters). screenshot_20230501_005353

S-S-X commented 1 year ago

Checked code and cause seems pretty clear: it is just that detector uses mintest.after to update states and there's nothing restoring state, item_exit isn't actually real event handler but just a thing queued with mintest.after.

So I guess have to add some way to reset state after server restart, best would probably be actual events for item movement. Other options from top of my head would be actually tracking timers and continue after restart. Or rather dirty LBM reset but LBM would not be complete solution because it is actually one-shot-ABM and gets triggered for block activation instead of block loading but probably "good enough".

numberZero commented 1 year ago

detector uses mintest.after to update states

Maybe use Mesecons actionqueue instead? It has public API IIRC.

actual events for item movement.

Maybe, or maybe not. That may get pretty hairy as there may be many items in the tube simultaneously.

S-S-X commented 1 year ago

Maybe use Mesecons actionqueue instead? It has public API IIRC.

Thanks, I guess this is probably best option if it easily allows similar rate limiting what now happens with stack counters + timer.

wsor4035 commented 1 year ago

if this can be done without a hard dependency on mesecons that would be preferable

S-S-X commented 1 year ago

if this can be done without a hard dependency on mesecons that would be preferable

Yes seems it is. Actually seems like even simpler than current method (from user's perspective) and seems it can easily be fully contained within tube definition (which is only registered if mesecons is available). Basically just single fire and forget API call.