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