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, vector f_diff, entity m_target)
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_Explode (entity this)
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)

Function Documentation

◆ W_Seeker_Attack()

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

Definition at line 323 of file seeker.qc.

324{
325 entity closest_target = NULL;
326
327 IL_EACH(g_seeker_trackers, it.classname == "tag_tracker" && it.realowner == actor,
328 {
329 if (closest_target)
330 {
331 if (vlen2(actor.origin - it.tag_target.origin) < vlen2(actor.origin - closest_target.origin))
332 closest_target = it.tag_target;
333 }
334 else
335 closest_target = it.tag_target;
336 });
337
338 if (closest_target)
339 {
340 traceline(actor.origin + actor.view_ofs, closest_target.origin, MOVE_NOMONSTERS, actor);
341 if (!closest_target || (trace_fraction < 1 && trace_ent != closest_target))
342 closest_target = NULL;
343 }
344
345 W_Seeker_Fire_Missile(thiswep, actor, weaponentity, '0 0 0', closest_target);
346}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const float MOVE_NOMONSTERS
entity trace_ent
float trace_fraction
#define IL_EACH(this, cond, body)
#define NULL
Definition post.qh:14
void W_Seeker_Fire_Missile(Weapon thiswep, entity actor,.entity weaponentity, vector f_diff, entity m_target)
Definition seeker.qc:165
IntrusiveList g_seeker_trackers
Definition seeker.qh:126

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

◆ W_Seeker_Fire_Flac()

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

Definition at line 251 of file seeker.qc.

252{
253 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, flac_ammo), weaponentity);
254
255 vector f_diff;
256 switch (actor.(weaponentity).bulletcounter % 4)
257 {
258 case 0:
259 f_diff = '-1.25 -3.75 0';
260 break;
261 case 1:
262 f_diff = '+1.25 -3.75 0';
263 break;
264 case 2:
265 f_diff = '-1.25 +3.75 0';
266 break;
267 case 3:
268 default:
269 f_diff = '+1.25 +3.75 0';
270 break;
271 }
272 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);
273 w_shotorg += f_diff;
274
275 // uses hagar effects!
276 W_MuzzleFlash(WEP_HAGAR, actor, weaponentity, w_shotorg, w_shotdir);
277
278 entity missile;
279 missile = new(missile);
280 missile.owner = missile.realowner = actor;
281 missile.bot_dodge = true;
282 missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, flac_damage);
284 missile.use = W_Seeker_Flac_Explode_use;
286 missile.nextthink = time + WEP_CVAR(WEP_SEEKER, flac_lifetime) + WEP_CVAR(WEP_SEEKER, flac_lifetime_rand);
287 missile.solid = SOLID_BBOX;
288 set_movetype(missile, MOVETYPE_FLY);
289 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
290 missile.weaponentity_fld = weaponentity;
291 missile.flags = FL_PROJECTILE;
292 IL_PUSH(g_projectiles, missile);
293 IL_PUSH(g_bot_dodge, missile);
294 missile.missile_flags = MIF_SPLASH;
295
296 // csqc projectiles
297 //missile.angles = vectoangles(missile.velocity);
298 //missile.scale = 0.4; // BUG: the model is too big
299
300 setorigin(missile, w_shotorg);
301 setsize(missile, '-2 -2 -2', '2 2 2');
302
303 W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, flac_);
304 CSQCProjectile(missile, true, PROJECTILE_FLAC, true);
305
306 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
307}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
int m_id
Definition weapon.qh:43
const int FL_PROJECTILE
Definition constants.qh:85
const float SOLID_BBOX
float time
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
const int HITTYPE_SECONDARY
Definition all.qh:29
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLY
Definition movetypes.qh:134
const int PROJECTILE_FLAC
void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
Definition seeker.qc:246
void W_Seeker_Flac_Touch(entity this, entity toucher)
Definition seeker.qc:241
#define setthink(e, f)
vector
Definition self.qh:92
#define settouch(e, f)
Definition self.qh:73
void adaptor_think2use_hittype_splash(entity this)
Definition common.qc:106
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
const int CH_WEAPON_A
Definition sound.qh:7
vector w_shotdir
Definition tracing.qh:20
#define W_SetupProjVelocity_UP_PRE(ent, wep, prefix)
Definition tracing.qh:52
#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:715
#define WEP_CVAR(wep, name)
Definition all.qh:337
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, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_FLAC, set_movetype(), setthink, settouch, SOLID_BBOX, time, vector, W_DecreaseAmmo(), W_MuzzleFlash(), W_Seeker_Flac_Explode_use(), W_Seeker_Flac_Touch(), W_SetupProjVelocity_UP_PRE, 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,
vector f_diff,
entity m_target )

