]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix directional activator deactivation with purely torches
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 27 Jun 2020 22:30:08 +0000 (18:30 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 27 Jun 2020 22:30:08 +0000 (18:30 -0400)
mods/redstone/init.lua

index db839dd51b801b7995c8dbed2dcfa638634e1141..69fbf111bbf48645d77abe2ff61815b3c5f21ca8 100644 (file)
@@ -162,27 +162,37 @@ local n_pos
 local temp_pool
 local temp_pool2
 local input
+local ignore
 local directional_activator = function(pos)
+       
+       ignore = false
+       input = nil
+       temp_pool2 = nil
+
        temp_pool = pool[pos.x][pos.y][pos.z]
        
-       if not temp_pool then return end
+       if not temp_pool then ignore = true end
 
-       input = temp_pool.input
+       if not ignore then
+               input = temp_pool.input
+       end
 
-       if not input then return end
+       if not input then ignore = true end
 
-       input = add_vec(input,pos)
+       if not ignore then
+               input = add_vec(input,pos)
+       end
 
-       if pool and pool[input.x] and pool[input.x][input.y] and pool[input.x][input.y][input.z] then
+       if not ignore and pool and pool[input.x] and pool[input.x][input.y] and pool[input.x][input.y][input.z] then
                temp_pool2 = pool[input.x][input.y][input.z]
        else
-               return
+               ignore = true
        end
 
-       if not temp_pool2 then return end
+       if not temp_pool2 then ignore = true end
 
-       if (temp_pool2.dust and temp_pool2.dust > 0) or (temp_pool2.torch and temp_pool2.directional_activator and temp_pool2.dir == temp_pool.dir) or 
-       (not temp_pool2.directional_activator and temp_pool2.torch)  then
+       if not ignore and ((temp_pool2.dust and temp_pool2.dust > 0) or (temp_pool2.torch and temp_pool2.directional_activator and temp_pool2.dir == temp_pool.dir) or 
+       (not temp_pool2.directional_activator and temp_pool2.torch))  then
                if activator_table[temp_pool.name].activate then
                        activator_table[temp_pool.name].activate(pos)
                        return
@@ -283,7 +293,6 @@ local function calculate(pos)
        for x,datax in pairs(boundary) do
                for y,datay in pairs(datax) do
                        for z,data in pairs(datay) do
-                               print("test")
                                if data.directional_activator then
                                        directional_activator(new_vec(x,y,z))
                                elseif data.activator then
@@ -311,6 +320,8 @@ function redstone.update(pos)
        if recursion_check[s_pos] > 50 then
                minetest.after(0,function()
                        minetest.dig_node(pos)
+                       data_injection(pos,nil)
+                       redstone.update(pos)
                end)
                return
        end