Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
seeker.qc File Reference
#include "seeker.qh"
#include <common/items/item/ammo.qh>
Include dependency graph for seeker.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void W_Seeker_Attack (Weapon thiswep, entity actor,.entity weaponentity)
void W_Seeker_Fire_Flac (Weapon thiswep, entity actor,.entity weaponentity)
void W_Seeker_Fire_Missile (Weapon thiswep, entity actor,.entity weaponentity, entity m_target, int bullet_count)
void W_Seeker_Fire_Tag (Weapon thiswep, entity actor,.entity weaponentity)
void W_Seeker_Flac_Explode (entity this, entity directhitentity)
void W_Seeker_Flac_Explode_use (entity this, entity actor, entity trigger)
void W_Seeker_Flac_Touch (entity this, entity toucher)
void W_Seeker_Missile_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Seeker_Missile_Explode (entity this, entity directhitentity)
void W_Seeker_Missile_Explode_think (entity this)
void W_Seeker_Missile_Think (entity this)
void W_Seeker_Missile_Touch (entity this, entity toucher)
void W_Seeker_Tag_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Seeker_Tag_Delete (entity this)
void W_Seeker_Tag_Explode (entity this)
void W_Seeker_Tag_Think (entity this)
 Think function, only for guided tags.
void W_Seeker_Tag_Touch (entity this, entity toucher)
entity W_Seeker_Tagged_Info (entity isowner,.entity weaponentity, entity istarget)
void W_Seeker_Tracker_Think (entity this)
void W_Seeker_Vollycontroller_Think (entity this)

Variables

entity lasttag

Function Documentation

◆ W_Seeker_Attack()

void W_Seeker_Attack ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 284 of file seeker.qc.

285{
286 entity closest = NULL;
287 vector it_trans_org;
288 float it_dist2, closest_dist2 = 0;
289 IL_EACH(g_seeker_trackers, it.classname == "tag_tracker" && it.realowner == actor,
290 {
291 // First check line of sight
292 it_trans_org = WarpZone_RefSys_TransformOrigin(it.tag_target, actor, it.tag_target.origin);
293 WarpZone_TraceLine(actor.origin + actor.view_ofs, it_trans_org, MOVE_NOMONSTERS, actor);
294 if (trace_fraction < 1 && trace_ent != it)
295 continue;
296
297 it_dist2 = vlen2(actor.origin - it_trans_org);
298 if (!closest || it_dist2 < closest_dist2) // new closest
299 {
300 closest_dist2 = it_dist2;
301 closest = it.tag_target;
302 }
303 });
304
305 W_Seeker_Fire_Missile(thiswep, actor, weaponentity, closest, -1);
306}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define IL_EACH(this, cond, body)
#define NULL
Definition post.qh:14
void W_Seeker_Fire_Missile(Weapon thiswep, entity actor,.entity weaponentity, entity m_target, int bullet_count)
Definition seeker.qc:135
IntrusiveList g_seeker_trackers
Definition seeker.qh:134
vector
Definition self.qh:96

References entity(), g_seeker_trackers, IL_EACH, NULL, and vector.

◆ W_Seeker_Fire_Flac()

void W_Seeker_Fire_Flac ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 227 of file seeker.qc.

