[nexuiz-commits] r6871 - in branches/nexuiz-2.0: . data/models/onslaught data/qcsrc/server data/scripts data/sound/onslaught data/textures

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jun 5 06:26:49 EDT 2009


Author: div0
Date: 2009-06-05 06:26:49 -0400 (Fri, 05 Jun 2009)
New Revision: 6871

Added:
   branches/nexuiz-2.0/data/models/onslaught/ons_ray.md3
   branches/nexuiz-2.0/data/sound/onslaught/electricity_explode.ogg
   branches/nexuiz-2.0/data/sound/onslaught/ons_hit1.ogg
   branches/nexuiz-2.0/data/sound/onslaught/ons_hit2.ogg
   branches/nexuiz-2.0/data/sound/onslaught/ons_spark1.ogg
   branches/nexuiz-2.0/data/sound/onslaught/ons_spark2.ogg
   branches/nexuiz-2.0/data/textures/ons_ray.tga
Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/models/onslaught/boom.md3
   branches/nexuiz-2.0/data/models/onslaught/shockwave.md3
   branches/nexuiz-2.0/data/models/onslaught/shockwavetransring.md3
   branches/nexuiz-2.0/data/qcsrc/server/mode_onslaught.qc
   branches/nexuiz-2.0/data/scripts/onslaught.shader
   branches/nexuiz-2.0/data/sound/onslaught/damageblockedbyshield.wav
Log:
r6747 | morphed | 2009-05-20 19:39:04 -0400 (Wed, 20 May 2009) | 1 line
pimp my onslaught, various changes to our favorite game mode, lots of new fx, less spammy announcers and much more
r6748 | morphed | 2009-05-21 13:41:12 -0400 (Thu, 21 May 2009) | 1 line
forgotten onslaught code found in shaolin temple
r6750 | mand1nga | 2009-05-21 22:31:28 -0400 (Thu, 21 May 2009) | 1 line
Pimp Onslaught code :)
r6768 | div0 | 2009-05-24 07:09:02 -0400 (Sun, 24 May 2009) | 3 lines
fix major breakage in onslaught code (e.g. map reset not working), more issues may be left.
Who originally wrote this messy code?
r6769 | div0 | 2009-05-24 13:41:28 -0400 (Sun, 24 May 2009) | 2 lines
fix some more bad stuff in new onslaught code


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-06-05 10:08:11 UTC (rev 6870)
+++ branches/nexuiz-2.0/.patchsets	2009-06-05 10:26:49 UTC (rev 6871)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-6746,6749-6749,6751-6766,6770-6774
+revisions_applied = 1-6774

Modified: branches/nexuiz-2.0/data/models/onslaught/boom.md3
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/models/onslaught/ons_ray.md3 (from rev 6748, trunk/data/models/onslaught/ons_ray.md3)
===================================================================
(Binary files differ)

Modified: branches/nexuiz-2.0/data/models/onslaught/shockwave.md3
===================================================================
(Binary files differ)

Modified: branches/nexuiz-2.0/data/models/onslaught/shockwavetransring.md3
===================================================================
(Binary files differ)

Modified: branches/nexuiz-2.0/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/mode_onslaught.qc	2009-06-05 10:08:11 UTC (rev 6870)
+++ branches/nexuiz-2.0/data/qcsrc/server/mode_onslaught.qc	2009-06-05 10:26:49 UTC (rev 6871)
@@ -17,46 +17,84 @@
 
 .string model1, model2, model3;
 
+
+void onslaught_generator_boom_think()
+{
+	self.nextthink = time + 0.05;
+	if(self.frame > 14)
+	{
+		self.think = SUB_Remove;
+		return;
+	}
+	self.frame +=1;
+};
+
+void onslaught_generator_boom_spawn(vector org, float fscale)
+{
+	entity e;
+	e = spawn();
+	setmodel(e, "models/onslaught/boom.md3");
+	setorigin(e, org);
+
+	e.scale = fscale;
+	setsize(e, e.mins * e.scale, e.maxs * e.scale);
+	e.angles = randomvec() * 360;
+
+	e.effects = EF_NOSHADOW;
+
+	e.think = onslaught_generator_boom_think;
+	e.nextthink = time + 0.05;
+};
+
 void ons_gib_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
 {
-    self.velocity += vforce;
+	self.velocity = self.velocity + vforce;
 }
 
