r5085 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Nov 23 14:50:17 EST 2008


Author: div0
Date: 2008-11-23 14:50:16 -0500 (Sun, 23 Nov 2008)
New Revision: 5085

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
new mutator: g_touchexplode (spawn explosion where two players touch). Ideal with g_bugrigs.


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-11-23 11:29:46 UTC (rev 5084)
+++ trunk/data/defaultNexuiz.cfg	2008-11-23 19:50:16 UTC (rev 5085)
@@ -1215,3 +1215,9 @@
 set g_bugrigs_speed_ref 400 // reference speed for accel and steer responsiveness
 set g_bugrigs_speed_pow 2 // reference power for accel and steer responsiveness
 set g_bugrigs_steer 1 // steering amount
+
+set g_touchexplode 0
+set g_touchexplode_radius 50
+set g_touchexplode_damage 10
+set g_touchexplode_edgedamage 0
+set g_touchexplode_force 150

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-11-23 11:29:46 UTC (rev 5084)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-11-23 19:50:16 UTC (rev 5085)
@@ -470,6 +470,7 @@
 	self.angles_z = 0;
 	self.fixangle = TRUE;
 	self.crouch = FALSE;
+	self.touch = SUB_Null;
 
 	self.view_ofs = PL_VIEW_OFS;
 	setorigin (self, spot.origin);
@@ -585,6 +586,52 @@
 				setcolor(self, cvar("sv_defaultplayercolors"));
 }
 
+.float touchexplode_time;
+
+void PlayerTouchExplode()
+{
+	if(self.owner.classname == "player")
+	if(self.owner.deadflag == DEAD_NO)
+	if(self.enemy.classname == "player")
+	if(self.enemy.deadflag == DEAD_NO)
+	if not(IS_INDEPENDENT_PLAYER(self.owner))
+	if not(IS_INDEPENDENT_PLAYER(self.enemy))
+	{
+		vector org;
+		org = (self.owner.origin + self.enemy.origin) * 0.5;
+		org_z += (self.owner.mins_z + self.enemy.mins_z) * 0.5;
+		setorigin(self, org);
+
+		te_explosion(org);
+		RadiusDamage(self, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
+	}
+	remove(self);
+}
+
+void PlayerTouch()
+{
+	if(g_touchexplode && time > self.touchexplode_time && time > other.touchexplode_time)
+	{
+		if(self.classname == "player")
+		if(self.deadflag == DEAD_NO)
+		if(other.classname == "player")
+		if(other.deadflag == DEAD_NO)
+		if not(IS_INDEPENDENT_PLAYER(self))
+		if not(IS_INDEPENDENT_PLAYER(other))
+		{
+			entity e;
+			e = spawn();
+			e.classname = "touchexplode";
+			e.think = PlayerTouchExplode;
+			e.nextthink = time;
+			e.owner = self;
+			e.enemy = other;
+
+			self.touchexplode_time = other.touchexplode_time = time + 0.2;
+		}
+	}
+}
+
 /*
 =============
 PutClientInServer
@@ -729,6 +776,7 @@
 		FixPlayermodel();
 
 		self.crouch = FALSE;
+		self.touch = PlayerTouch;
 		self.view_ofs = PL_VIEW_OFS;
 		setsize (self, PL_MIN, PL_MAX);
 		self.spawnorigin = spot.origin;

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2008-11-23 11:29:46 UTC (rev 5084)
+++ trunk/data/qcsrc/server/constants.qh	2008-11-23 19:50:16 UTC (rev 5085)
@@ -181,6 +181,7 @@
 float	DEATH_SHOOTING_STAR			= 10012;
 float	DEATH_ROT				= 10013;
 float	DEATH_MIRRORDAMAGE		= 10014;
+float	DEATH_TOUCHEXPLODE      = 10015;
 float   DEATH_TURRET            = 10100;
 
 float	DEATH_WEAPONMASK        = 0xFF;

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2008-11-23 11:29:46 UTC (rev 5084)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-11-23 19:50:16 UTC (rev 5085)
@@ -335,6 +335,8 @@
 					}
                     else if(deathtype == DEATH_TURRET)
                         bprint ("^1",s, "^1 was pushed into the line of fire by ^1", a, "\n");
+                    else if(deathtype == DEATH_TOUCHEXPLODE)
+                        bprint ("^1",s, "^1 was pushed into an accident by ^1", a, "\n");
 					else
 						bprint ("^1",s, "^1 was fragged by ", a, "\n");
 				}
@@ -458,6 +460,8 @@
 					bprint ("^1",s, "^1 is now conserved for centuries to come\n");
             else if(deathtype == DEATH_TURRET)
                     bprint ("^1",s, "^1 was mowed down by a turret \n");
+			else if(deathtype == DEATH_TOUCHEXPLODE)
+				bprint ("^1",s, "^1 died in an accident\n");
 			else
 				if(sv_gentle)
 					bprint ("^1",s, "^1 needs a restart\n");
@@ -912,7 +916,7 @@
 							{
 								if(targ.iscreature)
 									total_damage_to_creatures += finaldmg;
-								if(targ == directhitentity)
+								if(targ == directhitentity || DEATH_ISSPECIAL(deathtype))
 									Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
 								else
 									Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-11-23 11:29:46 UTC (rev 5084)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-11-23 19:50:16 UTC (rev 5085)
@@ -932,6 +932,12 @@
 float g_bugrigs_speed_pow;
 float g_bugrigs_steer;
 
+float g_touchexplode;
+float g_touchexplode_radius;
+float g_touchexplode_damage;
+float g_touchexplode_edgedamage;
+float g_touchexplode_force;
+
 void readlevelcvars(void)
 {
  	g_bugrigs = cvar("g_bugrigs");
@@ -950,6 +956,12 @@
  	g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
  	g_bugrigs_steer = cvar("g_bugrigs_steer");
 
+	g_touchexplode = cvar("g_touchexplode");
+	g_touchexplode_radius = cvar("g_touchexplode_radius");
+	g_touchexplode_damage = cvar("g_touchexplode_damage");
+	g_touchexplode_edgedamage = cvar("g_touchexplode_edgedamage");
+	g_touchexplode_force = cvar("g_touchexplode_force");
+
  	sv_clones = cvar("sv_clones");
 	sv_cheats = cvar("sv_cheats");
 	sv_gentle = cvar("sv_gentle");




More information about the nexuiz-commits mailing list