228{
229 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, flac_ammo), weaponentity);
230
231 vector old_movedir = actor.(weaponentity).movedir;
232 actor.(weaponentity).movedir += W_SetupShot_GetAlternatingOffset(actor.(weaponentity).bulletcounter);
233 W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_SEEKER, flac_damage), thiswep.m_id | HITTYPE_SECONDARY);
234 actor.(weaponentity).movedir = old_movedir;
235
236 // uses hagar effects!
237 W_MuzzleFlash(WEP_HAGAR, actor, weaponentity, w_shotorg, w_shotdir);
238
239 entity missile;
240 missile = new(missile);
241 missile.owner = missile.realowner = actor;
242 missile.bot_dodge = true;
243 missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, flac_damage);
245 missile.use = W_Seeker_Flac_Explode_use;
247 missile.nextthink = time + WEP_CVAR(WEP_SEEKER, flac_lifetime) + WEP_CVAR(WEP_SEEKER, flac_lifetime_rand);
248 set_movetype(missile, MOVETYPE_FLY);
249 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
250 missile.weaponentity_fld = weaponentity;
251 missile.flags = FL_PROJECTILE;
252 IL_PUSH(g_projectiles, missile);
253 IL_PUSH(g_bot_dodge, missile);
254 missile.missile_flags = MIF_SPLASH;
255
256 // csqc projectiles
257 //missile.angles = vectoangles(missile.velocity);
258 //missile.scale = 0.4; // BUG: the model is too big
259
260 PROJECTILE_MAKETRIGGER(missile);
261 setorigin(missile, w_shotorg);
262 setsize(missile, '-2 -2 -2', '2 2 2');
263
264 W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, flac_);
265 CSQCProjectile(missile, true, PROJECTILE_SEEKER_FLAC, true);
266
267 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
268}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_CALLHOOK(name,...)
Definition base.qh:186
int m_id
Definition weapon.qh:37
const int FL_PROJECTILE
Definition constants.qh:77
float time
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
const int HITTYPE_SECONDARY
Definition all.qh:31
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
vector movedir
Definition viewloc.qh:18
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLY
Definition movetypes.qh:138
const int PROJECTILE_SEEKER_FLAC
void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
Definition seeker.qc:222
void W_Seeker_Flac_Touch(entity this, entity toucher)
Definition seeker.qc:215
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:77
void adaptor_think2use_hittype_splash(entity this)
Definition common.qc:106
const int MIF_SPLASH
Definition common.qh:63
IntrusiveList g_projectiles
Definition common.qh:75
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:51
const int CH_WEAPON_A
Definition sound.qh:7
vector W_SetupShot_GetAlternatingOffset(int bullet_count)
Definition tracing.qc:166
vector w_shotdir
Definition tracing.qh:20
#define W_SetupProjVelocity_UP_PRE(ent, wep, prefix)
Definition tracing.qh:54
#define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:30
vector w_shotorg
Definition tracing.qh:19
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:694
#define WEP_CVAR(wep, name)
Definition all.qh:339
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)

References adaptor_think2use_hittype_splash(), CH_WEAPON_A, CSQCProjectile(), entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, HITTYPE_SECONDARY, IL_PUSH(), Weapon::m_id, MIF_SPLASH, movedir, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_MAKETRIGGER, PROJECTILE_SEEKER_FLAC, set_movetype(), setthink, settouch, time, vector, W_DecreaseAmmo(), W_MuzzleFlash(), W_Seeker_Flac_Explode_use(), W_Seeker_Flac_Touch(), W_SetupProjVelocity_UP_PRE, W_SetupShot_GetAlternatingOffset(), W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, and WEP_CVAR.

◆ W_Seeker_Fire_Missile()

void W_Seeker_Fire_Missile ( Weapon thiswep,
entity actor,
.entity weaponentity,
entity m_target,
int bullet_count )

Definition at line 135 of file seeker.qc.

