Restore armor stand entities when knocked-back by TNT

This commit is contained in:
stujones11 2016-04-27 18:48:06 +01:00
parent 1aa2b769d7
commit 5c5359de4f

View File

@ -212,9 +212,31 @@ minetest.register_entity("3d_armor_stand:armor_entity", {
visual_size = {x=1, y=1},
collisionbox = {-0.1,-0.4,-0.1, 0.1,1.3,0.1},
textures = {"3d_armor_trans.png"},
pos = nil,
timer = 0,
on_activate = function(self)
local pos = self.object:getpos()
if pos then
self.pos = vector.round(pos)
update_entity(pos)
end
end,
on_step = function(self, dtime)
if not self.pos then
return
end
self.timer = self.timer + dtime
if self.timer > 1 then
self.timer = 0
local pos = self.object:getpos()
if pos then
if vector.equals(self.pos, pos) then
return
end
end
update_entity(self.pos)
self.object:remove()
end
end,
})