move debug/nametag code back to api.lua

This commit is contained in:
cora 2022-11-11 19:20:43 +01:00
parent 90321ee578
commit 6948b77226
2 changed files with 24 additions and 23 deletions

View File

@ -55,6 +55,30 @@ local node_ok = function(pos, fallback)
return minetest.registered_nodes[fallback]
end
function mob_class:update_tag() --update nametag and/or the debug box
local tag
if mobs_debug then
tag = "nametag = '"..tostring(self.nametag).."'\n"..
"state = '"..tostring(self.state).."'\n"..
"order = '"..tostring(self.order).."'\n"..
"attack = "..tostring(self.attack).."\n"..
"health = "..tostring(self.health).."\n"..
"breath = "..tostring(self.breath).."\n"..
"gotten = "..tostring(self.gotten).."\n"..
"tamed = "..tostring(self.tamed).."\n"..
"horny = "..tostring(self.horny).."\n"..
"hornytimer = "..tostring(self.hornytimer).."\n"..
"runaway_timer = "..tostring(self.runaway_timer).."\n"..
"following = "..tostring(self.following).."\n"..
"lifetimer = "..tostring(self.lifetimer)
else
tag = self.nametag
end
self.object:set_properties({
nametag = tag,
})
end
function mob_class:get_staticdata()
for _,p in pairs(minetest.get_connected_players()) do

View File

@ -250,29 +250,6 @@ function mob_class:update_roll()
end
function mob_class:update_tag()
local tag
if mobs_debug then
tag = "nametag = '"..tostring(self.nametag).."'\n"..
"state = '"..tostring(self.state).."'\n"..
"order = '"..tostring(self.order).."'\n"..
"attack = "..tostring(self.attack).."\n"..
"health = "..tostring(self.health).."\n"..
"breath = "..tostring(self.breath).."\n"..
"gotten = "..tostring(self.gotten).."\n"..
"tamed = "..tostring(self.tamed).."\n"..
"horny = "..tostring(self.horny).."\n"..
"hornytimer = "..tostring(self.hornytimer).."\n"..
"runaway_timer = "..tostring(self.runaway_timer).."\n"..
"following = "..tostring(self.following)
else
tag = self.nametag
end
self.object:set_properties({
nametag = tag,
})
end
local function shortest_term_of_yaw_rotation(self, rot_origin, rot_target, nums)
if not rot_origin or not rot_target then