136{
137 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, missile_ammo), weaponentity);
138
139 makevectors(actor.v_angle);
140 vector old_movedir = actor.(weaponentity).movedir;
141 if (bullet_count > 0)
142 actor.(weaponentity).movedir += W_SetupShot_GetAlternatingOffset(bullet_count);
143 W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0, ((m_target != NULL) ? thiswep.m_id | HITTYPE_SECONDARY : thiswep.m_id));
144 actor.(weaponentity).movedir = old_movedir;
145 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
146
147 //actor.detornator = false;
148
149 entity missile = new(seeker_missile);
150 WarpZone_RefSys_Copy(missile, actor);
151 missile.owner = missile.realowner = actor;
152 missile.bot_dodge = true;
153 missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, missile_damage);
154
157 missile.event_damage = W_Seeker_Missile_Damage;
158 missile.nextthink = time; // + 0.2; // + cvar("g_balance_seeker_missile_activate_delay");
159 missile.cnt = time + WEP_CVAR(WEP_SEEKER, missile_lifetime);
160 missile.enemy = m_target;
161 missile.scale = 2;
162 missile.takedamage = DAMAGE_YES;
163 missile.weaponentity_fld = weaponentity;
164 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, missile_health));
165 missile.damageforcescale = WEP_CVAR(WEP_SEEKER, missile_damageforcescale);
166 missile.damagedbycontents = true;
168 //missile.think = W_Seeker_Missile_Animate; // csqc projectiles.
169
170 if (missile.enemy != NULL)
171 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
172 else
173 missile.projectiledeathtype = thiswep.m_id;
174
175 PROJECTILE_MAKETRIGGER(missile);
176 setorigin(missile, w_shotorg);
177 setsize(missile, '-4 -4 -4', '4 4 4');
179 missile.flags = FL_PROJECTILE;
180 IL_PUSH(g_projectiles, missile);
181 IL_PUSH(g_bot_dodge, missile);
182 missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG;
183
184 W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, missile_);
185
186 missile.angles = vectoangles(missile.velocity);
187
188 CSQCProjectile(missile, false, PROJECTILE_SEEKER_MISSILE, true);
189
190 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
191}
IntrusiveList g_damagedbycontents
Definition damage.qh:143
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
void WarpZone_RefSys_Copy(entity me, entity from)
Copies the warpzone reference of from onto me.
Definition common.qc:828
vector vectoangles(vector v)
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:142
#define makevectors
Definition post.qh:21
const int PROJECTILE_SEEKER_MISSILE
void W_Seeker_Missile_Think(entity this)
Definition seeker.qc:38
void W_Seeker_Missile_Touch(entity this, entity toucher)
Definition seeker.qc:31
void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition seeker.qc:96
const int MIF_GUIDED_TAG
Definition common.qh:70
const int DAMAGE_YES
Definition subs.qh:80

References CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, entity(), FL_PROJECTILE, g_bot_dodge, g_damagedbycontents, g_projectiles, HITTYPE_SECONDARY, IL_PUSH(), Weapon::m_id, makevectors, MIF_GUIDED_TAG, MIF_SPLASH, movedir, MOVETYPE_FLYMISSILE, MUTATOR_CALLHOOK, NULL, PROJECTILE_MAKETRIGGER, PROJECTILE_SEEKER_MISSILE, set_movetype(), SetResourceExplicit(), setthink, settouch, time, vectoangles(), vector, W_DecreaseAmmo(), W_MuzzleFlash(), W_Seeker_Missile_Damage(), W_Seeker_Missile_Think(), W_Seeker_Missile_Touch(), W_SetupProjVelocity_UP_PRE, W_SetupShot_GetAlternatingOffset(), W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, WarpZone_RefSys_Copy(), and WEP_CVAR.

Referenced by W_Seeker_Vollycontroller_Think().

◆ W_Seeker_Fire_Tag()

void W_Seeker_Fire_Tag ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 477 of file seeker.qc.

