Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
devastator.qc File Reference
Include dependency graph for devastator.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void W_Devastator_Attack (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Devastator_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Devastator_DoRemoteExplode (entity this,.entity weaponentity)
bool W_Devastator_DoRemoteExplode_cond (entity e)
void W_Devastator_Explode (entity this, entity directhitentity)
void W_Devastator_Explode_think (entity this)
void W_Devastator_RemoteExplode (entity this,.entity weaponentity)
vector W_Devastator_SteerTo (vector thisdir, vector goaldir, float maxturn_cos)
void W_Devastator_Think (entity this)
void W_Devastator_Touch (entity this, entity toucher)
void W_Devastator_Unregister (entity this)

Variables

entity lastrocket

Function Documentation

◆ W_Devastator_Attack()

void W_Devastator_Attack ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 290 of file devastator.qc.

291{
292 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_DEVASTATOR, ammo), weaponentity);
293
294 W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_DEVASTATOR_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_DEVASTATOR, damage), thiswep.m_id);
295 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
296
297 entity missile = new(rocket);
298 WarpZone_RefSys_Copy(missile, actor);
299 missile.weaponentity_fld = weaponentity;
300 missile.owner = missile.realowner = actor;
301 actor.(weaponentity).lastrocket = missile;
302 if (WEP_CVAR(WEP_DEVASTATOR, detonatedelay) >= 0)
303 missile.spawnshieldtime = time + WEP_CVAR(WEP_DEVASTATOR, detonatedelay);
304 else
305 missile.spawnshieldtime = -1; // NOTE: proximity based when rocket jumping
306 missile.pushltime = time + WEP_CVAR(WEP_DEVASTATOR, guidedelay);
307 missile.bot_dodge = true;
308 missile.bot_dodgerating = WEP_CVAR(WEP_DEVASTATOR, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous
309
310 missile.takedamage = DAMAGE_YES;
311 missile.damageforcescale = WEP_CVAR(WEP_DEVASTATOR, damageforcescale);
312 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_DEVASTATOR, health));
313 missile.event_damage = W_Devastator_Damage;
314 missile.damagedbycontents = true;
316
317 set_movetype(missile, MOVETYPE_FLY);
318 PROJECTILE_MAKETRIGGER(missile);
319 missile.projectiledeathtype = thiswep.m_id;
320 setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
321
322 setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
323 W_SetupProjVelocity_Basic(missile, WEP_CVAR(WEP_DEVASTATOR, speedstart), 0);
324 missile.angles = vectoangles(missile.velocity);
325
328 missile.nextthink = time;
329 missile.cnt = time + WEP_CVAR(WEP_DEVASTATOR, lifetime);
330 missile.rl_detonate_later = (fire & 2); // allow instant detonation
331 missile.flags = FL_PROJECTILE;
332 IL_PUSH(g_projectiles, missile);
333 IL_PUSH(g_bot_dodge, missile);
334 missile.missile_flags = MIF_SPLASH;
335
336 CSQCProjectile(missile, WEP_CVAR(WEP_DEVASTATOR, guiderate) == 0 && WEP_CVAR(WEP_DEVASTATOR, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
337
338 // common properties
339 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
340
341 if (time >= missile.nextthink)
342 getthink(missile)(missile);
343}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
int m_id
Definition weapon.qh:43
float lifetime
Definition powerups.qc:23
const int FL_PROJECTILE
Definition constants.qh:77
float time
vector v_forward
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
IntrusiveList g_damagedbycontents
Definition damage.qh:143
float damageforcescale
void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Devastator_Touch(entity this, entity toucher)
void W_Devastator_Think(entity this)
entity lastrocket
Definition devastator.qc:5
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void WarpZone_RefSys_Copy(entity me, entity from)
Copies the warpzone reference of from onto me.
Definition common.qc:824
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLY
Definition movetypes.qh:138
const int PROJECTILE_ROCKET
Definition projectiles.qh:4
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
#define setthink(e, f)
#define getthink(e)
#define settouch(e, f)
Definition self.qh:77
const int MIF_SPLASH
Definition common.qh:58
IntrusiveList g_projectiles
Definition common.qh:70
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:46
const int CH_WEAPON_A
Definition sound.qh:7
const int DAMAGE_YES
Definition subs.qh:80
float ammo
Definition sv_turrets.qh:43
vector w_shotdir
Definition tracing.qh:20
#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
#define W_SetupProjVelocity_Basic(ent, pspeed, pspread)
Definition tracing.qh:51
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 ammo, CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_damagedbycontents, g_projectiles, getthink, health, IL_PUSH(), lastrocket, lifetime, Weapon::m_id, MIF_SPLASH, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_MAKETRIGGER, PROJECTILE_ROCKET, set_movetype(), SetResourceExplicit(), setthink, settouch, time, v_forward, vectoangles(), W_DecreaseAmmo(), W_Devastator_Damage(), W_Devastator_Think(), W_Devastator_Touch(), W_MuzzleFlash(), W_SetupProjVelocity_Basic, W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, WarpZone_RefSys_Copy(), and WEP_CVAR.

◆ W_Devastator_Damage()

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

Definition at line 276 of file devastator.qc.

277{
278 if (GetResource(this, RES_HEALTH) <= 0)
279 return;
280 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
281 return; // g_projectiles_damage says to halt
282
283 TakeResource(this, RES_HEALTH, damage);
284 this.angles = vectoangles(this.velocity);
285
286 if (GetResource(this, RES_HEALTH) <= 0)
288}
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.
vector velocity
void W_Devastator_Explode_think(entity this)
Definition devastator.qc:60
ent angles
Definition ent_cs.qc:146
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 angles, entity(), GetResource(), TakeResource(), vectoangles(), vector, velocity, W_CheckProjectileDamage(), W_Devastator_Explode_think(), and W_PrepareExplosionByDamage().

Referenced by W_Devastator_Attack().

◆ W_Devastator_DoRemoteExplode()

void W_Devastator_DoRemoteExplode ( entity this,
.entity weaponentity )

Definition at line 69 of file devastator.qc.

70{
72
73 this.event_damage = func_null;
74 this.takedamage = DAMAGE_NO;
75
76 bool handled_as_rocketjump = false;
77 entity head = NULL;
78 bool allow_rocketjump = WEP_CVAR(WEP_DEVASTATOR, remote_jump);
79 MUTATOR_CALLHOOK(AllowRocketJumping, allow_rocketjump);
80 allow_rocketjump = M_ARGV(0, bool);
81
82 if (allow_rocketjump && WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius))
83 {
85 head = WarpZone_SearchInRadius(this.origin, WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius), MOVE_NOTHING, W_Devastator_DoRemoteExplode_cond);
86 if (head) // TODO: this could be optimized by changing the WarpZone_SearchInRadius to return as soon as it finds one entity, somehow
87 {
88 // we handled this as a rocketjump :)
89 handled_as_rocketjump = true;
90
91 // modify velocity
92 if (WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_add))
93 {
94 head.velocity.x *= 0.9;
95 head.velocity.y *= 0.9;
96 head.velocity.z = bound(
97 WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_min),
98 head.velocity.z + WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_add),
99 WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_max)
100 );
101 }
102
103 // now do the damage
104 RadiusDamage(this, head,
105 WEP_CVAR(WEP_DEVASTATOR, remote_jump_damage),
106 WEP_CVAR(WEP_DEVASTATOR, remote_jump_damage),
107 WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius),
108 NULL,
109 head,
110 (WEP_CVAR(WEP_DEVASTATOR, remote_jump_force) ? WEP_CVAR(WEP_DEVASTATOR, remote_jump_force) : 0),
112 this.weaponentity_fld,
113 NULL
114 );
115 }
116 }
117
118 RadiusDamage(this, this.realowner,
119 WEP_CVAR(WEP_DEVASTATOR, remote_damage),
120 WEP_CVAR(WEP_DEVASTATOR, remote_edgedamage),
121 WEP_CVAR(WEP_DEVASTATOR, remote_radius),
122 (handled_as_rocketjump ? head : NULL),
123 NULL,
124 WEP_CVAR(WEP_DEVASTATOR, remote_force),
126 this.weaponentity_fld,
127 NULL
128 );
129
130 Weapon thiswep = WEP_DEVASTATOR;
131 if (this.realowner.(weaponentity).m_weapon == thiswep
132 && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo)
133 && !(this.realowner.items & IT_UNLIMITED_AMMO))
134 {
135 this.realowner.cnt = thiswep.m_id;
136 ATTACK_FINISHED(this.realowner, weaponentity) = time;
137 this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
138 }
139 delete(this);
140}
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
#define M_ARGV(x, type)
Definition events.qh:17
vector origin
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
const int HITTYPE_BOUNCE
set manually after projectile has bounced
Definition all.qh:33
bool W_Devastator_DoRemoteExplode_cond(entity e)
Definition devastator.qc:65
void W_Devastator_Unregister(entity this)
Definition devastator.qc:7
entity WarpZone_SearchInRadius(vector org, float rad, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
Definition common.qc:680
noref entity WarpZone_SearchInRadius_otherent
Free to use in the callback.
Definition common.qh:71
#define MOVE_NOTHING
Definition common.qh:35
float bound(float min, float value, float max)
var void func_null()
#define NULL
Definition post.qh:14
#define w_getbestweapon(ent, wepent)
Definition selection.qh:23
int projectiledeathtype
Definition common.qh:33
const int DAMAGE_NO
Definition subs.qh:79
float takedamage
Definition subs.qh:78
entity realowner
#define ATTACK_FINISHED(ent, w)
entity weaponentity_fld
Weapon m_switchweapon
Definition wepent.qh:25

References ammo, Weapon::ammo_type, ATTACK_FINISHED, bound(), DAMAGE_NO, entity(), func_null(), GetResource(), HITTYPE_BOUNCE, IT_UNLIMITED_AMMO, M_ARGV, Weapon::m_id, m_switchweapon, MOVE_NOTHING, MUTATOR_CALLHOOK, NULL, origin, projectiledeathtype, RadiusDamage(), realowner, takedamage, time, W_Devastator_DoRemoteExplode_cond(), W_Devastator_Unregister(), w_getbestweapon, WarpZone_SearchInRadius(), WarpZone_SearchInRadius_otherent, weaponentity_fld, and WEP_CVAR.

Referenced by W_Devastator_RemoteExplode().

◆ W_Devastator_DoRemoteExplode_cond()

bool W_Devastator_DoRemoteExplode_cond ( entity e)

Definition at line 65 of file devastator.qc.

66{
67 return (e.takedamage && e == WarpZone_SearchInRadius_otherent);
68}

References entity(), and WarpZone_SearchInRadius_otherent.

Referenced by W_Devastator_DoRemoteExplode().

◆ W_Devastator_Explode()

void W_Devastator_Explode ( entity this,
entity directhitentity )

Definition at line 17 of file devastator.qc.

18{
20
21 if (directhitentity.takedamage == DAMAGE_AIM
22 && IS_PLAYER(directhitentity) && DIFF_TEAM(this.realowner, directhitentity) && !IS_DEAD(directhitentity)
23 && IsFlying(directhitentity))
24 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
25
26 this.event_damage = func_null;
27 this.takedamage = DAMAGE_NO;
28
29 vector force_xyzscale = '1 1 1';
30 force_xyzscale.x = WEP_CVAR(WEP_DEVASTATOR, force_xyscale);
31 force_xyzscale.y = WEP_CVAR(WEP_DEVASTATOR, force_xyscale);
32
33 RadiusDamageForSource(this, this.origin, this.velocity, this.realowner,
34 WEP_CVAR(WEP_DEVASTATOR, damage),
35 WEP_CVAR(WEP_DEVASTATOR, edgedamage),
36 WEP_CVAR(WEP_DEVASTATOR, radius),
37 NULL,
38 NULL,
39 false,
40 WEP_CVAR(WEP_DEVASTATOR, force),
41 force_xyzscale,
44 directhitentity
45 );
46
47 Weapon thiswep = WEP_DEVASTATOR;
48 .entity weaponentity = this.weaponentity_fld;
49 if (this.realowner.(weaponentity).m_weapon == thiswep
50 && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo)
51 && !(this.realowner.items & IT_UNLIMITED_AMMO))
52 {
53 this.realowner.cnt = thiswep.m_id;
54 ATTACK_FINISHED(this.realowner, weaponentity) = time;
55 this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
56 }
57 delete(this);
58}
float radius
Definition impulse.qh:11
bool IsFlying(entity this)
Definition player.qc:843
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
float RadiusDamageForSource(entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, bool inflictorselfdamage, float forceintensity, vector forcexyzscale, int deathtype,.entity weaponentity, entity directhitentity)
Returns total damage applied to creatures.
Definition damage.qc:714
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500
vector
Definition self.qh:96
const int DAMAGE_AIM
Definition subs.qh:81
#define DIFF_TEAM(a, b)
Definition teams.qh:242

