]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/electro.qc
Add an intrusive list for projectiles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / electro.qc
1 #ifndef IMPLEMENTATION
2 CLASS(Electro, Weapon)
3 /* ammotype  */ ATTRIB(Electro, ammo_field, .int, ammo_cells)
4 /* impulse   */ ATTRIB(Electro, impulse, int, 5)
5 /* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
6 /* rating    */ ATTRIB(Electro, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
7 /* color     */ ATTRIB(Electro, wpcolor, vector, '0 0.5 1');
8 /* modelname */ ATTRIB(Electro, mdl, string, "electro");
9 #ifndef MENUQC
10 /* model     */ ATTRIB(Electro, m_model, Model, MDL_ELECTRO_ITEM);
11 #endif
12 /* crosshair */ ATTRIB(Electro, w_crosshair, string, "gfx/crosshairelectro");
13 /* crosshair */ ATTRIB(Electro, w_crosshair_size, float, 0.6);
14 /* wepimg    */ ATTRIB(Electro, model2, string, "weaponelectro");
15 /* refname   */ ATTRIB(Electro, netname, string, "electro");
16 /* wepname   */ ATTRIB(Electro, m_name, string, _("Electro"));
17
18 #define X(BEGIN, P, END, class, prefix) \
19         BEGIN(class) \
20                 P(class, prefix, ammo, float, BOTH) \
21                 P(class, prefix, animtime, float, BOTH) \
22                 P(class, prefix, bouncefactor, float, SEC) \
23                 P(class, prefix, bouncestop, float, SEC) \
24                 P(class, prefix, comboradius, float, PRI) \
25                 P(class, prefix, combo_comboradius, float, NONE) \
26                 P(class, prefix, combo_comboradius_thruwall, float, NONE) \
27                 P(class, prefix, combo_damage, float, NONE) \
28                 P(class, prefix, combo_edgedamage, float, NONE) \
29                 P(class, prefix, combo_force, float, NONE) \
30                 P(class, prefix, combo_radius, float, NONE) \
31                 P(class, prefix, combo_safeammocheck, float, NONE) \
32                 P(class, prefix, combo_speed, float, NONE) \
33                 P(class, prefix, count, float, SEC) \
34                 P(class, prefix, damagedbycontents, float, SEC) \
35                 P(class, prefix, damageforcescale, float, SEC) \
36                 P(class, prefix, damage, float, BOTH) \
37                 P(class, prefix, edgedamage, float, BOTH) \
38                 P(class, prefix, force, float, BOTH) \
39                 P(class, prefix, health, float, SEC) \
40                 P(class, prefix, lifetime, float, BOTH) \
41                 P(class, prefix, midaircombo_explode, float, PRI) \
42                 P(class, prefix, midaircombo_interval, float, PRI) \
43                 P(class, prefix, midaircombo_radius, float, PRI) \
44                 P(class, prefix, radius, float, BOTH) \
45                 P(class, prefix, refire2, float, SEC) \
46                 P(class, prefix, refire, float, BOTH) \
47                 P(class, prefix, reload_ammo, float, NONE) \
48                 P(class, prefix, reload_time, float, NONE) \
49                 P(class, prefix, speed, float, BOTH) \
50                 P(class, prefix, speed_up, float, SEC) \
51                 P(class, prefix, speed_z, float, SEC) \
52                 P(class, prefix, spread, float, BOTH) \
53                 P(class, prefix, stick, float, SEC) \
54                 P(class, prefix, switchdelay_drop, float, NONE) \
55                 P(class, prefix, switchdelay_raise, float, NONE) \
56                 P(class, prefix, touchexplode, float, SEC) \
57                 P(class, prefix, weaponreplace, string,NONE) \
58                 P(class, prefix, weaponstartoverride, float, NONE) \
59                 P(class, prefix, weaponstart, float, NONE) \
60                 P(class, prefix, weaponthrowable, float, NONE) \
61         END()
62         W_PROPS(X, Electro, electro)
63 #undef X
64
65 ENDCLASS(Electro)
66 REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
67
68
69 #ifdef SVQC
70 .float electro_count;
71 .float electro_secondarytime;
72 void W_Electro_ExplodeCombo(entity this);
73 #endif
74 #endif
75 #ifdef IMPLEMENTATION
76 #ifdef SVQC
77 spawnfunc(weapon_electro) { weapon_defaultspawnfunc(this, WEP_ELECTRO); }
78
79 void W_Electro_TriggerCombo(vector org, float rad, entity own)
80 {
81         entity e = WarpZone_FindRadius(org, rad, !WEP_CVAR(electro, combo_comboradius_thruwall));
82         while(e)
83         {
84                 if(e.classname == "electro_orb")
85                 {
86                         // do we allow thruwall triggering?
87                         if(WEP_CVAR(electro, combo_comboradius_thruwall))
88                         {
89                                 // if distance is greater than thruwall distance, check to make sure it's not through a wall
90                                 if(vdist(e.WarpZone_findradius_dist, >, WEP_CVAR(electro, combo_comboradius_thruwall)))
91                                 {
92                                         WarpZone_TraceLine(org, e.origin, MOVE_NOMONSTERS, e);
93                                         if(trace_fraction != 1)
94                                         {
95                                                 // trigger is through a wall and outside of thruwall range, abort
96                                                 e = e.chain;
97                                                 continue;
98                                         }
99                                 }
100                         }
101
102                         // change owner to whoever caused the combo explosion
103                         e.realowner = own;
104                         e.takedamage = DAMAGE_NO;
105                         e.classname = "electro_orb_chain";
106
107                         // now set the next one to trigger as well
108                         setthink(e, W_Electro_ExplodeCombo);
109
110                         // delay combo chains, looks cooler
111                         e.nextthink =
112                                 (
113                                         time
114                                         +
115                                         (WEP_CVAR(electro, combo_speed) ?
116                                                 (vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed))
117                                                 :
118                                                 0
119                                         )
120                                 );
121                 }
122                 e = e.chain;
123         }
124 }
125
126 void W_Electro_ExplodeCombo(entity this)
127 {
128         W_Electro_TriggerCombo(this.origin, WEP_CVAR(electro, combo_comboradius), this.realowner);
129
130         this.event_damage = func_null;
131
132         RadiusDamage(
133                 this,
134                 this.realowner,
135                 WEP_CVAR(electro, combo_damage),
136                 WEP_CVAR(electro, combo_edgedamage),
137                 WEP_CVAR(electro, combo_radius),
138                 NULL,
139                 NULL,
140                 WEP_CVAR(electro, combo_force),
141                 WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce
142                 NULL
143         );
144
145         remove(this);
146 }
147
148 void W_Electro_Explode(entity this, entity directhitentity)
149 {
150         if(directhitentity.takedamage == DAMAGE_AIM)
151                 if(IS_PLAYER(directhitentity))
152                         if(DIFF_TEAM(this.realowner, directhitentity))
153                                 if(!IS_DEAD(directhitentity))
154                                         if(IsFlying(directhitentity))
155                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
156
157         this.event_damage = func_null;
158         this.takedamage = DAMAGE_NO;
159
160         if(this.move_movetype == MOVETYPE_BOUNCE || this.classname == "electro_orb") // TODO: classname is more reliable anyway?
161         {
162                 RadiusDamage(
163                         this,
164                         this.realowner,
165                         WEP_CVAR_SEC(electro, damage),
166                         WEP_CVAR_SEC(electro, edgedamage),
167                         WEP_CVAR_SEC(electro, radius),
168                         NULL,
169                         NULL,
170                         WEP_CVAR_SEC(electro, force),
171                         this.projectiledeathtype,
172                         directhitentity
173                 );
174         }
175         else
176         {
177                 W_Electro_TriggerCombo(this.origin, WEP_CVAR_PRI(electro, comboradius), this.realowner);
178                 RadiusDamage(
179                         this,
180                         this.realowner,
181                         WEP_CVAR_PRI(electro, damage),
182                         WEP_CVAR_PRI(electro, edgedamage),
183                         WEP_CVAR_PRI(electro, radius),
184                         NULL,
185                         NULL,
186                         WEP_CVAR_PRI(electro, force),
187                         this.projectiledeathtype,
188                         directhitentity
189                 );
190         }
191
192         remove(this);
193 }
194
195 void W_Electro_Explode_use(entity this, entity actor, entity trigger)
196 {
197         W_Electro_Explode(this, trigger);
198 }
199
200 void W_Electro_TouchExplode(entity this, entity toucher)
201 {
202         PROJECTILE_TOUCH(this, toucher);
203         W_Electro_Explode(this, toucher);
204 }
205
206 void W_Electro_Bolt_Think(entity this)
207 {
208         if(time >= this.ltime)
209         {
210                 this.use(this, NULL, NULL);
211                 return;
212         }
213
214         if(WEP_CVAR_PRI(electro, midaircombo_radius))
215         {
216                 float found = 0;
217                 entity e = WarpZone_FindRadius(this.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true);
218
219                 // loop through nearby orbs and trigger them
220                 while(e)
221                 {
222                         if(e.classname == "electro_orb")
223                         {
224                                 // change owner to whoever caused the combo explosion
225                                 e.realowner = this.realowner;
226                                 e.takedamage = DAMAGE_NO;
227                                 e.classname = "electro_orb_chain";
228
229                                 // now set the next one to trigger as well
230                                 setthink(e, W_Electro_ExplodeCombo);
231
232                                 // delay combo chains, looks cooler
233                                 e.nextthink =
234                                         (
235                                                 time
236                                                 +
237                                                 (WEP_CVAR(electro, combo_speed) ?
238                                                         (vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed))
239                                                         :
240                                                         0
241                                                 )
242                                         );
243
244                                 ++found;
245                         }
246                         e = e.chain;
247                 }
248
249                 // if we triggered an orb, should we explode? if not, lets try again next time
250                 if(found && WEP_CVAR_PRI(electro, midaircombo_explode))
251                         { this.use(this, NULL, NULL); }
252                 else
253                         { this.nextthink = min(time + WEP_CVAR_PRI(electro, midaircombo_interval), this.ltime); }
254         }
255         else { this.nextthink = this.ltime; }
256 }
257
258 void W_Electro_Attack_Bolt(Weapon thiswep, entity actor)
259 {
260         entity proj;
261
262         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(electro, ammo));
263
264         W_SetupShot_ProjectileSize(
265                 actor,
266                 '0 0 -3',
267                 '0 0 -3',
268                 false,
269                 2,
270                 SND_ELECTRO_FIRE,
271                 CH_WEAPON_A,
272                 WEP_CVAR_PRI(electro, damage)
273         );
274
275         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
276
277         proj = new(electro_bolt);
278         proj.owner = proj.realowner = actor;
279         proj.bot_dodge = true;
280         proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
281         proj.use = W_Electro_Explode_use;
282         setthink(proj, W_Electro_Bolt_Think);
283         proj.nextthink = time;
284         proj.ltime = time + WEP_CVAR_PRI(electro, lifetime);
285         PROJECTILE_MAKETRIGGER(proj);
286         proj.projectiledeathtype = WEP_ELECTRO.m_id;
287         setorigin(proj, w_shotorg);
288
289         set_movetype(proj, MOVETYPE_FLY);
290         W_SetupProjVelocity_PRI(proj, electro);
291         proj.angles = vectoangles(proj.velocity);
292         settouch(proj, W_Electro_TouchExplode);
293         setsize(proj, '0 0 -3', '0 0 -3');
294         proj.flags = FL_PROJECTILE;
295         IL_PUSH(g_projectiles, proj);
296         proj.missile_flags = MIF_SPLASH;
297
298         CSQCProjectile(proj, true, PROJECTILE_ELECTRO_BEAM, true);
299
300         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
301 }
302
303 void W_Electro_Orb_Stick(entity this, entity to)
304 {
305         entity newproj = spawn();
306         newproj.classname = this.classname;
307
308         newproj.bot_dodge = this.bot_dodge;
309         newproj.bot_dodgerating = this.bot_dodgerating;
310
311         newproj.owner = this.owner;
312         newproj.realowner = this.realowner;
313         setsize(newproj, this.mins, this.maxs);
314         setorigin(newproj, this.origin);
315         setmodel(newproj, MDL_PROJECTILE_ELECTRO);
316         newproj.angles = vectoangles(-trace_plane_normal); // face against the surface
317
318         newproj.takedamage = this.takedamage;
319         newproj.damageforcescale = this.damageforcescale;
320         newproj.health = this.health;
321         newproj.event_damage = this.event_damage;
322         newproj.spawnshieldtime = this.spawnshieldtime;
323         newproj.damagedbycontents = true;
324
325         set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place
326         newproj.projectiledeathtype = this.projectiledeathtype;
327
328         settouch(newproj, func_null);
329         setthink(newproj, getthink(this));
330         newproj.nextthink = this.nextthink;
331         newproj.use = this.use;
332         newproj.flags = this.flags;
333
334         remove(this);
335
336         if(to)
337                 SetMovetypeFollow(this, to);
338 }
339
340 void W_Electro_Orb_Touch(entity this, entity toucher)
341 {
342         PROJECTILE_TOUCH(this, toucher);
343         if(toucher.takedamage == DAMAGE_AIM)
344                 { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this, toucher); } }
345         else
346         {
347                 //UpdateCSQCProjectile(this);
348                 spamsound(this, CH_SHOTS, SND(ELECTRO_BOUNCE), VOL_BASE, ATTEN_NORM);
349                 this.projectiledeathtype |= HITTYPE_BOUNCE;
350
351                 if(WEP_CVAR_SEC(electro, stick))
352                         W_Electro_Orb_Stick(this, toucher);
353         }
354 }
355
356 void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
357 {
358         if(this.health <= 0)
359                 return;
360
361         // note: combos are usually triggered by W_Electro_TriggerCombo, not damage
362         float is_combo = (inflictor.classname == "electro_orb_chain" || inflictor.classname == "electro_bolt");
363
364         if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1)))
365                 return; // g_projectiles_damage says to halt
366
367         this.health = this.health - damage;
368         if(this.health <= 0)
369         {
370                 this.takedamage = DAMAGE_NO;
371                 this.nextthink = time;
372                 if(is_combo)
373                 {
374                         // change owner to whoever caused the combo explosion
375                         this.realowner = inflictor.realowner;
376                         this.classname = "electro_orb_chain";
377                         setthink(this, W_Electro_ExplodeCombo);
378                         this.nextthink = time +
379                                 (
380                                         // bound the length, inflictor may be in a galaxy far far away (warpzones)
381                                         min(
382                                                 WEP_CVAR(electro, combo_radius),
383                                                 vlen(this.origin - inflictor.origin)
384                                         )
385                                         /
386                                         // delay combo chains, looks cooler
387                                         WEP_CVAR(electro, combo_speed)
388                                 );
389                 }
390                 else
391                 {
392                         this.use = W_Electro_Explode_use;
393                         setthink(this, adaptor_think2use); // not _hittype_splash, as this runs "immediately"
394                 }
395         }
396 }
397
398 void W_Electro_Attack_Orb(Weapon thiswep, entity actor)
399 {
400         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(electro, ammo));
401
402         W_SetupShot_ProjectileSize(
403                 actor,
404                 '-4 -4 -4',
405                 '4 4 4',
406                 false,
407                 2,
408                 SND_ELECTRO_FIRE2,
409                 CH_WEAPON_A,
410                 WEP_CVAR_SEC(electro, damage)
411         );
412
413         w_shotdir = v_forward; // no TrueAim for grenades please
414
415         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
416
417         entity proj = new(electro_orb);
418         proj.owner = proj.realowner = actor;
419         proj.use = W_Electro_Explode_use;
420         setthink(proj, adaptor_think2use_hittype_splash);
421         proj.bot_dodge = true;
422         proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
423         proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime);
424         PROJECTILE_MAKETRIGGER(proj);
425         proj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_SECONDARY;
426         setorigin(proj, w_shotorg);
427
428         //proj.glow_size = 50;
429         //proj.glow_color = 45;
430         set_movetype(proj, MOVETYPE_BOUNCE);
431         W_SetupProjVelocity_UP_SEC(proj, electro);
432         settouch(proj, W_Electro_Orb_Touch);
433         setsize(proj, '-4 -4 -4', '4 4 4');
434         proj.takedamage = DAMAGE_YES;
435         proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale);
436         proj.health = WEP_CVAR_SEC(electro, health);
437         proj.event_damage = W_Electro_Orb_Damage;
438         proj.flags = FL_PROJECTILE;
439         IL_PUSH(g_projectiles, proj);
440         proj.damagedbycontents = (WEP_CVAR_SEC(electro, damagedbycontents));
441
442         proj.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor);
443         proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop);
444         proj.missile_flags = MIF_SPLASH | MIF_ARC;
445
446 #if 0
447         entity p2;
448         p2 = spawn();
449         copyentity(proj, p2);
450         setmodel(p2, MDL_PROJECTILE_ELECTRO);
451         setsize(p2, proj.mins, proj.maxs);
452 #endif
453
454         CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound
455
456         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
457 }
458
459 void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
460 {
461         if(actor.electro_count > 1)
462         if(PHYS_INPUT_BUTTON_ATCK2(actor))
463         if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
464         {
465                 W_Electro_Attack_Orb(WEP_ELECTRO, actor);
466                 actor.electro_count -= 1;
467                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
468                 return;
469         }
470         // WEAPONTODO: when the player releases the button, cut down the length of refire2?
471         w_ready(thiswep, actor, weaponentity, fire);
472 }
473
474 .float bot_secondary_electromooth;
475
476 METHOD(Electro, wr_aim, void(entity thiswep, entity actor))
477 {
478     PHYS_INPUT_BUTTON_ATCK(actor) = PHYS_INPUT_BUTTON_ATCK2(actor) = false;
479     if(vdist(actor.origin - actor.enemy.origin, >, 1000)) { actor.bot_secondary_electromooth = 0; }
480     if(actor.bot_secondary_electromooth == 0)
481     {
482         float shoot;
483
484         if(WEP_CVAR_PRI(electro, speed))
485             shoot = bot_aim(actor, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
486         else
487             shoot = bot_aim(actor, 1000000, 0, 0.001, false);
488
489         if(shoot)
490         {
491             PHYS_INPUT_BUTTON_ATCK(actor) = true;
492             if(random() < 0.01) actor.bot_secondary_electromooth = 1;
493         }
494     }
495     else
496     {
497         if(bot_aim(actor, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
498         {
499             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
500             if(random() < 0.03) actor.bot_secondary_electromooth = 0;
501         }
502     }
503 }
504 METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
505 {
506     if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
507     {
508         float ammo_amount = 0;
509         if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
510             ammo_amount = 1;
511         if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
512             ammo_amount += 1;
513
514         if(!ammo_amount)
515         {
516             thiswep.wr_reload(thiswep, actor, weaponentity);
517             return;
518         }
519     }
520
521     if(fire & 1)
522     {
523         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
524         {
525                 W_Electro_Attack_Bolt(thiswep, actor);
526                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
527         }
528     }
529     else if(fire & 2)
530     {
531         if(time >= actor.electro_secondarytime)
532         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
533         {
534             W_Electro_Attack_Orb(thiswep, actor);
535             actor.electro_count = WEP_CVAR_SEC(electro, count);
536             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
537             actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
538         }
539     }
540 }
541 METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor))
542 {
543     float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
544     ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
545     return ammo_amount;
546 }
547 METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor))
548 {
549     float ammo_amount;
550     if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
551     {
552         ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
553         ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
554     }
555     else
556     {
557         ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
558         ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
559     }
560     return ammo_amount;
561 }
562 METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor))
563 {
564     actor.electro_secondarytime = time;
565 }
566 METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
567 {
568     W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
569 }
570 METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
571 {
572     if(w_deathtype & HITTYPE_SECONDARY)
573         return WEAPON_ELECTRO_SUICIDE_ORBS;
574     else
575         return WEAPON_ELECTRO_SUICIDE_BOLT;
576 }
577 METHOD(Electro, wr_killmessage, Notification(entity thiswep))
578 {
579     if(w_deathtype & HITTYPE_SECONDARY)
580     {
581         return WEAPON_ELECTRO_MURDER_ORBS;
582     }
583     else
584     {
585         if(w_deathtype & HITTYPE_BOUNCE)
586             return WEAPON_ELECTRO_MURDER_COMBO;
587         else
588             return WEAPON_ELECTRO_MURDER_BOLT;
589     }
590 }
591
592 #endif
593 #ifdef CSQC
594
595 METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor))
596 {
597     vector org2;
598     org2 = w_org + w_backoff * 6;
599     if(w_deathtype & HITTYPE_SECONDARY)
600     {
601         pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1);
602         if(!w_issilent)
603             sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
604     }
605     else
606     {
607         if(w_deathtype & HITTYPE_BOUNCE)
608         {
609             // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
610             pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
611             if(!w_issilent)
612                 sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
613         }
614         else
615         {
616             pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1);
617             if(!w_issilent)
618                 sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
619         }
620     }
621 }
622
623 #endif
624 #endif