diff --git a/game/engines/default/engine/Actor.lua b/game/engines/default/engine/Actor.lua index f5c43106756ce1a9327eb96b5e1bab31ae8896e4..6515af10c0c84f10468c820ccc319c8035a9d03f 100644 --- a/game/engines/default/engine/Actor.lua +++ b/game/engines/default/engine/Actor.lua @@ -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 diff --git a/game/modules/tome/ai/escort.lua b/game/modules/tome/ai/escort.lua index f6c24113f2b31fb302ea748ecfad38b2be78f0f9..08904f8bb3fb21d70831d7e5c2718b35f349a95f 100644 --- a/game/modules/tome/ai/escort.lua +++ b/game/modules/tome/ai/escort.lua @@ -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")