Definition at line 165 of file seeker.qc.

166{
167 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, missile_ammo), weaponentity);
168
169 makevectors(actor.v_angle);
170 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));
171 w_shotorg += f_diff;
172 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
173
174 //actor.detornator = false;
175
176 entity missile = new(seeker_missile);
177 missile.owner = missile.realowner = actor;
178 missile.bot_dodge = true;
179 missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, missile_damage);
180
183 missile.event_damage = W_Seeker_Missile_Damage;
184 missile.nextthink = time; // + 0.2; // + cvar("g_balance_seeker_missile_activate_delay");
185 missile.cnt = time + WEP_CVAR(WEP_SEEKER, missile_lifetime);
186 missile.enemy = m_target;
187 missile.solid = SOLID_BBOX;
188 missile.scale = 2;
189 missile.takedamage = DAMAGE_YES;
190 missile.weaponentity_fld = weaponentity;
191 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, missile_health));
192 missile.damageforcescale = WEP_CVAR(WEP_SEEKER, missile_damageforcescale);
193 missile.damagedbycontents = true;
195 //missile.think = W_Seeker_Missile_Animate; // csqc projectiles.
196
197 if (missile.enemy != NULL)
198 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
199 else
200 missile.projectiledeathtype = thiswep.m_id;
201
202 setorigin(missile, w_shotorg);
203 setsize(missile, '-4 -4 -4', '4 4 4');
205 missile.flags = FL_PROJECTILE;
206 IL_PUSH(g_projectiles, missile);
207 IL_PUSH(g_bot_dodge, missile);
208 missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG;
209
210 W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, missile_);
211
212 missile.angles = vectoangles(missile.velocity);
213
214 CSQCProjectile(missile, false, PROJECTILE_SEEKER, true);
215
216 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
217}
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
IntrusiveList g_damagedbycontents
Definition damage.qh:143
vector vectoangles(vector v)
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:138
#define makevectors
Definition post.qh:21
const int PROJECTILE_SEEKER
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:126
const int MIF_GUIDED_TAG
Definition common.qh:53
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, MOVETYPE_FLYMISSILE, MUTATOR_CALLHOOK, NULL, PROJECTILE_SEEKER, set_movetype(), SetResourceExplicit(), setthink, settouch, SOLID_BBOX, 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_ProjectileSize, w_shotdir, w_shotorg, 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 489 of file seeker.qc.

490{
491 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, tag_ammo), weaponentity);
492
493 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);
494
495 entity missile = new(seeker_tag);
496 missile.weaponentity_fld = weaponentity;
497 missile.owner = missile.realowner = actor;
498 missile.bot_dodge = true;
499 missile.bot_dodgerating = 50;
501 setthink(missile, SUB_Remove);
502 missile.nextthink = time + WEP_CVAR(WEP_SEEKER, tag_lifetime);
503 set_movetype(missile, MOVETYPE_FLY);
504 missile.solid = SOLID_BBOX;
505
506 missile.takedamage = DAMAGE_YES;
507 missile.event_damage = W_Seeker_Tag_Damage;
508 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, tag_health));
509 missile.damageforcescale = WEP_CVAR(WEP_SEEKER, tag_damageforcescale);
510
511 setorigin(missile, w_shotorg);
512 setsize(missile, '-2 -2 -2', '2 2 2');
513
514 missile.flags = FL_PROJECTILE;
515 IL_PUSH(g_projectiles, missile);
516 IL_PUSH(g_bot_dodge, missile);
517 //missile.missile_flags = MIF_..?;
518
519 set_movetype(missile, MOVETYPE_FLY);
520 W_SetupProjVelocity_PRE(missile, WEP_SEEKER, tag_);
521 missile.angles = vectoangles(missile.velocity);
522
523 CSQCProjectile(missile, true, PROJECTILE_TAG, false); // has sound
524
525 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
526}
const int HITTYPE_BOUNCE
Definition all.qh:31
void SUB_Remove(entity this)
Remove entity.
Definition defer.qh:13
const int PROJECTILE_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:419
void W_Seeker_Tag_Touch(entity this, entity toucher)
Definition seeker.qc:428
#define W_SetupProjVelocity_PRE(ent, wep, prefix)
Definition tracing.qh:65

References CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, HITTYPE_BOUNCE, HITTYPE_SECONDARY, IL_PUSH(), Weapon::m_id, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_TAG, set_movetype(), SetResourceExplicit(), setthink, settouch, SOLID_BBOX, SUB_Remove(), time, vectoangles(), W_DecreaseAmmo(), W_Seeker_Tag_Damage(), W_Seeker_Tag_Touch(), W_SetupProjVelocity_PRE, W_SetupShot_ProjectileSize, w_shotorg, and WEP_CVAR.

◆ W_Seeker_Flac_Explode()

void W_Seeker_Flac_Explode ( entity this,
entity directhitentity )

Definition at line 222 of file seeker.qc.

223{
224 this.event_damage = func_null;
225
226 RadiusDamage(this, this.realowner,
227 WEP_CVAR(WEP_SEEKER, flac_damage),
228 WEP_CVAR(WEP_SEEKER, flac_edgedamage),
229 WEP_CVAR(WEP_SEEKER, flac_radius),
230 NULL,
231 NULL,
232 WEP_CVAR(WEP_SEEKER, flac_force),
234 this.weaponentity_fld,
235 directhitentity
236 );
237
238 delete(this);
239}
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:943
var void func_null()
int projectiledeathtype
Definition common.qh:21
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 246 of file seeker.qc.

247{
248 W_Seeker_Flac_Explode(this, trigger);
249}
void W_Seeker_Flac_Explode(entity this, entity directhitentity)
Definition seeker.qc:222

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 241 of file seeker.qc.

242{
244}
entity entity toucher
Definition self.qh:72

References entity(), 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 126 of file seeker.qc.

