mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-09 17:30:21 +01:00
simplify homing
This commit is contained in:
parent
682d76d7b3
commit
bb66ffe335
9
api.lua
9
api.lua
@ -2655,8 +2655,7 @@ function mob_class:do_states(dtime)
|
|||||||
|
|
||||||
-- setup homing arrow and target
|
-- setup homing arrow and target
|
||||||
if self.homing then
|
if self.homing then
|
||||||
ent._target = self.attack
|
ent._homing_target = self.attack
|
||||||
ent.homing = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- offset makes shoot aim accurate
|
-- offset makes shoot aim accurate
|
||||||
@ -4232,9 +4231,9 @@ function mobs:register_arrow(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- make homing arrows follow target if seen
|
-- make homing arrows follow target if seen
|
||||||
if self.homing and self._target then
|
if self._homing_target then
|
||||||
|
|
||||||
local p = self._target:get_pos()
|
local p = self._homing_target:get_pos()
|
||||||
|
|
||||||
if p then
|
if p then
|
||||||
|
|
||||||
@ -4244,7 +4243,7 @@ function mobs:register_arrow(name, def)
|
|||||||
vector.direction(self.object:get_pos(), p) * self.velocity)
|
vector.direction(self.object:get_pos(), p) * self.velocity)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self._target = nil
|
self._homing_target = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user