478{
479 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, tag_ammo), weaponentity);
480
481 W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_SEEKER, missile_damage) * WEP_CVAR(WEP_SEEKER, missile_count), thiswep.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY);
482
483 entity missile = new(seeker_tag);
484 WarpZone_RefSys_Copy(missile, actor);
485 if (WEP_CVAR(WEP_SEEKER, tag_guiderate) > 0)
486 {
487 actor.(weaponentity).lasttag = missile;
488 missile.pushltime = time + WEP_CVAR(WEP_SEEKER, tag_guidedelay);
489 missile.ltime = time + WEP_CVAR(WEP_SEEKER, tag_lifetime);
490 missile.nextthink = time;
492 }
493 else
494 {
495 missile.nextthink = time + WEP_CVAR(WEP_SEEKER, tag_lifetime);
496 setthink(missile, SUB_Remove);
497 }
498
499 missile.owner = missile.realowner = actor;
500 missile.bot_dodge = true;
501 missile.bot_dodgerating = 50;
503 set_movetype(missile, MOVETYPE_FLY);
504 missile.projectiledeathtype = thiswep.m_id;
505 missile.weaponentity_fld = weaponentity;
506
507 missile.takedamage = DAMAGE_YES;
508 missile.event_damage = W_Seeker_Tag_Damage;
509 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, tag_health));
510 missile.damageforcescale = WEP_CVAR(WEP_SEEKER, tag_damageforcescale);
511
512 PROJECTILE_MAKETRIGGER(missile);
513 setorigin(missile, w_shotorg);
514 setsize(missile, '-2 -2 -2', '2 2 2');
515
516 missile.flags = FL_PROJECTILE;
517 IL_PUSH(g_projectiles, missile);
518 IL_PUSH(g_bot_dodge, missile);
519 //missile.missile_flags = MIF_..?;
520
521 set_movetype(missile, MOVETYPE_FLY);
522 W_SetupProjVelocity_PRE(missile, WEP_SEEKER, tag_);
523 missile.angles = vectoangles(missile.velocity);
524
525 CSQCProjectile(missile, fabs(WEP_CVAR(WEP_SEEKER, tag_guiderate)) <= 30, PROJECTILE_SEEKER_TAG, false); // has sound
526 // Network velocity for the trail only if the guiding isn't strong,
527 // or else the trail clearly goes off path (backwards)
528
529 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
530
531 if (time >= missile.nextthink)
532 getthink(missile)(missile);
533}
const int HITTYPE_BOUNCE
set manually after projectile has bounced
Definition all.qh:33
void SUB_Remove(entity this)
Remove entity.
Definition defer.qh:12
float fabs(float f)
const int PROJECTILE_SEEKER_TAG
Definition projectiles.qh:5
void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition seeker.qc:375
void W_Seeker_Tag_Touch(entity this, entity toucher)
Definition seeker.qc:384
entity lasttag
Definition seeker.qc:353
void W_Seeker_Tag_Think(entity this)
Think function, only for guided tags.
Definition seeker.qc:448
#define getthink(e)
#define W_SetupProjVelocity_PRE(ent, wep, prefix)
Definition tracing.qh:67

References CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, entity(), fabs(), FL_PROJECTILE, g_bot_dodge, g_projectiles, getthink, HITTYPE_BOUNCE, HITTYPE_SECONDARY, IL_PUSH(), lasttag, Weapon::m_id, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_MAKETRIGGER, PROJECTILE_SEEKER_TAG, set_movetype(), SetResourceExplicit(), setthink, settouch, SUB_Remove(), time, vectoangles(), W_DecreaseAmmo(), W_Seeker_Tag_Damage(), W_Seeker_Tag_Think(), W_Seeker_Tag_Touch(), W_SetupProjVelocity_PRE, W_SetupShot_ProjectileSize, w_shotorg, WarpZone_RefSys_Copy(), and WEP_CVAR.

◆ W_Seeker_Flac_Explode()

void W_Seeker_Flac_Explode ( entity this,
entity directhitentity )

Definition at line 196 of file seeker.qc.

197{
198 this.event_damage = func_null;
199
200 RadiusDamage(this, this.realowner,
201 WEP_CVAR(WEP_SEEKER, flac_damage),
202 WEP_CVAR(WEP_SEEKER, flac_edgedamage),
203 WEP_CVAR(WEP_SEEKER, flac_radius),
204 NULL,
205 NULL,
206 WEP_CVAR(WEP_SEEKER, flac_force),
208 this.weaponentity_fld,
209 directhitentity
210 );
211
212 delete(this);
213}
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:937
var void func_null()
int projectiledeathtype
Definition common.qh:38
entity realowner
entity weaponentity_fld

References entity(), func_null(), NULL, projectiledeathtype, RadiusDamage(), realowner, weaponentity_fld, and WEP_CVAR.

Referenced by W_Seeker_Flac_Explode_use(), and W_Seeker_Flac_Touch().

◆ W_Seeker_Flac_Explode_use()

void W_Seeker_Flac_Explode_use ( entity this,
entity actor,
entity trigger )

Definition at line 222 of file seeker.qc.

223{
224 W_Seeker_Flac_Explode(this, trigger);
225}
void W_Seeker_Flac_Explode(entity this, entity directhitentity)
Definition seeker.qc:196

References entity(), and W_Seeker_Flac_Explode().

Referenced by W_Seeker_Fire_Flac().

◆ W_Seeker_Flac_Touch()

void W_Seeker_Flac_Touch ( entity this,
entity toucher )

Definition at line 215 of file seeker.qc.

