Skip to content
Snippets Groups Projects
Commit ed8b4cfd authored by Grayswandir's avatar Grayswandir
Browse files

Makes AI see through stealth better.

If AI gains LoS for the first time but fails to spot you, they treat it
as if they haven't seen you for 10 turns, instead of as if they had
spotted you that turn.
parent 87d85ea9
No related branches found
No related tags found
No related merge requests found
......@@ -163,8 +163,14 @@ function _M:aiSeeTargetPos(target)
local LSeen = self.ai_state.target_last_seen
if type(LSeen) ~= "table" then return tx, ty end
local spread = 0
LSeen.GCache_turn = LSeen.GCache_turn or game.turn -- Guess Cache turn to update position guess (so it's consistent during a turn)
LSeen.GCknown_turn = LSeen.GCknown_turn or game.turn -- Guess Cache known turn for spread calculation (self.ai_state.target_last_seen.turn can't be used because it's needed by FOV code)
-- Guess Cache turn to update position guess (so it's consistent during a turn)
-- Start at -1000 to make sure ti gets run the first time.
LSeen.GCache_turn = LSeen.GCache_turn or game.turn - 1000
-- Guess Cache known turn for spread calculation (self.ai_state.target_last_seen.turn
-- can't be used because it's needed by FOV code)
LSeen.GCknown_turn = LSeen.GCknown_turn or game.turn - 1000
-- Check if target is currently seen
local see, chance = self:canSee(target)
......@@ -187,4 +193,4 @@ function _M:aiSeeTargetPos(target)
if LSeen.GCache_x then return LSeen.GCache_x, LSeen.GCache_y end
end
return tx, ty -- Fall through to correct coords
end
\ No newline at end of file
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