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

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@6182 51575b47-30f0-44d4-a5cc-537603b46e54
parent 85724ceb
No related branches found
No related tags found
No related merge requests found
......@@ -1906,7 +1906,7 @@ function _M:setAllowedBuild(what, notify)
end
function _M:playSoundNear(who, name)
if who and self.level.map.seens(who.x, who.y) then
if who and self.level and self.level.map.seens(who.x, who.y) then
local pos = {x=0,y=0,z=0}
if self.player and self.player.x then pos.x, pos.y = who.x - self.player.x, who.y - self.player.y end
self:playSound(name, pos)
......
......@@ -739,7 +739,7 @@ function _M:restCheck()
node.actor:addParticles(engine.Particles.new("notice_enemy", 1))
end
local dir = game.level.map:compassDirection(spotted[1].x - self.x, spotted[1].y - self.y)
return false, ("hostile spotted to the %s (%s%s)"):format(dir, spotted[1].actor.name, game.level.map:isOnScreen(spotted[1].x, spotted[1].y) and "" or " - offscreen")
return false, ("hostile spotted to the %s (%s%s)"):format(dir or "???", spotted[1].actor.name, game.level.map:isOnScreen(spotted[1].x, spotted[1].y) and "" or " - offscreen")
end
-- Resting improves regen
......@@ -823,7 +823,7 @@ function _M:runCheck(ignore_memory)
local spotted = spotHostiles(self)
if #spotted > 0 then
local dir = game.level.map:compassDirection(spotted[1].x - self.x, spotted[1].y - self.y)
return false, ("hostile spotted to the %s (%s%s)"):format(dir, spotted[1].actor.name, game.level.map:isOnScreen(spotted[1].x, spotted[1].y) and "" or " - offscreen")
return false, ("hostile spotted to the %s (%s%s)"):format(dir or "???", spotted[1].actor.name, game.level.map:isOnScreen(spotted[1].x, spotted[1].y) and "" or " - offscreen")
end
if self.air_regen < 0 and self.air < 0.75 * self.max_air then return false, "losing breath!" 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