-void ons_trowgib(
-    vector v_from, vector v_to, vector v_colormod,
-    string smodel,
-    float f_lifetime, float f_fadetime, float b_burn)
+.float giblifetime;
+void ons_throwgib_think()
 {
-    local entity gib;
-    local entity burn;
+	local vector org;
 
-    gib = spawn();
+	self.nextthink = time + 0.05;
+	if(self.count > self.giblifetime)
+	{
+		self.think = SUB_Remove;
+		return;
+	}
+	if(self.count > self.giblifetime-10)
+		self.alpha -= 0.1;
+	org = self.origin + 20 * randomvec();
+	onslaught_generator_boom_spawn(org, random()*0.5+0.3);
+	self.count +=1;
+};
 
-    gib.classname = "turret_gib";
-    setmodel(gib,smodel);
-    setorigin(gib,v_from);
-    SUB_SetFade(gib,time + f_lifetime,2);
+void ons_throwgib(vector v_from, vector v_to, string smodel, float f_lifetime, float f_fadetime, float b_burn)
+{
+	local entity gib;
 
-    gib.solid              = SOLID_BBOX;
+	gib = spawn();
 
-    gib.movetype           = MOVETYPE_BOUNCE;
-    gib.takedamage         = DAMAGE_YES;
-    gib.event_damage       = ons_gib_damage;
-    gib.health             = -1;
-    gib.effects            = EF_LOWPRECISION;
-    gib.flags              = FL_NOTARGET;
-    gib.colormod           = v_colormod;
-    gib.velocity           = v_to;
+	setmodel(gib, smodel);
+	setorigin(gib, v_from);
+	gib.solid = SOLID_BBOX;
+	gib.movetype = MOVETYPE_BOUNCE;
+	gib.takedamage = DAMAGE_YES;
+	gib.event_damage = ons_gib_damage;
+	gib.health = -1;
+	gib.effects = EF_LOWPRECISION;
+	gib.flags = FL_NOTARGET;
+	gib.velocity = v_to;
+	gib.giblifetime	= f_lifetime;
 
-    if (b_burn)
-    {
-        burn = spawn();
-        burn.effects        = EF_LOWPRECISION;//|EF_FLAME;
-        setattachment(burn,gib,"");
-        setorigin(burn,(gib.mins + gib.maxs) * 0.5);
-        SUB_SetFade(burn,time + (f_lifetime * 0.5) ,2);
-    }
-}
+	if (b_burn)
+	{
+		gib.think = ons_throwgib_think;
+		gib.nextthink = time + 0.05;
+	}
+	else
+		SUB_SetFade(gib, time + f_lifetime, 2);
+};
 
 void onslaught_updatelinks()
 {
@@ -107,22 +145,22 @@
 			// if both points are captured by the same team, and only one of
 			// them is powered, mark the other one as powered as well
 			if (l.enemy.iscaptured && l.goalentity.iscaptured)
-			if (l.enemy.islinked != l.goalentity.islinked)
-			if (l.enemy.team == l.goalentity.team)
-			{
-				if (!l.goalentity.islinked)
-				{
-					stop = FALSE;
-					l.goalentity.islinked = TRUE;
-					dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n");
-				}
-				else if (!l.enemy.islinked)
-				{
-					stop = FALSE;
-					l.enemy.islinked = TRUE;
-					dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n");
-				}
-			}
+				if (l.enemy.islinked != l.goalentity.islinked)
+					if (l.enemy.team == l.goalentity.team)
+					{
+						if (!l.goalentity.islinked)
+						{
+							stop = FALSE;
+							l.goalentity.islinked = TRUE;
+							dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n");
+						}
+						else if (!l.enemy.islinked)
+						{
+							stop = FALSE;
+							l.enemy.islinked = TRUE;
+							dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n");
+						}
+					}
 			l = l.chain;
 		}
 	}
@@ -260,62 +298,62 @@
 			return 1;
 	}
 	return 0;
