a406e750980e2749c656682821f49618a1de6079
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / minelayer.qc
1 #ifndef IMPLEMENTATION
2 CLASS(MineLayer, Weapon)
3 /* ammotype  */ ATTRIB(MineLayer, ammo_field, .int, ammo_rockets)
4 /* impulse   */ ATTRIB(MineLayer, impulse, int, 4)
5 /* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
6 /* rating    */ ATTRIB(MineLayer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
7 /* color     */ ATTRIB(MineLayer, wpcolor, vector, '0.75 1 0');
8 /* modelname */ ATTRIB(MineLayer, mdl, string, "minelayer");
9 #ifndef MENUQC
10 /* model     */ ATTRIB(MineLayer, m_model, Model, MDL_MINELAYER_ITEM);
11 #endif
12 /* crosshair */ ATTRIB(MineLayer, w_crosshair, string, "gfx/crosshairminelayer");
13 /* crosshair */ ATTRIB(MineLayer, w_crosshair_size, float, 0.9);
14 /* wepimg    */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
15 /* refname   */ ATTRIB(MineLayer, netname, string, "minelayer");
16 /* wepname   */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
17
18 #define X(BEGIN, P, END, class, prefix) \
19         BEGIN(class) \
20                 P(class, prefix, ammo, float, NONE) \
21                 P(class, prefix, animtime, float, NONE) \
22                 P(class, prefix, damageforcescale, float, NONE) \
23                 P(class, prefix, damage, float, NONE) \
24                 P(class, prefix, detonatedelay, float, NONE) \
25                 P(class, prefix, edgedamage, float, NONE) \
26                 P(class, prefix, force, float, NONE) \
27                 P(class, prefix, health, float, NONE) \
28                 P(class, prefix, lifetime, float, NONE) \
29                 P(class, prefix, lifetime_countdown, float, NONE) \
30                 P(class, prefix, limit, float, NONE) \
31                 P(class, prefix, protection, float, NONE) \
32                 P(class, prefix, proximityradius, float, NONE) \
33                 P(class, prefix, radius, float, NONE) \
34                 P(class, prefix, refire, float, NONE) \
35                 P(class, prefix, reload_ammo, float, NONE) \
36         P(class, prefix, reload_time, float, NONE) \
37                 P(class, prefix, remote_damage, float, NONE) \
38                 P(class, prefix, remote_edgedamage, float, NONE) \
39                 P(class, prefix, remote_force, float, NONE) \
40                 P(class, prefix, remote_radius, float, NONE) \
41                 P(class, prefix, speed, float, NONE) \
42         P(class, prefix, switchdelay_drop, float, NONE) \
43         P(class, prefix, switchdelay_raise, float, NONE) \
44                 P(class, prefix, time, float, NONE) \
45         P(class, prefix, weaponreplace, string, NONE) \
46         P(class, prefix, weaponstartoverride, float, NONE) \
47         P(class, prefix, weaponstart, float, NONE) \
48         P(class, prefix, weaponthrowable, float, NONE) \
49         END()
50     W_PROPS(X, MineLayer, minelayer)
51 #undef X
52 ENDCLASS(MineLayer)
53 REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
54
55 #ifdef SVQC
56 void W_MineLayer_Think(entity this);
57 .float minelayer_detonate, mine_explodeanyway;
58 .float mine_time;
59 .vector mine_orientation;
60 #endif
61 #endif
62 #ifdef IMPLEMENTATION
63 #ifdef SVQC
64 spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
65
66 void W_MineLayer_Stick(entity this, entity to)
67 {
68         spamsound(this, CH_SHOTS, SND(MINE_STICK), VOL_BASE, ATTN_NORM);
69
70         // in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile
71
72         entity newmine = spawn();
73         newmine.classname = this.classname;
74
75         newmine.bot_dodge = this.bot_dodge;
76         newmine.bot_dodgerating = this.bot_dodgerating;
77
78         newmine.owner = this.owner;
79         newmine.realowner = this.realowner;
80         setsize(newmine, '-4 -4 -4', '4 4 4');
81         setorigin(newmine, this.origin);
82         setmodel(newmine, MDL_MINELAYER_MINE);
83         newmine.angles = vectoangles(-trace_plane_normal); // face against the surface
84
85         newmine.mine_orientation = -trace_plane_normal;
86
87         newmine.takedamage = this.takedamage;
88         newmine.damageforcescale = this.damageforcescale;
89         newmine.health = this.health;
90         newmine.event_damage = this.event_damage;
91         newmine.spawnshieldtime = this.spawnshieldtime;
92         newmine.damagedbycontents = true;
93
94         newmine.movetype = MOVETYPE_NONE; // lock the mine in place
95         newmine.projectiledeathtype = this.projectiledeathtype;
96
97         newmine.mine_time = this.mine_time;
98
99         settouch(newmine, func_null);
100         setthink(newmine, W_MineLayer_Think);
101         newmine.nextthink = time;
102         newmine.cnt = this.cnt;
103         newmine.flags = this.flags;
104
105         remove(this);
106
107         if(to)
108                 SetMovetypeFollow(newmine, to);
109 }
110
111 void W_MineLayer_Explode(entity this)
112 {
113         if(other.takedamage == DAMAGE_AIM)
114                 if(IS_PLAYER(other))
115                         if(DIFF_TEAM(this.realowner, other))
116                                 if(!IS_DEAD(other))
117                                         if(IsFlying(other))
118                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
119
120         this.event_damage = func_null;
121         this.takedamage = DAMAGE_NO;
122
123         RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, other);
124
125         if(PS(this.realowner).m_weapon == WEP_MINE_LAYER)
126         {
127                 entity own = this.realowner;
128                 Weapon w = WEP_MINE_LAYER;
129                 if(!w.wr_checkammo1(w, own))
130                 {
131                         own.cnt = WEP_MINE_LAYER.m_id;
132                         int slot = 0; // TODO: unhardcode
133                         ATTACK_FINISHED(own, slot) = time;
134                         PS(own).m_switchweapon = w_getbestweapon(own);
135                 }
136         }
137         this.realowner.minelayer_mines -= 1;
138         remove(this);
139 }
140
141 void W_MineLayer_DoRemoteExplode(entity this)
142 {
143         this.event_damage = func_null;
144         this.takedamage = DAMAGE_NO;
145
146         if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW)
147                 this.velocity = this.mine_orientation; // particle fx and decals need .velocity
148
149         RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, NULL);
150
151         if(PS(this.realowner).m_weapon == WEP_MINE_LAYER)
152         {
153                 entity own = this.realowner;
154                 Weapon w = WEP_MINE_LAYER;
155                 if(!w.wr_checkammo1(w, own))
156                 {
157                         own.cnt = WEP_MINE_LAYER.m_id;
158                         int slot = 0; // TODO: unhardcode
159                         ATTACK_FINISHED(own, slot) = time;
160                         PS(own).m_switchweapon = w_getbestweapon(own);
161                 }
162         }
163         this.realowner.minelayer_mines -= 1;
164         remove(this);
165 }
166
167 void W_MineLayer_RemoteExplode(entity this)
168 {
169         if(!IS_DEAD(this.realowner))
170                 if((this.spawnshieldtime >= 0)
171                         ? (time >= this.spawnshieldtime) // timer
172                         : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device
173                 )
174                 {
175                         W_MineLayer_DoRemoteExplode(this);
176                 }
177 }
178
179 void W_MineLayer_ProximityExplode(entity this)
180 {
181         // make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance
182         if(WEP_CVAR(minelayer, protection) && this.mine_explodeanyway == 0)
183         {
184                 entity head;
185                 head = findradius(this.origin, WEP_CVAR(minelayer, radius));
186                 while(head)
187                 {
188                         if(head == this.realowner || SAME_TEAM(head, this.realowner))
189                                 return;
190                         head = head.chain;
191                 }
192         }
193
194         this.mine_time = 0;
195         W_MineLayer_Explode(this);
196 }
197
198 int W_MineLayer_Count(entity e)
199 {
200         int minecount = 0;
201         entity mine;
202         for(mine = NULL; (mine = find(mine, classname, "mine")); ) if(mine.realowner == e)
203                 minecount += 1;
204
205         return minecount;
206 }
207
208 void W_MineLayer_Think(entity this)
209 {
210         entity head;
211
212         this.nextthink = time;
213
214         if(this.movetype == MOVETYPE_FOLLOW)
215         {
216                 if(LostMovetypeFollow(this))
217                 {
218                         UnsetMovetypeFollow(this);
219                         this.movetype = MOVETYPE_NONE;
220                 }
221         }
222
223         // our lifetime has expired, it's time to die - mine_time just allows us to play a sound for this
224         // TODO: replace this mine_trigger.wav sound with a real countdown
225         if((time > this.cnt) && (!this.mine_time) && (this.cnt > 0))
226         {
227                 if(WEP_CVAR(minelayer, lifetime_countdown) > 0)
228                         spamsound(this, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM);
229                 this.mine_time = time + WEP_CVAR(minelayer, lifetime_countdown);
230                 this.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near.
231         }
232
233         // a player's mines shall explode if he disconnects or dies
234         // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
235         if(!IS_PLAYER(this.realowner) || IS_DEAD(this.realowner) || STAT(FROZEN, this.realowner))
236         {
237                 other = NULL;
238                 this.projectiledeathtype |= HITTYPE_BOUNCE;
239                 W_MineLayer_Explode(this);
240                 return;
241         }
242
243         // set the mine for detonation when a foe gets close enough
244         head = findradius(this.origin, WEP_CVAR(minelayer, proximityradius));
245         while(head)
246         {
247                 if(IS_PLAYER(head) && !IS_DEAD(head) && !STAT(FROZEN, head))
248                 if(head != this.realowner && DIFF_TEAM(head, this.realowner)) // don't trigger for team mates
249                 if(!this.mine_time)
250                 {
251                         spamsound(this, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM);
252                         this.mine_time = time + WEP_CVAR(minelayer, time);
253                 }
254                 head = head.chain;
255         }
256
257         // explode if it's time to
258         if(this.mine_time && time >= this.mine_time)
259         {
260                 W_MineLayer_ProximityExplode(this);
261                 return;
262         }
263
264         // remote detonation
265         if(PS(this.realowner).m_weapon == WEP_MINE_LAYER)
266         if(!IS_DEAD(this.realowner))
267         if(this.minelayer_detonate)
268                 W_MineLayer_RemoteExplode(this);
269 }
270
271 void W_MineLayer_Touch(entity this)
272 {
273         if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW)
274                 return; // we're already a stuck mine, why do we get called? TODO does this even happen?
275
276         if(WarpZone_Projectile_Touch(this))
277         {
278                 if(wasfreed(this))
279                         this.realowner.minelayer_mines -= 1;
280                 return;
281         }
282
283         if(other && IS_PLAYER(other) && !IS_DEAD(other))
284         {
285                 // hit a player
286                 // don't stick
287         }
288         else
289         {
290                 W_MineLayer_Stick(this, other);
291         }
292 }
293
294 void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
295 {
296         if(this.health <= 0)
297                 return;
298
299         float is_from_enemy = (inflictor.realowner != this.realowner);
300
301         if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_from_enemy ? 1 : -1)))
302                 return; // g_projectiles_damage says to halt
303
304         this.health = this.health - damage;
305         this.angles = vectoangles(this.velocity);
306
307         if(this.health <= 0)
308                 W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode);
309 }
310
311 void W_MineLayer_Attack(Weapon thiswep, entity actor)
312 {
313         entity mine;
314         entity flash;
315
316         // scan how many mines we placed, and return if we reached our limit
317         if(WEP_CVAR(minelayer, limit))
318         {
319                 if(actor.minelayer_mines >= WEP_CVAR(minelayer, limit))
320                 {
321                         // the refire delay keeps this message from being spammed
322                         Send_Notification(NOTIF_ONE, actor, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit));
323                         play2(actor, SND(UNAVAILABLE));
324                         return;
325                 }
326         }
327
328         W_DecreaseAmmo(thiswep, actor, WEP_CVAR(minelayer, ammo));
329
330         W_SetupShot_ProjectileSize(actor, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage));
331         Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
332
333         mine = WarpZone_RefSys_SpawnSameRefSys(actor);
334         mine.owner = mine.realowner = actor;
335         if(WEP_CVAR(minelayer, detonatedelay) >= 0)
336                 mine.spawnshieldtime = time + WEP_CVAR(minelayer, detonatedelay);
337         else
338                 mine.spawnshieldtime = -1;
339         mine.classname = "mine";
340         mine.bot_dodge = true;
341         mine.bot_dodgerating = WEP_CVAR(minelayer, damage) * 2; // * 2 because it can detonate inflight which makes it even more dangerous
342
343         mine.takedamage = DAMAGE_YES;
344         mine.damageforcescale = WEP_CVAR(minelayer, damageforcescale);
345         mine.health = WEP_CVAR(minelayer, health);
346         mine.event_damage = W_MineLayer_Damage;
347         mine.damagedbycontents = true;
348
349         mine.movetype = MOVETYPE_TOSS;
350         PROJECTILE_MAKETRIGGER(mine);
351         mine.projectiledeathtype = WEP_MINE_LAYER.m_id;
352         setsize(mine, '-4 -4 -4', '4 4 4'); // give it some size so it can be shot
353
354         setorigin(mine, w_shotorg - v_forward * 4); // move it back so it hits the wall at the right point
355         W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0);
356         mine.angles = vectoangles(mine.velocity);
357
358         settouch(mine, W_MineLayer_Touch);
359         setthink(mine, W_MineLayer_Think);
360         mine.nextthink = time;
361         mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
362         mine.flags = FL_PROJECTILE;
363         mine.missile_flags = MIF_SPLASH | MIF_ARC | MIF_PROXY;
364
365         if(mine.cnt > 0) { mine.cnt += time; }
366
367         CSQCProjectile(mine, true, PROJECTILE_MINE, true);
368
369         // muzzle flash for 1st person view
370         flash = spawn();
371         setmodel(flash, MDL_MINELAYER_MUZZLEFLASH); // precision set below
372         SUB_SetFade(flash, time, 0.1);
373         flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
374         W_AttachToShotorg(actor, flash, '5 0 0');
375
376         // common properties
377
378         MUTATOR_CALLHOOK(EditProjectile, actor, mine);
379
380         actor.minelayer_mines = W_MineLayer_Count(actor);
381 }
382
383 float W_MineLayer_PlacedMines(entity this, float detonate)
384 {
385         entity mine;
386         float minfound = 0;
387
388         for(mine = NULL; (mine = find(mine, classname, "mine")); ) if(mine.realowner == this)
389         {
390                 if(detonate)
391                 {
392                         if(!mine.minelayer_detonate)
393                         {
394                                 mine.minelayer_detonate = true;
395                                 minfound = 1;
396                         }
397                 }
398                 else
399                         minfound = 1;
400         }
401         return minfound;
402 }
403
404 METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor))
405 {
406     // aim and decide to fire if appropriate
407     if(actor.minelayer_mines >= WEP_CVAR(minelayer, limit))
408         PHYS_INPUT_BUTTON_ATCK(actor) = false;
409     else
410         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
411     if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
412     {
413         // decide whether to detonate mines
414         entity targetlist, targ;
415         float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
416         float selfdamage, teamdamage, enemydamage;
417         edgedamage = WEP_CVAR(minelayer, edgedamage);
418         coredamage = WEP_CVAR(minelayer, damage);
419         edgeradius = WEP_CVAR(minelayer, radius);
420         recipricoledgeradius = 1 / edgeradius;
421         selfdamage = 0;
422         teamdamage = 0;
423         enemydamage = 0;
424         targetlist = findchainfloat(bot_attack, true);
425         entity mine = find(NULL, classname, "mine");
426         while(mine)
427         {
428             if(mine.realowner != actor)
429             {
430                 mine = find(mine, classname, "mine");
431                 continue;
432             }
433             targ = targetlist;
434             while(targ)
435             {
436                 d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin);
437                 d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
438                 // count potential damage according to type of target
439                 if(targ == actor)
440                     selfdamage = selfdamage + d;
441                 else if(targ.team == actor.team && teamplay)
442                     teamdamage = teamdamage + d;
443                 else if(bot_shouldattack(actor, targ))
444                     enemydamage = enemydamage + d;
445                 targ = targ.chain;
446             }
447             mine = find(mine, classname, "mine");
448         }
449         float desirabledamage;
450         desirabledamage = enemydamage;
451         if(time > actor.invincible_finished && time > actor.spawnshieldtime)
452             desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
453         if(teamplay && actor.team)
454             desirabledamage = desirabledamage - teamdamage;
455
456         mine = find(NULL, classname, "mine");
457         while(mine)
458         {
459             if(mine.realowner != actor)
460             {
461                 mine = find(mine, classname, "mine");
462                 continue;
463             }
464             makevectors(mine.v_angle);
465             targ = targetlist;
466             if(skill > 9) // normal players only do this for the target they are tracking
467             {
468                 targ = targetlist;
469                 while(targ)
470                 {
471                     if(
472                         (v_forward * normalize(mine.origin - targ.origin)< 0.1)
473                         && desirabledamage > 0.1*coredamage
474                     ) PHYS_INPUT_BUTTON_ATCK2(actor) = true;
475                     targ = targ.chain;
476                 }
477             }else{
478                 float distance; distance= bound(300,vlen(actor.origin-actor.enemy.origin),30000);
479                 //As the distance gets larger, a correct detonation gets near imposible
480                 //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
481                 if(v_forward * normalize(mine.origin - actor.enemy.origin)< 0.1)
482                     if(IS_PLAYER(actor.enemy))
483                         if(desirabledamage >= 0.1*coredamage)
484                             if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
485                                 PHYS_INPUT_BUTTON_ATCK2(actor) = true;
486             //  dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
487             }
488
489             mine = find(mine, classname, "mine");
490         }
491         // if we would be doing at X percent of the core damage, detonate it
492         // but don't fire a new shot at the same time!
493         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
494             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
495         if((skill > 6.5) && (selfdamage > actor.health))
496             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
497         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
498         //      dprint(ftos(desirabledamage),"\n");
499         if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false;
500     }
501 }
502 METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
503 {
504     if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
505     {
506         // not if we're holding the minelayer without enough ammo, but can detonate existing mines
507         if(!(W_MineLayer_PlacedMines(actor, false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
508             thiswep.wr_reload(thiswep, actor, weaponentity);
509         }
510     }
511     else if(fire & 1)
512     {
513         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
514         {
515             W_MineLayer_Attack(thiswep, actor);
516             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
517         }
518     }
519
520     if(fire & 2)
521     {
522         if(W_MineLayer_PlacedMines(actor, true))
523             sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
524     }
525 }
526 METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor))
527 {
528     //int slot = 0; // TODO: unhardcode
529     // actually do // don't switch while placing a mine
530     //if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_MINE_LAYER)
531     //{
532         float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
533         ammo_amount += actor.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
534         return ammo_amount;
535     //}
536     //return true;
537 }
538 METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor))
539 {
540     if(W_MineLayer_PlacedMines(actor, false))
541         return true;
542     else
543         return false;
544 }
545 METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor))
546 {
547     actor.minelayer_mines = 0;
548 }
549 METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
550 {
551     W_Reload(actor, WEP_CVAR(minelayer, ammo), SND_RELOAD);
552 }
553 METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
554 {
555     return WEAPON_MINELAYER_SUICIDE;
556 }
557 METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
558 {
559     return WEAPON_MINELAYER_MURDER;
560 }
561
562 #endif
563 #ifdef CSQC
564
565 METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor))
566 {
567     vector org2;
568     org2 = w_org + w_backoff * 12;
569     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
570     if(!w_issilent)
571         sound(actor, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM);
572 }
573
574 #endif
575 #endif