From 7fb2bc55226767cd69a4ae9ee8cbffe2f8f75424 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 9 Oct 2008 13:51:13 +0000 Subject: [PATCH] "message2" for hurt triggers git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4690 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/cl_player.qc | 2 +- data/qcsrc/server/defs.qh | 2 ++ data/qcsrc/server/g_damage.qc | 12 +++++++++--- data/qcsrc/server/g_triggers.qc | 6 +++++- data/qcsrc/server/race.qc | 2 ++ data/qcsrc/server/t_plats.qc | 22 ++++++++++++++-------- data/scripts/entities.def | 13 ++++++++++--- 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 23b4b2116..5c137506e 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -496,7 +496,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // throw a weapon SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon); // print an obituary message - Obituary (attacker, self, deathtype); + Obituary (attacker, inflictor, self, deathtype); race_PreDie(); DropAllRunes(self); if(self == attacker) diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 2cf4a83b6..d9b4e81d3 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -497,3 +497,5 @@ float game_starttime; //point in time when the countdown is over void W_Porto_Remove (entity p); .float projectiledeathtype; + +.string message2; diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index ec004fca0..67579511e 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -146,7 +146,7 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed) GameLogEcho(s); } -void Obituary (entity attacker, entity targ, float deathtype) +void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) { string s, a; float p; @@ -315,8 +315,14 @@ void Obituary (entity attacker, entity targ, float deathtype) bprint ("^1",s, "^1 was shot into space by ", a, "\n"); else if (deathtype == DEATH_SWAMP) bprint ("^1",s, "^1 was conserved by ", a, "\n"); - else if (deathtype == DEATH_HURTTRIGGER) - bprint ("^1",s, "^1 was thrown into a world of hurt by ", a, "\n"); + else if (deathtype == DEATH_HURTTRIGGER && attacker.message2 != "") + { + p = strstrofs(inflictor.message2, "#", 0); + if(p < 0) + bprint("^1", s, "^1 ", inflictor.message2, " ", a, "\n"); + else + bprint("^1", s, "^1 ", substring(inflictor.message2, 0, p), a, "^1", substring(inflictor.message2, p+1, strlen(inflictor.message2) - (p+1)), "\n"); + } else if(deathtype == DEATH_TURRET) bprint ("^1",s, "^1 was pushed into the line of fire by ^1", a, "\n"); else diff --git a/data/qcsrc/server/g_triggers.qc b/data/qcsrc/server/g_triggers.qc index 16c694002..f8c5b06ef 100644 --- a/data/qcsrc/server/g_triggers.qc +++ b/data/qcsrc/server/g_triggers.qc @@ -402,7 +402,9 @@ void spawnfunc_trigger_hurt() if (!self.dmg) self.dmg = 1000; if (!self.message) - self.message = "was in the wrong place."; + self.message = "was in the wrong place"; + if (!self.message2) + self.message2 = "was thrown into a world of hurt by"; if(!trigger_hurt_first) trigger_hurt_first = self; @@ -923,6 +925,8 @@ void spawnfunc_misc_laser() self.colormod = '1 0 0'; if(!self.message) self.message = "saw the light"; + if (!self.message2) + self.message2 = "was pushed into a laser by"; self.think = misc_laser_think; self.nextthink = time; InitializeEntity(self, misc_laser_init, INITPRIO_FINDTARGET); diff --git a/data/qcsrc/server/race.qc b/data/qcsrc/server/race.qc index cfb728623..496e3aa61 100644 --- a/data/qcsrc/server/race.qc +++ b/data/qcsrc/server/race.qc @@ -420,6 +420,8 @@ void spawnfunc_trigger_race_checkpoint() if(!self.message) self.message = "went backwards"; + if (!self.message2) + self.message2 = "was pushed backwards by"; self.race_checkpoint = self.cnt; diff --git a/data/qcsrc/server/t_plats.qc b/data/qcsrc/server/t_plats.qc index 121834a05..29f0c7893 100644 --- a/data/qcsrc/server/t_plats.qc +++ b/data/qcsrc/server/t_plats.qc @@ -163,7 +163,9 @@ void spawnfunc_func_plat() self.dmg = 10000; if(self.dmg && (!self.message)) - self.message = "was in the wrong place."; + self.message = "was squished"; + if(self.dmg && (!self.message2)) + self.message2 = "was squished by"; if (self.sounds == 1) { @@ -334,7 +336,9 @@ void spawnfunc_func_rotating() self.avelocity = '0 1 0' * self.speed; if(self.dmg & (!self.message)) - self.message = " was in the wrong place."; + self.message = " was squished"; + if(self.dmg && (!self.message2)) + self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) @@ -399,7 +403,9 @@ void spawnfunc_func_bobbing() // damage when blocked self.blocked = bobbing_blocked; if(self.dmg & (!self.message)) - self.message = " was in the wrong place."; + self.message = " was squished"; + if(self.dmg && (!self.message2)) + self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25; self.dmgtime2 = time; @@ -808,7 +814,7 @@ void door_touch() self.owner.attack_finished_single = time + 2; - if (self.owner.message != "") + if (!self.dmg && self.owner.message != "") { if (other.flags & FL_CLIENT) centerprint (other, self.owner.message); @@ -996,10 +1002,10 @@ void spawnfunc_func_door() if(self.spawnflags & 8) self.dmg = 10000; - if(self.dmg & (!self.message)) - self.message = "was in the wrong place."; - - + if(self.dmg && (!self.message)) + self.message = "was squished"; + if(self.dmg && (!self.message2)) + self.message2 = "was squished by"; if (self.sounds > 0) { diff --git a/data/scripts/entities.def b/data/scripts/entities.def index 505083055..2b0baa153 100644 --- a/data/scripts/entities.def +++ b/data/scripts/entities.def @@ -51,6 +51,7 @@ noise: path/name of .wav or .ogg file to play. Use looping sounds only (e.g. sou dmg: damage a player who gets crushed by it receives dmgtime: interval to apply dmg to a player who is s in the way message: death message when a player gets crushed +message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) -------- SPAWNFLAGS -------- X_AXIS: entity will bob along the X axis. Y_AXIS: entity will bob along the Y axis. @@ -71,7 +72,8 @@ health: (default 0) if set to any non-zero value, the button must take damage (a Normal sliding door entity. By default, the door will activate when player walks close to it or when damage is inflicted to it. If DOOR_DONT_LINK is not set, the door will be linked with all doors it touches. -------- KEYS -------- -message: is printed when the door is touched if it is a trigger door and it hasn't been fired yet +message: is printed when the door is touched if it is a trigger door and it hasn't been fired yet, or death message if dmg is set +message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) angle: determines the opening direction targetname: if set, no touch field will be spawned and a remote button or trigger field activates the door. health: if set, door must be shot open @@ -97,7 +99,8 @@ key2: second entity key with one-line description t_width: override WIDTH to move back (or height if going down) t_length: override LENGTH to move sideways dmg: damage to inflict when blocked (2 default) -message: text to display when activating the door +message: text to display when activating the door, or death message if dmg is set +message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) noise1: sound when opening backwards or closing noise2: sound when opening sideways noise3: sound when stopping @@ -140,6 +143,7 @@ sounds: 2 for alternate sound set, -1 for silence, or use the fields below sound1: platform starts moving sound sound2: platform stop sound message: kill message, when someone gets killed by this plat +message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) -------- SPAWNFLAGS -------- CRUSH: crush players hit by the platform instantly -------- NOTES -------- @@ -163,6 +167,7 @@ noise: path/name of looping .wav file to play. dmg: Do this much dmg every .dmgtime interval when blocked dmgtime: See above. (0.25s default) message: kill message when crushed by this +message2: death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) -------- SPAWNFLAGS -------- X_AXIS: rotate around the X axis Y_AXIS: rotate around the Y axis @@ -736,7 +741,8 @@ Any object touching this will be hurt. Has the useful effect of automatically returning flags, keys and runes when they touch it. -------- KEYS -------- dmg: amount of damage to deal (default: 1000) -message: kill message when someone gets killed by this (default: "was in the wrong place.") +message: kill message when someone gets killed by this (default: "was in the wrong place") +message2: kill message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) */ /*QUAKED trigger_impulse (.5 .5 .5) ? @@ -955,6 +961,7 @@ A checkpoint, for the race game mode. Be sure to make them quite long, so they a -------- KEYS -------- cnt: Number of the checkpoint. 0 for finish line, and at least two other checkpoints have to exist. They MUST be touched in sequential order! message: Death message, when touching checkpoints in the wrong order. +message2: Death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end) targetname: Name of the checkpoint. info_player_race can target this to assign a spawn to a checkpoint. Also used for triggering a checkpoint by an event. target: when the checkpoint is passed, these entities are triggered. Useful for forcing items in certain areas using trigger_items -------- SPAWNFLAGS -------- -- 2.39.2