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

Circuit is not properly updated when changed by pistons #502

Closed
bodqhrohro opened this issue Feb 22, 2020 · 3 comments
Closed

Circuit is not properly updated when changed by pistons #502

bodqhrohro opened this issue Feb 22, 2020 · 3 comments

Comments

@bodqhrohro
Copy link

mesecons_bug1_comp

I see some similar recent issues related to overheat, so maybe it's the cause this time too?

@Desour
Copy link
Contributor

Desour commented Feb 22, 2020

I'm able to reproduce.
The pos where the node came from is updated correctly, the destination however isn't.
(See

for source.)

@bodqhrohro
Copy link
Author

So how to fix it? I tried to replace it with updating both positions:

diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua
index 807692e..dd4e56f 100644
--- a/mesecons_mvps/init.lua
+++ b/mesecons_mvps/init.lua
@@ -239,11 +239,6 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
                minetest.remove_node(n.pos)
        end
 
-       -- update mesecons for removed nodes ( has to be done after all nodes have been removed )
-       for _, n in ipairs(nodes) do
-               mesecon.on_dignode(n.pos, n.node)
-       end
-
        -- add nodes
        for _, n in ipairs(nodes) do
                local np = vector.add(n.pos, movedir)
@@ -267,6 +262,12 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
                moved_nodes[i].node_timer = nodes[i].node_timer
        end
 
+       -- update the moved mesecons
+       for _, n in ipairs(moved_nodes) do
+               mesecon.on_dignode(n.oldpos, n.node)
+               mesecon.on_dignode(n.pos, n.node)
+       end
+
        on_mvps_move(moved_nodes)
 
        return true, nodes, oldstack

But it didn't help.

@numberZero
Copy link
Contributor

Dupe of #406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants