]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/w_electro.qc
Merge remote branch 'origin/master' into samual/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_electro.qc
1 #ifdef REGISTER_WEAPON
2 REGISTER_WEAPON(ELECTRO, w_electro, IT_CELLS, 5, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "electro", "electro", _("Electro"));
3 #else
4 #ifdef SVQC
5 .float electro_count;
6 .float electro_secondarytime;
7
8 void W_Plasma_Explode_Combo (void);
9
10 void W_Plasma_TriggerCombo(vector org, float rad, entity own)
11 {
12         local entity e;
13         e = WarpZone_FindRadius(org, rad, TRUE);
14         while (e)
15         {
16                 if (e.classname == "plasma")
17                 {
18                         // change owner to whoever caused the combo explosion
19                         e.realowner = own;
20                         e.takedamage = DAMAGE_NO;
21                         e.classname = "plasma_chain";
22                         e.think = W_Plasma_Explode_Combo;
23                         e.nextthink = time + vlen(e.WarpZone_findradius_dist) / autocvar_g_balance_electro_combo_speed; // delay combo chains, looks cooler
24                 }
25                 e = e.chain;
26         }
27 }
28
29 void W_Plasma_Explode (void)
30 {
31         if(other.takedamage == DAMAGE_AIM)
32                 if(other.classname == "player")
33                         if(IsDifferentTeam(self.realowner, other))
34                                 if(other.deadflag == DEAD_NO)
35                                         if(IsFlying(other))
36                                                 AnnounceTo(self.realowner, "electrobitch");
37
38         self.event_damage = SUB_Null;
39         self.takedamage = DAMAGE_NO;
40         if (self.movetype == MOVETYPE_BOUNCE)
41         {
42                 RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
43         }
44         else
45         {
46                 W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_primary_comboradius, self.realowner);
47                 RadiusDamage (self, self.realowner, autocvar_g_balance_electro_primary_damage, autocvar_g_balance_electro_primary_edgedamage, autocvar_g_balance_electro_primary_radius, world, autocvar_g_balance_electro_primary_force, self.projectiledeathtype, other);
48         }
49
50         remove (self);
51 }
52
53 void W_Plasma_Explode_Combo (void)
54 {
55         W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_combo_comboradius, self.realowner);
56
57         self.event_damage = SUB_Null;
58         RadiusDamage (self, self.realowner, autocvar_g_balance_electro_combo_damage, autocvar_g_balance_electro_combo_edgedamage, autocvar_g_balance_electro_combo_radius, world, autocvar_g_balance_electro_combo_force, WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
59         remove (self);
60 }
61
62 void W_Plasma_Touch (void)
63 {
64         //self.velocity = self.velocity  * 0.1;
65
66         PROJECTILE_TOUCH;
67         if (other.takedamage == DAMAGE_AIM) {
68                 W_Plasma_Explode ();
69         } else {
70                 //UpdateCSQCProjectile(self);
71                 spamsound (self, CH_SHOTS, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
72                 self.projectiledeathtype |= HITTYPE_BOUNCE;
73         }
74 }
75
76 void W_Plasma_TouchExplode (void)
77 {
78         PROJECTILE_TOUCH;
79         W_Plasma_Explode ();
80 }
81
82 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
83 {
84         if(self.health <= 0)
85                 return;
86         // note: combos are usually triggered by W_Plasma_TriggerCombo, not damage
87         self.health = self.health - damage;
88         if (self.health <= 0)
89         {
90                 self.takedamage = DAMAGE_NO;
91                 self.nextthink = time;
92                 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
93                 {
94                         // change owner to whoever caused the combo explosion
95                         self.realowner = inflictor.realowner;
96                         self.classname = "plasma_chain";
97                         self.think = W_Plasma_Explode_Combo;
98                         self.nextthink = time + min(autocvar_g_balance_electro_combo_radius, vlen(self.origin - inflictor.origin)) / autocvar_g_balance_electro_combo_speed; // delay combo chains, looks cooler
99                                 //                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bounding the length, because inflictor may be in a galaxy far far away (warpzones)
100                 }
101                 else
102                 {
103                         self.use = W_Plasma_Explode;
104                         self.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
105                 }
106         }
107 }
108
109 void W_Electro_Attack()
110 {
111         local entity proj;
112
113         W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_reload_ammo);
114
115         W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", CH_WEAPON_A, autocvar_g_balance_electro_primary_damage);
116
117         pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
118
119         proj = spawn ();
120         proj.classname = "plasma_prim";
121         proj.owner = proj.realowner = self;
122         proj.bot_dodge = TRUE;
123         proj.bot_dodgerating = autocvar_g_balance_electro_primary_damage;
124         proj.use = W_Plasma_Explode;
125         proj.think = adaptor_think2use_hittype_splash;
126         proj.nextthink = time + autocvar_g_balance_electro_primary_lifetime;
127         PROJECTILE_MAKETRIGGER(proj);
128         proj.projectiledeathtype = WEP_ELECTRO;
129         setorigin(proj, w_shotorg);
130
131         proj.movetype = MOVETYPE_FLY;
132         W_SETUPPROJECTILEVELOCITY(proj, g_balance_electro_primary);
133         proj.angles = vectoangles(proj.velocity);
134         proj.touch = W_Plasma_TouchExplode;
135         setsize(proj, '0 0 -3', '0 0 -3');
136         proj.flags = FL_PROJECTILE;
137
138         CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
139
140         other = proj; MUTATOR_CALLHOOK(EditProjectile);
141 }
142
143 void W_Electro_Attack2()
144 {
145         local entity proj;
146
147         W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_secondary_ammo, autocvar_g_balance_electro_reload_ammo);
148
149         W_SetupShot_ProjectileSize (self, '0 0 -4', '0 0 -4', FALSE, 2, "weapons/electro_fire2.wav", CH_WEAPON_A, autocvar_g_balance_electro_secondary_damage);
150
151         w_shotdir = v_forward; // no TrueAim for grenades please
152
153         pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
154
155         proj = spawn ();
156         proj.classname = "plasma";
157         proj.owner = proj.realowner = self;
158         proj.use = W_Plasma_Explode;
159         proj.think = adaptor_think2use_hittype_splash;
160         proj.bot_dodge = TRUE;
161         proj.bot_dodgerating = autocvar_g_balance_electro_secondary_damage;
162         proj.nextthink = time + autocvar_g_balance_electro_secondary_lifetime;
163         PROJECTILE_MAKETRIGGER(proj);
164         proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
165         setorigin(proj, w_shotorg);
166
167         //proj.glow_size = 50;
168         //proj.glow_color = 45;
169         proj.movetype = MOVETYPE_BOUNCE;
170         W_SETUPPROJECTILEVELOCITY_UP(proj, g_balance_electro_secondary);
171         proj.touch = W_Plasma_Touch;
172         setsize(proj, '0 0 -4', '0 0 -4');
173         proj.takedamage = DAMAGE_YES;
174         proj.damageforcescale = autocvar_g_balance_electro_secondary_damageforcescale;
175         proj.health = autocvar_g_balance_electro_secondary_health;
176         proj.event_damage = W_Plasma_Damage;
177         proj.flags = FL_PROJECTILE;
178         proj.damagedbycontents = (autocvar_g_balance_electro_secondary_damagedbycontents);
179
180         proj.bouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
181         proj.bouncestop = autocvar_g_balance_electro_secondary_bouncestop;
182
183 #if 0
184         entity p2;
185         p2 = spawn();
186         copyentity(proj, p2);
187         setmodel(p2, "models/ebomb.mdl");
188         setsize(p2, proj.mins, proj.maxs);
189 #endif
190
191         CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
192
193         other = proj; MUTATOR_CALLHOOK(EditProjectile);
194 }
195
196 .vector hook_start, hook_end;
197 float lgbeam_send(entity to, float sf)
198 {
199         WriteByte(MSG_ENTITY, ENT_CLIENT_LGBEAM);
200         sf = sf & 0x7F;
201         if(sound_allowed(MSG_BROADCAST, self.realowner))
202                 sf |= 0x80;
203         WriteByte(MSG_ENTITY, sf);
204         if(sf & 1)
205         {
206                 WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
207                 WriteCoord(MSG_ENTITY, autocvar_g_balance_electro_primary_range);
208         }
209         if(sf & 2)
210         {
211                 WriteCoord(MSG_ENTITY, self.hook_start_x);
212                 WriteCoord(MSG_ENTITY, self.hook_start_y);
213                 WriteCoord(MSG_ENTITY, self.hook_start_z);
214         }
215         if(sf & 4)
216         {
217                 WriteCoord(MSG_ENTITY, self.hook_end_x);
218                 WriteCoord(MSG_ENTITY, self.hook_end_y);
219                 WriteCoord(MSG_ENTITY, self.hook_end_z);
220         }
221         return TRUE;
222 }
223 .entity lgbeam;
224 .float prevlgfire;
225 float lgbeam_checkammo()
226 {
227         if(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO)
228                 return TRUE;
229         else if(autocvar_g_balance_electro_reload_ammo)
230                 return self.realowner.clip_load > 0;
231         else
232                 return self.realowner.ammo_cells > 0;
233 }
234
235 entity lgbeam_owner_ent;
236 void lgbeam_think()
237 {
238         entity owner_player;
239         owner_player = self.realowner;
240
241         owner_player.prevlgfire = time;
242         if (self != owner_player.lgbeam)
243         {
244                 remove(self);
245                 return;
246         }
247
248         if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.freezetag_frozen)
249         {
250                 if(self == owner_player.lgbeam)
251                         owner_player.lgbeam = world;
252                 remove(self);
253                 return;
254         }
255
256         self.nextthink = time;
257
258         makevectors(owner_player.v_angle);
259
260         float dt, f;
261         dt = frametime;
262
263         // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
264         if not(owner_player.items & IT_UNLIMITED_WEAPON_AMMO)
265         {
266                 if(autocvar_g_balance_electro_primary_ammo)
267                 {
268                         if(autocvar_g_balance_electro_reload_ammo)
269                         {
270                                 dt = min(dt, owner_player.clip_load / autocvar_g_balance_electro_primary_ammo);
271                                 owner_player.clip_load = max(0, owner_player.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
272                                 owner_player.weapon_load[WEP_ELECTRO] = owner_player.clip_load;
273                         }
274                         else
275                         {
276                                 dt = min(dt, owner_player.ammo_cells / autocvar_g_balance_electro_primary_ammo);
277                                 owner_player.ammo_cells = max(0, owner_player.ammo_cells - autocvar_g_balance_electro_primary_ammo * frametime);
278                         }
279                 }
280         }
281
282         W_SetupShot_Range(owner_player, TRUE, 0, "", 0, autocvar_g_balance_electro_primary_damage * dt, autocvar_g_balance_electro_primary_range);
283         if(!lgbeam_owner_ent)
284         {
285                 lgbeam_owner_ent = spawn();
286                 lgbeam_owner_ent.classname = "lgbeam_owner_ent";
287         }
288         WarpZone_traceline_antilag(lgbeam_owner_ent, w_shotorg, w_shotend, MOVE_NORMAL, lgbeam_owner_ent, ANTILAG_LATENCY(owner_player));
289
290         // apply the damage
291         if(trace_ent)
292         {
293                 vector force;
294                 force = w_shotdir * autocvar_g_balance_electro_primary_force + '0 0 1' * autocvar_g_balance_electro_primary_force_up;
295
296                 f = ExponentialFalloff(autocvar_g_balance_electro_primary_falloff_mindist, autocvar_g_balance_electro_primary_falloff_maxdist, autocvar_g_balance_electro_primary_falloff_halflifedist, vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - w_shotorg));
297
298                 if(accuracy_isgooddamage(owner_player, trace_ent))
299                         accuracy_add(owner_player, WEP_ELECTRO, 0, autocvar_g_balance_electro_primary_damage * dt * f);
300                 Damage (trace_ent, owner_player, owner_player, autocvar_g_balance_electro_primary_damage * dt * f, WEP_ELECTRO, trace_endpos, force * dt);
301         }
302         W_Plasma_TriggerCombo(trace_endpos, autocvar_g_balance_electro_primary_comboradius, owner_player);
303
304         // draw effect
305         if(w_shotorg != self.hook_start)
306         {
307                 self.SendFlags |= 2;
308                 self.hook_start = w_shotorg;
309         }
310         if(w_shotend != self.hook_end)
311         {
312                 self.SendFlags |= 4;
313                 self.hook_end = w_shotend;
314         }
315 }
316
317 // experimental lightning gun
318 void W_Electro_Attack3 (void)
319 {
320         // only play fire sound if 0.5 sec has passed since player let go the fire button
321         if(time - self.prevlgfire > 0.5)
322                 sound (self, CH_WEAPON_A, "weapons/lgbeam_fire.wav", VOL_BASE, ATTN_NORM);
323
324         entity beam, oldself;
325
326         self.lgbeam = beam = spawn();
327         beam.classname = "lgbeam";
328         beam.solid = SOLID_NOT;
329         beam.think = lgbeam_think;
330         beam.owner = beam.realowner = self;
331         beam.movetype = MOVETYPE_NONE;
332         beam.shot_spread = 0;
333         beam.bot_dodge = TRUE;
334         beam.bot_dodgerating = autocvar_g_balance_electro_primary_damage;
335         Net_LinkEntity(beam, FALSE, 0, lgbeam_send);
336
337         oldself = self;
338         self = beam;
339         self.think();
340         self = oldself;
341 }
342
343 void ElectroInit()
344 {
345         weapon_action(WEP_ELECTRO, WR_PRECACHE);
346         electro_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 1);
347         electro_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 2);
348         electro_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 3);
349         electro_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 4);
350 }
351
352 void spawnfunc_weapon_electro (void)
353 {
354         weapon_defaultspawnfunc(WEP_ELECTRO);
355 }
356
357 void w_electro_checkattack()
358 {
359         if(self.electro_count > 1)
360         if(self.BUTTON_ATCK2)
361         if(weapon_prepareattack(1, -1))
362         {
363                 W_Electro_Attack2();
364                 self.electro_count -= 1;
365                 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
366                 return;
367         }
368
369         w_ready();
370 }
371
372 .float bot_secondary_electromooth;
373 .float BUTTON_ATCK_prev;
374 float w_electro(float req)
375 {
376         float ammo_amount;
377         if (req == WR_AIM)
378         {
379                 self.BUTTON_ATCK=FALSE;
380                 self.BUTTON_ATCK2=FALSE;
381                 if(vlen(self.origin-self.enemy.origin) > 1000)
382                         self.bot_secondary_electromooth = 0;
383                 if(self.bot_secondary_electromooth == 0)
384                 {
385                         float shoot;
386
387                         if(autocvar_g_balance_electro_primary_speed)
388                                 shoot = bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE);
389                         else
390                                 shoot = bot_aim(1000000, 0, 0.001, FALSE);
391
392                         if(shoot)
393                         {
394                                 self.BUTTON_ATCK = TRUE;
395                                 if(random() < 0.01) self.bot_secondary_electromooth = 1;
396                         }
397                 }
398                 else
399                 {
400                         if(bot_aim(autocvar_g_balance_electro_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_electro_secondary_lifetime, TRUE))
401                         {
402                                 self.BUTTON_ATCK2 = TRUE;
403                                 if(random() < 0.03) self.bot_secondary_electromooth = 0;
404                         }
405                 }
406         }
407         else if (req == WR_THINK)
408         {
409                 if(autocvar_g_balance_electro_reload_ammo) // forced reload
410                 {
411                         if(autocvar_g_balance_electro_lightning)
412                         {
413                                 if(self.clip_load > 0)
414                                         ammo_amount = 1;
415                         }
416                         else if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
417                                 ammo_amount = 1;
418                         if(self.clip_load >= autocvar_g_balance_electro_secondary_ammo)
419                                 ammo_amount += 1;
420
421                         if(!ammo_amount)
422                         {
423                                 weapon_action(self.weapon, WR_RELOAD);
424                                 return FALSE;
425                         }
426                 }
427                 if (self.BUTTON_ATCK)
428                 {
429                         if(autocvar_g_balance_electro_lightning)
430                                 if(self.BUTTON_ATCK_prev)
431                                 {
432                                         // prolong the animtime while the gun is being fired
433                                         if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
434                                                 weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_electro_primary_animtime, w_ready);
435                                         else
436                                                 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
437                                 }
438                         if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
439                         {
440                                 if(autocvar_g_balance_electro_lightning)
441                                 {
442                                         if ((!self.lgbeam) || wasfreed(self.lgbeam))
443                                         {
444                                                 W_Electro_Attack3();
445                                         }
446                                         if(!self.BUTTON_ATCK_prev)
447                                         {
448                                                 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
449                                                 self.BUTTON_ATCK_prev = 1;
450                                         }
451                                 }
452                                 else
453                                 {
454                                         W_Electro_Attack();
455                                         weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
456                                 }
457                         }
458                 } else {
459                         if(autocvar_g_balance_electro_lightning)
460                         {
461                                 if (self.BUTTON_ATCK_prev != 0)
462                                 {
463                                         weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
464                                         ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
465                                 }
466                                 self.BUTTON_ATCK_prev = 0;
467                         }
468
469                         if (self.BUTTON_ATCK2)
470                         {
471                                 if (time >= self.electro_secondarytime)
472                                 if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
473                                 {
474                                         W_Electro_Attack2();
475                                         self.electro_count = autocvar_g_balance_electro_secondary_count;
476                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
477                                         self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
478                                 }
479                         }
480                 }
481         }
482         else if (req == WR_PRECACHE)
483         {
484                 precache_model ("models/weapons/g_electro.md3");
485                 precache_model ("models/weapons/v_electro.md3");
486                 precache_model ("models/weapons/h_electro.iqm");
487                 precache_sound ("weapons/electro_bounce.wav");
488                 precache_sound ("weapons/electro_fire.wav");
489                 precache_sound ("weapons/electro_fire2.wav");
490                 precache_sound ("weapons/electro_impact.wav");
491                 precache_sound ("weapons/electro_impact_combo.wav");
492                 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
493                 if(autocvar_g_balance_electro_lightning)
494                 {
495                         precache_sound ("weapons/lgbeam_fire.wav");
496                 }
497         }
498         else if (req == WR_SETUP)
499         {
500                 weapon_setup(WEP_ELECTRO);
501                 self.current_ammo = ammo_cells;
502         }
503         else if (req == WR_CHECKAMMO1)
504         {
505                 if(autocvar_g_balance_electro_lightning)
506                 {
507                         if(!autocvar_g_balance_electro_primary_ammo)
508                                 ammo_amount = 1;
509                         else
510                                 ammo_amount = self.ammo_cells > 0;
511                         ammo_amount += self.weapon_load[WEP_ELECTRO] > 0;
512                 }
513                 else
514                 {
515                         ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
516                         ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_primary_ammo;
517                 }
518                 return ammo_amount;
519         }
520         else if (req == WR_CHECKAMMO2)
521         {
522                 ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
523                 ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_secondary_ammo;
524                 return ammo_amount;
525         }
526         else if (req == WR_RESETPLAYER)
527         {
528                 self.electro_secondarytime = time;
529         }
530         else if (req == WR_RELOAD)
531         {
532                 W_Reload(min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo), autocvar_g_balance_electro_reload_ammo, autocvar_g_balance_electro_reload_time, "weapons/reload.wav");
533         }
534         return TRUE;
535 };
536 #endif
537 #ifdef CSQC
538 float w_electro(float req)
539 {
540         if(req == WR_IMPACTEFFECT)
541         {
542                 vector org2;
543                 org2 = w_org + w_backoff * 6;
544                 if(w_deathtype & HITTYPE_SECONDARY)
545                 {
546                         pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
547                         if(!w_issilent)
548                                 sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
549                 }
550                 else
551                 {
552                         if(w_deathtype & HITTYPE_BOUNCE)
553                         {
554                                 // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
555                                 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
556                                 if(!w_issilent)
557                                         sound(self, CH_SHOTS, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
558                         }
559                         else
560                         {
561                                 pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
562                                 if(!w_issilent)
563                                         sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
564                         }
565                 }
566         }
567         else if(req == WR_PRECACHE)
568         {
569                 precache_sound("weapons/electro_impact.wav");
570                 precache_sound("weapons/electro_impact_combo.wav");
571         }
572         else if (req == WR_SUICIDEMESSAGE)
573         {
574                 if(w_deathtype & HITTYPE_SECONDARY)
575                         w_deathtypestring = _("%s could not remember where they put plasma");
576                 else
577                         w_deathtypestring = _("%s played with plasma");
578         }
579         else if (req == WR_KILLMESSAGE)
580         {
581                 if(w_deathtype & HITTYPE_SECONDARY)
582                 {
583                         if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
584                                 w_deathtypestring = _("%s just noticed %s's blue ball");
585                         else // unchecked: BOUNCE
586                                 w_deathtypestring = _("%s got in touch with %s's blue ball");
587                 }
588                 else
589                 {
590                         if(w_deathtype & HITTYPE_BOUNCE) // combo
591                                 w_deathtypestring = _("%s felt the electrifying air of %s's combo");
592                         else if(w_deathtype & HITTYPE_SPLASH)
593                                 w_deathtypestring = _("%s got too close to %s's blue beam");
594                         else
595                                 w_deathtypestring = _("%s was blasted by %s's blue beam");
596                 }
597         }
598         return TRUE;
599 }
600 #endif
601 #endif