r4854 - in trunk/data: . qcsrc/server/tturrets/system
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 24 03:46:31 EDT 2008
Author: tzork
Date: 2008-10-24 03:46:23 -0400 (Fri, 24 Oct 2008)
New Revision: 4854
Modified:
trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc
trunk/data/turrets.cfg
Log:
Better inactive turrets handling. cvar for enforcing target re-scan at minimum intervals (g_turrets_targetscan_mindelay). Some helpfully comments in turrets.cfg. g_turrets_aimidle_delay controls how long turrets aim where the last known enemy was before returning to "idle aim".
Modified: trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc 2008-10-24 07:35:00 UTC (rev 4853)
+++ trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc 2008-10-24 07:46:23 UTC (rev 4854)
@@ -146,13 +146,20 @@
if (self.track_flags == TFL_TRACK_NO)
return;
- if (self.enemy == world)
+ if(!self.tur_active)
{
+ wish_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);
+ }
+ else if (self.enemy == world)
+ {
if (self.turrcaps_flags & TFL_TURRCAPS_LINKED)
wish_angle = self.idle_aim + self.angles;
else
- wish_angle = self.tur_head.angles;
- //wish_angle = self.idle_aim;
+ if(cvar("g_turrets_aimidle_delay") > (time - self.lip))
+ wish_angle = self.idle_aim;
+ else
+ wish_angle = self.tur_head.angles;
+
}
else
{
@@ -598,15 +605,25 @@
self.ammo = min(self.ammo + self.ammo_recharge,self.ammo_max);
- if ((!self.tur_active) || (self.deadflag != DEAD_NO))
+ // Inactive turrets needs to run the think loop too
+ // So they can handle animation and wake up if need be.
+ if(!self.tur_active)
{
- dprint("Warning: Inactive or dead turret running the think function!\n");
- self.enemy = world;
- //self.turret_track();
turret_stdproc_track();
return;
}
+ //This is just wrong :|
+ if(self.deadflag != DEAD_NO)
+ {
+ dprint("Warning:dead turret running the think function!\n");
+ //self.enemy = world;
+ //turret_stdproc_track();
+ return;
+ }
+
+ // This is typicaly used for zaping every target in range
+ // turret_fusionreactor uses this to recharge friendlys.
if (self.shoot_flags & TFL_SHOOT_HITALLVALID)
{
@@ -631,12 +648,11 @@
}
else
{
- // Check if we have a vailid enemy, and get one if we dont.
- // turret_do_updates(self);
+ // Check if we have a vailid enemy, and try to find one if we dont.
if ((turret_validate_target(self,self.enemy,self.target_validate_flags) <= 0) || (self.cnt < time))
{
self.enemy = turret_select_target();
- self.cnt = time + self.ticrate * 3;
+ self.cnt = time + cvar("g_turrets_targetscan_mindelay");
}
@@ -653,6 +669,8 @@
// And bail.
return;
}
+ else
+ self.lip = time; // Keep track of the last time we had a target.
turret_do_updates(self);
@@ -663,6 +681,7 @@
// Fire?
if (self.turret_firecheckfunc() != 0)
turret_fire();
+
turret_do_updates(self);
// Turn & pitch
@@ -732,10 +751,7 @@
turret_stdproc_respawn();
if(self.team == 0)
- {
self.tur_active = 0;
- self.tur_head.angles = '-25 0 0';
- }
else
self.tur_active = 1;
Modified: trunk/data/turrets.cfg
===================================================================
--- trunk/data/turrets.cfg 2008-10-24 07:35:00 UTC (rev 4853)
+++ trunk/data/turrets.cfg 2008-10-24 07:46:23 UTC (rev 4854)
@@ -2,19 +2,51 @@
set g_turrets_reloadcvars 0
set g_turrets_nofire 0
+// Target scanning and validation can be resource intensive
+// Dont let turrets look for new targets more frequently then this
+set g_turrets_targetscan_mindelay 0.5
+
+// Turrets with no target returns to their idle aim after this much time.
+set g_turrets_aimidle_delay 5
+
+// --- Units ---
+
+// Machinegun on a stick.
+exec unit_machinegun.cfg
+
+// Hunter killer rocket turret. "smart rockets"
exec unit_hk.cfg
+
+// Fires a pair of accelerating, simple homing rockets.
+exec unit_hellion.cfg
+
+// Fire lots of dumbfire rockets
+exec unit_mlrs.cfg
+
+// Kills killable enemy missiles.
+exec unit_flac.cfg
+
+// Support unit. Recharges friendly energy based turrets in range
+exec unit_fusreac.cfg
+
+// "Electro" turret.
exec unit_plasma.cfg
+
+// The the all new "Electro" turret, same ting with two barrels.
exec unit_plasma2.cfg
-exec unit_fusreac.cfg
-exec unit_mlrs.cfg
-exec unit_hellion.cfg
-exec unit_flac.cfg
+
+// AAAaaaarg! Bzzaat! yber turret. chain lightning missile and player killing.
exec unit_tesla.cfg
-exec unit_machinegun.cfg
+
+// Fires a constant beam that slows down and slowly damages its target.
exec unit_phaser.cfg
+
+// The bastred son of a turret and a quake monster.
+// A walking minigun with longrage missiles and closerange meele attack.
exec unit_walker.cfg
// not exec'd: gauss
+
set g_turrets_reloadcvars 1 // reload when this cfg has been exec'd
alias g_turrets_reload "set g_turrets_reloadcvars 1"
More information about the nexuiz-commits
mailing list