r4948 - in trunk/data: qcsrc/server scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 31 05:09:15 EDT 2008
Author: div0
Date: 2008-10-31 05:09:05 -0400 (Fri, 31 Oct 2008)
New Revision: 4948
Modified:
trunk/data/qcsrc/server/target_spawn.qc
trunk/data/scripts/entities.def
Log:
trigger_relay_if was useless. Make it useful, by letting it check cvars.
Modified: trunk/data/qcsrc/server/target_spawn.qc
===================================================================
--- trunk/data/qcsrc/server/target_spawn.qc 2008-10-31 09:01:34 UTC (rev 4947)
+++ trunk/data/qcsrc/server/target_spawn.qc 2008-10-31 09:09:05 UTC (rev 4948)
@@ -299,33 +299,12 @@
n = self.count;
// TODO make this generic AND faster than nextent()ing through all, if somehow possible
- if(self.netname == "targetname")
- fld = targetname;
- else if(self.netname == "netname")
- fld = netname;
- else if(self.netname == "target")
- fld = target;
- else if(self.netname == "classname")
- fld = classname;
- else
- {
- objerror("invalid field specified for trigger_relay_if");
- return;
- }
+ n = (cvar_string(self.netname) == cvar_string(self.message));
+ if(self.spawnflags & 1)
+ n = !n;
- for(e = world; (e = find(e, fld, self.message)) && (n > 0); --n)
- ;
-
- if(self.spawnflags & 1) // MORE THAN count valid targets
- {
- if(n)
- SUB_UseTargets();
- }
- else // AT MOST count valid targets
- {
- if(!n)
- SUB_UseTargets();
- }
+ if(n)
+ SUB_UseTargets();
}
void spawnfunc_trigger_relay_if()
Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def 2008-10-31 09:01:34 UTC (rev 4947)
+++ trunk/data/scripts/entities.def 2008-10-31 09:09:05 UTC (rev 4948)
@@ -1135,16 +1135,16 @@
INDICATE: indicate amount of damage already taken by coloring
*/
-/*QUAKED trigger_relay_if (0 1 0) (-8 -8 -8) (8 8 8) MORETHAN
-Relays the trigger event if there are at most count entities of the given type.
+/*QUAKED trigger_relay_if (0 1 0) (-8 -8 -8) (8 8 8) NEGATE
+Relays the trigger event if a cvar is set to a specified value.
-------- KEYS --------
target: The entity/entities to relay the trigger events to
targetname: The name other entities can use to target this entity
-netname: The name of the field to check (can currently only be targetname, netname, target or classname)
-message: The value of the field to check
+netname: The name of the cvar to check
+message: The value of the cvar to check
count: The count of entities that must be found
-------- SPAWNFLAGS --------
-MORETHAN: trigger if there are more than the given count, not at least
+NEGATE: trigger if the cvar does NOT match the value.
*/
/*QUAKED weapon_hlac (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
More information about the nexuiz-commits
mailing list