r4747 - in branches/nexuiz-2.0: . data/qcsrc/client data/qcsrc/common data/qcsrc/server data/qcsrc/server/tturrets/include data/qcsrc/server/tturrets/system data/qcsrc/server/tturrets/units data/scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Oct 14 05:21:06 EDT 2008
Author: div0
Date: 2008-10-14 05:21:05 -0400 (Tue, 14 Oct 2008)
New Revision: 4747
Added:
branches/nexuiz-2.0/data/qcsrc/server/target_spawn.qc
Modified:
branches/nexuiz-2.0/.patchsets
branches/nexuiz-2.0/data/qcsrc/client/miscfunctions.qc
branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
branches/nexuiz-2.0/data/qcsrc/common/util.qc
branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc
branches/nexuiz-2.0/data/qcsrc/server/defs.qh
branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
branches/nexuiz-2.0/data/qcsrc/server/progs.src
branches/nexuiz-2.0/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh
branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_damage.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_main.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_common.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_flac.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_fusionreactor.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hellion.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hk.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_machinegun.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_mlrs.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_phaser.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_plasma.qc
branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_tessla.qc
branches/nexuiz-2.0/data/qcsrc/server/vote.qc
branches/nexuiz-2.0/data/qcsrc/server/vote.qh
branches/nexuiz-2.0/data/scripts/entities.def
Log:
r4741 | tzork | 2008-10-13 17:23:02 +0200 (Mon, 13 Oct 2008) | 1 line
Turrets precache fixed. Turrets now work with ONS.
r4742 | div0 | 2008-10-14 07:51:37 +0200 (Tue, 14 Oct 2008) | 2 lines
de-linuxed the code base a bit
r4743 | div0 | 2008-10-14 10:30:18 +0200 (Tue, 14 Oct 2008) | 2 lines
experimental target_spawn entity that should be able to spawn anything
r4744 | div0 | 2008-10-14 10:33:03 +0200 (Tue, 14 Oct 2008) | 2 lines
forgot spawnflags
r4745 | div0 | 2008-10-14 10:53:07 +0200 (Tue, 14 Oct 2008) | 2 lines
MOAR stuff ;)
r4746 | div0 | 2008-10-14 11:00:38 +0200 (Tue, 14 Oct 2008) | 2 lines
ignore empty "say" commands, make all argv_start_index calls check if the index is in range
Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/.patchsets 2008-10-14 09:21:05 UTC (rev 4747)
@@ -1,2 +1,2 @@
master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-4739
+revisions_applied = 1-4746
Modified: branches/nexuiz-2.0/data/qcsrc/client/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/miscfunctions.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/client/miscfunctions.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -71,8 +71,6 @@
AuditLists();
}
-// warning: Local "team" defined with name of a global
-// FU FTEQCC, .float team is a ENTVAR shitty piece of crap!!!
float RegisterTeam(entity Team)
{
entity tm;
Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -911,7 +911,7 @@
pos_x -= sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
/**
* FTEQCC BUG!
- * Using the following line will fuck it all up:
+ * Using the following line will mess it all up:
**
* tmp_x = sbar_size[i] - strlen(sbar_title[i])*8;
*/
Modified: branches/nexuiz-2.0/data/qcsrc/common/util.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/util.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/common/util.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -202,7 +202,7 @@
result = ftos(number);
len = strlen(result);
// does it have a decimal point (should not happen)? If there is one, it is always at len-7)
- // if ftos had fucked it up, which should never happen: "34278.000000"
+ // if ftos had messed it up, which should never happen: "34278.000000"
if(len >= 7)
if(substring(result, len - 7, 1) == ".")
{
Modified: branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/clientcommands.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -223,9 +223,9 @@
//float ctf_clientcommand();
void SV_ParseClientCommand(string s) {
local string cmd;
- local float i;
+ local float i, tokens;
- tokenize_sane(s);
+ tokens = tokenize_sane(s);
if(GameCommand_Vote(s, self)) {
return;
@@ -371,10 +371,12 @@
} else if(argv(0) == "voice") {
VoiceMessage(argv(1));
} else if(argv(0) == "say") {
- Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+ if(tokens >= 2)
+ Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
//clientcommand(self, formatmessage(s));
} else if(argv(0) == "say_team") {
- Say(self, TRUE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+ if(tokens >= 2)
+ Say(self, TRUE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
//clientcommand(self, formatmessage(s));
} else if(argv(0) == "info") {
cmd = cvar_string(strcat("sv_info_", argv(1)));
Modified: branches/nexuiz-2.0/data/qcsrc/server/defs.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/defs.qh 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/defs.qh 2008-10-14 09:21:05 UTC (rev 4747)
@@ -415,6 +415,7 @@
// database
float ServerProgsDB;
+float TemporaryDB;
.float team_saved;
Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -232,6 +232,8 @@
else
ServerProgsDB = db_load("server.db");
+ TemporaryDB = db_create();
+
/*
TODO sound pack system
// initialize sound pack system
@@ -2322,7 +2324,10 @@
Ban_SaveBans();
if(!sv_cheats)
db_save(ServerProgsDB, "server.db");
+ if(cvar("developer"))
+ db_save(TemporaryDB, "server-temp.db");
db_close(ServerProgsDB);
+ db_close(TemporaryDB);
print("done!\n");
// tell the bot system the game is ending now
bot_endgame();
Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -731,7 +731,7 @@
entity get_weaponinfo(float w);
-void readplayerstartcvars()
+void readplayerstartcvars()
{
entity e;
float i;
@@ -1021,6 +1021,11 @@
precache_model ("models/runematch/rune.mdl");
}
+#ifdef TTURRETS_ENABLED
+ if(cvar("g_turrets"))
+ turrets_precash();
+#endif
+
// Precache all player models if desired
if (cvar("sv_precacheplayermodels"))
{
@@ -1308,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;
@@ -1328,7 +1336,6 @@
func();
self = e;
}
- initialize_entity_first = world;
}
.float uncustomizeentityforclient_set;
@@ -1432,7 +1439,7 @@
}
//
-// func_breakable
+// func_breakable
// - basically func_assault_destructible for general gameplay use
//
float () crandom;
@@ -1440,10 +1447,10 @@
void LaunchDebris (string debrisname) =
{
local entity dbr;
-
+
if (debrisname == "" || !debrisname)
return;
-
+
dbr = spawn();
dbr.origin = self.origin;
setmodel (dbr, debrisname );
@@ -1470,14 +1477,14 @@
self.solid = SOLID_NOT;
}
self.takedamage = DAMAGE_NO;
-
+
// now throw around the debris
LaunchDebris(self.debris1);
LaunchDebris(self.debris2);
LaunchDebris(self.debris3);
-
+
SUB_UseTargets();
-
+
self.event_damage = SUB_Null;
}
@@ -1505,12 +1512,12 @@
- self.classname = "func_breakable";
+ self.classname = "func_breakable";
self.mdl = self.model;
setmodel(self, self.mdl);
-
+
self.solid = SOLID_BSP;
-
+
// precache all the models
if (self.mdl_dead)
precache_model(self.mdl_dead);
@@ -1520,7 +1527,7 @@
precache_model(self.debris2);
if (self.debris3)
precache_model(self.debris3);
-
+
self.use = assault_destructible_use; // shared use function, b/c they woudl do the same thing anyways
self.event_damage = func_breakable_damage;
}
Modified: branches/nexuiz-2.0/data/qcsrc/server/progs.src
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/progs.src 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/progs.src 2008-10-14 09:21:05 UTC (rev 4747)
@@ -136,3 +136,5 @@
scores.qc
portals.qc
+
+target_spawn.qc
Copied: branches/nexuiz-2.0/data/qcsrc/server/target_spawn.qc (from rev 4746, trunk/data/qcsrc/server/target_spawn.qc)
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/target_spawn.qc (rev 0)
+++ branches/nexuiz-2.0/data/qcsrc/server/target_spawn.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -0,0 +1,214 @@
+// spawner entity
+// "classname" "target_spawn"
+// "message" "fieldname value fieldname value ..."
+// "spawnflags"
+// 1 = call the spawn function
+// 2 = trigger on map load
+
+float target_spawn_initialized;
+.void() target_spawn_spawnfunc;
+float target_spawn_spawnfunc_field;
+.entity target_spawn_activator;
+
+void target_spawn_use()
+{
+ float i, n, valuefieldpos, sPWNed;
+ entity e;
+ string key, value, valuefield, valueoffset, valueoffsetrandom;
+ entity valueent;
+ vector data, data2;
+ entity oldself;
+ entity oldactivator;
+
+ e = spawn();
+ n = tokenize_sane(self.message);
+
+ sPWNed = FALSE;
+
+ for(i = 0; i < n-1; i += 2)
+ {
+ key = argv(i);
+ value = argv(i+1);
+ data = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", key)));
+ if(data_y == 0) // undefined field, i.e., invalid type
+ {
+ print("target_spawn: invalid/unknown entity key ", key, " specified, ignored!\n");
+ continue;
+ }
+ if(substring(value, 0, 1) == "$")
+ {
+ value = substring(value, 1, strlen(value) - 1);
+ if(substring(value, 0, 1) == "$")
+ {
+ // deferred replacement
+ // do nothing
+ // useful for creating target_spawns with this!
+ }
+ else
+ {
+ // replace me!
+ valuefieldpos = strstrofs(value, ".", 0);
+ valuefield = "";
+ if(valuefieldpos != -1)
+ {
+ valuefield = substring(value, valuefieldpos + 1, strlen(value) - valuefieldpos - 1);
+ value = substring(value, 0, valuefieldpos);
+ }
+
+ valuefieldpos = strstrofs(value, "+", 0);
+ valueoffset = "";
+ if(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;
+ value = "";
+ }
+ else if(value == "activator")
+ {
+ valueent = activator;
+ value = "";
+ }
+ else if(value == "pusher")
+ {
+ if(time < activator.pushltime)
+ valueent = activator.pusher;
+ else
+ valueent = world;
+ value = "";
+ }
+ else if(value == "time")
+ {
+ valueent = world;
+ value = ftos(time);
+ }
+ else
+ {
+ print("target_spawn: invalid/unknown variable replacement ", value, " specified, ignored!\n");
+ continue;
+ }
+
+ if(valuefield == "")
+ {
+ if(value == "")
+ value = ftos(num_for_edict(valueent));
+ }
+ else
+ {
+ if(value != "")
+ {
+ print("target_spawn: try to get a field of a non-entity, ignored!\n");
+ continue;
+ }
+ data2 = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", valuefield)));
+ if(data2_y == 0) // undefined field, i.e., invalid type
+ {
+ print("target_spawn: invalid/unknown entity key replacement ", value, " specified, ignored!\n");
+ continue;
+ }
+ value = getentityfieldstring(data2_x, valueent);
+ }
+
+ if(valueoffset != "")
+ {
+ switch(data_y)
+ {
+ case FIELD_STRING:
+ value = strcat(value, valueoffset);
+ break;
+ case FIELD_FLOAT:
+ value = ftos(stof(value) + stof(valueoffset));
+ break;
+ case FIELD_VECTOR:
+ value = vtos(stov(value) + stov(valueoffset));
+ break;
+ default:
+ print("target_spawn: only string, float and vector fields can do calculations, calculation ignored!\n");
+ 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);
+
+ if(key == "classname" && !sPWNed)
+ {
+ if(self.spawnflags & 1)
+ {
+ if(!e.target_spawn_spawnfunc)
+ putentityfieldstring(target_spawn_spawnfunc_field, e, strcat("spawnfunc_", value));
+
+ oldself = self;
+ oldactivator = activator;
+
+ self = e;
+ activator = self.target_spawn_activator;
+
+ self.target_spawn_spawnfunc();
+
+ self = oldself;
+ activator = oldactivator;
+ }
+ sPWNed = TRUE;
+ }
+ }
+}
+
+void target_spawn_spawnfirst()
+{
+ activator = self.target_spawn_activator;
+ target_spawn_use();
+}
+
+void spawnfunc_target_spawn()
+{
+ if(!target_spawn_initialized)
+ {
+ float n, i;
+ string fn;
+ float ft;
+
+ n = numentityfields();
+ for(i = 0; i < n; ++i)
+ {
+ fn = entityfieldname(i);
+ ft = entityfieldtype(i);
+ db_put(TemporaryDB, strcat("/target_spawn/field/", fn), vtos(i * '1 0 0' + ft * '0 1 0' + '0 0 1'));
+ if(fn == "target_spawn_spawnfunc")
+ target_spawn_spawnfunc_field = i;
+ }
+
+ target_spawn_initialized = 1;
+ }
+ self.use = target_spawn_use;
+ InitializeEntity(self, target_spawn_spawnfirst, INITPRIO_LAST);
+}
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh 2008-10-14 09:21:05 UTC (rev 4747)
@@ -331,8 +331,8 @@
.void() turret_firefunc;
/// prefire checks go here. return 1 to go bang, 0 not to.
.float() turret_firecheckfunc;
-/// Execure BEFORE main ai loop. return 0 to cancel any following proccessing.
-.float() turret_prethink;
+// Execure BEFORE main ai loop. return 0 to cancel any following proccessing.
+//.float() turret_prethink;
/// Execure AFTER main AI loop UNLESS turret_prethink returnd 0
.void() turret_postthink;
@@ -387,7 +387,7 @@
/*
* Damage, death and respawn.
*/
-void turret_gibs_precash();
+//void turret_gibs_precash();
// generalized so save mem (on fields)
// Function to handle incomming damage. usualy turret_stdproc_damage
//.void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) turret_damagefunc;
@@ -420,7 +420,7 @@
/// Generic fairly smart bias-aware target selection.
float turret_stdproc_targetscore_generic(entity e_turret, entity e_target);
/// Experimental supportunits targetselector
-float turret_stdproc_targetscore_support(entity e_turret,entity e_target);
+float turret_stdproc_targetscore_support(entity e_turret,entity e_target);
/*
* Aim functions
@@ -462,4 +462,5 @@
.vector tur_shotorg_updated;
.vector tur_shotdir_updated;
+void turrets_precash();
#endif // TTURRETS_ENABLED
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_damage.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_damage.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_damage.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -5,19 +5,7 @@
{
self.velocity += vforce;
}
-void turret_gibs_precash()
-{
- precache_model("models/turrets/base-gib1.md3");
- precache_model("models/turrets/base-gib2.md3");
- precache_model("models/turrets/base-gib3.md3");
- precache_model("models/turrets/base-gib4.md3");
- precache_model("models/turrets/head-gib1.md3");
- precache_model("models/turrets/head-gib2.md3");
- precache_model("models/turrets/head-gib3.md3");
- precache_model("models/turrets/head-gib4.md3");
-}
-
void turret_trowgib(
vector v_from, vector v_to, vector v_colormod,
string smodel,
@@ -60,7 +48,7 @@
float i;
string s;
- for (i=1;i<5;i++)
+ for (i = 1; i < 5; i = i +1)
{
gib = spawn();
gib.classname = "turret_gib";
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_main.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/turret_system_main.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -510,6 +510,36 @@
self.nextthink = (time + self.ticrate);
+ // ONS uses somewhat backwards linking.
+ if(teamplay)
+ {
+ if(g_onslaught)
+ {
+
+ /*
+ // see turret_stdproc_use()
+ if(self.targetname)
+ {
+ e = find(world,target,self.targetname);
+ if(e != world)
+ self.team = e.team;
+ }*/
+ }
+ else
+ {
+ if(self.target)
+ {
+ e = find(world,targetname,self.target);
+ if(e != world)
+ self.team = e.team;
+ }
+ }
+
+ if(self.team != self.tur_head.team)
+ turret_stdproc_respawn();
+ }
+
+
if (cvar("g_turrets_reloadcvars") == 1)
{
e = nextent(world);
@@ -538,7 +568,7 @@
#endif
//Do custom prethink, and bail if it fails.
- if (!self.turret_prethink()) return;
+ //if (!self.turret_prethink()) return;
// Handle ammo
if (self.ammo < self.ammo_max)
@@ -660,11 +690,29 @@
void turret_stdproc_use()
{
- // bprint("Used:",self.netname,"\n");
- if (self.tur_active)
- self.tur_active = 0;
+ // bprint("Used:",self.netname, " By ",other.netname,"\n");
+
+ if(g_onslaught)
+ {
+ entity e;
+
+ if(self.targetname)
+ {
+ e = find(world,target,self.targetname);
+ if(e != world)
+ self.team = e.team;
+ }
+
+ if(self.team != self.tur_head.team)
+ turret_stdproc_respawn();
+ }
else
- self.tur_active = 1;
+ {
+ if (self.tur_active)
+ self.tur_active = 0;
+ else
+ self.tur_active = 1;
+ }
}
@@ -681,7 +729,7 @@
if (cvar("g_turrets") == 0) return 0;
// Better more then once then never.
- turret_gibs_precash();
+ // turret_gibs_precash();
if (self.spawnflags & 2)
{
@@ -922,7 +970,7 @@
// Attach stdprocs. override when and what needed
if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
{
- self.turret_prethink = turret_stdproc_true;
+ //self.turret_prethink = turret_stdproc_true;
self.turret_score_target = turret_stdproc_targetscore_support;
//self.turret_aim = turret_stdproc_aim_generic;
//self.turret_track = turret_stdproc_track;
@@ -941,7 +989,7 @@
else
{
- self.turret_prethink = turret_stdproc_true;
+ //self.turret_prethink = turret_stdproc_true;
self.turret_score_target = turret_stdproc_targetscore_generic;
//if (self.aim_flags & TFL_AIM_SIMPLE)
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_common.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_common.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_common.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -4,7 +4,7 @@
float f;
// Laters dooz
- if(linked)
+ if (linked)
return 0;
f = gettagindex(self,"tag_head");
@@ -45,72 +45,104 @@
float bforce,float f_dmg,float f_velfactor, float deathtype)
{
- local vector hitloc, force, endpoint, dir;
- local entity ent;
+ local vector hitloc, force, endpoint, dir;
+ local entity ent;
- dir = normalize(end - start);
- force = dir * bforce;
+ dir = normalize(end - start);
+ force = dir * bforce;
- // go a little bit into the wall because we need to hit this wall later
- end = end + dir;
+ // go a little bit into the wall because we need to hit this wall later
+ end = end + dir;
- // trace multiple times until we hit a wall, each obstacle will be made unsolid.
- // note down which entities were hit so we can damage them later
- while (1)
- {
+ // trace multiple times until we hit a wall, each obstacle will be made unsolid.
+ // note down which entities were hit so we can damage them later
+ while (1)
+ {
tracebox(start, smin, smax, end, FALSE, self);
- // if it is world we can't hurt it so stop now
- if (trace_ent == world || trace_fraction == 1)
- break;
+ // if it is world we can't hurt it so stop now
+ if (trace_ent == world || trace_fraction == 1)
+ break;
- if (trace_ent.solid == SOLID_BSP)
+ if (trace_ent.solid == SOLID_BSP)
break;
- // make the entity non-solid so we can hit the next one
- trace_ent.railgunhit = TRUE;
- trace_ent.railgunhitloc = end;
- trace_ent.railgunhitsolidbackup = trace_ent.solid;
+ // make the entity non-solid so we can hit the next one
+ trace_ent.railgunhit = TRUE;
+ trace_ent.railgunhitloc = end;
+ trace_ent.railgunhitsolidbackup = trace_ent.solid;
- // stop if this is a wall
+ // stop if this is a wall
- // make the entity non-solid
- trace_ent.solid = SOLID_NOT;
- }
+ // make the entity non-solid
+ trace_ent.solid = SOLID_NOT;
+ }
- endpoint = trace_endpos;
+ endpoint = trace_endpos;
- // find all the entities the railgun hit and restore their solid state
- ent = findfloat(world, railgunhit, TRUE);
- while (ent)
- {
- // restore their solid type
- ent.solid = ent.railgunhitsolidbackup;
- ent = findfloat(ent, railgunhit, TRUE);
- }
+ // find all the entities the railgun hit and restore their solid state
+ ent = findfloat(world, railgunhit, TRUE);
+ while (ent)
+ {
+ // restore their solid type
+ ent.solid = ent.railgunhitsolidbackup;
+ ent = findfloat(ent, railgunhit, TRUE);
+ }
- // find all the entities the railgun hit and hurt them
- ent = findfloat(world, railgunhit, TRUE);
- while (ent)
- {
- // get the details we need to call the damage function
- hitloc = ent.railgunhitloc;
- ent.railgunhitloc = '0 0 0';
- ent.railgunhitsolidbackup = SOLID_NOT;
- ent.railgunhit = FALSE;
+ // find all the entities the railgun hit and hurt them
+ ent = findfloat(world, railgunhit, TRUE);
+ while (ent)
+ {
+ // get the details we need to call the damage function
+ hitloc = ent.railgunhitloc;
+ ent.railgunhitloc = '0 0 0';
+ ent.railgunhitsolidbackup = SOLID_NOT;
+ ent.railgunhit = FALSE;
- // apply the damage
- if (ent.takedamage)
- {
- Damage (ent, self, self, f_dmg, deathtype, hitloc, force);
+ // apply the damage
+ if (ent.takedamage)
+ {
+ Damage (ent, self, self, f_dmg, deathtype, hitloc, force);
ent.velocity = ent.velocity * f_velfactor;
//ent.alpha = 0.25 + random() * 0.75;
- }
+ }
- // advance to the next entity
- ent = findfloat(ent, railgunhit, TRUE);
- }
- trace_endpos = endpoint;
+ // advance to the next entity
+ ent = findfloat(ent, railgunhit, TRUE);
+ }
+ trace_endpos = endpoint;
}
+void turrets_precash()
+{
+ precache_sound ("turrets/phaser.ogg");
+
+ precache_model ("models/turrets/base-gib1.md3");
+ precache_model ("models/turrets/base-gib2.md3");
+ precache_model ("models/turrets/base-gib3.md3");
+ precache_model ("models/turrets/base-gib4.md3");
+
+ precache_model ("models/turrets/head-gib1.md3");
+ precache_model ("models/turrets/head-gib2.md3");
+ precache_model ("models/turrets/head-gib3.md3");
+ precache_model ("models/turrets/head-gib4.md3");
+
+ precache_model ("models/turrets/base.md3");
+ precache_model ("models/turrets/flac.md3");
+ precache_model ("models/turrets/pd_proj.md3");
+ precache_model ("models/turrets/reactor.md3");
+ precache_model ("models/turrets/mlrs_rocket.md3");
+ precache_model ("models/turrets/hellion.md3");
+ precache_model ("models/turrets/hunter2.md3");
+ precache_model ("models/turrets/hk.md3");
+ precache_model ("models/turrets/machinegun.md3");
+ precache_model ("models/turrets/rocket.md3");
+ precache_model ("models/turrets/mlrs.md3");
+ precache_model ("models/turrets/phaser.md3");
+ precache_model ("models/turrets/phaser_beam.md3");
+ precache_model ("models/turrets/plasmad.md3");
+ precache_model ("models/turrets/plasma.md3");
+ precache_model ("models/turrets/tesla_head.md3");
+ precache_model ("models/turrets/tesla_base.md3");
+}
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_flac.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_flac.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_flac.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -93,9 +93,9 @@
void spawnfunc_turret_flac()
{
- precache_model ("models/turrets/base.md3");
- precache_model ("models/turrets/flac.md3");
- precache_model("models/turrets/pd_proj.md3");
+ //precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/flac.md3");
+ //precache_model("models/turrets/pd_proj.md3");
self.think = turret_flac_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_fusionreactor.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_fusionreactor.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_fusionreactor.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -66,7 +66,6 @@
self.turret_firecheckfunc = turret_fusionreactor_firecheck;
self.turret_firefunc = turret_fusionreactor_fire;
- // re-color badge & handle recoil effect
self.turret_postthink = turret_fusionreactor_postthink;
}
@@ -74,8 +73,8 @@
*/
void spawnfunc_turret_fusionreactor()
{
- precache_model ("models/turrets/reactor.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/reactor.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_fusionreactor_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hellion.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hellion.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hellion.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -210,9 +210,9 @@
*/
void spawnfunc_turret_hellion()
{
- precache_model ( "models/turrets/mlrs_rocket.md3");
- precache_model ("models/turrets/hellion.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ( "models/turrets/mlrs_rocket.md3");
+ //precache_model ("models/turrets/hellion.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_hellion_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hk.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hk.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_hk.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -460,9 +460,9 @@
void spawnfunc_turret_hk()
{
- precache_model ( "models/turrets/hunter2.md3");
- precache_model ("models/turrets/base.md3");
- precache_model ("models/turrets/hk.md3");
+ //precache_model ( "models/turrets/hunter2.md3");
+ //precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/hk.md3");
self.think = turret_hk_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_machinegun.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_machinegun.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_machinegun.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -62,8 +62,8 @@
*/
void spawnfunc_turret_machinegun()
{
- precache_model ("models/turrets/machinegun.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/machinegun.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_machinegun_std_init;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_mlrs.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_mlrs.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_mlrs.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -106,9 +106,9 @@
void spawnfunc_turret_mlrs()
{
- precache_model ( "models/turrets/rocket.md3");
- precache_model ("models/turrets/mlrs.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ( "models/turrets/rocket.md3");
+ //precache_model ("models/turrets/mlrs.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_mlrs_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_phaser.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_phaser.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_phaser.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -137,10 +137,10 @@
*/
void spawnfunc_turret_phaser()
{
- precache_sound ("turrets/phaser.ogg");
- precache_model ("models/turrets/phaser.md3");
- precache_model ("models/turrets/phaser_beam.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_sound ("turrets/phaser.ogg");
+ //precache_model ("models/turrets/phaser.md3");
+ //precache_model ("models/turrets/phaser_beam.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_phaser_dinit;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_plasma.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_plasma.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_plasma.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -163,8 +163,8 @@
*/
void spawnfunc_turret_plasma()
{
- precache_model ("models/turrets/plasma.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/plasma.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_plasma_std_init;
self.nextthink = time + 0.5;
@@ -174,8 +174,8 @@
*/
void spawnfunc_turret_plasma_dual()
{
- precache_model ("models/turrets/plasmad.md3");
- precache_model ("models/turrets/base.md3");
+ //precache_model ("models/turrets/plasmad.md3");
+ //precache_model ("models/turrets/base.md3");
self.think = turret_plasma_dual_init;
self.nextthink = time + 0.5;
Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_tessla.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_tessla.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/units/turret_unit_tessla.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -72,7 +72,7 @@
self.attack_finished_single = time + self.shot_refire;
self.ammo = self.ammo - self.shot_dmg;
- for (i = 0;i < 10;i++)
+ for (i = 0;i < 10;i = i + 1)
{
d *= 0.5;
r *= 0.75;
@@ -137,8 +137,8 @@
*/
void spawnfunc_turret_tesla()
{
- precache_model ("models/turrets/tesla_head.md3");
- precache_model ("models/turrets/tesla_base.md3");
+ //precache_model ("models/turrets/tesla_head.md3");
+ //precache_model ("models/turrets/tesla_base.md3");
self.think = turret_tesla_dinit;
Modified: branches/nexuiz-2.0/data/qcsrc/server/vote.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/vote.qc 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/vote.qc 2008-10-14 09:21:05 UTC (rev 4747)
@@ -37,7 +37,10 @@
if(ns != "")
{
- GetKickVoteVictim_reason = substring(vote, argv_start_index(t), argv_end_index(-1) - argv_start_index(t));
+ if(t < tokens)
+ GetKickVoteVictim_reason = substring(vote, argv_start_index(t), argv_end_index(-1) - argv_start_index(t));
+ else
+ GetKickVoteVictim_reason = "";
n = stof(ns);
if(ns == ftos(n)) if(n >= 1) if(n <= maxclients)
@@ -108,7 +111,8 @@
}
float GameCommand_Vote(string s, entity e) {
- tokenize_sane(s);
+ float argc;
+ argc = tokenize_sane(s);
if(argv(0) == "help") {
print_to(e, " vote COMMANDS ARGUMENTS. See 'vote help' for more info.");
return TRUE;
@@ -135,7 +139,7 @@
print_to(e, "^1There is already a vote called.");
} else {
local string vote;
- vote = VoteParse(s);
+ vote = VoteParse(s, argc);
if(vote == "") {
print_to(e, "^1Your vote is empty. See help for more info.");
} else if(e
@@ -205,7 +209,7 @@
} else if(argv(1) == "do") {
if(!e || e.vote_master) {
local string dovote;
- dovote = VoteParse(s);
+ dovote = VoteParse(s, argc);
if(dovote == "") {
print_to(e, "^1Your command was empty. See help for more info.");
} else if(VoteCheckNasty(dovote)) {
@@ -375,7 +379,9 @@
}
}
-string VoteParse(string all) {
+string VoteParse(string all, float argc) {
+ if(argc < 3)
+ return "";
return substring(all, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
}
Modified: branches/nexuiz-2.0/data/qcsrc/server/vote.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/vote.qh 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/qcsrc/server/vote.qh 2008-10-14 09:21:05 UTC (rev 4747)
@@ -8,7 +8,7 @@
string VoteNetname(entity e);
string ValidateMap(string m, entity e);
void VoteThink();
-string VoteParse(string s);
+string VoteParse(string s, float tokens);
float VoteAllowed(string votecommand);
void VoteReset();
void VoteAccept();
Modified: branches/nexuiz-2.0/data/scripts/entities.def
===================================================================
--- branches/nexuiz-2.0/data/scripts/entities.def 2008-10-14 09:00:38 UTC (rev 4746)
+++ branches/nexuiz-2.0/data/scripts/entities.def 2008-10-14 09:21:05 UTC (rev 4747)
@@ -1080,3 +1080,27 @@
OR: the player may keep items not listed
ANDNOT: the items listed will get removed from the player
*/
+
+/*QUAKED target_spawn (1 0 1) (-8 -8 -8) (8 8 8) SPAWNFUNC ONLOAD
+Spawns an entity when triggered.
+The entity field list is a single string of the form:
+"field" "value" "field" "value" ... "classname" "item_bullets" ... "field" "value"
+Field values can use various variable replacements:
+$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:
+{
+"classname" "target_spawn"
+"message" "origin \"$self.origin+0 0 128\" velocity \"$activator.velocity+0 0 200\" owner $activator flags 65536 colormap $activator.colormap target_spawn_spawnfunc weapon_nex classname droppedweapon think thrown_wep_think nextthink $time+0.5"
+"spawnflags" "1"
+}
+-------- KEYS --------
+targetname: used to trigger this
+message: entity field list
+-------- SPAWNFLAGS --------
+SPAWNFUNC: call the spawn function when the "classname" key is mentioned in the fields list
+ONLOAD: create a first entity on map load
+*/
More information about the nexuiz-commits
mailing list