127{
128 if (GetResource(this, RES_HEALTH) <= 0)
129 return;
130 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
131 return; // g_projectiles_damage says to halt
132
133 if (this.realowner == attacker)
134 TakeResource(this, RES_HEALTH, (damage * 0.25));
135 else
136 TakeResource(this, RES_HEALTH, damage);
137
138 if (GetResource(this, RES_HEALTH) <= 0)
140}
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 }
45
46 float spd = vlen(this.velocity);
47 spd = bound(
48 spd - WEP_CVAR(WEP_SEEKER, missile_decel) * frametime,
49 WEP_CVAR(WEP_SEEKER, missile_speed_max),
50 spd + WEP_CVAR(WEP_SEEKER, missile_accel) * frametime
51 );
52
53 if (this.enemy != NULL
54 && (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy)))
55 this.enemy = NULL;
56
57 float dist;
58 if (this.enemy != NULL)
59 {
60 vector eorg = 0.5 * (this.enemy.absmin + this.enemy.absmax);
61 vector desireddir = normalize(eorg - this.origin);
62 vector olddir = normalize(this.velocity); // get my current direction
63 dist = vlen(eorg - this.origin);
64
65 // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
66 if (WEP_CVAR(WEP_SEEKER, missile_smart) && dist > WEP_CVAR(WEP_SEEKER, missile_smart_mindist))
67 {
68 // Is it a better idea (shorter distance) to trace to the target itself?
69 if (vdist(this.origin + olddir * this.wait, <, dist))
70 traceline(this.origin, this.origin + olddir * this.wait, false, this);
71 else
72 traceline(this.origin, eorg, false, this);
73
74 // Setup adaptive tracelength
75 this.wait = bound(WEP_CVAR(WEP_SEEKER, missile_smart_trace_min), vlen(this.origin - trace_endpos), WEP_CVAR(WEP_SEEKER, missile_smart_trace_max));
76
77 // Calc how important it is that we turn and add this to the desierd (enemy) dir.
78 desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
79 }
80
81 vector newdir = normalize(olddir + desireddir * WEP_CVAR(WEP_SEEKER, missile_turnrate)); // take the average of the 2 directions; not the best method but simple & easy
82 this.velocity = newdir * spd; // make me fly in the new direction at my flight speed
83 }
84 else
85 dist = 0;
86
87 // Proxy
88 if (WEP_CVAR(WEP_SEEKER, missile_proxy))
89 {
90 if (dist <= WEP_CVAR(WEP_SEEKER, missile_proxy_maxrange))
91 {
92 if (this.cvar_cl_autoswitch == 0)
93 this.cvar_cl_autoswitch = time + WEP_CVAR(WEP_SEEKER, missile_proxy_delay);
94 else
95 {
96 if (this.cvar_cl_autoswitch <= time)
97 {
99 this.cvar_cl_autoswitch = 0;
100 }
101 }
102 }
103 else
104 {
105 if (this.cvar_cl_autoswitch != 0)
106 this.cvar_cl_autoswitch = 0;
107 }
108 }
110
111 if (IS_DEAD(this.enemy))
112 {
113 this.enemy = NULL;
114 this.cnt = time + 1 + (random() * 4);
115 this.nextthink = this.cnt;
116 return;
117 }
118
119 //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
120 this.nextthink = time;// + 0.05; // csqc projectiles
122}
float cnt
Definition powerups.qc:24
float wait
Definition items.qc:17
#define IS_DEAD(s)
Definition player.qh:244
float frametime
vector velocity
vector trace_endpos
float nextthink
vector origin
vector trace_plane_normal
void UpdateCSQCProjectile(entity e)
const int HITTYPE_SPLASH
Definition all.qh:30
float bound(float min, float value, float max)
float random(void)
float vlen(vector v)
vector normalize(vector v)
const int DAMAGE_AIM
Definition subs.qh:81
entity enemy
Definition sv_ctf.qh:153
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References bound(), cnt, DAMAGE_AIM, enemy, entity(), frametime, HITTYPE_SPLASH, IS_DEAD, nextthink, normalize(), NULL, origin, projectiledeathtype, random(), time, trace_endpos, trace_fraction, trace_plane_normal, UpdateCSQCProjectile(), vdist, vector, velocity, vlen(), W_Seeker_Missile_Explode(), wait, 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}
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

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 419 of file seeker.qc.

420{
421 if (GetResource(this, RES_HEALTH) <= 0)
422 return;
423 TakeResource(this, RES_HEALTH, damage);
424 if (GetResource(this, RES_HEALTH) <= 0)
426}
void W_Seeker_Tag_Explode(entity this)
Definition seeker.qc:410

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

Referenced by W_Seeker_Fire_Tag().

◆ W_Seeker_Tag_Explode()

void W_Seeker_Tag_Explode ( entity this)

Definition at line 410 of file seeker.qc.

411{
412 //if (other == this.realowner)
413 // return;
414 Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, 0, this);
415
416 delete(this);
417}
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)

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

Referenced by W_Seeker_Tag_Damage().

◆ W_Seeker_Tag_Touch()

void W_Seeker_Tag_Touch ( entity this,
entity toucher )

Definition at line 428 of file seeker.qc.

