From d44d7eaa04583ec26f416d1d62ab7294bb2ad841 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 29 Jan 2011 21:25:32 +0100 Subject: [PATCH] trigger_hurt now can be targeted, and if triggered, the frag will be awarded to the one who triggered it --- qcsrc/server/g_triggers.qc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 0a70de75f..e177cdec7 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -411,6 +411,14 @@ void spawnfunc_trigger_counter() self.reset = counter_reset; }; +void trigger_hurt_use() +{ + if(activator.classname == "player") + self.enemy = activator; + else + self.enemy = world; // let's just destroy it, if taking over is too much work +} + .float triggerhurttime; void trigger_hurt_touch() { @@ -429,7 +437,16 @@ void trigger_hurt_touch() { EXACTTRIGGER_TOUCH; other.triggerhurttime = time + 1; - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + + entity own; + own = self.enemy; + if(own.classname != "player") + { + own = self; + self.enemy = world; // I still hate you all + } + + Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); } } else @@ -465,6 +482,8 @@ void spawnfunc_trigger_hurt() EXACTTRIGGER_INIT; self.active = ACTIVE_ACTIVE; self.touch = trigger_hurt_touch; + self.use = trigger_hurt_use; + self.enemy = world; // I hate you all if (!self.dmg) self.dmg = 1000; if (!self.message) -- 2.39.2