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

The custom death messages now account for drowning, suffocating, and other such fun deaths

git-svn-id: http://svn.net-core.org/repos/t-engine4@3799 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3fa0f6d1
No related branches found
No related tags found
No related merge requests found
......@@ -322,7 +322,7 @@ function _M:actBase()
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 air_condition or not self.can_breath[air_condition] or self.can_breath[air_condition] <= 0 then
self:suffocate(-air_level, self)
self:suffocate(-air_level, self, air_condition == "water" and "drowned to death" or nil)
end
end
end
......@@ -2523,14 +2523,14 @@ function _M:worthExp(target)
end
--- Suffocate a bit, lose air
function _M:suffocate(value, src)
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
self.air = self.air - value
local ae = game.level.map(self.x, self.y, Map.ACTOR)
if self.air <= 0 then
game.logSeen(self, "%s suffocates to death!", self.name:capitalize())
return self:die(src), true
return self:die(src, {special_death_msg=death_message or "suffocated to death"}), true
end
return false, true
end
......
......@@ -436,8 +436,8 @@ function _M:die(src, death_note)
end
--- Suffocate a bit, lose air
function _M:suffocate(value, src)
local dead, affected = mod.class.Actor.suffocate(self, value, src)
function _M:suffocate(value, src, death_msg)
local dead, affected = mod.class.Actor.suffocate(self, value, src, death_msg)
if affected and value > 0 and self.runStop then
self:runStop("suffocating")
self:restStop("suffocating")
......
......@@ -77,15 +77,25 @@ function _M:onPartyDeath(src, death_note)
end
end
local msg = "%s the %d %s %s was %s to death by %s%s%s on level %s of %s."
msg = msg:format(
game.player.name, game.player.level, game.player.descriptor.subrace:lower(), game.player.descriptor.subclass:lower(),
death_mean or "battered",
src.unique and src.name or src.name:a_an(),
src.name == top_killer and " (yet again)" or "",
(src.killer_message and " "..src.killer_message or ""):gsub("#sex#", game.player.female and "her" or "him"),
game.level.level, game.zone.name
)
local msg
if not death_note.special_death_msg then
msg = "%s the level %d %s %s was %s to death by %s%s%s on level %s of %s."
msg = msg:format(
game.player.name, game.player.level, game.player.descriptor.subrace:lower(), game.player.descriptor.subclass:lower(),
death_mean or "battered",
src.unique and src.name or src.name:a_an(),
src.name == top_killer and " (yet again)" or "",
(src.killer_message and " "..src.killer_message or ""):gsub("#sex#", game.player.female and "her" or "him"),
game.level.level, game.zone.name
)
else
msg = "%s the level %d %s %s %s on level %s of %s."
msg = msg:format(
game.player.name, game.player.level, game.player.descriptor.subrace:lower(), game.player.descriptor.subclass:lower(),
death_note.special_death_msg,
game.level.level, game.zone.name
)
end
game.log("#{bold}#"..msg.."#{normal}#")
if not game.player.easy_mode_lifes or game.player.easy_mode_lifes <= 0 then
......
......@@ -66,7 +66,7 @@ newEntity{
local a = game.level.map(self.x, self.y, engine.Map.ACTOR)
if a then
game.logPlayer(a, "You are crushed by the collapsing tunnel! You suffocate!")
a:suffocate(30, self)
a:suffocate(30, self, "was buried alive")
engine.DamageType:get(engine.DamageType.PHYSICAL).projector(self, self.x, self.y, engine.DamageType.PHYSICAL, a.life / 2)
end
end
......
......@@ -524,7 +524,7 @@ newEffect{
if math.floor(core.fov.distance(self.x, self.y, eff.src.x, eff.src.y)) > 1 or eff.src.dead or not game.level:hasEntity(eff.src) then
return true
end
self:suffocate(eff.power, eff.src)
self:suffocate(eff.power, eff.src, (" was constricted to death by %s."):format(eff.src.unique and eff.src.name or eff.src.name:a_an()))
end,
deactivate = function(self, eff)
self:removeTemporaryValue("never_move", eff.tmpid)
......
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