-/*
-	entity e;
+	/*
+	   entity e;
 	// check to see if this player has a legitimate claim to capture this
 	// control point - more specifically that there is a captured path of
 	// points leading back to the team generator
 	e = findchain(classname, "onslaught_link");
 	while (e)
 	{
-		if (e.goalentity == cp)
-		{
-			dprint(etos(e), " (link) connects to ", etos(e.enemy), " (point)");
-			if (e.enemy.islinked)
-			{
-				dprint(" which is linked");
-				if (e.enemy.team == t)
-				{
-					dprint(" and has the correct team!\n");
-					return 1;
-				}
-				else
-					dprint(" but has the wrong team\n");
-			}
-			else
-				dprint("\n");
-		}
-		else if (e.enemy == cp)
-		{
-			dprint(etos(e), " (link) connects to ", etos(e.goalentity), " (point)");
-			if (e.goalentity.islinked)
-			{
-				dprint(" which is linked");
-				if (e.goalentity.team == t)
-				{
-					dprint(" and has a team!\n");
-					return 1;
-				}
-				else
-					dprint(" but has the wrong team\n");
-			}
-			else
-				dprint("\n");
-		}
-		e = e.chain;
+	if (e.goalentity == cp)
+	{
+	dprint(etos(e), " (link) connects to ", etos(e.enemy), " (point)");
+	if (e.enemy.islinked)
+	{
+	dprint(" which is linked");
+	if (e.enemy.team == t)
+	{
+	dprint(" and has the correct team!\n");
+	return 1;
 	}
+	else
+	dprint(" but has the wrong team\n");
+	}
+	else
+	dprint("\n");
+	}
+	else if (e.enemy == cp)
+	{
+	dprint(etos(e), " (link) connects to ", etos(e.goalentity), " (point)");
+	if (e.goalentity.islinked)
+	{
+	dprint(" which is linked");
+	if (e.goalentity.team == t)
+	{
+	dprint(" and has a team!\n");
+	return 1;
+	}
+	else
+	dprint(" but has the wrong team\n");
+	}
+	else
+	dprint("\n");
+	}
+	e = e.chain;
+	}
 	return 0;
-*/
+	 */
 }
 
 float onslaught_controlpoint_attackable(entity cp, float t)
-// -2: SAME TEAM, attackable by enemy!
-// -1: SAME TEAM!
-// 0:  off limits
-// 1:  attack it
-// 2:  touch it
-// 3:  attack it (HIGH PRIO)
-// 4:  touch it (HIGH PRIO)
+	// -2: SAME TEAM, attackable by enemy!
+	// -1: SAME TEAM!
+	// 0: off limits
+	// 1: attack it
+	// 2: touch it
+	// 3: attack it (HIGH PRIO)
+	// 4: touch it (HIGH PRIO)
 {
 	float a;
 
@@ -361,41 +399,41 @@
 	local entity e;
 	self.nextthink = ceil(time + 1);
 	if (cvar("timelimit"))
-	if (time > cvar("timelimit") * 60 - 60)
-	{
-		// self.max_health / 300 gives 5 minutes of overtime.
-		// control points reduce the overtime duration.
-		sound(self, CHAN_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM);
-		d = 1;
-		e = findchain(classname, "onslaught_controlpoint");
-		while (e)
+		if (time > cvar("timelimit") * 60 - 60)
 		{
-			if (e.team != self.team)
-			if (e.islinked)
-				d = d + 1;
-			e = e.chain;
+			// self.max_health / 300 gives 5 minutes of overtime.
+			// control points reduce the overtime duration.
+			sound(self, CHAN_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM);
+			d = 1;
+			e = findchain(classname, "onslaught_controlpoint");
+			while (e)
+			{
+				if (e.team != self.team)
+					if (e.islinked)
+						d = d + 1;
+				e = e.chain;
+			}
+			d = d * self.max_health / 300;
+			Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
 		}
-		d = d * self.max_health / 300;
-		Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
-	}
+
 };
 
 void onslaught_generator_ring_think()
 {
-	self.nextthink = time;
-	if(self.count>20)
+	self.nextthink = time + 0.05;
+	if(self.count > 24)
 	{
 		self.think = SUB_Remove;
 		return;
 	}
 
 	self.scale = self.count * 4;
-	setsize(self, self.mins * self.scale, self.maxs * self.scale);
 
-	self.frame = self.count * 4;
+	self.frame = self.count;
 
-	self.count +=1;
-	self.alpha = 0.3;
+	self.count += 1;
+	self.alpha = 0.1;
 };
 
 void onslaught_generator_ring_spawn(vector org)
@@ -403,32 +441,62 @@
 	entity e;
 	e = spawn();
 	setmodel(e, "models/onslaught/shockwavetransring.md3");
-	setorigin(e,org);
+	setorigin(e, org);
 
 	e.count = 1;
 	e.alpha = 0;
 
 	e.think = onslaught_generator_ring_think;
-	e.nextthink = time;
+	e.nextthink = time + 0.05;
 };
