r4745 - in trunk/data: qcsrc/server scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Oct 14 04:53:20 EDT 2008
Author: div0
Date: 2008-10-14 04:53:07 -0400 (Tue, 14 Oct 2008)
New Revision: 4745
Modified:
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/target_spawn.qc
trunk/data/scripts/entities.def
Log:
MOAR stuff ;)
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2008-10-14 08:33:03 UTC (rev 4744)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2008-10-14 08:53:07 UTC (rev 4745)
@@ -1313,7 +1313,10 @@
}
void InitializeEntitiesRun()
{
- for(self = initialize_entity_first; self; )
+ entity startoflist;
+ startoflist = initialize_entity_first;
+ initialize_entity_first = world;
+ for(self = startoflist; self; )
{
entity e;
var void(void) func;
@@ -1333,7 +1336,6 @@
func();
self = e;
}
- initialize_entity_first = world;
}
.float uncustomizeentityforclient_set;
Modified: trunk/data/qcsrc/server/target_spawn.qc
===================================================================
--- trunk/data/qcsrc/server/target_spawn.qc 2008-10-14 08:33:03 UTC (rev 4744)
+++ trunk/data/qcsrc/server/target_spawn.qc 2008-10-14 08:53:07 UTC (rev 4745)
@@ -14,7 +14,7 @@
{
float i, n, valuefieldpos, sPWNed;
entity e;
- string key, value, valuefield, valueoffset;
+ string key, value, valuefield, valueoffset, valueoffsetrandom;
entity valueent;
vector data, data2;
entity oldself;
@@ -59,10 +59,18 @@
valueoffset = "";
if(valuefieldpos != -1)
{
- valueoffset = substring(valuefield, valuefieldpos + 1, strlen(value) - valuefieldpos - 1);
+ valueoffset = substring(valuefield, valuefieldpos + 1, strlen(valueoffset) - valuefieldpos - 1);
valuefield = substring(valuefield, 0, valuefieldpos);
}
+ valuefieldpos = strstrofs(valueoffset, "+", 0);
+ valueoffsetrandom = "";
+ if(valuefieldpos != -1)
+ {
+ valueoffsetrandom = substring(valueoffset, valuefieldpos + 1, strlen(valueoffset) - valuefieldpos - 1);
+ valueoffset = substring(valueoffset, 0, valuefieldpos);
+ }
+
if(value == "self")
{
valueent = self;
@@ -131,6 +139,23 @@
break;
}
}
+
+ if(valueoffsetrandom != "")
+ {
+ switch(data_y)
+ {
+ case FIELD_FLOAT:
+ value = ftos(stof(value) + random() * stof(valueoffsetrandom));
+ break;
+ case FIELD_VECTOR:
+ data2 = stov(valueoffsetrandom);
+ value = vtos(stov(value) + random() * data2_x * '1 0 0' + random() * data2_y * '0 1 0' + random() * data2_z * '0 0 1');
+ break;
+ default:
+ print("target_spawn: only float and vector fields can do random calculations, calculation ignored!\n");
+ break;
+ }
+ }
}
}
putentityfieldstring(data_x, e, value);
@@ -184,6 +209,6 @@
target_spawn_initialized = 1;
}
- if(self.spawnflags & 2)
- InitializeEntity(self, target_spawn_spawnfirst, INITPRIO_LAST);
+ self.use = target_spawn_use;
+ InitializeEntity(self, target_spawn_spawnfirst, INITPRIO_LAST);
}
Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def 2008-10-14 08:33:03 UTC (rev 4744)
+++ trunk/data/scripts/entities.def 2008-10-14 08:53:07 UTC (rev 4745)
@@ -1089,6 +1089,7 @@
$E
$E.field
$E.field+offset
+$E.field+offset+randomoffset
where "E" can be self, activator and pusher.
Example is a Mario-style question mark block which could throw a new weapon_nex when activated like this:
{
More information about the nexuiz-commits
mailing list