]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/w_electro.qc
eliminate CHAN_PROJECTILE now
[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_SINGLE, "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", CHAN_WEAPON, 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         //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
139         //sounds bad
140
141         CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
142
143         other = proj; MUTATOR_CALLHOOK(EditProjectile);
144 }
145
146 void W_Electro_Attack2()
147 {
148         local entity proj;
149
150         W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_secondary_ammo, autocvar_g_balance_electro_reload_ammo);
151
152         W_SetupShot_ProjectileSize (self, '0 0 -4', '0 0 -4', FALSE, 2, "weapons/electro_fire2.wav", CHAN_WEAPON, autocvar_g_balance_electro_secondary_damage);
153
154         w_shotdir = v_forward; // no TrueAim for grenades please
155
156         pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
157
158         proj = spawn ();
159         proj.classname = "plasma";
160         proj.owner = proj.realowner = self;
161         proj.use = W_Plasma_Explode;
162         proj.think = adaptor_think2use_hittype_splash;
163         proj.bot_dodge = TRUE;
164         proj.bot_dodgerating = autocvar_g_balance_electro_secondary_damage;
165         proj.nextthink = time + autocvar_g_balance_electro_secondary_lifetime;
166         PROJECTILE_MAKETRIGGER(proj);
167         proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
168         setorigin(proj, w_shotorg);
169
170         //proj.glow_size = 50;
171         //proj.glow_color = 45;
172         proj.movetype = MOVETYPE_BOUNCE;
173         W_SETUPPROJECTILEVELOCITY_UP(proj, g_balance_electro_secondary);
174         proj.touch = W_Plasma_Touch;
175         setsize(proj, '0 0 -4', '0 0 -4');
176         proj.takedamage = DAMAGE_YES;
177         proj.damageforcescale = autocvar_g_balance_electro_secondary_damageforcescale;
178         proj.health = autocvar_g_balance_electro_secondary_health;
179         proj.event_damage = W_Plasma_Damage;
180         proj.flags = FL_PROJECTILE;
181
182         proj.bouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
183         proj.bouncestop = autocvar_g_balance_electro_secondary_bouncestop;
184
185 #if 0
186         entity p2;
187         p2 = spawn();
188         copyentity(proj, p2);
189         setmodel(p2, "models/ebomb.mdl");
190         setsize(p2, proj.mins, proj.maxs);
191 #endif
192
193         CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
194
195         other = proj; MUTATOR_CALLHOOK(EditProjectile);
196 }
197
198 .vector hook_start, hook_end;
199 float lgbeam_send(entity to, float sf)
200 {
201         WriteByte(MSG_ENTITY, ENT_CLIENT_LGBEAM);
202         sf = sf & 0x7F;
203         if(sound_allowed(MSG_BROADCAST, self.realowner))
204                 sf |= 0x80;
205         WriteByte(MSG_ENTITY, sf);
206         if(sf & 1)
207         {
208                 WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
209                 WriteCoord(MSG_ENTITY, autocvar_g_balance_electro_primary_range);
210         }
211         if(sf & 2)
212         {
213                 WriteCoord(MSG_ENTITY, self.hook_start_x);
214                 WriteCoord(MSG_ENTITY, self.hook_start_y);
215                 WriteCoord(MSG_ENTITY, self.hook_start_z);
216         }
217         if(sf & 4)
218         {
219                 WriteCoord(MSG_ENTITY, self.hook_end_x);
220                 WriteCoord(MSG_ENTITY, self.hook_end_y);
221                 WriteCoord(MSG_ENTITY, self.hook_end_z);
222         }
223         return TRUE;
224 }
225 .entity lgbeam;
226 .float prevlgfire;
227 float lgbeam_checkammo()
228 {
229         if(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO)
230                 return TRUE;
231         else if(autocvar_g_balance_electro_reload_ammo)
232                 return self.realowner.clip_load > 0;
233         else
234                 return self.realowner.ammo_cells > 0;
235 }
236
237 entity lgbeam_owner_ent;
238 void lgbeam_think()
239 {
240         entity owner_player;
241         owner_player = self.realowner;
242
243         owner_player.prevlgfire = time;
244         if (self != owner_player.lgbeam)
245         {
246                 remove(self);
247                 return;
248         }
249
250         if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.freezetag_frozen)
251         {
252                 if(self == owner_player.lgbeam)
253                         owner_player.lgbeam = world;
254                 remove(self);
255                 return;
256         }
257
258         self.nextthink = time;
259
260         makevectors(owner_player.v_angle);
261
262         float dt, f;
263         dt = frametime;
264
265         // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
266         if not(owner_player.items & IT_UNLIMITED_WEAPON_AMMO)
267         {
268                 if(autocvar_g_balance_electro_primary_ammo)
269                 {
270                         if(autocvar_g_balance_electro_reload_ammo)
271                         {
272                                 dt = min(dt, owner_player.clip_load / autocvar_g_balance_electro_primary_ammo);
273                                 owner_player.clip_load = max(0, owner_player.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
274                                 owner_player.weapon_load[WEP_ELECTRO] = owner_player.clip_load;
275                         }
276                         else
277                         {
278                                 dt = min(dt, owner_player.ammo_cells / autocvar_g_balance_electro_primary_ammo);
279                                 owner_player.ammo_cells = max(0, owner_player.ammo_cells - autocvar_g_balance_electro_primary_ammo * frametime);
280                         }
281                 }
282         }
283
284         W_SetupShot_Range(owner_player, TRUE, 0, "", 0, autocvar_g_balance_electro_primary_damage * dt, autocvar_g_balance_electro_primary_range);
285         if(!lgbeam_owner_ent)
286         {
287                 lgbeam_owner_ent = spawn();
288                 lgbeam_owner_ent.classname = "lgbeam_owner_ent";
289         }
290         WarpZone_traceline_antilag(lgbeam_owner_ent, w_shotorg, w_shotend, MOVE_NORMAL, lgbeam_owner_ent, ANTILAG_LATENCY(owner_player));
291
292         // apply the damage
293         if(trace_ent)
294         {
295                 vector force;
296                 force = w_shotdir * autocvar_g_balance_electro_primary_force + '0 0 1' * autocvar_g_balance_electro_primary_force_up;
297
298                 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));
299
300                 if(accuracy_isgooddamage(owner_player, trace_ent))
301                         accuracy_add(owner_player, WEP_ELECTRO, 0, autocvar_g_balance_electro_primary_damage * dt * f);
302                 Damage (trace_ent, owner_player, owner_player, autocvar_g_balance_electro_primary_damage * dt * f, WEP_ELECTRO, trace_endpos, force * dt);
303         }
304         W_Plasma_TriggerCombo(trace_endpos, autocvar_g_balance_electro_primary_comboradius, owner_player);
305
306         // draw effect
307         if(w_shotorg != self.hook_start)
308         {
309                 self.SendFlags |= 2;
310                 self.hook_start = w_shotorg;
311         }
312         if(w_shotend != self.hook_end)
313         {
314                 self.SendFlags |= 4;
315                 self.hook_end = w_shotend;
316         }
317 }
318
319 // experimental lightning gun
320 void W_Electro_Attack3 (void)
321 {
322         // only play fire sound if 0.5 sec has passed since player let go the fire button
323         if(time - self.prevlgfire > 0.5)
324                 sound (self, CHAN_WEAPON, "weapons/lgbeam_fire.wav", VOL_BASE, ATTN_NORM);
325
326         entity beam, oldself;
327
328         self.lgbeam = beam = spawn();
329         beam.classname = "lgbeam";
330         beam.solid = SOLID_NOT;
331         beam.think = lgbeam_think;
332         beam.owner = beam.realowner = self;
333         beam.movetype = MOVETYPE_NONE;
334         beam.shot_spread = 0;
335         beam.bot_dodge = TRUE;
336         beam.bot_dodgerating = autocvar_g_balance_electro_primary_damage;
337         Net_LinkEntity(beam, FALSE, 0, lgbeam_send);
338
339         oldself = self;
340         self = beam;
341         self.think();
342         self = oldself;
343 }
344
345 void ElectroInit()
346 {
347         weapon_action(WEP_ELECTRO, WR_PRECACHE);
348         electro_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 1);
349         electro_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 2);
350         electro_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 3);
351         electro_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 4);
352 }
353
354 void spawnfunc_weapon_electro (void)
355 {
356         weapon_defaultspawnfunc(WEP_ELECTRO);
357 }
358
359 void w_electro_checkattack()
360 {
361         if(self.electro_count > 1)
362         if(self.BUTTON_ATCK2)
363         if(weapon_prepareattack(1, -1))
364         {
365                 W_Electro_Attack2();
366                 self.electro_count -= 1;
367                 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
368                 return;
369         }
370
371         w_ready();
372 }
373
374 .float bot_secondary_electromooth;
375 .float BUTTON_ATCK_prev;
376 float w_electro(float req)
377 {
378         float ammo_amount;
379         if (req == WR_AIM)
380         {
381                 self.BUTTON_ATCK=FALSE;
382                 self.BUTTON_ATCK2=FALSE;
383                 if(vlen(self.origin-self.enemy.origin) > 1000)
384                         self.bot_secondary_electromooth = 0;
385                 if(self.bot_secondary_electromooth == 0)
386                 {
387                         float shoot;
388
389                         if(autocvar_g_balance_electro_primary_speed)
390                                 shoot = bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE);
391                         else
392                                 shoot = bot_aim(1000000, 0, 0.001, FALSE);
393
394                         if(shoot)
395                         {
396                                 self.BUTTON_ATCK = TRUE;
397                                 if(random() < 0.01) self.bot_secondary_electromooth = 1;
398                         }
399                 }
400                 else
401                 {
402                         if(bot_aim(autocvar_g_balance_electro_secondary_speed, autocvar_g_balance_grenadelauncher_secondary_speed_up, autocvar_g_balance_electro_secondary_lifetime, TRUE))
403                         {
404                                 self.BUTTON_ATCK2 = TRUE;
405                                 if(random() < 0.03) self.bot_secondary_electromooth = 0;
406                         }
407                 }
408         }
409         else if (req == WR_THINK)
410         {
411                 if(autocvar_g_balance_electro_reload_ammo) // forced reload
412                 {
413                         if(autocvar_g_balance_electro_lightning)
414                         {
415                                 if(self.clip_load > 0)
416                                         ammo_amount = 1;
417                         }
418                         else if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
419                                 ammo_amount = 1;
420                         if(self.clip_load >= autocvar_g_balance_electro_secondary_ammo)
421                                 ammo_amount += 1;
422
423                         if(!ammo_amount)
424                         {
425                                 weapon_action(self.weapon, WR_RELOAD);
426                                 return FALSE;
427                         }
428                 }
429                 if (self.BUTTON_ATCK)
430                 {
431                         if(autocvar_g_balance_electro_lightning)
432                                 if(self.BUTTON_ATCK_prev)
433                                 {
434                                         // prolong the animtime while the gun is being fired
435                                         if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
436                                                 weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_electro_primary_animtime, w_ready);
437                                         else
438                                                 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
439                                 }
440                         if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
441                         {
442                                 if(autocvar_g_balance_electro_lightning)
443                                 {
444                                         if ((!self.lgbeam) || wasfreed(self.lgbeam))
445                                         {
446                                                 W_Electro_Attack3();
447                                         }
448                                         if(!self.BUTTON_ATCK_prev)
449                                         {
450                                                 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
451                                                 self.BUTTON_ATCK_prev = 1;
452                                         }
453                                 }
454                                 else
455                                 {
456                                         W_Electro_Attack();
457                                         weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
458                                 }
459                         }
460                 } else {
461                         if(autocvar_g_balance_electro_lightning)
462                         {
463                                 if (self.BUTTON_ATCK_prev != 0)
464                                 {
465                                         weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
466                                         ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
467                                 }
468                                 self.BUTTON_ATCK_prev = 0;
469                         }
470
471                         if (self.BUTTON_ATCK2)
472                         {
473                                 if (time >= self.electro_secondarytime)
474                                 if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
475                                 {
476                                         W_Electro_Attack2();
477                                         self.electro_count = autocvar_g_balance_electro_secondary_count;
478                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
479                                         self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
480                                 }
481                         }
482                 }
483         }
484         else if (req == WR_PRECACHE)
485         {
486                 precache_model ("models/weapons/g_electro.md3");
487                 precache_model ("models/weapons/v_electro.md3");
488                 precache_model ("models/weapons/h_electro.iqm");
489                 precache_sound ("weapons/electro_bounce.wav");
490                 precache_sound ("weapons/electro_fire.wav");
491                 precache_sound ("weapons/electro_fire2.wav");
492                 precache_sound ("weapons/electro_impact.wav");
493                 precache_sound ("weapons/electro_impact_combo.wav");
494                 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
495                 if(autocvar_g_balance_electro_lightning)
496                 {
497                         precache_sound ("weapons/lgbeam_fire.wav");
498                 }
499         }
500         else if (req == WR_SETUP)
501         {
502                 weapon_setup(WEP_ELECTRO);
503                 self.current_ammo = ammo_cells;
504         }
505         else if (req == WR_CHECKAMMO1)
506         {
507                 if(autocvar_g_balance_electro_lightning)
508                 {
509                         if(!autocvar_g_balance_electro_primary_ammo)
510                                 ammo_amount = 1;
511                         else
512                                 ammo_amount = self.ammo_cells > 0;
513                         ammo_amount += self.weapon_load[WEP_ELECTRO] > 0;
514                 }
515                 else
516                 {
517                         ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
518                         ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_primary_ammo;
519                 }
520                 return ammo_amount;
521         }
522         else if (req == WR_CHECKAMMO2)
523         {
524                 ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
525                 ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_secondary_ammo;
526                 return ammo_amount;
527         }
528         else if (req == WR_RESETPLAYER)
529         {
530                 self.electro_secondarytime = time;
531         }
532         else if (req == WR_RELOAD)
533         {
534                 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");
535         }
536         return TRUE;
537 };
538 #endif
539 #ifdef CSQC
540 float w_electro(float req)
541 {
542         if(req == WR_IMPACTEFFECT)
543         {
544                 vector org2;
545                 org2 = w_org + w_backoff * 6;
546                 if(w_deathtype & HITTYPE_SECONDARY)
547                 {
548                         pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
549                         if(!w_issilent)
550                                 sound(self, CH_SHOTS_SINGLE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
551                 }
552                 else
553                 {
554                         if(w_deathtype & HITTYPE_BOUNCE)
555                         {
556                                 // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
557                                 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
558                                 if(!w_issilent)
559                                         sound(self, CH_SHOTS_SINGLE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
560                         }
561                         else
562                         {
563                                 pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
564                                 if(!w_issilent)
565                                         sound(self, CH_SHOTS_SINGLE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
566                         }
567                 }
568         }
569         else if(req == WR_PRECACHE)
570         {
571                 precache_sound("weapons/electro_impact.wav");
572                 precache_sound("weapons/electro_impact_combo.wav");
573         }
574         else if (req == WR_SUICIDEMESSAGE)
575         {
576                 if(w_deathtype & HITTYPE_SECONDARY)
577                         w_deathtypestring = _("%s could not remember where they put plasma");
578                 else
579                         w_deathtypestring = _("%s played with plasma");
580         }
581         else if (req == WR_KILLMESSAGE)
582         {
583                 if(w_deathtype & HITTYPE_SECONDARY)
584                 {
585                         if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
586                                 w_deathtypestring = _("%s just noticed %s's blue ball");
587                         else // unchecked: BOUNCE
588                                 w_deathtypestring = _("%s got in touch with %s's blue ball");
589                 }
590                 else
591                 {
592                         if(w_deathtype & HITTYPE_BOUNCE) // combo
593                                 w_deathtypestring = _("%s felt the electrifying air of %s's combo");
594                         else if(w_deathtype & HITTYPE_SPLASH)
595                                 w_deathtypestring = _("%s got too close to %s's blue beam");
596                         else
597                                 w_deathtypestring = _("%s was blasted by %s's blue beam");
598                 }
599         }
600         return TRUE;
601 }
602 #endif
603 #endif