References ammo, Weapon::ammo_type, ATTACK_FINISHED, DAMAGE_AIM, DAMAGE_NO, DIFF_TEAM, entity(), func_null(), GetResource(), IS_DEAD, IS_PLAYER, IsFlying(), IT_UNLIMITED_AMMO, Weapon::m_id, m_switchweapon, NULL, origin, projectiledeathtype, radius, RadiusDamageForSource(), realowner, Send_Notification(), takedamage, time, vector, velocity, W_Devastator_Unregister(), w_getbestweapon, weaponentity_fld, and WEP_CVAR.

Referenced by W_Devastator_Explode_think(), W_Devastator_Think(), and W_Devastator_Touch().

◆ W_Devastator_Explode_think()

void W_Devastator_Explode_think ( entity this)

Definition at line 60 of file devastator.qc.

61{
63}
void W_Devastator_Explode(entity this, entity directhitentity)
Definition devastator.qc:17

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

Referenced by W_Devastator_Damage().

◆ W_Devastator_RemoteExplode()

void W_Devastator_RemoteExplode ( entity this,
.entity weaponentity )

Definition at line 142 of file devastator.qc.

143{
144 if (IS_DEAD(this.realowner)
145 || !this.realowner.(weaponentity).lastrocket)
146 return;
147
148 bool do_explode;
149 if (this.spawnshieldtime >= 0)
150 do_explode = (time >= this.spawnshieldtime); // timer
151 else
152 {
153 vector transformed_org = WarpZone_RefSys_TransformOrigin(this, this.realowner, this.origin);
154 do_explode = vdist(NearestPointOnBox(this.realowner, transformed_org) - transformed_org, >, WEP_CVAR(WEP_DEVASTATOR, remote_radius)); // safety device
155 }
156 if (do_explode)
157 W_Devastator_DoRemoteExplode(this, weaponentity);
158}
float spawnshieldtime
Definition damage.qh:61
void W_Devastator_DoRemoteExplode(entity this,.entity weaponentity)
Definition devastator.qc:69
vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org)
Transform origin org in from's reference into to's reference.
Definition common.qc:787
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8
ERASEABLE vector NearestPointOnBox(entity box, vector org)
Definition vector.qh:187

