]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_triggers.qc
Merge remote branch 'origin/samual/hitindication'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_triggers.qc
index 0a70de75f802fb13561c7ccf6eb259788b901023..e177cdec73673d89bf4c812aff5dfaad099c8da6 100644 (file)
@@ -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)