]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make a temporary server side trigger think function for touch handling
authorMario <zacjardine@y7mail.com>
Fri, 20 Feb 2015 07:58:39 +0000 (18:58 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 20 Feb 2015 07:58:39 +0000 (18:58 +1100)
qcsrc/common/triggers/trigger/hurt.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/triggers.qc

index 433f0350dcf323da25c45ef1c635a750b4d3b4d8..d39c32c41fc43ea0f3090f2c92d8223e6e4ff693 100644 (file)
@@ -61,7 +61,9 @@ void spawnfunc_trigger_hurt()
 {
        EXACTTRIGGER_INIT;
        self.active = ACTIVE_ACTIVE;
-       self.move_touch = self.touch = trigger_hurt_touch;
+       self.trigger_touch = trigger_hurt_touch;
+       self.think = trigger_think_generic;
+       self.nextthink = time;
        self.use = trigger_hurt_use;
        self.enemy = world; // I hate you all
        if (!self.dmg)
index d63b3a3935d4a652f024c061138b9600dfc18d1a..adf62cf2a827f9b97c088a17f55ca0c3b53ee092 100644 (file)
@@ -352,29 +352,6 @@ void trigger_push_link()
 {
        Net_LinkEntity(self, false, 0, trigger_push_send);
 }
-
-void trigger_push_think()
-{
-       self.nextthink = time;
-
-       entity e;
-       if(self.trigger_touch)
-       for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
-       {
-               vector emin = e.absmin, emax = e.absmax;
-               if(self.solid == SOLID_BSP)
-               {
-                       emin -= '1 1 1';
-                       emax += '1 1 1';
-               }
-               if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
-               if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
-               {
-                       other = e;
-                       self.trigger_touch();
-               }
-       }
-}
 #endif
 #ifdef SVQC
 /*
@@ -398,7 +375,7 @@ void spawnfunc_trigger_push()
        self.active = ACTIVE_ACTIVE;
        self.use = trigger_push_use;
        self.trigger_touch = trigger_push_touch;
-       self.think = trigger_push_think;
+       self.think = trigger_think_generic;
        self.nextthink = time;
 
        // normal push setup
index da0301778c23529ec340451f31ecbde60254870e..fdffbb9e0018a626470d6bc00a4e5a6c581f9d3a 100644 (file)
@@ -240,6 +240,31 @@ void SUB_UseTargets()
        other = otemp;
 }
 
+#ifdef SVQC
+void trigger_think_generic()
+{
+       self.nextthink = time;
+
+       entity e;
+       if(self.trigger_touch)
+       for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
+       {
+               vector emin = e.absmin, emax = e.absmax;
+               if(self.solid == SOLID_BSP)
+               {
+                       emin -= '1 1 1';
+                       emax += '1 1 1';
+               }
+               if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
+               if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
+               {
+                       other = e;
+                       self.trigger_touch();
+               }
+       }
+}
+#endif
+
 #ifdef CSQC
 void trigger_touch_generic(void() touchfunc)
 {