]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/devastator.qc
Use the weapon entity as a parameter to ATTACK_FINISHED instead of the slot number...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / devastator.qc
1 #include "devastator.qh"
2
3 #ifdef SVQC
4
5 .entity lastrocket;
6
7 void W_Devastator_Unregister(entity this)
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 }
16
17 void W_Devastator_Explode(entity this, entity directhitentity)
18 {
19         W_Devastator_Unregister(this);
20
21         if(directhitentity.takedamage == DAMAGE_AIM)
22                 if(IS_PLAYER(directhitentity))
23                         if(DIFF_TEAM(this.realowner, directhitentity))
24                                 if(!IS_DEAD(directhitentity))
25                                         if(IsFlying(directhitentity))
26                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
27
28         this.event_damage = func_null;
29         this.takedamage = DAMAGE_NO;
30
31         RadiusDamage(
32                 this,
33                 this.realowner,
34                 WEP_CVAR(devastator, damage),
35                 WEP_CVAR(devastator, edgedamage),
36                 WEP_CVAR(devastator, radius),
37                 NULL,
38                 NULL,
39                 WEP_CVAR(devastator, force),
40                 this.projectiledeathtype,
41                 this.weaponentity_fld,
42                 directhitentity
43         );
44
45         Weapon thiswep = WEP_DEVASTATOR;
46         .entity weaponentity = this.weaponentity_fld;
47         if(this.realowner.(weaponentity).m_weapon == thiswep)
48         {
49                 if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
50                 if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
51                 {
52                         this.realowner.cnt = thiswep.m_id;
53                         ATTACK_FINISHED(this.realowner, weaponentity) = time;
54                         this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
55                 }
56         }
57         delete(this);
58 }
59
60 void W_Devastator_Explode_think(entity this)
61 {
62         W_Devastator_Explode(this, NULL);
63 }
64
65 void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity)
66 {
67         W_Devastator_Unregister(this);
68
69         this.event_damage = func_null;
70         this.takedamage = DAMAGE_NO;
71
72         bool handled_as_rocketjump = false;
73         entity head = NULL;
74
75         if(WEP_CVAR(devastator, remote_jump_radius))
76         {
77                 head = WarpZone_FindRadius(
78                         this.origin,
79                         WEP_CVAR(devastator, remote_jump_radius),
80                         false
81                 );
82
83                 while(head)
84                 {
85                         if(head.takedamage && (head == this.realowner))
86                         {
87                                 if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(devastator, remote_jump_radius)))
88                                 {
89                                         // we handled this as a rocketjump :)
90                                         handled_as_rocketjump = true;
91
92                                         // modify velocity
93                                         if(WEP_CVAR(devastator, remote_jump_velocity_z_add))
94                                         {
95                                                 head.velocity_x *= 0.9;
96                                                 head.velocity_y *= 0.9;
97                                                 head.velocity_z = bound(
98                                                         WEP_CVAR(devastator, remote_jump_velocity_z_min),
99                                                         head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add),
100                                                         WEP_CVAR(devastator, remote_jump_velocity_z_max)
101                                                 );
102                                         }
103
104                                         // now do the damage
105                                         RadiusDamage(
106                                                 this,
107                                                 head,
108                                                 WEP_CVAR(devastator, remote_jump_damage),
109                                                 WEP_CVAR(devastator, remote_jump_damage),
110                                                 WEP_CVAR(devastator, remote_jump_radius),
111                                                 NULL,
112                                                 head,
113                                                 (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0),
114                                                 this.projectiledeathtype | HITTYPE_BOUNCE,
115                                                 this.weaponentity_fld,
116                                                 NULL
117                                         );
118                                         break;
119                                 }
120                         }
121                         head = head.chain;
122                 }
123         }
124
125         RadiusDamage(
126                 this,
127                 this.realowner,
128                 WEP_CVAR(devastator, remote_damage),
129                 WEP_CVAR(devastator, remote_edgedamage),
130                 WEP_CVAR(devastator, remote_radius),
131                 (handled_as_rocketjump ? head : NULL),
132                 NULL,
133                 WEP_CVAR(devastator, remote_force),
134                 this.projectiledeathtype | HITTYPE_BOUNCE,
135                 this.weaponentity_fld,
136                 NULL
137         );
138
139         Weapon thiswep = WEP_DEVASTATOR;
140         if(this.realowner.(weaponentity).m_weapon == thiswep)
141         {
142                 if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
143                 if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
144                 {
145                         this.realowner.cnt = thiswep.m_id;
146                         ATTACK_FINISHED(this.realowner, weaponentity) = time;
147                         this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
148                 }
149         }
150         delete(this);
151 }
152
153 void W_Devastator_RemoteExplode(entity this, .entity weaponentity)
154 {
155         if(!IS_DEAD(this.realowner))
156         if(this.realowner.(weaponentity).lastrocket)
157         {
158                 if((this.spawnshieldtime >= 0)
159                         ? (time >= this.spawnshieldtime) // timer
160                         : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
161                 )
162                 {
163                         W_Devastator_DoRemoteExplode(this, weaponentity);
164                 }
165         }
166 }
167
168 vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos)
169 {
170         if(thisdir * goaldir > maxturn_cos)
171                 return goaldir;
172         if(thisdir * goaldir < -0.9998) // less than 1 degree and opposite
173                 return thisdir; // refuse to guide (better than letting a numerical error happen)
174         float f, m2;
175         vector v;
176         // solve:
177         //   g = normalize(thisdir + goaldir * X)
178         //   thisdir * g = maxturn
179         //
180         //   gg = thisdir + goaldir * X
181         //   (thisdir * gg)^2 = maxturn^2 * (gg * gg)
182         //
183         //   (1 + (thisdir * goaldir) * X)^2 = maxturn^2 * (1 + X*X + 2 * X * thisdir * goaldir)
184         f = thisdir * goaldir;
185         //   (1 + f * X)^2 = maxturn^2 * (1 + X*X + 2 * X * f)
186         //   0 = (m^2 - f^2) * x^2 + (2 * f * (m^2 - 1)) * x + (m^2 - 1)
187         m2 = maxturn_cos * maxturn_cos;
188         v = solve_quadratic(m2 - f * f, 2 * f * (m2 - 1), m2 - 1);
189         return normalize(thisdir + goaldir * v.y); // the larger solution!
190 }
191 // assume thisdir == -goaldir:
192 //   f == -1
193 //   v = solve_qadratic(m2 - 1, -2 * (m2 - 1), m2 - 1)
194 //   (m2 - 1) x^2 - 2 * (m2 - 1) * x + (m2 - 1) = 0
195 //   x^2 - 2 * x + 1 = 0
196 //   (x - 1)^2 = 0
197 //   x = 1
198 //   normalize(thisdir + goaldir)
199 //   normalize(0)
200
201 void W_Devastator_Think(entity this)
202 {
203         vector desireddir, olddir, newdir, desiredorigin, goal;
204         float velspeed, f;
205         this.nextthink = time;
206         if(time > this.cnt)
207         {
208                 this.projectiledeathtype |= HITTYPE_BOUNCE;
209                 W_Devastator_Explode(this, NULL);
210                 return;
211         }
212
213         // accelerate
214         makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0');
215         velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward);
216         if(velspeed > 0)
217                 this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed);
218
219         // laser guided, or remote detonation
220         .entity weaponentity = this.weaponentity_fld;
221         if(this.realowner.(weaponentity).m_weapon == WEP_DEVASTATOR)
222         {
223                 if(this == this.realowner.(weaponentity).lastrocket)
224                 if(!this.realowner.(weaponentity).rl_release)
225                 if(!PHYS_INPUT_BUTTON_ATCK2(this))
226                 if(WEP_CVAR(devastator, guiderate))
227                 if(time > this.pushltime)
228                 if(!IS_DEAD(this.realowner))
229                 {
230                         f = WEP_CVAR(devastator, guideratedelay);
231                         if(f)
232                                 f = bound(0, (time - this.pushltime) / f, 1);
233                         else
234                                 f = 1;
235
236                         vector md = this.realowner.(weaponentity).movedir;
237                         vector vecs = ((md.x > 0) ? md : '0 0 0');
238
239                         vector dv = v_right * -vecs.y + v_up * vecs.z;
240
241                         if(!W_DualWielding(this.realowner))
242                                 dv = '0 0 0'; // don't override!
243
244                         velspeed = vlen(this.velocity);
245
246                         makevectors(this.realowner.v_angle);
247                         desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward);
248                         desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs + dv);
249                         olddir = normalize(this.velocity);
250
251                         // now it gets tricky... we want to move like some curve to approximate the target direction
252                         // but we are limiting the rate at which we can turn!
253                         goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(devastator, guidegoal)) * desireddir;
254                         newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(devastator, guiderate) * f * frametime * DEG2RAD));
255
256                         this.velocity = newdir * velspeed;
257                         this.angles = vectoangles(this.velocity);
258
259                         if(!this.count)
260                         {
261                                 Send_Effect(EFFECT_ROCKET_GUIDE, this.origin, this.velocity, 1);
262                                 // TODO add a better sound here
263                                 sound(this.realowner, CH_WEAPON_B, SND_ROCKET_MODE, VOL_BASE, ATTN_NORM);
264                                 this.count = 1;
265                         }
266                 }
267
268                 if(this.rl_detonate_later)
269                         W_Devastator_RemoteExplode(this, weaponentity);
270         }
271
272         if(this.csqcprojectile_clientanimate == 0)
273                 UpdateCSQCProjectile(this);
274 }
275
276 void W_Devastator_Touch(entity this, entity toucher)
277 {
278         if(WarpZone_Projectile_Touch(this, toucher))
279         {
280                 if(wasfreed(this))
281                         W_Devastator_Unregister(this);
282                 return;
283         }
284         W_Devastator_Unregister(this);
285         W_Devastator_Explode(this, toucher);
286 }
287
288 void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
289 {
290         if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
291                 return;
292
293         if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
294                 return; // g_projectiles_damage says to halt
295
296         TakeResource(this, RESOURCE_HEALTH, damage);
297         this.angles = vectoangles(this.velocity);
298
299         if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
300                 W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think);
301 }
302
303 void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
304 {
305         W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity);
306
307         W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), thiswep.m_id);
308         Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
309
310         entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
311         missile.weaponentity_fld = weaponentity;
312         missile.owner = missile.realowner = actor;
313         actor.(weaponentity).lastrocket = missile;
314         if(WEP_CVAR(devastator, detonatedelay) >= 0)
315                 missile.spawnshieldtime = time + WEP_CVAR(devastator, detonatedelay);
316         else
317                 missile.spawnshieldtime = -1;
318         missile.pushltime = time + WEP_CVAR(devastator, guidedelay);
319         missile.classname = "rocket";
320         missile.bot_dodge = true;
321         missile.bot_dodgerating = WEP_CVAR(devastator, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous
322
323         missile.takedamage = DAMAGE_YES;
324         missile.damageforcescale = WEP_CVAR(devastator, damageforcescale);
325         SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR(devastator, health));
326         missile.event_damage = W_Devastator_Damage;
327         missile.damagedbycontents = true;
328         IL_PUSH(g_damagedbycontents, missile);
329
330         set_movetype(missile, MOVETYPE_FLY);
331         PROJECTILE_MAKETRIGGER(missile);
332         missile.projectiledeathtype = thiswep.m_id;
333         setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
334
335         setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
336         W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
337         missile.angles = vectoangles(missile.velocity);
338
339         settouch(missile, W_Devastator_Touch);
340         setthink(missile, W_Devastator_Think);
341         missile.nextthink = time;
342         missile.cnt = time + WEP_CVAR(devastator, lifetime);
343         missile.rl_detonate_later = (fire & 2); // allow instant detonation
344         missile.flags = FL_PROJECTILE;
345         IL_PUSH(g_projectiles, missile);
346         IL_PUSH(g_bot_dodge, missile);
347         missile.missile_flags = MIF_SPLASH;
348
349         CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
350
351         // muzzle flash for 1st person view
352         entity flash = spawn();
353         setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below
354         SUB_SetFade(flash, time, 0.1);
355         flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
356         W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
357
358         // common properties
359         MUTATOR_CALLHOOK(EditProjectile, actor, missile);
360
361         if (time >= missile.nextthink)
362         {
363                 getthink(missile)(missile);
364         }
365 }
366
367 METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
368 {
369     // aim and decide to fire if appropriate
370     PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
371     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
372     {
373         // decide whether to detonate rockets
374         float edgedamage, coredamage, edgeradius, recipricoledgeradius;
375         float selfdamage, teamdamage, enemydamage;
376         edgedamage = WEP_CVAR(devastator, edgedamage);
377         coredamage = WEP_CVAR(devastator, damage);
378         edgeradius = WEP_CVAR(devastator, radius);
379         recipricoledgeradius = 1 / edgeradius;
380         selfdamage = 0;
381         teamdamage = 0;
382         enemydamage = 0;
383         IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
384         {
385             entity rocket = it;
386             IL_EACH(g_bot_targets, it.bot_attack,
387             {
388                 float d = vlen(it.origin + (it.mins + it.maxs) * 0.5 - rocket.origin);
389                 d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
390                 // count potential damage according to type of target
391                 if(it == actor)
392                         selfdamage = selfdamage + d;
393                 else if(SAME_TEAM(it, actor))
394                         teamdamage = teamdamage + d;
395                 else if(bot_shouldattack(actor, it))
396                         enemydamage = enemydamage + d;
397             });
398         });
399         float desirabledamage;
400         desirabledamage = enemydamage;
401         if(time > actor.invincible_finished && time > actor.spawnshieldtime)
402             desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
403         if(teamplay && actor.team)
404             desirabledamage = desirabledamage - teamdamage;
405
406         makevectors(actor.v_angle);
407         IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
408         {
409             if(skill > 9) // normal players only do this for the target they are tracking
410             {
411                     entity rocket = it;
412                     IL_EACH(g_bot_targets, it.bot_attack,
413                     {
414                         if((v_forward * normalize(rocket.origin - it.origin) < 0.1)
415                             && desirabledamage > 0.1 * coredamage
416                             ) PHYS_INPUT_BUTTON_ATCK2(actor) = true;
417                     });
418                 }
419                 else
420                 {
421                 //As the distance gets larger, a correct detonation gets near imposible
422                 //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
423                 if((v_forward * normalize(it.origin - actor.enemy.origin) < 0.1)
424                         && IS_PLAYER(actor.enemy)
425                         && (desirabledamage >= 0.1 * coredamage)
426                         )
427                 {
428                         float distance = bound(300, vlen(actor.origin - actor.enemy.origin), 30000);
429                         if(random() / distance * 300 > frametime * bound(0, (10 - skill) * 0.2, 1))
430                                 PHYS_INPUT_BUTTON_ATCK2(actor) = true;
431                 }
432                 }
433         });
434         // if we would be doing at X percent of the core damage, detonate it
435         // but don't fire a new shot at the same time!
436         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
437             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
438         if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RESOURCE_HEALTH)))
439             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
440         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
441         //      dprint(ftos(desirabledamage),"\n");
442         if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false;
443     }
444 }
445
446 METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
447 {
448     if(WEP_CVAR(devastator, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
449         thiswep.wr_reload(thiswep, actor, weaponentity);
450     } else {
451         if(fire & 1)
452         {
453             if(actor.(weaponentity).rl_release || WEP_CVAR(devastator, guidestop))
454             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
455             {
456                 W_Devastator_Attack(thiswep, actor, weaponentity, fire);
457                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
458                 actor.(weaponentity).rl_release = 0;
459             }
460         }
461         else
462             actor.(weaponentity).rl_release = 1;
463
464         if(fire & 2)
465         if(actor.(weaponentity).m_switchweapon == thiswep)
466         {
467             bool rockfound = false;
468             IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
469             {
470                 if(!it.rl_detonate_later)
471                 {
472                     it.rl_detonate_later = true;
473                     rockfound = true;
474                 }
475             });
476             if(rockfound)
477                 sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
478         }
479     }
480 }
481 METHOD(Devastator, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
482 {
483     actor.(weaponentity).rl_release = 1;
484 }
485 METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
486 {
487     #if 0
488     // don't switch while guiding a missile
489     if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_DEVASTATOR)
490     {
491         ammo_amount = false;
492         if(WEP_CVAR(devastator, reload_ammo))
493         {
494             if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
495                 ammo_amount = true;
496         }
497         else if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
498             ammo_amount = true;
499         return !ammo_amount;
500     }
501     #endif
502     #if 0
503     if(actor.rl_release == 0)
504     {
505         LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo));
506         return true;
507     }
508     else
509     {
510         ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
511         ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
512         LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
513         return ammo_amount;
514     }
515     #else
516     float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
517     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(devastator, ammo);
518     return ammo_amount;
519     #endif
520 }
521 METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
522 {
523     return false;
524 }
525 METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor))
526 {
527     for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
528     {
529         .entity weaponentity = weaponentities[slot];
530         actor.(weaponentity).lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
531         actor.(weaponentity).rl_release = 0;
532     }
533 }
534 METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
535 {
536     W_Reload(actor, weaponentity, WEP_CVAR(devastator, ammo), SND_RELOAD);
537 }
538 METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
539 {
540     return WEAPON_DEVASTATOR_SUICIDE;
541 }
542 METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
543 {
544     if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
545         return WEAPON_DEVASTATOR_MURDER_SPLASH;
546     else
547         return WEAPON_DEVASTATOR_MURDER_DIRECT;
548 }
549
550 #endif
551 #ifdef CSQC
552
553 METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor))
554 {
555     vector org2;
556     org2 = w_org + w_backoff * 12;
557     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
558     if(!w_issilent)
559         sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
560 }
561
562 #endif