References entity(), IS_DEAD, NearestPointOnBox(), origin, realowner, spawnshieldtime, time, vdist, vector, W_Devastator_DoRemoteExplode(), WarpZone_RefSys_TransformOrigin(), and WEP_CVAR.

Referenced by W_Devastator_Think().

◆ W_Devastator_SteerTo()

vector W_Devastator_SteerTo ( vector thisdir,
vector goaldir,
float maxturn_cos )

Definition at line 160 of file devastator.qc.

161{
162 if (thisdir * goaldir > maxturn_cos)
163 return goaldir;
164 if (thisdir * goaldir < -0.9998) // less than 1 degree and opposite
165 return thisdir; // refuse to guide (better than letting a numerical error happen)
166
167 // solve:
168 // g = normalize(thisdir + goaldir * X)
169 // thisdir * g = maxturn
170 //
171 // gg = thisdir + goaldir * X
172 // (thisdir * gg)^2 = maxturn^2 * (gg * gg)
173 //
174 // (1 + (thisdir * goaldir) * X)^2 = maxturn^2 * (1 + X*X + 2 * X * thisdir * goaldir)
175 float f = thisdir * goaldir;
176 // (1 + f * X)^2 = maxturn^2 * (1 + X*X + 2 * X * f)
177 // 0 = (m^2 - f^2) * x^2 + (2 * f * (m^2 - 1)) * x + (m^2 - 1)
178 float m2 = maxturn_cos * maxturn_cos;
179 vector v = solve_quadratic(m2 - f * f, 2 * f * (m2 - 1), m2 - 1);
180 return normalize(thisdir + goaldir * v.y); // the larger solution!
181}
ERASEABLE vector solve_quadratic(float a, float b, float c)
ax^2 + bx + c = 0
Definition math.qh:312
vector normalize(vector v)

