r4985 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Nov 5 02:32:48 EST 2008


Author: div0
Date: 2008-11-05 02:32:47 -0500 (Wed, 05 Nov 2008)
New Revision: 4985

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/cl_impulse.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
sv_clones party


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-11-04 20:05:51 UTC (rev 4984)
+++ trunk/data/defaultNexuiz.cfg	2008-11-05 07:32:47 UTC (rev 4985)
@@ -1181,4 +1181,6 @@
 alias _gl_flashblend_update_11 "gl_flashblend 0"
 alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_showsurfaces"
 
+set sv_clones 0 // number of clones a player may make (reset by the "kill" command) a04191b92fbd93aa67214ef7e72d6d2e
+
 exec turrets.cfg

Modified: trunk/data/qcsrc/server/cl_impulse.qc
===================================================================
--- trunk/data/qcsrc/server/cl_impulse.qc	2008-11-04 20:05:51 UTC (rev 4984)
+++ trunk/data/qcsrc/server/cl_impulse.qc	2008-11-05 07:32:47 UTC (rev 4985)
@@ -307,186 +307,195 @@
 	}
 	else if(imp >= 140 && imp <= 149 || imp == 99) // 10 cheats ought to be enough for anyone
 	{
-		if(sv_cheats)
 		if(self.deadflag == DEAD_NO)
 		{
-			switch(imp)
+			if(sv_cheats || (self.lip < sv_clones))
 			{
-				case 99:
-					self.weapons |= WEPBIT_ALL;
-					self.items |= IT_UNLIMITED_WEAPON_AMMO;
-					self.ammo_shells = g_pickup_shells_max;
-					self.ammo_nails = g_pickup_nails_max;
-					self.ammo_rockets = g_pickup_rockets_max;
-					self.ammo_cells = g_pickup_cells_max;
-					self.health = g_pickup_healthsmall_max;
-					self.armorvalue = g_pickup_armorsmall_max;
-					self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
-					self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
-					self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
-					// precache weapon models/sounds
-					wep = WEP_FIRST;
-					while (wep <= WEP_LAST)
-					{
-						weapon_action(wep, WR_PRECACHE);
-						wep = wep + 1;
-					}
-					break;
-				case 140:
-					makevectors (self.v_angle);
-					self.velocity = self.velocity + v_forward * 300;
-					CopyBody(1);
-					self.lip += 1;
-					self.velocity = self.velocity - v_forward * 300;
-					break;
-				case 141:
-					if(self.waypointsprite_deployed_personal)
-					{
-						self.speedrunning = TRUE;
-						tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
-						if(trace_startsolid)
+				switch(imp)
+				{	
+					 case 140:
+						makevectors (self.v_angle);
+						self.velocity = self.velocity + v_forward * 300;
+						CopyBody(1);
+						self.lip += 1;
+						self.velocity = self.velocity - v_forward * 300;
+						break;
+					case 142:
+						CopyBody(0);
+						self.lip += 1;
+						break;
+				 }
+			}
+
+			if(sv_cheats)
+			{
+				switch(imp)
+				{
+					case 99:
+						self.weapons |= WEPBIT_ALL;
+						self.items |= IT_UNLIMITED_WEAPON_AMMO;
+						self.ammo_shells = g_pickup_shells_max;
+						self.ammo_nails = g_pickup_nails_max;
+						self.ammo_rockets = g_pickup_rockets_max;
+						self.ammo_cells = g_pickup_cells_max;
+						self.health = g_pickup_healthsmall_max;
+						self.armorvalue = g_pickup_armorsmall_max;
+						self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
+						self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
+						self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
+						// precache weapon models/sounds
+						wep = WEP_FIRST;
+						while (wep <= WEP_LAST)
 						{
-							sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
+							weapon_action(wep, WR_PRECACHE);
+							wep = wep + 1;
 						}
-						else
+						break;
+					case 141:
+						if(self.waypointsprite_deployed_personal)
 						{
-							// Abort speedrun, teleport back
-							setorigin(self, self.waypointsprite_deployed_personal.origin);
-							self.oldvelocity = self.velocity = self.personal_velocity;
-							self.angles = self.personal_v_angle;
-							self.fixangle = TRUE;
-							if(self.flagcarried)
+							self.speedrunning = TRUE;
+							tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
+							if(trace_startsolid)
 							{
-								bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
-								ReturnFlag(self.flagcarried);
+								sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
 							}
+							else
+							{
+								// Abort speedrun, teleport back
+								setorigin(self, self.waypointsprite_deployed_personal.origin);
+								self.oldvelocity = self.velocity = self.personal_velocity;
+								self.angles = self.personal_v_angle;
+								self.fixangle = TRUE;
+								if(self.flagcarried)
+								{
+									bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
+									ReturnFlag(self.flagcarried);
+								}
+							}
+							self.ammo_rockets = 999;
+							self.ammo_nails = 999;
+							self.ammo_cells = 999;
+							self.ammo_shells = 999;
+							self.health = start_health;
+							self.armorvalue = start_armorvalue;
+							self.weapons |= weaponsInMap;
+							self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
+							self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
+							self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
 						}
-						self.ammo_rockets = 999;
-						self.ammo_nails = 999;
-						self.ammo_cells = 999;
-						self.ammo_shells = 999;
-						self.health = start_health;
-						self.armorvalue = start_armorvalue;
-						self.weapons |= weaponsInMap;
-						self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
-						self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
-						self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
-					}
-					else if(self.deadflag != DEAD_NO)
-						sprint(self, "UR DEAD AHAHAH))\n");
-					else
-						sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
-					break;
-				case 142:
-					CopyBody(0);
-					self.lip += 1;
-					break;
-				case 143:
-					good = DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP;
-					evil = DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER;
-					evilsurf = Q3SURFACEFLAG_SKY;
+						else if(self.deadflag != DEAD_NO)
+							sprint(self, "UR DEAD AHAHAH))\n");
+						else
+							sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
+						break;
+					case 143:
+						good = DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP;
+						evil = DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER;
+						evilsurf = Q3SURFACEFLAG_SKY;
 
-					m = self.dphitcontentsmask;
-					self.dphitcontentsmask = good | evil;
+						m = self.dphitcontentsmask;
+						self.dphitcontentsmask = good | evil;
 
-					org = world.mins;
-					delta = world.maxs - world.mins;
+						org = world.mins;
+						delta = world.maxs - world.mins;
 
-					maxattempts = ((sv_cheats >= 2) ? 100000 : 100);
+						maxattempts = ((sv_cheats >= 2) ? 100000 : 100);
 
-					for(i = 0; i < maxattempts; ++i)
-					{
-						start_x = org_x + random() * delta_x;
-						start_y = org_y + random() * delta_y;
-						start_z = org_z + random() * delta_z;
+						for(i = 0; i < maxattempts; ++i)
+						{
+							start_x = org_x + random() * delta_x;
+							start_y = org_y + random() * delta_y;
+							start_z = org_z + random() * delta_z;
 
-						// rule 1: start inside world bounds, and outside
-						// solid, and don't start from somewhere where you can
-						// fall down to evil
-						tracebox(start, self.mins, self.maxs, start - '0 0 1' * delta_z, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
-						if(trace_startsolid)
-							continue;
-						dprint("hit contents ", ftos(trace_dphitcontents), "\n");
-						if(trace_dphitcontents & evil)
-							continue;
-						if(trace_dphitq3surfaceflags & evilsurf)
-							continue;
+							// rule 1: start inside world bounds, and outside
+							// solid, and don't start from somewhere where you can
+							// fall down to evil
+							tracebox(start, self.mins, self.maxs, start - '0 0 1' * delta_z, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
+							if(trace_startsolid)
+								continue;
+							dprint("hit contents ", ftos(trace_dphitcontents), "\n");
+							if(trace_dphitcontents & evil)
+								continue;
+							if(trace_dphitq3surfaceflags & evilsurf)
+								continue;
 
-						// rule 2: if we are too high, lower the point
-						if(trace_fraction * delta_z > 1024)
-							start = trace_endpos + '0 0 1024';
-						enddown = trace_endpos;
+							// rule 2: if we are too high, lower the point
+							if(trace_fraction * delta_z > 1024)
+								start = trace_endpos + '0 0 1024';
+							enddown = trace_endpos;
 
-						// these can be traceLINES as we already verified the starting box
-						traceline(start, start + '1 0 0' * delta_x, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
-						traceline(start, start - '1 0 0' * delta_x, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
-						traceline(start, start + '0 1 0' * delta_y, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
-						traceline(start, start - '0 1 0' * delta_y, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
-						traceline(start, start + '0 0 1' * delta_z, MOVE_NORMAL, self);
-						if(trace_fraction >= 1)
-							continue;
+							// these can be traceLINES as we already verified the starting box
+							traceline(start, start + '1 0 0' * delta_x, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
+							traceline(start, start - '1 0 0' * delta_x, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
+							traceline(start, start + '0 1 0' * delta_y, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
+							traceline(start, start - '0 1 0' * delta_y, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
+							traceline(start, start + '0 0 1' * delta_z, MOVE_NORMAL, self);
+							if(trace_fraction >= 1)
+								continue;
 
-						end_x = org_x + random() * delta_x;
-						end_y = org_y + random() * delta_y;
-						end_z = org_z + random() * delta_z;
-						end = start + normalize(end - start) * vlen(delta);
+							end_x = org_x + random() * delta_x;
+							end_y = org_y + random() * delta_y;
+							end_z = org_z + random() * delta_z;
+							end = start + normalize(end - start) * vlen(delta);
 
-						// rule 3: start TO end must not be too short
-						tracebox(start, self.mins, self.maxs, end, MOVE_NORMAL, self);
-						if(trace_startsolid)
-							continue;
-						if(trace_fraction < 256 / vlen(delta))
-							continue;
+							// rule 3: start TO end must not be too short
+							tracebox(start, self.mins, self.maxs, end, MOVE_NORMAL, self);
+							if(trace_startsolid)
+								continue;
+							if(trace_fraction < 256 / vlen(delta))
+								continue;
 
-						// rule 4: don't want to look at sky
-						if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
-							continue;
+							// rule 4: don't want to look at sky
+							if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+								continue;
 
-						// rule 5: we must not end up in trigger_hurt
-						if(tracebox_hits_trigger_hurt(start, self.mins, self.maxs, enddown))
+							// rule 5: we must not end up in trigger_hurt
+							if(tracebox_hits_trigger_hurt(start, self.mins, self.maxs, enddown))
+							{
+								dprint("trigger_hurt! ouch! and nothing else could find it!\n");
+								continue;
+							}
+
+							break;
+						}
+
+						if(i < maxattempts)
 						{
-							dprint("trigger_hurt! ouch! and nothing else could find it!\n");
-							continue;
+							self.origin = start;
+							self.angles = vectoangles(end - start);
+							self.angles_x = -self.angles_x;
+							self.fixangle = TRUE;
+							self.velocity = '0 0 0';
+							dprint("Needed ", ftos(i + 1), " attempts\n");
 						}
+						else
+							sprint(self, "Emergency teleport could not find a good location, forget it!\n");
 
+						self.dphitcontentsmask = m;
 						break;
-					}
-
-					if(i < maxattempts)
-					{
-						self.origin = start;
-						self.angles = vectoangles(end - start);
-						self.angles_x = -self.angles_x;
-						self.fixangle = TRUE;
-						self.velocity = '0 0 0';
-						dprint("Needed ", ftos(i + 1), " attempts\n");
-					}
-					else
-						sprint(self, "Emergency teleport could not find a good location, forget it!\n");
-
-					self.dphitcontentsmask = m;
-					break;
-				case 144:
-					makevectors(self.v_angle);
-					traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
-					if (trace_fraction < 1)
-						printsurfaceinfo(trace_ent, trace_endpos);
-					break;
-				case 145:
-					makevectors(self.v_angle);
-					traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
-					sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
-					break;
+					case 144:
+						makevectors(self.v_angle);
+						traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
+						if (trace_fraction < 1)
+							printsurfaceinfo(trace_ent, trace_endpos);
+						break;
+					case 145:
+						makevectors(self.v_angle);
+						traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
+						sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
+						break;
+				}
 			}
 		}
 	}

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-11-04 20:05:51 UTC (rev 4984)
+++ trunk/data/qcsrc/server/defs.qh	2008-11-05 07:32:47 UTC (rev 4985)
@@ -34,6 +34,7 @@
 float g_pickup_respawntime_powerup;
 float g_maplist_allow_hidden;
 
+float sv_clones;
 float sv_cheats;
 float sv_gentle;
 float sv_foginterval;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-11-04 20:05:51 UTC (rev 4984)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-11-05 07:32:47 UTC (rev 4985)
@@ -891,6 +891,7 @@
 
 void readlevelcvars(void)
 {
+ 	sv_clones = cvar("sv_clones");
 	sv_cheats = cvar("sv_cheats");
 	sv_gentle = cvar("sv_gentle");
 	sv_foginterval = cvar("sv_foginterval");




More information about the nexuiz-commits mailing list