on_step logic

This commit is contained in:
NatureFreshMilk 2019-07-29 13:24:21 +02:00
parent b60bc6328f
commit dc598bb21c

@ -42,8 +42,11 @@ local register_spacecannon = function(def)
end end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local node_def = minetest.registered_nodes[node.name]
if node.name == "air" or node.name == "vacuum:vacuum" then local goes_through = not node_def.walkable
if goes_through then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
local collided = false local collided = false
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
@ -61,7 +64,7 @@ local register_spacecannon = function(def)
self.object:remove() self.object:remove()
end end
elseif node.name ~= "air" and node.name ~= "vacuum:vacuum" then else
-- collision -- collision
spacecannon.destroy(pos, def.range, def.intensity) spacecannon.destroy(pos, def.range, def.intensity)
self.object:remove() self.object:remove()