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
1 changed files with 12 additions and 11 deletions

View File

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