]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix crashing in very specific state
authoroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 1 Jul 2020 17:09:55 +0000 (13:09 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 1 Jul 2020 17:09:55 +0000 (13:09 -0400)
mods/redstone/init.lua

index 1998fb4469b2c6db6c72c160e2966c401ba7f329..f9875bf8f8ec7efc9e01065440565b4b49f53418 100644 (file)
@@ -235,24 +235,26 @@ local temp_pool2
 local non_directional_activator = function(pos)
        if pool[pos.x] and pool[pos.x][pos.y] and pool[pos.x][pos.y][pos.z] then
                temp_pool = pool[pos.x][pos.y][pos.z]
-               for _,order in pairs(order) do
-                       n_pos = add_vec(pos,order)
-                       if pool[n_pos.x] and pool[n_pos.x][n_pos.y] and pool[n_pos.x][n_pos.y][n_pos.z] then
-                               temp_pool2 = pool[n_pos.x][n_pos.y][n_pos.z]
-                               if temp_pool2 then
-                                       if (not temp_pool2.directional_activator and temp_pool2.torch) or 
-                                       (temp_pool2.dust and temp_pool2.dust > 0) or 
-                                       (temp_pool2.torch_directional and vector.equals(temp_pool2.output, pos)) then
-                                               if activator_table[temp_pool.name].activate then
-                                                       activator_table[temp_pool.name].activate(pos)
+               if temp_pool then
+                       for _,order in pairs(order) do
+                               n_pos = add_vec(pos,order)
+                               if pool[n_pos.x] and pool[n_pos.x][n_pos.y] and pool[n_pos.x][n_pos.y][n_pos.z] then
+                                       temp_pool2 = pool[n_pos.x][n_pos.y][n_pos.z]
+                                       if temp_pool2 then
+                                               if (not temp_pool2.directional_activator and temp_pool2.torch) or 
+                                               (temp_pool2.dust and temp_pool2.dust > 0) or 
+                                               (temp_pool2.torch_directional and vector.equals(temp_pool2.output, pos)) then
+                                                       if activator_table[temp_pool.name] and activator_table[temp_pool.name].activate then
+                                                               activator_table[temp_pool.name].activate(pos)
+                                                       end
+                                                       return
                                                end
-                                               return
                                        end
                                end
+                       end     
+                       if activator_table[temp_pool.name] and activator_table[temp_pool.name].deactivate then
+                               activator_table[temp_pool.name].deactivate(pos)
                        end
-               end     
-               if activator_table[temp_pool.name].deactivate then
-                       activator_table[temp_pool.name].deactivate(pos)
                end
        end
 end