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