mods - mobs - fix nil when stop mob attacking if player isnt seen when explote
* the positionits not set cos the mobs is not attacking in such time seems there is a small amount of time that the actionis not true * the stop is only after double check , but must be after first also
This commit is contained in:
parent
e80a4596d8
commit
e82e0fa9cc
11
api.lua
11
api.lua
@ -2560,14 +2560,18 @@ function mob_class:do_states(dtime)
|
||||
if not self.attack:get_pos() or self.attack:get_hp() <= 0 and is_invisible(self, self.attack:get_player_name()) then
|
||||
--print(" ** stop attacking **", self.name, self.health, dist, self.view_range)
|
||||
self:stop_attack()
|
||||
return
|
||||
end
|
||||
if not p then
|
||||
self:stop_attack()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- check enemy is in sight
|
||||
local in_sight = self:line_of_sight(
|
||||
local in_sight
|
||||
if p then
|
||||
in_sight = self:line_of_sight(
|
||||
{x = s.x, y = s.y + 0.5, z = s.z},
|
||||
{x = p.x, y = p.y + 0.5, z = p.z})
|
||||
|
||||
@ -2582,17 +2586,18 @@ function mob_class:do_states(dtime)
|
||||
else
|
||||
self.target_time_lost = 0
|
||||
end
|
||||
end
|
||||
|
||||
if self.attack_type == "explode" then
|
||||
|
||||
self:yaw_to_pos(p)
|
||||
if p then self:yaw_to_pos(p) end
|
||||
|
||||
local node_break_radius = self.explosion_radius or 1
|
||||
local entity_damage_radius = self.explosion_damage_radius
|
||||
or (node_break_radius * 2)
|
||||
|
||||
-- look a little higher to fix raycast
|
||||
s.y = s.y + 0.5 ; p.y = p.y + 0.5
|
||||
if p then s.y = s.y + 0.5 ; p.y = p.y + 0.5 end
|
||||
|
||||
-- start timer when in reach and line of sight
|
||||
if not self.v_start
|
||||
|
Loading…
x
Reference in New Issue
Block a user