+void onslaught_generator_ray_think()
+{
+	self.nextthink = time + 0.05;
+	if(self.count > 10)
+	{
+		self.think = SUB_Remove;
+		return;
+	}
 
+	if(self.count > 5)
+		self.alpha -= 0.1;
+	else
+		self.alpha += 0.1;
+
+	self.scale += 0.2;
+	self.count +=1;
+};
+
+void onslaught_generator_ray_spawn(vector org)
+{
+	entity e;
+	e = spawn();
+	setmodel(e, "models/onslaught/ons_ray.md3");
+	setorigin(e, org);
+	e.angles = randomvec() * 360;
+	e.alpha = 0;
+	e.scale = random() * 5 + 8;
+	e.think = onslaught_generator_ray_think;
+	e.nextthink = time + 0.05;
+};
+
 void onslaught_generator_shockwave_think()
 {
-	self.nextthink = time;
-	if(self.count>20)
+	self.nextthink = time + 0.05;
+	if(self.count > 25)
 	{
 		self.think = SUB_Remove;
 		return;
 	}
 
-	if(self.count>10)
+	if(self.count > 15)
 		self.alpha -= 0.1;
 	else
 		self.alpha = 1;
 
 	self.scale = self.count * 4;
 	setsize(self, self.mins * self.scale, self.maxs * self.scale);
-	self.frame = self.count * 4;
+	self.frame = self.count;
 
 	self.count +=1;
 };
@@ -438,50 +506,52 @@
 	entity e;
 	e = spawn();
 	setmodel(e, "models/onslaught/shockwave.md3");
-	setorigin(e,org);
+	setorigin(e, org);
 
 	e.alpha = 0;
 	e.frame = 0;
+	e.count = 0;
 
+
 	e.think = onslaught_generator_shockwave_think;
-	e.nextthink = time;
+	e.nextthink = time + 0.05;
 };
 
-void onslaught_generator_boom_think()
+void onslaught_generator_damage_think()
 {
-	self.nextthink = time;
-	if(self.frame==15)
+	if(self.owner.health < 0)
 	{
 		self.think = SUB_Remove;
 		return;
 	}
+	self.nextthink = time+0.1;
 
-	if(self.frame>11)
-		self.alpha -= 0.3;
-
-	self.frame +=1;
+	// damaged fx (less probable the more damaged is the generator)
+	if(random() < 0.9 - self.owner.health / self.owner.max_health)
+		if(random() < 0.01)
+		{
+			pointparticles(particleeffectnum("electro_ballexplode"), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
+			sound(self, CHAN_TRIGGER, "onslaught/electricity_explode.ogg", VOL_BASE, ATTN_NORM);
+		}
+		else
+			pointparticles(particleeffectnum("torch_small"), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1);
 };
 
-void onslaught_generator_boom_spawn(vector org, float fscale)
+void onslaught_generator_damage_spawn(entity gd_owner)
 {
 	entity e;
 	e = spawn();
-	setmodel(e, "models/onslaught/boom.md3");
-	setorigin(e,org);
-
-	e.scale = fscale;
-	setsize(e, e.mins * e.scale, e.maxs * e.scale);
-
-	e.effects = EF_NOSHADOW;
-
-	e.think = onslaught_generator_boom_think;
-	e.nextthink = time;
+	e.owner = gd_owner;
+	e.health = self.owner.health;
+	setorigin(e, gd_owner.origin);
+	e.think = onslaught_generator_damage_think;
+	e.nextthink = time+1;
 };
 
 void onslaught_generator_deaththink()
 {
 	local vector org;
-	local float i, scale;
+	local float i;
 
 	if not (self.count)
 		self.count = 40;
@@ -494,38 +564,41 @@
 	}
 
 	// Throw some gibs
-	if(random()<0.2)
+	if(random() < 0.3)
 	{
 		i = random();
-		if(i<0.3)
-			ons_trowgib(self.origin, (100 * randomvec() - '1 1 1') * 25,'1 1 1',"models/onslaught/gen_gib1.md3",20,1,0);
-		else if(i>0.7)
-			ons_trowgib(self.origin, (100 * randomvec() - '1 1 1') * 25,'1 1 1',"models/onslaught/gen_gib2.md3",20,1,0);
+		if(i < 0.3)
+			ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 25, 1, 1);
+		else if(i > 0.7)
+			ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 20, 1, 1);
 		else
-			ons_trowgib(self.origin, (100 * randomvec() - '1 1 1') * 25,'1 1 1',"models/onslaught/gen_gib3.md3",20,1,0);
+			ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 15, 1, 1);
 	}
 
 	// Spawn fire balls
-	for(i=0;i<6;++i)
+	for(i=0;i < 6;++i)
 	{
-		org = self.origin + self.mins;
-		org_z = self.origin_z - 20;
-		org = randompos(org, self.origin + self.maxs + '0 0 20');
-
-		onslaught_generator_boom_spawn(org, 1);
+		org = self.origin + randompos('-30 -30 -30' * i + '0 0 -20', '30 30 30' * i + '0 0 20');
+		onslaught_generator_boom_spawn(org, (6-i)/5+0.3);
 	}
 
 	// Short explosion sound + small explosion
