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