From b32628591d779923cf7a701e4c09edc566c520f6 Mon Sep 17 00:00:00 2001
From: Mario <zacjardine@y7mail.com>
Date: Fri, 20 Feb 2015 18:58:39 +1100
Subject: [PATCH] Make a temporary server side trigger think function for touch
 handling

---
 qcsrc/common/triggers/trigger/hurt.qc     |  4 +++-
 qcsrc/common/triggers/trigger/jumppads.qc | 25 +----------------------
 qcsrc/common/triggers/triggers.qc         | 25 +++++++++++++++++++++++
 3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc
index 433f0350dc..d39c32c41f 100644
--- a/qcsrc/common/triggers/trigger/hurt.qc
+++ b/qcsrc/common/triggers/trigger/hurt.qc
@@ -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)
diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc
index d63b3a3935..adf62cf2a8 100644
--- a/qcsrc/common/triggers/trigger/jumppads.qc
+++ b/qcsrc/common/triggers/trigger/jumppads.qc
@@ -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
diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc
index da0301778c..fdffbb9e00 100644
--- a/qcsrc/common/triggers/triggers.qc
+++ b/qcsrc/common/triggers/triggers.qc
@@ -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)
 {
-- 
2.39.5