-	if(random()<0.25)
+	if(random() < 0.25)
 	{
 		te_explosion(self.origin);
 		sound(self, CHAN_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
 	}
 
 	// Particles
-	org = randompos(self.origin + self.mins + '8 8 8', self.origin + self.maxs + '-8 -8 -8');
+	org = self.origin + randompos(self.mins + '8 8 8', self.maxs + '-8 -8 -8');
 	pointparticles(particleeffectnum("onslaught_generator_smallexplosion"), org, '0 0 0', 1);
 
+	// rays
+	if(random() > 0.25 )
+	{
+		onslaught_generator_ray_spawn(self.origin);
+	}
+
 	// Final explosion
 	if(self.count==1)
 	{
@@ -536,13 +609,14 @@
 		sound(self, CHAN_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
 	}
 	else
-		self.nextthink = time;
+		self.nextthink = time + 0.05;
 
 	self.count = self.count - 1;
 };
 
 void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
+	local float i;
 	if (damage <= 0)
 		return;
 	if (attacker != self)
@@ -551,16 +625,16 @@
 		{
 			// this is protected by a shield, so ignore the damage
 			if (time > self.pain_finished)
-			if (attacker.classname == "player")
-			{
-				play2(attacker, "onslaught/damageblockedbyshield.wav");
-				self.pain_finished = time + 1;
-			}
+				if (attacker.classname == "player")
+				{
+					play2(attacker, "onslaught/damageblockedbyshield.wav");
+					self.pain_finished = time + 1;
+				}
 			return;
 		}
 		if (time > self.pain_finished)
 		{
-			self.pain_finished = time + 5;
+			self.pain_finished = time + 10;
 			bprint(ColoredTeamName(self.team), " generator under attack!\n");
 			play2team(self.team, "onslaught/generator_underattack.wav");
 		}
@@ -599,26 +673,56 @@
 		self.think(); // do the first explosion now
 		onslaught_updatelinks();
 	}
