Skip to content
Snippets Groups Projects
Commit cd92cfe0 authored by dg's avatar dg
Browse files

lets see what yufra breaks thise time :)

git-svn-id: http://svn.net-core.org/repos/t-engine4@6812 51575b47-30f0-44d4-a5cc-537603b46e54
parent 55629f62
No related branches found
No related tags found
No related merge requests found
......@@ -23,13 +23,12 @@ local Astar = require "engine.Astar"
newAI("move_simple", function(self)
if self.ai_target.actor then
local tx, ty = self:aiSeeTargetPos(self.ai_target.actor)
if not self:hasLOS(self.ai_target.actor.x, self.ai_target.actor.y) then
-- Move towards the last seen position if we have one
if self.ai_state.target_last_seen and type(self.ai_state.target_last_seen) == "table" then
tx, ty = self.ai_state.target_last_seen.x, self.ai_state.target_last_seen.y
end
local tx, ty
-- Move towards the last seen position if we have one
if self.ai_state.target_last_seen and type(self.ai_state.target_last_seen) == "table" then
tx, ty = self.ai_state.target_last_seen.x, self.ai_state.target_last_seen.y
else
tx, ty = self:aiSeeTargetPos(self.ai_target.actor)
end
return self:moveDirection(tx, ty)
end
......
......@@ -122,7 +122,8 @@ function _M:doAI()
-- Update the ai_target table
local target_pos = self.ai_target.actor and self.fov and self.fov.actors and self.fov.actors[self.ai_target.actor]
if target_pos then
self.ai_state.target_last_seen = {x=target_pos.x, y=target_pos.y, turn=self.fov_last_turn}
local tx, ty = self:aiSeeTargetPos(self.ai_target.actor)
self.ai_state.target_last_seen = {x=tx, y=ty, turn=self.fov_last_turn}
end
return self:runAI(self.ai)
......
......@@ -431,7 +431,8 @@ function _M:clearAITarget()
self.ai_target.actor = self.ai_target.actor.summoner
-- You think you can cheat with summons ? let's cheat back !
-- yeah it's logical because .. hum .. yeah because the npc saw were the summon came from!
self.ai_state.target_last_seen = {x=self.ai_target.actor.x, y=self.ai_target.actor.y, turn=game.turn}
local tx, ty = self:aiSeeTargetPos(self.ai_target.actor)
self.ai_state.target_last_seen = {x=tx, y=ty, turn=game.turn}
end
if self.ai_target.actor and self.ai_target.actor.dead then self.ai_target.actor = nil end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment