mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-11 18:30:21 +01:00
fix nametag bug when self.follow is nil
This commit is contained in:
parent
487e037cc9
commit
78ef560852
15
api.lua
15
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20181220",
|
version = "20181229",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||||
}
|
}
|
||||||
@ -537,7 +537,6 @@ function mob_class:update_tag()
|
|||||||
nametag = self.nametag,
|
nametag = self.nametag,
|
||||||
nametag_color = col
|
nametag_color = col
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -974,6 +973,7 @@ local entity_physics = function(pos, radius)
|
|||||||
obj_pos = objs[n]:get_pos()
|
obj_pos = objs[n]:get_pos()
|
||||||
|
|
||||||
dist = get_distance(pos, obj_pos)
|
dist = get_distance(pos, obj_pos)
|
||||||
|
|
||||||
if dist < 1 then dist = 1 end
|
if dist < 1 then dist = 1 end
|
||||||
|
|
||||||
local damage = floor((4 / dist) * radius)
|
local damage = floor((4 / dist) * radius)
|
||||||
@ -3111,7 +3111,6 @@ function mob_class:on_step(dtime)
|
|||||||
self:do_jump()
|
self:do_jump()
|
||||||
|
|
||||||
self:do_runaway_from(self)
|
self:do_runaway_from(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -3947,12 +3946,9 @@ local mob_sta = {}
|
|||||||
-- feeding, taming and breeding (thanks blert2112)
|
-- feeding, taming and breeding (thanks blert2112)
|
||||||
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
|
|
||||||
if not self.follow then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- can eat/tame with item in hand
|
-- can eat/tame with item in hand
|
||||||
if self:follow_holding(clicker) then
|
if self.follow
|
||||||
|
and self:follow_holding(clicker) then
|
||||||
|
|
||||||
-- if not in creative then take item
|
-- if not in creative then take item
|
||||||
if not mobs.is_creative(clicker:get_player_name()) then
|
if not mobs.is_creative(clicker:get_player_name()) then
|
||||||
@ -3995,6 +3991,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
|||||||
|
|
||||||
-- feed and tame
|
-- feed and tame
|
||||||
self.food = (self.food or 0) + 1
|
self.food = (self.food or 0) + 1
|
||||||
|
|
||||||
if self.food >= feed_count then
|
if self.food >= feed_count then
|
||||||
|
|
||||||
self.food = 0
|
self.food = 0
|
||||||
@ -4003,8 +4000,6 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
|||||||
self.horny = true
|
self.horny = true
|
||||||
end
|
end
|
||||||
|
|
||||||
self.gotten = false
|
|
||||||
|
|
||||||
if tame then
|
if tame then
|
||||||
|
|
||||||
if self.tamed == false then
|
if self.tamed == false then
|
||||||
|
Loading…
Reference in New Issue
Block a user