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