From: Mario Date: Fri, 9 Aug 2019 10:13:37 +0000 (+1000) Subject: Clean up turret_checkpoint code a bit X-Git-Tag: xonotic-v0.8.5~1424 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64c7cc273aa1dfe25509c18a86236432c316f497;p=xonotic%2Fxonotic-data.pk3dir.git Clean up turret_checkpoint code a bit --- diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index f5ba71477..25c61b4b6 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -2,43 +2,6 @@ #ifdef SVQC -/** - turret_checkpoint -**/ - - -//.entity checkpoint_target; - -/* -#define checkpoint_cache_who flagcarried -#define checkpoint_cache_from lastrocket -#define checkpoint_cache_to selected_player -*/ - -/* -entity path_makeorcache(entity forwho,entity start, entity end) -{ - entity pth; - - //pth = pathlib_makepath(forwho, start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR); - - return pth; -} -*/ - -void turret_checkpoint_use() -{ -} - -#if 0 -void turret_checkpoint_think(entity this) -{ - if(this.enemy) - te_lightning1(this,this.origin, this.enemy.origin); - - this.nextthink = time + 0.25; -} -#endif /*QUAKED turret_checkpoint (1 0 1) (-32 -32 -32) (32 32 32) -----------KEYS------------ target: .targetname of next waypoint in chain. @@ -46,30 +9,25 @@ wait: Pause at this point # seconds. -----------SPAWNFLAGS----------- ---------NOTES---------- If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly. -If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached. +If the checkpoint chain is not looped, the unit will go "Roaming" when the last point is reached. */ -//float tc_acum; void turret_checkpoint_init(entity this) { traceline(this.origin + '0 0 16', this.origin - '0 0 1024', MOVE_WORLDONLY, this); setorigin(this, trace_endpos + '0 0 32'); - if(this.target != "") + if(this.target && this.target != "") { this.enemy = find(NULL, targetname, this.target); - if(this.enemy == NULL) - LOG_TRACE("A turret_checkpoint faild to find its target!"); + if(!this.enemy) + LOG_TRACE("A turret_checkpoint failed to find its target!"); } - //setthink(this, turret_checkpoint_think); - //this.nextthink = time + tc_acum + 0.25; - //tc_acum += 0.25; } spawnfunc(turret_checkpoint) { setorigin(this, this.origin); - setthink(this, turret_checkpoint_init); - this.nextthink = time + 0.2; + InitializeEntity(this, turret_checkpoint_init, INITPRIO_FINDTARGET); } // Compat.