References normalize(), solve_quadratic(), and vector.

Referenced by W_Devastator_Think().

◆ W_Devastator_Think()

void W_Devastator_Think ( entity this)

Definition at line 192 of file devastator.qc.

193{
194 this.nextthink = time;
195 if (time > this.cnt)
196 {
199 return;
200 }
201
202 // accelerate
203 makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0');
204 float velspeed = WEP_CVAR(WEP_DEVASTATOR, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward);
205 if (velspeed > 0)
206 this.velocity += v_forward * min(WEP_CVAR(WEP_DEVASTATOR, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed);
207
208 // laser guided, or remote detonation
209 .entity weaponentity = this.weaponentity_fld;
210 if (this.realowner.(weaponentity).m_weapon == WEP_DEVASTATOR)
211 {
212 if (this == this.realowner.(weaponentity).lastrocket
213 && !this.realowner.(weaponentity).rl_release
215 && WEP_CVAR(WEP_DEVASTATOR, guiderate)
216 && time > this.pushltime
217 && !IS_DEAD(this.realowner))
218 {
219 vector desireddir, olddir, newdir, desiredorigin, goal;
220 float f = WEP_CVAR(WEP_DEVASTATOR, guideratedelay);
221 if (f)
222 f = bound(0, (time - this.pushltime) / f, 1);
223 else
224 f = 1;
225
226 vector md = this.realowner.(weaponentity).movedir;
227 vector dv = v_right * -md.y + v_up * md.z;
228
229 if (!W_DualWielding(this.realowner))
230 dv = '0 0 0'; // don't override!
231
232 velspeed = vlen(this.velocity);
233
234 makevectors(this.realowner.v_angle);
235 desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward);
236 desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs + dv);
237 olddir = normalize(this.velocity);
238
239 // now it gets tricky... we want to move like some curve to approximate the target direction
240 // but we are limiting the rate at which we can turn!
241 goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(WEP_DEVASTATOR, guidegoal)) * desireddir;
242 newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(WEP_DEVASTATOR, guiderate) * f * frametime * DEG2RAD));
243
244 this.velocity = newdir * velspeed;
245 this.angles = vectoangles(this.velocity);
246
247 if (!this.count)
248 {
249 Send_Effect(EFFECT_ROCKET_GUIDE, this.origin, this.velocity, 1);
250 // TODO add a better sound here
251 sound(this.realowner, CH_WEAPON_B, SND_DEVASTATOR_MODE, VOL_BASE, ATTN_NORM);
252 this.count = 1;
253 }
254 }
255
256 if (this.rl_detonate_later)
257 W_Devastator_RemoteExplode(this, weaponentity);
258 }
259
260 if (this.csqcprojectile_clientanimate == 0)
262}
float cnt
Definition powerups.qc:24
float count
Definition powerups.qc:22
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:154
vector v_up
float DEG2RAD
float frametime
vector v_right
float nextthink
const float ATTN_NORM
void UpdateCSQCProjectile(entity e)
float csqcprojectile_clientanimate
void W_Devastator_RemoteExplode(entity this,.entity weaponentity)
vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos)
float rl_detonate_later
Definition devastator.qh:92
float speed
Definition dynlight.qc:9
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:155
float pushltime
Definition jumppads.qh:21
vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel)
Transform velocity vel in from's reference into to's reference.
Definition common.qc:796
vector movedir
Definition viewloc.qh:18
float cos(float f)
float vlen(vector v)
float min(float f,...)
#define makevectors
Definition post.qh:21
bool W_DualWielding(entity player)
Definition common.qc:20
const float VOL_BASE
Definition sound.qh:36
#define sound(e, c, s, v, a)
Definition sound.qh:52
const int CH_WEAPON_B
Definition sound.qh:8
float W_WeaponSpeedFactor(entity this)