216{
218
220}
entity entity toucher
Definition self.qh:76
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:45

References entity(), PROJECTILE_TOUCH, toucher, and W_Seeker_Flac_Explode().

Referenced by W_Seeker_Fire_Flac().

◆ W_Seeker_Missile_Damage()

void W_Seeker_Missile_Damage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 96 of file seeker.qc.

97{
98 if (GetResource(this, RES_HEALTH) <= 0)
99 return;
100 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
101 return; // g_projectiles_damage says to halt
102
103 if (this.realowner == attacker)
104 TakeResource(this, RES_HEALTH, (damage * 0.25));
105 else
106 TakeResource(this, RES_HEALTH, damage);
107
108 if (GetResource(this, RES_HEALTH) <= 0)
110}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
void W_Seeker_Missile_Explode_think(entity this)
Definition seeker.qc:26
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
Definition common.qc:45
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87

References entity(), GetResource(), realowner, TakeResource(), vector, W_CheckProjectileDamage(), W_PrepareExplosionByDamage(), and W_Seeker_Missile_Explode_think().

Referenced by W_Seeker_Fire_Missile().

◆ W_Seeker_Missile_Explode()

void W_Seeker_Missile_Explode ( entity this,
entity directhitentity )

Definition at line 8 of file seeker.qc.

9{
10 this.event_damage = func_null;
11 RadiusDamage(this, this.realowner,
12 WEP_CVAR(WEP_SEEKER, missile_damage),
13 WEP_CVAR(WEP_SEEKER, missile_edgedamage),
14 WEP_CVAR(WEP_SEEKER, missile_radius),
15 NULL,
16 NULL,
17 WEP_CVAR(WEP_SEEKER, missile_force),
20 directhitentity
21 );
22
23 delete(this);
24}

References entity(), func_null(), NULL, projectiledeathtype, RadiusDamage(), realowner, weaponentity_fld, and WEP_CVAR.

Referenced by W_Seeker_Missile_Explode_think(), W_Seeker_Missile_Think(), and W_Seeker_Missile_Touch().

◆ W_Seeker_Missile_Explode_think()

void W_Seeker_Missile_Explode_think ( entity this)

Definition at line 26 of file seeker.qc.

27{
29}
void W_Seeker_Missile_Explode(entity this, entity directhitentity)
Definition seeker.qc:8

References entity(), NULL, and W_Seeker_Missile_Explode().

Referenced by W_Seeker_Missile_Damage().

◆ W_Seeker_Missile_Think()

void W_Seeker_Missile_Think ( entity this)

Definition at line 38 of file seeker.qc.

39{
40 if (time >= this.cnt)
41 {
44 return;
45 }
46
47 float dist = W_SeekOutEnemy(this,
48 WEP_CVAR(WEP_SEEKER, missile_decel),
49 WEP_CVAR(WEP_SEEKER, missile_accel),
50 WEP_CVAR(WEP_SEEKER, missile_speed_max),
51 WEP_CVAR(WEP_SEEKER, missile_turnrate),
52 WEP_CVAR(WEP_SEEKER, missile_smart),
53 WEP_CVAR(WEP_SEEKER, missile_smart_mindist),
54 WEP_CVAR(WEP_SEEKER, missile_smart_trace_min),
55 WEP_CVAR(WEP_SEEKER, missile_smart_trace_max));
56
57 // Proxy
58 if (WEP_CVAR(WEP_SEEKER, missile_proxy))
59 {
60 if (dist <= WEP_CVAR(WEP_SEEKER, missile_proxy_maxrange))
61 {
62 if (this.cvar_cl_autoswitch == 0)
63 this.cvar_cl_autoswitch = time + WEP_CVAR(WEP_SEEKER, missile_proxy_delay);
64 else
65 {
66 if (this.cvar_cl_autoswitch <= time)
67 {
69 this.cvar_cl_autoswitch = 0;
70 }
71 }
72 }
73 else
74 {
75 if (this.cvar_cl_autoswitch != 0)
76 this.cvar_cl_autoswitch = 0;
77 }
78 }
80
81 if (IS_DEAD(this.enemy))
82 {
83 this.enemy = NULL;
84 this.cnt = time + 1 + (random() * 4);
85 this.nextthink = this.cnt;
86 return;
87 }
88
89 //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
90 this.nextthink = time;// + 0.05; // csqc projectiles
92}
float cnt
Definition powerups.qc:24
#define IS_DEAD(s)
Definition player.qh:244
float nextthink
void UpdateCSQCProjectile(entity e)
const int HITTYPE_SPLASH
automatically set by RadiusDamage
Definition all.qh:32
float random(void)
float W_SeekOutEnemy(entity this, float speed_decel, float speed_accel, float speed_max, float turn_rate, bool smart, float smart_mindist, float smart_trace_min, float smart_trace_max)
Automatically guides a projectile towards its enemy.
Definition common.qc:239
entity enemy
Definition sv_ctf.qh:152

