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

Escort quest AI will now run for the portal if it is in sight and the path is clear

git-svn-id: http://svn.net-core.org/repos/t-engine4@1176 51575b47-30f0-44d4-a5cc-537603b46e54
parent 12e6aa72
No related branches found
No related tags found
No related merge requests found
......@@ -281,11 +281,12 @@ function _M:canSee(actor, def, def_pct)
end
--- Does the actor have LOS to the target
function _M:hasLOS(x, y)
function _M:hasLOS(x, y, what)
what = what or "block_sight"
local l = line.new(self.x, self.y, x, y)
local lx, ly = l()
while lx and ly do
if game.level.map:checkAllEntities(lx, ly, "block_sight") then break end
if game.level.map:checkAllEntities(lx, ly, what) then break end
lx, ly = l()
end
......
......@@ -28,7 +28,7 @@ newAI("escort_quest", function(self)
self:runAI("dumb_talented")
end
if not self.energy.used then
if self:reactionToward(self.ai_target.actor) < 0 then
if self:reactionToward(self.ai_target.actor) < 0 and not self:hasLOS(self.escort_target.x, self.escort_target.y, "block_move") then
self:runAI("move_dmap")
else
self:runAI("move_escort")
......
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