mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-21 05:15:47 +01:00
entity cleanups
This commit is contained in:
parent
419d663e15
commit
61108c179a
26
cannon.lua
26
cannon.lua
@ -9,15 +9,30 @@ local register_spacecannon = function(def)
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
visual_size = {x=0.25, y=0.25},
|
||||
textures = {entity_texture,entity_texture,entity_texture,entity_texture,entity_texture,entity_texture},
|
||||
textures = {
|
||||
entity_texture,
|
||||
entity_texture,
|
||||
entity_texture,
|
||||
entity_texture,
|
||||
entity_texture,
|
||||
entity_texture
|
||||
},
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
physical = false
|
||||
},
|
||||
timer = 0,
|
||||
lifetime = 0,
|
||||
static_save = false,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
self.lifetime = self.lifetime + dtime
|
||||
|
||||
if self.lifetime > def.timeout then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
|
||||
if self.timer > 0.5 then
|
||||
@ -70,16 +85,7 @@ local register_spacecannon = function(def)
|
||||
self.object:remove()
|
||||
|
||||
end
|
||||
end,
|
||||
|
||||
on_activate = function(self)
|
||||
minetest.after(def.timeout,
|
||||
function(me)
|
||||
me.object:remove()
|
||||
end,
|
||||
self)
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user