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

Trying to rest with foes in sight will not spend a turn

git-svn-id: http://svn.net-core.org/repos/t-engine4@4680 51575b47-30f0-44d4-a5cc-537603b46e54
parent adfbdf42
No related branches found
No related tags found
No related merge requests found
......@@ -31,14 +31,23 @@ function _M:restInit(turns, what, past, on_end)
rest_turns = turns,
past = past,
on_end = on_end,
cnt = 1,
cnt = 0,
dialog = Dialog:simplePopup(what:capitalize().."...", "You are "..what..", press Enter to stop.", function()
self:restStop()
end),
}
self.resting.dialog.__showup = nil
self:useEnergy()
game.log(what:capitalize().." starts...")
local ret, msg = self:restCheck()
if ret and self.resting and self.resting.rest_turns and self.resting.cnt > self.resting.rest_turns then ret = false msg = nil end
if not ret then
self:restStop(msg)
else
self:useEnergy()
self.resting.cnt = self.resting.cnt + 1
end
end
--- Rest a turn
......
......@@ -554,6 +554,8 @@ end
local function spotHostiles(self)
local seen = {}
if not self.x then return seen end
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent resting
core.fov.calc_circle(self.x, self.y, game.level.map.w, game.level.map.h, self.sight or 10, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
local actor = game.level.map(x, y, game.level.map.ACTOR)
......
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