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