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

Death message is now shown after the damage message

git-svn-id: http://svn.net-core.org/repos/t-engine4@5485 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0537411f
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ require "engine.Actor"
require "engine.Autolevel"
require "engine.interface.ActorInventory"
require "engine.interface.ActorTemporaryEffects"
require "engine.interface.ActorLife"
require "mod.class.interface.ActorLife"
require "engine.interface.ActorProject"
require "engine.interface.ActorLevel"
require "engine.interface.ActorStats"
......@@ -44,7 +44,7 @@ module(..., package.seeall, class.inherit(
engine.Actor,
engine.interface.ActorInventory,
engine.interface.ActorTemporaryEffects,
engine.interface.ActorLife,
mod.class.interface.ActorLife,
engine.interface.ActorProject,
engine.interface.ActorLevel,
engine.interface.ActorStats,
......@@ -201,7 +201,7 @@ function _M:init(t, no_default)
engine.Actor.init(self, t, no_default)
engine.interface.ActorInventory.init(self, t)
engine.interface.ActorTemporaryEffects.init(self, t)
engine.interface.ActorLife.init(self, t)
mod.class.interface.ActorLife.init(self, t)
engine.interface.ActorProject.init(self, t)
engine.interface.ActorTalents.init(self, t)
engine.interface.ActorResource.init(self, t)
......@@ -2003,7 +2003,7 @@ function _M:takeHit(value, src, death_note)
end
end
local dead, val = engine.interface.ActorLife.takeHit(self, value, src, death_note)
local dead, val = mod.class.interface.ActorLife.takeHit(self, value, src, death_note)
if dead and src and src.attr and src:attr("overkill") and src.project and not src.turn_procs.overkill then
src.turn_procs.overkill = true
......@@ -2038,7 +2038,7 @@ end
function _M:die(src, death_note)
if self.dead then self:disappear(src) self:deleteFromMap(game.level.map) return true end
engine.interface.ActorLife.die(self, src, death_note)
mod.class.interface.ActorLife.die(self, src, death_note)
-- Gives the killer some exp for the kill
local killer = nil
......
......@@ -1024,6 +1024,7 @@ function _M:displayDelayedLogDamage()
if target.dead then
if self.level.map.seens(x, y) and (rsrc == self.player or rtarget == self.player or self.party:hasMember(rsrc) or self.party:hasMember(rtarget)) then
self.flyers:add(sx, sy, 30, (rng.range(0,2)-1) * 0.5, rng.float(-2.5, -1.5), ("Kill (%d)!"):format(dams.total), {255,0,255}, true)
game.logSeen(target, "#{bold}#%s killed %s!#{normal}#", src.name:capitalize(), target.name)
end
else
if self.level.map.seens(x, y) and (rsrc == self.player or self.party:hasMember(rsrc)) then
......@@ -1034,6 +1035,8 @@ function _M:displayDelayedLogDamage()
end
end
end
if self.delayed_death_message then game.log(self.delayed_death_message) end
self.delayed_death_message = nil
self.delayed_log_damage = {}
end
......
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Base = require "engine.interface.ActorLife"
--- Handles actors life and death
module(..., package.seeall, class.inherit(Base))
--- Remove some HP from an actor
-- If HP is reduced to 0 then remove from the level and call the die method.<br/>
-- When an actor dies its dead property is set to true, to wait until garbage collection deletes it
-- @return true/false if the actor died and the actual damage done
function _M:takeHit(value, src, death_note)
if self.onTakeHit then value = self:onTakeHit(value, src) end
self.life = self.life - value
self.changed = true
if self.life <= self.die_at then
if src.on_kill and src:on_kill(self) then return false, value end
return self:die(src, death_note), value
end
return false, value
end
\ No newline at end of file
......@@ -114,8 +114,7 @@ function _M:onPartyDeath(src, death_note)
end
game:playSound("actions/death")
game.log("#{bold}#"..msg.."#{normal}#")
game.delayed_death_message = "#{bold}#"..msg.."#{normal}#"
if (not game.player.easy_mode_lifes or game.player.easy_mode_lifes <= 0) and not game.player.infinite_lifes then
profile.chat.uc_ext:sendKillerLink(msg, src)
end
......
......@@ -33,6 +33,7 @@ void main(void)
// Impact
float it = tick - impact_tick;
float vaadjust = aadjust;
if (it < impact_time) {
float v = (impact_time - it) / impact_time;
float il = distance(impact / ll, (vec2(0.5) - gl_TexCoord[0].xy) / ll);
......@@ -40,11 +41,11 @@ void main(void)
v *= v * v;
float ic = (1.0 - length(uv - impact)) * v * 3.0;
c.rgb = mix(c.rgb, impact_color, ic);
aadjust *= 1.0 + v * 3.0;
vaadjust *= 1.0 + v * 3.0;
}
}
c.a *= aadjust;
c.a *= vaadjust;
if (l <= 1.0) c.a = max(0.15, c.a);
......
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