mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-21 13:25:44 +01:00
on_step logic
This commit is contained in:
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user