[nexuiz-commits] r7970 - in trunk/data: . qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Sep 28 06:52:49 EDT 2009


Author: div0
Date: 2009-09-28 06:52:49 -0400 (Mon, 28 Sep 2009)
New Revision: 7970

Modified:
   trunk/data/balance.cfg
   trunk/data/balance25.cfg
   trunk/data/balanceHavoc.cfg
   trunk/data/balanceSamual.cfg
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/sv_main.qc
   trunk/data/qcsrc/server/w_hagar.qc
   trunk/data/scripts/entities.def
Log:
hagar: support randomized lifetime on secondary (unused)
feature: cvar filters on map entities


Modified: trunk/data/balance.cfg
===================================================================
--- trunk/data/balance.cfg	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/balance.cfg	2009-09-28 10:52:49 UTC (rev 7970)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 3ec2d034ac400bba7e93eef2c720669a
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map
@@ -392,7 +392,8 @@
 set g_balance_hagar_secondary_radius 90
 set g_balance_hagar_secondary_spread 0.1
 set g_balance_hagar_secondary_speed 2000
-set g_balance_hagar_secondary_lifetime 30
+set g_balance_hagar_secondary_lifetime_min 30
+set g_balance_hagar_secondary_lifetime_rand 0
 set g_balance_hagar_secondary_refire 0.15
 set g_balance_hagar_secondary_ammo 1
 //   }}}

Modified: trunk/data/balance25.cfg
===================================================================
--- trunk/data/balance25.cfg	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/balance25.cfg	2009-09-28 10:52:49 UTC (rev 7970)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 3ec2d034ac400bba7e93eef2c720669a
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map
@@ -392,7 +392,8 @@
 set g_balance_hagar_secondary_radius 65
 set g_balance_hagar_secondary_spread 0.015
 set g_balance_hagar_secondary_speed 1400
-set g_balance_hagar_secondary_lifetime 30
+set g_balance_hagar_secondary_lifetime_min 30
+set g_balance_hagar_secondary_lifetime_rand 0
 set g_balance_hagar_secondary_refire 0.15
 set g_balance_hagar_secondary_ammo 1
 //   }}}

Modified: trunk/data/balanceHavoc.cfg
===================================================================
--- trunk/data/balanceHavoc.cfg	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/balanceHavoc.cfg	2009-09-28 10:52:49 UTC (rev 7970)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 3ec2d034ac400bba7e93eef2c720669a
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map
@@ -392,7 +392,8 @@
 set g_balance_hagar_secondary_radius 90
 set g_balance_hagar_secondary_spread 0.1
 set g_balance_hagar_secondary_speed 2000
-set g_balance_hagar_secondary_lifetime 30
+set g_balance_hagar_secondary_lifetime_min 30
+set g_balance_hagar_secondary_lifetime_rand 0
 set g_balance_hagar_secondary_refire 0.1
 set g_balance_hagar_secondary_ammo 1
 //   }}}

Modified: trunk/data/balanceSamual.cfg
===================================================================
--- trunk/data/balanceSamual.cfg	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/balanceSamual.cfg	2009-09-28 10:52:49 UTC (rev 7970)
@@ -3,7 +3,7 @@
 //
 // And... don't forget to edit the other balance*.cfg too.
 
-set cvar_check_balance 3ec2d034ac400bba7e93eef2c720669a
+set cvar_check_balance 9b590c8f7c3065d917ac8e2e5e842a88
 
 // {{{ weapon replacement
 // NOTE: this only replaces weapons on the map
@@ -392,7 +392,8 @@
 set g_balance_hagar_secondary_radius 70
 set g_balance_hagar_secondary_spread 0.05
 set g_balance_hagar_secondary_speed 2000
-set g_balance_hagar_secondary_lifetime 30
+set g_balance_hagar_secondary_lifetime_min 30
+set g_balance_hagar_secondary_lifetime_rand 0
 set g_balance_hagar_secondary_refire 0.15
 set g_balance_hagar_secondary_ammo 1
 //   }}}

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/qcsrc/server/constants.qh	2009-09-28 10:52:49 UTC (rev 7970)
@@ -1,5 +1,5 @@
 string CVAR_CHECK_DEFAULT = "4bb48bd2d43bd891aa49d542abb24bf8";
-string CVAR_CHECK_BALANCE = "3ec2d034ac400bba7e93eef2c720669a";
+string CVAR_CHECK_BALANCE = "9b590c8f7c3065d917ac8e2e5e842a88";
 
 float	FALSE					= 0;
 float	TRUE					= 1;

