mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-01 23:11:11 +01:00
Merge pull request 'Fix nametags (Fixes #1649)' (#1651) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1651
This commit is contained in:
commit
d5e0632ebc
4 changed files with 10 additions and 30 deletions
|
@ -53,7 +53,6 @@ local vector_multiply = vector.multiply
|
|||
local vector_divide = vector.divide
|
||||
|
||||
-- mob constants
|
||||
local MAX_MOB_NAME_LENGTH = 30
|
||||
local BREED_TIME = 30
|
||||
local BREED_TIME_AGAIN = 300
|
||||
local CHILD_GROW_TIME = 60*20
|
||||
|
|
|
@ -940,30 +940,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
|
|||
end
|
||||
end
|
||||
|
||||
local update_tag = function(self)
|
||||
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,
|
||||
})
|
||||
|
||||
update_roll(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ local math_random = math.random
|
|||
local vector_direction = vector.direction
|
||||
local vector_multiply = vector.multiply
|
||||
|
||||
local MAX_MOB_NAME_LENGTH = 30
|
||||
|
||||
mobs.feed_tame = function(self)
|
||||
return nil
|
||||
end
|
||||
|
@ -28,7 +30,7 @@ local on_rightclick_prefix = function(self, clicker)
|
|||
end
|
||||
self.nametag = tag
|
||||
|
||||
update_tag(self)
|
||||
mobs.update_tag(self)
|
||||
|
||||
if not mobs.is_creative(clicker:get_player_name()) then
|
||||
item:take_item()
|
||||
|
@ -281,3 +283,9 @@ mobs.shoot_projectile = function(self)
|
|||
--call internal shoot_arrow function
|
||||
self.shoot_arrow(self,pos1,dir)
|
||||
end
|
||||
|
||||
mobs.update_tag = function(self)
|
||||
self.object:set_properties({
|
||||
nametag = self.nametag,
|
||||
})
|
||||
end
|
|
@ -200,10 +200,6 @@ mobs.mob_activate = function(self, staticdata, def, dtime)
|
|||
self.object:set_texture_mod("")
|
||||
end
|
||||
|
||||
-- check existing nametag
|
||||
if not self.nametag then
|
||||
self.nametag = def.nametag
|
||||
end
|
||||
|
||||
-- set anything changed above
|
||||
self.object:set_properties(self)
|
||||
|
|
Loading…
Reference in a new issue