-	if(self.health < cvar("g_onslaught_gen_health") * 0.90)
-		setmodel(self, "models/onslaught/generator_dmg1.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.80)
-		setmodel(self, "models/onslaught/generator_dmg2.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.70)
-		setmodel(self, "models/onslaught/generator_dmg3.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.60)
-		setmodel(self, "models/onslaught/generator_dmg4.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.50)
-		setmodel(self, "models/onslaught/generator_dmg5.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.40)
-		setmodel(self, "models/onslaught/generator_dmg6.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.30)
-		setmodel(self, "models/onslaught/generator_dmg7.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.20)
-		setmodel(self, "models/onslaught/generator_dmg8.md3");
-	if(self.health < cvar("g_onslaught_gen_health") * 0.10)
-		setmodel(self, "models/onslaught/generator_dmg9.md3");
 	if(self.health <= 0)
 		setmodel(self, "models/onslaught/generator_dead.md3");
+	else if(self.health < self.max_health * 0.10)
+		setmodel(self, "models/onslaught/generator_dmg9.md3");
+	else if(self.health < self.max_health * 0.20)
+		setmodel(self, "models/onslaught/generator_dmg8.md3");
+	else if(self.health < self.max_health * 0.30)
+		setmodel(self, "models/onslaught/generator_dmg7.md3");
+	else if(self.health < self.max_health * 0.40)
+		setmodel(self, "models/onslaught/generator_dmg6.md3");
+	else if(self.health < self.max_health * 0.50)
+		setmodel(self, "models/onslaught/generator_dmg5.md3");
+	else if(self.health < self.max_health * 0.60)
+		setmodel(self, "models/onslaught/generator_dmg4.md3");
+	else if(self.health < self.max_health * 0.70)
+		setmodel(self, "models/onslaught/generator_dmg3.md3");
+	else if(self.health < self.max_health * 0.80)
+		setmodel(self, "models/onslaught/generator_dmg2.md3");
+	else if(self.health < self.max_health * 0.90)
+		setmodel(self, "models/onslaught/generator_dmg1.md3");
+	setsize(self, '-52 -52 -14', '52 52 75');
+
+	// Throw some flaming gibs on damage, more damage = more chance for gib
+	if(random() < damage/220)
+	{
+		sound(self, CHAN_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+		i = random();
+		if(i < 0.3)
+			ons_throwgib(hitloc, (force * -1) + '0 0 40', "models/onslaught/gen_gib1.md3", 7, 1, 1);
+		else if(i > 0.7)
+			ons_throwgib(hitloc, (force * -1)+ '0 0 40', "models/onslaught/gen_gib2.md3", 6, 1, 1);
+		else
+			ons_throwgib(hitloc, (force * -1)+ '0 0 40', "models/onslaught/gen_gib3.md3", 5, 1, 1);
+	}
+	else
+	{
+		// particles on every hit
+		pointparticles(particleeffectnum("sparks"), hitloc, force * -1, 1);
+
+		//sound on every hit
+		if (random() < 0.5)
+			sound(self, CHAN_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTN_NORM);
+		else
+			sound(self, CHAN_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);
+	}
+
+	//throw some gibs on damage
+	if(random() < damage/200+0.2)
+		if(random() < 0.5)
+			ons_throwgib(hitloc, randomvec()*360, "models/onslaught/gen_gib1.md3", 1, 1, 0);
 };
 
 // update links after a delay
@@ -775,17 +879,18 @@
 	self.enemy.solid = SOLID_NOT;
 	self.think = onslaught_generator_delayed;
 	self.nextthink = time + 0.2;
+	setmodel(self, "models/onslaught/generator.md3");
 }
 
 /*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64)
-Base generator.
+  Base generator.
 
-spawnfunc_onslaught_link entities can target this.
+  spawnfunc_onslaught_link entities can target this.
 
 keys:
 "team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
-*/
+ */
 void spawnfunc_onslaught_generator()
 {
 	if (!g_onslaught)
@@ -813,20 +918,24 @@
 	precache_model("models/onslaught/gen_gib1.md3");
 	precache_model("models/onslaught/gen_gib2.md3");
 	precache_model("models/onslaught/gen_gib3.md3");
+	precache_model("models/onslaught/ons_ray.md3");
 	precache_sound("onslaught/generator_decay.wav");
 	precache_sound("weapons/grenade_impact.wav");
 	precache_sound("weapons/rocket_impact.wav");
 	precache_sound("onslaught/generator_underattack.wav");
 	precache_sound("onslaught/shockwave.wav");
+	precache_sound("onslaught/ons_hit1.wav");
+	precache_sound("onslaught/ons_hit2.wav");
+	precache_sound("onslaught/electricity_explode.wav");
 	if (!self.team)
 		objerror("team must be set");
 	self.team_saved = self.team;
 	self.colormap = 1024 + (self.team - 1) * 17;
-	self.solid = SOLID_BSP;
+	self.solid = SOLID_BBOX;
 	self.movetype = MOVETYPE_NONE;
 	self.lasthealth = self.max_health = self.health = cvar("g_onslaught_gen_health");
 	setmodel(self, "models/onslaught/generator.md3");
-	//setsize(self, '-32 -32 -24', '32 32 64');
+	setsize(self, '-52 -52 -14', '52 52 75');
 	setorigin(self, self.origin);
 	self.takedamage = DAMAGE_AIM;
 	self.bot_attack = TRUE;
@@ -834,6 +943,8 @@
 	self.iscaptured = TRUE;
 	self.islinked = TRUE;
 	self.isshielded = TRUE;
+	// helper entity that create fx when generator is damaged
+	onslaught_generator_damage_spawn(self);
 	// spawn shield model which indicates whether this can be damaged
 	self.enemy = e = spawn();
 	e.classname = "onslaught_generator_shield";
@@ -841,7 +952,6 @@
 	e.movetype = MOVETYPE_NONE;
 	e.effects = EF_ADDITIVE;
 	setmodel(e, "models/onslaught/generator_shield.md3");
-	//setsize(e, '-32 -32 0', '32 32 128');
 	setorigin(e, self.origin);
 	e.colormap = self.colormap;
 	e.team = self.team;
@@ -869,40 +979,48 @@
 	{
 		// this is protected by a shield, so ignore the damage
 		if (time > self.pain_finished)
+			if (attacker.classname == "player")
+			{
+				play2(attacker, "onslaught/damageblockedbyshield.wav");
+				self.pain_finished = time + 1;
+			}
+		return;
+	}
+	if (time > self.pain_finished)
 		if (attacker.classname == "player")
 		{
-			play2(attacker, "onslaught/damageblockedbyshield.wav");
-			self.pain_finished = time + 1;
+			play2team(self.team, "onslaught/controlpoint_underattack.wav");
+			self.pain_finished = time + 10;
 		}
-		return;
-	}
-	if (time > self.pain_finished)
-	if (attacker.classname == "player")
-	{
-		play2team(self.team, "onslaught/controlpoint_underattack.wav");
-		self.pain_finished = time + 5;
-	}
 	self.health = self.health - damage;
 	self.pain_finished = time + 1;
 	self.punchangle = (2 * randomvec() - '1 1 1') * 45;
 	self.cp_bob_dmg_z = (2 * random() - 1) * 15;
 	// colormod flash when shot
 	self.colormod = '2 2 2';
+	// particles on every hit
+	pointparticles(particleeffectnum("sparks"), hitloc, force*-1, 1);
+	//sound on every hit
+	if (random() < 0.5)
+		sound(self, CHAN_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTN_NORM);
+	else
+		sound(self, CHAN_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTN_NORM);
+
 	if (self.health < 0)
 	{
 		sound(self, CHAN_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
-		pointparticles(particleeffectnum("onslaught_controlpoint_explosion"), self.origin, '0 0 0', 1);
+		pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
 		{
 			string t;
 			t = ColoredTeamName(attacker.team);
 			bprint(ColoredTeamName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 25,'1 1 1',"models/onslaught/controlpoint_icon_gib1.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 45,'1 1 1',"models/onslaught/controlpoint_icon_gib2.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 45,'1 1 1',"models/onslaught/controlpoint_icon_gib2.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 75,'1 1 1',"models/onslaught/controlpoint_icon_gib4.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 75,'1 1 1',"models/onslaught/controlpoint_icon_gib4.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 75,'1 1 1',"models/onslaught/controlpoint_icon_gib4.md3",5,1,1);
-			ons_trowgib(self.origin, (2 * randomvec() - '1 1 1') * 75,'1 1 1',"models/onslaught/controlpoint_icon_gib4.md3",5,1,1);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 5, 1, 0);
+			ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 5, 1, 0);
 		}
 		self.owner.goalentity = world;
 		self.owner.islinked = FALSE;
@@ -918,9 +1036,11 @@
 		SUB_UseTargets ();
 		self = oself;
 
+
 		self.owner.waslinked = self.owner.islinked;
 		if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
 			setmodel(self.owner, "models/onslaught/controlpoint_pad.md3");
+		//setsize(self, '-32 -32 0', '32 32 8');
 
 		remove(self);
 	}
@@ -936,14 +1056,14 @@
 		if (self.health >= self.max_health)
 			self.health = self.max_health;
 	}
-	if (self.health < self.max_health * 0.90)
-		setmodel(self, "models/onslaught/controlpoint_icon.md3");
-	if (self.health < self.max_health * 0.75)
-		setmodel(self, "models/onslaught/controlpoint_icon_dmg1.md3");
-	if (self.health < self.max_health * 0.50)
-		setmodel(self, "models/onslaught/controlpoint_icon_dmg2.md3");
 	if (self.health < self.max_health * 0.25)
 		setmodel(self, "models/onslaught/controlpoint_icon_dmg3.md3");
+	else if (self.health < self.max_health * 0.50)
+		setmodel(self, "models/onslaught/controlpoint_icon_dmg2.md3");
+	else if (self.health < self.max_health * 0.75)
+		setmodel(self, "models/onslaught/controlpoint_icon_dmg1.md3");
+	else if (self.health < self.max_health * 0.90)
+		setmodel(self, "models/onslaught/controlpoint_icon.md3");
 	// colormod flash when shot
 	self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
 
@@ -984,7 +1104,7 @@
 	else
 		self.punchangle_z = 0;
 	self.angles_x = self.punchangle_x;
-	self.angles_y = self.angles_y + self.punchangle_y + 2;
+	self.angles_y = self.punchangle_y;
 	self.angles_z = self.punchangle_z;
 
 	self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd / 8));
@@ -994,6 +1114,17 @@
 	else
 		self.cp_bob_dmg_z = 0;
 	self.origin = self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg;
+
+	// damaged fx
+	if(random() < 0.6 - self.health / self.max_health)
+	{
+		pointparticles(particleeffectnum("electricity_sparks"), self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
+
+		if(random() > 0.8)
+			sound(self, CHAN_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTN_NORM);
+		else if (random() > 0.5)
+			sound(self, CHAN_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTN_NORM);
+	}
 };
 
 void onslaught_controlpoint_icon_buildthink()
@@ -1008,7 +1139,7 @@
 	if(!a)
 		return;
 
-	self.health = self.health + (self.count / 2);
+	self.health = self.health + self.count;
 
 	if (self.health >= self.max_health)
 	{
@@ -1035,8 +1166,15 @@
 	self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
 	if(self.owner.model != "models/onslaught/controlpoint_pad2.md3")
 		setmodel(self.owner, "models/onslaught/controlpoint_pad2.md3");
+	//setsize(self, '-32 -32 0', '32 32 8');
+
+	if(random() < 0.9 - self.health / self.max_health)
+		pointparticles(particleeffectnum("rage"), self.origin + 10 * randomvec(), '0 0 -1', 1);
 };
 
+
+
+
 void onslaught_controlpoint_touch()
 {
 	local entity e;
@@ -1066,7 +1204,7 @@
 	e.colormap = 1024 + (e.team - 1) * 17;
 	e.think = onslaught_controlpoint_icon_buildthink;
 	e.nextthink = time + 0.1;
-	e.count = e.max_health / 50; // how long it takes to build
+	e.count = e.max_health / 100; // how long it takes to build
 	sound(e, CHAN_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTN_NORM);
 	self.team = e.team;
 	self.colormap = e.colormap;
@@ -1086,6 +1224,8 @@
 	self.enemy.colormap = self.colormap;
 	self.think = self.enemy.think = SUB_Null;
 	self.nextthink = 0; // don't like SUB_Null :P
+	setmodel(self, "models/onslaught/controlpoint_pad.md3");
+	//setsize(self, '-32 -32 0', '32 32 8');
 
 	onslaught_updatelinks();
 
@@ -1094,15 +1234,15 @@
 }
 
 /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
-Control point.  Be sure to give this enough clearance so that the shootable part has room to exist
+  Control point. Be sure to give this enough clearance so that the shootable part has room to exist
 
-This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
+  This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
 
 keys:
 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
 "target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities.
 "message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
-*/
+ */
 void spawnfunc_onslaught_controlpoint()
 {
 	local entity e;
@@ -1126,7 +1266,9 @@
 	precache_sound("weapons/grenade_impact.wav");
 	precache_sound("onslaught/damageblockedbyshield.wav");
 	precache_sound("onslaught/controlpoint_underattack.wav");
-	self.solid = SOLID_BSP;
+	precache_sound("onslaught/ons_spark1.wav");
+	precache_sound("onslaught/ons_spark2.wav");
+	self.solid = SOLID_BBOX;
 	self.movetype = MOVETYPE_NONE;
 	setmodel(self, "models/onslaught/controlpoint_pad.md3");
 	//setsize(self, '-32 -32 0', '32 32 8');
@@ -1232,21 +1374,20 @@
 	if (!self.enemy)
 		objerror("can not find target2\n");
 	dprint(etos(self.goalentity), " linked with ", etos(self.enemy), "\n");
-
 	self.SendFlags |= 3;
 	self.think = onslaught_link_checkupdate;
 	self.nextthink = time;
 }
 
 /*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
-Link between control points.
+  Link between control points.
 
-This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
+  This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
 
 keys:
 "target" - first control point.
 "target2" - second control point.
-*/
+ */
 void spawnfunc_onslaught_link()
 {
 	if (!g_onslaught)

Modified: branches/nexuiz-2.0/data/scripts/onslaught.shader
===================================================================
--- branches/nexuiz-2.0/data/scripts/onslaught.shader	2009-06-05 10:08:11 UTC (rev 6870)
+++ branches/nexuiz-2.0/data/scripts/onslaught.shader	2009-06-05 10:26:49 UTC (rev 6871)
@@ -86,4 +86,14 @@
 	tcGen environment
 	blendfunc add
  }
+}
+
+ons_ray
+{
+cull none
+ {
+	map textures/ons_ray.tga
+	tcMod rotate 85
+	blendfunc add
+ }
 }
\ No newline at end of file

Modified: branches/nexuiz-2.0/data/sound/onslaught/damageblockedbyshield.wav
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/sound/onslaught/electricity_explode.ogg (from rev 6748, trunk/data/sound/onslaught/electricity_explode.ogg)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/sound/onslaught/ons_hit1.ogg (from rev 6748, trunk/data/sound/onslaught/ons_hit1.ogg)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/sound/onslaught/ons_hit2.ogg (from rev 6748, trunk/data/sound/onslaught/ons_hit2.ogg)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/sound/onslaught/ons_spark1.ogg (from rev 6748, trunk/data/sound/onslaught/ons_spark1.ogg)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/sound/onslaught/ons_spark2.ogg (from rev 6748, trunk/data/sound/onslaught/ons_spark2.ogg)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/textures/ons_ray.tga (from rev 6748, trunk/data/textures/ons_ray.tga)
===================================================================
(Binary files differ)



More information about the nexuiz-commits mailing list