References cnt, enemy, entity(), HITTYPE_SPLASH, IS_DEAD, nextthink, NULL, projectiledeathtype, random(), time, UpdateCSQCProjectile(), W_Seeker_Missile_Explode(), W_SeekOutEnemy(), and WEP_CVAR.

Referenced by W_Seeker_Fire_Missile().

◆ W_Seeker_Missile_Touch()

void W_Seeker_Missile_Touch ( entity this,
entity toucher )

Definition at line 31 of file seeker.qc.

32{
34
36}

References entity(), PROJECTILE_TOUCH, toucher, and W_Seeker_Missile_Explode().

Referenced by W_Seeker_Fire_Missile().

◆ W_Seeker_Tag_Damage()

void W_Seeker_Tag_Damage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 375 of file seeker.qc.

376{
377 if (GetResource(this, RES_HEALTH) <= 0)
378 return;
379 TakeResource(this, RES_HEALTH, damage);
380 if (GetResource(this, RES_HEALTH) <= 0)
382}
void W_Seeker_Tag_Explode(entity this)
Definition seeker.qc:366

References entity(), GetResource(), TakeResource(), vector, and W_Seeker_Tag_Explode().

Referenced by W_Seeker_Fire_Tag().

◆ W_Seeker_Tag_Delete()

void W_Seeker_Tag_Delete ( entity this)

Definition at line 355 of file seeker.qc.

356{
357 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
358 {
359 .entity weaponentity = weaponentities[slot];
360 if (this.realowner.(weaponentity).lasttag == this)
361 this.realowner.(weaponentity).lasttag = NULL;
362 }
363 delete(this);
364}
const int MAX_WEAPONSLOTS
Definition weapon.qh:15
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:16

References entity(), lasttag, MAX_WEAPONSLOTS, NULL, realowner, and weaponentities.

Referenced by W_Seeker_Tag_Explode(), W_Seeker_Tag_Think(), and W_Seeker_Tag_Touch().

◆ W_Seeker_Tag_Explode()

void W_Seeker_Tag_Explode ( entity this)

Definition at line 366 of file seeker.qc.

367{
368 //if (other == this.realowner)
369 // return;
370 Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, 0, this);
371
373}
vector velocity
vector origin
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
void W_Seeker_Tag_Delete(entity this)
Definition seeker.qc:355

References Damage_DamageInfo(), entity(), HITTYPE_BOUNCE, origin, velocity, and W_Seeker_Tag_Delete().

Referenced by W_Seeker_Tag_Damage().

◆ W_Seeker_Tag_Think()

void W_Seeker_Tag_Think ( entity this)

Think function, only for guided tags.

Definition at line 448 of file seeker.qc.