429{
431
432 vector dir;
433 dir = normalize(this.realowner.origin - this.origin);
434 vector org2 = findbetterlocation(this.origin, 8);
435
436 te_knightspike(org2);
437
438 this.event_damage = func_null;
439 Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, toucher.species, this);
440
441 if (toucher.takedamage == DAMAGE_AIM && !IS_DEAD(toucher))
442 {
443 // check to see if this person is already tagged by me
444 .entity weaponentity = this.weaponentity_fld;
445 entity tag = W_Seeker_Tagged_Info(this.realowner, weaponentity, toucher);
446
447 if (tag != NULL)
448 {
449 if (toucher.wps_tag_tracker && WEP_CVAR(WEP_SEEKER, type) == 1) // don't attach another waypointsprite without killing the old one first
450 WaypointSprite_Kill(toucher.wps_tag_tracker);
451 tag.tag_time = time;
452 }
453 else
454 {
455 //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n"));
456 entity e = new(tag_tracker);
457 e.weaponentity_fld = this.weaponentity_fld;
458 e.cnt = WEP_CVAR(WEP_SEEKER, missile_count);
459 e.owner = this.owner;
460 e.realowner = this.realowner;
462
463 if (WEP_CVAR(WEP_SEEKER, type) == 1)
464 {
465 e.tag_target = toucher;
466 e.tag_time = time;
468 }
469 else
470 {
471 e.enemy = toucher;
473 }
474
475 e.nextthink = time;
476 }
477
478 if (WEP_CVAR(WEP_SEEKER, type) == 1)
479 {
480 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);
482 }
483 }
484
485 delete(this);
486 return;
487}
entity owner
Definition main.qh:87
vector findbetterlocation(vector org, float mindist)
Definition util.qc:116
void W_Seeker_Vollycontroller_Think(entity this)
Definition seeker.qc:348
entity W_Seeker_Tagged_Info(entity isowner,.entity weaponentity, entity istarget)
Definition seeker.qc:312
void W_Seeker_Tracker_Think(entity this)
Definition seeker.qc:388
entity wps_tag_tracker
Definition seeker.qh:123
int dir
Definition impulse.qc:89
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_AIM, Damage_DamageInfo(), dir, entity(), findbetterlocation(), func_null(), g_seeker_trackers, HITTYPE_BOUNCE, HITTYPE_SECONDARY, IL_PUSH(), IS_DEAD, normalize(), NULL, origin, owner, PROJECTILE_TOUCH, realowner, setthink, SPRITERULE_DEFAULT, time, toucher, vector, velocity, W_Seeker_Tagged_Info(), W_Seeker_Tracker_Think(), W_Seeker_Vollycontroller_Think(), 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 312 of file seeker.qc.

313{
314 IL_EACH(g_seeker_trackers, it.classname == "tag_tracker" && it.realowner == isowner,
315 {
316 if (it.tag_target == istarget && it.weaponentity_fld == weaponentity)
317 return it;
318 });
319
320 return NULL;
321}

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 388 of file seeker.qc.

389{
390 .entity weaponentity = this.weaponentity_fld;
391 // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
392 if (IS_DEAD(this.realowner) || IS_DEAD(this.tag_target) || this.realowner.(weaponentity).m_switchweapon != WEP_SEEKER
393 || (time > this.tag_time + WEP_CVAR(WEP_SEEKER, tag_tracker_lifetime)))
394 {
395 if (this)
396 {
397 WaypointSprite_Kill(this.tag_target.wps_tag_tracker);
398 delete(this);
399 }
400 return;
401 }
402
403 // Update the think method information
404 this.nextthink = time;
405}
entity tag_target
Definition seeker.qh:123

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 348 of file seeker.qc.

349{
350 --this.cnt;
351
352 Weapon thiswep = WEP_SEEKER;
353 .entity weaponentity = this.weaponentity_fld;
354 if ((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_SEEKER, missile_ammo))
355 || this.cnt <= -1 || IS_DEAD(this.realowner) || this.realowner.(weaponentity).m_switchweapon != thiswep)
356 {
357 delete(this);
358 return;
359 }
360
361 this.nextthink = time + WEP_CVAR(WEP_SEEKER, missile_delay) * W_WeaponRateFactor(this.realowner);
362
363 entity own = this.realowner;
364
365 entity oldenemy = own.enemy;
366 own.enemy = this.enemy;
367
368 switch (own.cnt % 4)
369 {
370 case 0:
371 W_Seeker_Fire_Missile(thiswep, own, weaponentity, '-1.25 -3.75 0', own.enemy); // TODO
372 break;
373 case 1:
374 W_Seeker_Fire_Missile(thiswep, own, weaponentity, '+1.25 -3.75 0', own.enemy); // TODO
375 break;
376 case 2:
377 W_Seeker_Fire_Missile(thiswep, own, weaponentity, '-1.25 +3.75 0', own.enemy); // TODO
378 break;
379 case 3:
380 default:
381 W_Seeker_Fire_Missile(thiswep, own, weaponentity, '+1.25 +3.75 0', own.enemy); // TODO
382 break;
383 }
384
385 own.enemy = oldenemy;
386}
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:42
Resource ammo_type
M: ammotype : main ammo type.
Definition weapon.qh:56
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().