Modified: trunk/data/qcsrc/server/sv_main.qc
===================================================================
--- trunk/data/qcsrc/server/sv_main.qc	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/qcsrc/server/sv_main.qc	2009-09-28 10:52:49 UTC (rev 7970)
@@ -241,6 +241,7 @@
 .vector anglesjitter;
 .float anglejitter;
 .string gametypefilter;
+.string cvarfilter;
 void SV_OnEntityPreSpawnFunction()
 {
 	if(self.gametypefilter != "")
@@ -249,7 +250,103 @@
 		remove(self);
 		return;
 	}
+	if(self.cvarfilter != "")
+	{
+		float n, i, o, inv;
+		string s, k, v;
+		inv = 0;
 
+		s = self.cvarfilter;
+		if(substring(s, 0, 1) == "+")
+		{
+			s = substring(s, 1, -1);
+		}
+		else if(substring(s, 0, 1) == "-")
+		{
+			inv = 1;
+			s = substring(s, 1, -1);
+		}
+
+		n = tokenize(s);
+		for(i = 0; i < n; ++i)
+		{
+			s = argv(i);
+			// syntax:
+			// var>x
+			// var<x
+			// var>=x
+			// var<=x
+			// var==x
+			// var!=x
+			// var===x
+			// var!==x
+			if((o = strstrofs(s, ">=", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar(k) < stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "<=", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar(k) > stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, ">", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+1, -1);
+				if(cvar(k) <= stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "<", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+1, -1);
+				if(cvar(k) >= stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "==", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar(k) != stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "!=", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar(k) == stof(v))
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "===", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar_string(k) != v)
+					goto cvar_fail;
+			}
+			else if((o = strstrofs(s, "!==", 0)) >= 0)
+			{
+				k = substring(s, 0, o);
+				v = substring(s, o+2, -1);
+				if(cvar_string(k) == v)
+					goto cvar_fail;
+			}
+		}
+		inv = !inv;
+:cvar_fail
+		// now inv is 1 if we want to keep the item, and 0 if we want to get rid of it
+		if not(inv)
+		{
+			remove(self);
+			return;
+		}
+	}
+
 	// support special -1 and -2 angle from radiant
 	if (self.angles == '0 -1 0')
 		self.angles = '-90 0 0';

Modified: trunk/data/qcsrc/server/w_hagar.qc
===================================================================
--- trunk/data/qcsrc/server/w_hagar.qc	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/qcsrc/server/w_hagar.qc	2009-09-28 10:52:49 UTC (rev 7970)
@@ -90,7 +90,7 @@
 	missile.cnt = 0;
 	missile.use = W_Hagar_Explode;
 	missile.think = adaptor_think2use;
-	missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
+	missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime_min") + random() * cvar("g_balance_hagar_secondary_lifetime_rand");
 	PROJECTILE_MAKETRIGGER(missile);
 	missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
 	setorigin (missile, w_shotorg);

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-09-28 10:36:46 UTC (rev 7969)
+++ trunk/data/scripts/entities.def	2009-09-28 10:52:49 UTC (rev 7970)
@@ -684,6 +684,7 @@
 anglesjitter: a vector in the order "pitch yaw roll" describing a random angles change on this entity on initial spawn. The value 180 180 180 makes the angles entirely random and uniformly distributed (among euler angles). This corresponds to the "angles" field. Works on any non-q3map2-only entity.
 anglejitter: a float describing a random yaw angle change on this entity on initial spawn. The value 180 makes the yaw angle entirely random (maybe good for items). This corresponds to the "angle" field. Works on any non-q3map2-only entity.
 gametypefilter: either a + sign and a comma separated list of game types or the aliases "teams" and "noteams" to ONLY show the entity in the listed game types, or a - sign and a comma separated list of game types or the aliases "teams" and "noteams" to NOT show the entity in the listed game types. The syntax is the same as in sbar_columns_set strings. Works on any non-q3map2-only entity.
+cvarfilter: either a + sign and a space separated list of conditions, or a - sign and the same for an inverted filter. The conditions are ALWAYS combined with AND! Possible conditions are: "cvar==value", "cvar!=value", "cvar<value", "cvar>value", "cvar<=value", "cvar>=value", "cvar===string", "cvar!==string", "cvar", "!cvar". Ridiculous example filter: "-g_balance_health_start<150 g_balance_armor_start==0" spawns an item only if start health is at least 150 or start armor is not 0. Other ideas: "+g_campaign" and "-g_campaign" for enabling/disabling items when the map is played as part of the campaign.
 -------- SPAWNFLAGS --------
 ALIGN_ORIGN: align the origin to the surface below the model
 ALIGN_BOTTOM: align the bottom of the model to the surface below it



More information about the nexuiz-commits mailing list