]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix piston stack overflow problem with ironblocks
authoroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 29 Jun 2020 09:06:20 +0000 (05:06 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 29 Jun 2020 09:06:20 +0000 (05:06 -0400)
mods/redstone/capacitors.lua
mods/redstone/piston.lua

index 2d2fe7b2ccebb7c3b8eb0d643aacde62936092b1..694c597be371d742fd586eb89575c9daf0ca98c4 100644 (file)
@@ -12,8 +12,10 @@ minetest.override_item("main:ironblock",{
     end,
     after_destruct = function(pos, oldnode)
         redstone.inject(pos,nil)
-        redstone.update(pos)
-        redstone.update(pos,true)
+        --redstone.update(pos)
+        minetest.after(0,function()
+            redstone.update(pos,true)
+        end)
     end
 })
 
@@ -86,8 +88,10 @@ minetest.register_node(":main:ironblock_on", {
     end,
     after_destruct = function(pos, oldnode)
         redstone.inject(pos,nil)
-        redstone.update(pos)
-        redstone.update(pos,true)
+        --redstone.update(pos)
+        minetest.after(0,function()
+            redstone.update(pos,true)
+        end)
     end,
 })
 
index 9f52a89e6e3738d4ab514995cf4bfac0eabdc4b3..294479814fc6f86a3de8322bdf9d954810d490fe 100644 (file)
@@ -94,9 +94,13 @@ local function push_nodes(pos,dir)
                        end
                else
                        for i = 1,table.getn(move_index) do
-                               move_index[i].pos = vector.add(move_index[i].pos,dir)
-                               minetest.set_node(move_index[i].pos,move_index[i])
-                               minetest.check_for_falling(move_index[i].pos)
+                               if move_index[i] then
+                                       if move_index[i].pos then
+                                       move_index[i].pos = vector.add(move_index[i].pos,dir)
+                                       minetest.set_node(move_index[i].pos,move_index[i])
+                                       minetest.check_for_falling(move_index[i].pos)
+                                       end
+                               end
                        end
                end
        end