449{
450 if (time >= this.ltime)
451 {
453 return;
454 }
455 this.nextthink = time;
456
457 // laser guided
458 .entity weaponentity = this.weaponentity_fld;
459 if (this.realowner.(weaponentity).m_weapon == WEP_SEEKER
460 && this == this.realowner.(weaponentity).lasttag
461 && !this.realowner.(weaponentity).tag_release
462 && WEP_CVAR(WEP_SEEKER, tag_guiderate)
463 && time > this.pushltime
464 && !IS_DEAD(this.realowner))
465 {
466 makevectors(vec2(-this.angles.x, this.angles.y));
467 W_GuideProjectile(this, weaponentity, this.pushltime,
468 WEP_CVAR(WEP_SEEKER, tag_guiderate),
469 WEP_CVAR(WEP_SEEKER, tag_guideratedelay),
470 WEP_CVAR(WEP_SEEKER, tag_guidegoal),
471 WEP_CVAR(WEP_SEEKER, tag_guidedelay),
472 NULL, SND_DEVASTATOR_MODE, VOL_BASE * 0.5); // TODO: add a better sound here
474 }
475}
float ltime
Definition net.qh:10
ent angles
Definition ent_cs.qc:146
float pushltime
Definition jumppads.qh:21
void W_GuideProjectile(entity this,.entity weaponentity, float guide_start_time, float guide_rate, float guide_rate_delay, float guide_goal, float guide_delay, entity eff, entity snd, float vol)
Guides a projectile towards the crosshair (v_forward).
Definition common.qc:349
const float VOL_BASE
Definition sound.qh:36
#define vec2(...)
Definition vector.qh:95

References angles, entity(), IS_DEAD, ltime, makevectors, nextthink, NULL, pushltime, realowner, time, UpdateCSQCProjectile(), vec2, VOL_BASE, W_GuideProjectile(), W_Seeker_Tag_Delete(), weaponentity_fld, and WEP_CVAR.

Referenced by W_Seeker_Fire_Tag().

◆ W_Seeker_Tag_Touch()

void W_Seeker_Tag_Touch ( entity this,
entity toucher )

Definition at line 384 of file seeker.qc.

385{
387
388 this.event_damage = func_null;
389 Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, toucher.species, this);
390
391 if (toucher.takedamage == DAMAGE_AIM && !IS_DEAD(toucher))
392 {
393 Damage(toucher, this, this.realowner,
394 WEP_CVAR(WEP_SEEKER, tag_damage),
396 this.weaponentity_fld,
397 this.origin,
398 '0 0 0'
399 );
400
401 // check to see if this person is already tagged by me
402 .entity weaponentity = this.weaponentity_fld;
403 entity tag = W_Seeker_Tagged_Info(this.realowner, weaponentity, toucher);
404
405 if (tag != NULL)
406 {
407 if (toucher.wps_tag_tracker && WEP_CVAR(WEP_SEEKER, type) == 1) // don't attach another waypointsprite without killing the old one first
408 WaypointSprite_Kill(toucher.wps_tag_tracker);
409 tag.tag_time = time;
410 }
411 else
412 {
413 //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n"));
414 entity tracker = new(tag_tracker);
415 WarpZone_RefSys_Copy(toucher, this); // toucher is in the same reference as the tag, since the tag hit the toucher
416 tracker.weaponentity_fld = this.weaponentity_fld;
417 tracker.cnt = WEP_CVAR(WEP_SEEKER, missile_count);
418 tracker.owner = this.owner;
419 tracker.realowner = this.realowner;
420 IL_PUSH(g_seeker_trackers, tracker);
421
422 if (WEP_CVAR(WEP_SEEKER, type) == 1)
423 {
424 tracker.tag_target = toucher;
425 tracker.tag_time = time;
427 }
428 else
429 {
430 tracker.enemy = toucher;
432 }
433
434 tracker.nextthink = time;
435 }
436
437 if (WEP_CVAR(WEP_SEEKER, type) == 1)
438 {
439 WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(WEP_SEEKER, tag_tracker_lifetime), 0, toucher, '0 0 64', this.realowner, 0, toucher, wps_tag_tracker, true, RADARICON_TAGGED);
441 }
442 }
443
445}
entity owner
Definition main.qh:87
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:484
void W_Seeker_Vollycontroller_Think(entity this)
Definition seeker.qc:308
entity W_Seeker_Tagged_Info(entity isowner,.entity weaponentity, entity istarget)
Definition seeker.qc:273
void W_Seeker_Tracker_Think(entity this)
Definition seeker.qc:331
entity wps_tag_tracker
Definition seeker.qh:130
const int DAMAGE_AIM
Definition subs.qh:81
void WaypointSprite_Kill(entity wp)
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
void WaypointSprite_UpdateRule(entity e, float t, float r)
const int SPRITERULE_DEFAULT

