1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-11-05 18:10:37 +01:00

Add initial_properties to armor stand entity (#116)

* Add `initial_properties` to armor stand entity

* Keep pos param

* fix

* fix crash
This commit is contained in:
Niklp 2023-10-22 19:21:52 +02:00 committed by GitHub
parent aef125a0ca
commit c894ba4b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,26 +300,27 @@ minetest.register_node("3d_armor_stand:locked_armor_stand", {
})
minetest.register_entity("3d_armor_stand:armor_entity", {
physical = true,
visual = "mesh",
mesh = "3d_armor_entity.obj",
visual_size = {x=1, y=1},
collisionbox = {0,0,0,0,0,0},
textures = {"3d_armor_trans.png"},
pos = nil,
timer = 0,
initial_properties = {
physical = true,
visual = "mesh",
mesh = "3d_armor_entity.obj",
visual_size = {x=1, y=1},
collisionbox = {0,0,0,0,0,0},
textures = {"3d_armor_trans.png"},
},
_pos = nil,
on_activate = function(self)
local pos = self.object:get_pos()
if pos then
self.pos = vector.round(pos)
self._pos = vector.round(pos)
update_entity(pos)
end
end,
on_blast = function(self, damage)
local drops = {}
local node = minetest.get_node(self.pos)
local node = minetest.get_node(self._pos)
if node.name == "3d_armor_stand:armor_stand" then
drop_armor(self.pos)
drop_armor(self._pos)
self.object:remove()
end
return false, false, drops