From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Wed, 1 Jul 2020 17:09:55 +0000 (-0400) Subject: Fix crashing in very specific state X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=cf4db41d7032241e4a958c765417a4911bb6a308;p=Crafter.git Fix crashing in very specific state --- diff --git a/mods/redstone/init.lua b/mods/redstone/init.lua index 1998fb4..f9875bf 100644 --- a/mods/redstone/init.lua +++ b/mods/redstone/init.lua @@ -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