References Damage(), DAMAGE_AIM, Damage_DamageInfo(), entity(), func_null(), g_seeker_trackers, HITTYPE_BOUNCE, HITTYPE_SECONDARY, IL_PUSH(), IS_DEAD, NULL, origin, owner, PROJECTILE_TOUCH, projectiledeathtype, realowner, setthink, SPRITERULE_DEFAULT, time, toucher, velocity, W_Seeker_Tag_Delete(), W_Seeker_Tagged_Info(), W_Seeker_Tracker_Think(), W_Seeker_Vollycontroller_Think(), WarpZone_RefSys_Copy(), WaypointSprite_Kill(), WaypointSprite_Spawn(), WaypointSprite_UpdateRule(), weaponentity_fld, WEP_CVAR, and wps_tag_tracker.

Referenced by W_Seeker_Fire_Tag().

◆ W_Seeker_Tagged_Info()

entity W_Seeker_Tagged_Info ( entity isowner,
.entity weaponentity,
entity istarget )

Definition at line 273 of file seeker.qc.

274{
275 IL_EACH(g_seeker_trackers, it.classname == "tag_tracker" && it.realowner == isowner,
276 {
277 if (it.tag_target == istarget && it.weaponentity_fld == weaponentity)
278 return it;
279 });
280
281 return NULL;
282}

References entity(), g_seeker_trackers, IL_EACH, and NULL.

Referenced by W_Seeker_Tag_Touch().

◆ W_Seeker_Tracker_Think()

void W_Seeker_Tracker_Think ( entity this)

Definition at line 331 of file seeker.qc.

332{
333 .entity weaponentity = this.weaponentity_fld;
334 // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
335 if (IS_DEAD(this.realowner) || IS_DEAD(this.tag_target) || this.realowner.(weaponentity).m_switchweapon != WEP_SEEKER
336 || (time > this.tag_time + WEP_CVAR(WEP_SEEKER, tag_tracker_lifetime)))
337 {
338 if (this)
339 {
340 WaypointSprite_Kill(this.tag_target.wps_tag_tracker);
341 delete(this);
342 }
343 return;
344 }
345
346 // Update the think method information
347 this.nextthink = time;
348}
entity tag_target
Definition seeker.qh:129

References entity(), IS_DEAD, nextthink, realowner, tag_target, time, WaypointSprite_Kill(), weaponentity_fld, and WEP_CVAR.

Referenced by W_Seeker_Tag_Touch().

◆ W_Seeker_Vollycontroller_Think()

void W_Seeker_Vollycontroller_Think ( entity this)

Definition at line 308 of file seeker.qc.

309{
310 --this.cnt;
311
312 Weapon thiswep = WEP_SEEKER;
313 .entity weaponentity = this.weaponentity_fld;
314 if ((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_SEEKER, missile_ammo))
315 || this.cnt <= -1 || IS_DEAD(this.realowner) || this.realowner.(weaponentity).m_switchweapon != thiswep)
316 {
317 delete(this);
318 return;
319 }
320
321 this.nextthink = time + WEP_CVAR(WEP_SEEKER, missile_delay) * W_WeaponRateFactor(this.realowner);
322
323 entity own = this.realowner;
324
325 entity oldenemy = own.enemy;
326 own.enemy = this.enemy;
327 W_Seeker_Fire_Missile(thiswep, own, weaponentity, own.enemy, own.cnt);
328 own.enemy = oldenemy;
329}
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:36
Resource ammo_type
M: ammotype : main ammo type.
Definition weapon.qh:50
const int IT_UNLIMITED_AMMO
Definition item.qh:23
float W_WeaponRateFactor(entity this)

References Weapon::ammo_type, cnt, enemy, entity(), GetResource(), IS_DEAD, IT_UNLIMITED_AMMO, nextthink, realowner, time, W_Seeker_Fire_Missile(), W_WeaponRateFactor(), weaponentity_fld, and WEP_CVAR.

Referenced by W_Seeker_Tag_Touch().

Variable Documentation

◆ lasttag

entity lasttag

Definition at line 353 of file seeker.qc.

Referenced by W_Seeker_Fire_Tag(), and W_Seeker_Tag_Delete().