Skip to content
Snippets Groups Projects
Commit d2e078da authored by DarkGod's avatar DarkGod
Browse files

Equipping a belt of undeath or similar immediately stops suffocation

parent 12d18b54
No related branches found
No related tags found
No related merge requests found
......@@ -7301,8 +7301,8 @@ end
--- Suffocate a bit, lose air
function _M:suffocate(value, src, death_message)
if self:attr("no_breath") then return false, false end
if self:attr("invulnerable") then return false, false end
if self:attr("no_breath") then self:removeEffect(self.EFF_SUFFOCATING) return false, false end
if self:attr("invulnerable") then self:removeEffect(self.EFF_SUFFOCATING) return false, false end
self.air = self.air - value
local ae = game.level.map(self.x, self.y, Map.ACTOR)
self.force_suffocate = true
......
......@@ -2672,6 +2672,15 @@ newEffect{
self:removeEffect(self.EFF_SUFFOCATING, false, true)
return
end
-- We can breathe now! What a relief!
local air_level, air_condition = game.level.map:checkEntity(self.x, self.y, Map.TERRAIN, "air_level"), game.level.map:checkEntity(self.x, self.y, Map.TERRAIN, "air_condition")
if air_level then
if not (not air_condition or not self.can_breath[air_condition] or self.can_breath[air_condition] <= 0) or self:attr("no_breath") or self:attr("invulnerable") then
self.is_suffocating = nil
self:removeEffect(self.EFF_SUFFOCATING, false, true)
return
end
end
-- Bypass all shields & such
local old = self.onTakeHit
......
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