References angles, ATTN_NORM, bound(), CH_WEAPON_B, cnt, cos(), count, csqcprojectile_clientanimate, DEG2RAD, entity(), frametime, HITTYPE_BOUNCE, IS_DEAD, makevectors, min(), movedir, nextthink, normalize(), NULL, origin, PHYS_INPUT_BUTTON_ATCK2, projectiledeathtype, pushltime, realowner, rl_detonate_later, Send_Effect(), sound, speed, time, UpdateCSQCProjectile(), v_forward, v_right, v_up, vectoangles(), vector, velocity, vlen(), VOL_BASE, W_Devastator_Explode(), W_Devastator_RemoteExplode(), W_Devastator_SteerTo(), W_DualWielding(), W_WeaponSpeedFactor(), WarpZone_RefSys_TransformOrigin(), WarpZone_RefSys_TransformVelocity(), weaponentity_fld, and WEP_CVAR.

Referenced by W_Devastator_Attack().

◆ W_Devastator_Touch()

void W_Devastator_Touch ( entity this,
entity toucher )

Definition at line 264 of file devastator.qc.

265{
267 {
268 if (wasfreed(this))
270 return;
271 }
274}
entity entity toucher
Definition self.qh:76
float WarpZone_Projectile_Touch(entity this, entity toucher)
Definition server.qc:344

References entity(), toucher, W_Devastator_Explode(), W_Devastator_Unregister(), and WarpZone_Projectile_Touch().

Referenced by W_Devastator_Attack().

◆ W_Devastator_Unregister()

void W_Devastator_Unregister ( entity this)

Definition at line 7 of file devastator.qc.

8{
9 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
10 {
11 .entity weaponentity = weaponentities[slot];
12 if (this.realowner.(weaponentity).lastrocket == this)
13 this.realowner.(weaponentity).lastrocket = NULL;
14 }
15}
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

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

Referenced by W_Devastator_DoRemoteExplode(), W_Devastator_Explode(), and W_Devastator_Touch().

Variable Documentation

◆ lastrocket

entity lastrocket

Definition at line 5 of file devastator.qc.

Referenced by W_Devastator_Attack(), and W_Devastator_Unregister().