CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
}
-// experimental lightning gun
-void W_Electro_Attack3 (void)
+void lgbeam_think()
{
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
- W_SetupShot (self, TRUE, 0, "weapons/crylink_fire2.wav", cvar("g_balance_electro_primary_damage"));
+ if (!self.owner.BUTTON_ATCK || self.owner.ammo_cells <= 0) // || (self.ammo_cells <= 0 && !(self.items & IT_UNLIMITED_WEAPON_AMMO)))
+ {
+ sound (self, CHAN_PROJECTILE, "sound/misc/null.wav", VOL_BASE, ATTN_NORM);
+ remove(self);
+ return;
+ }
+
+ if (time - self.shot_spread + random() * 0.2 > 0)
+ {
+ self.shot_spread = time + 2;
+ sound (self, CHAN_PROJECTILE, "turrets/phaser.wav", VOL_BASE, ATTN_NORM);
+ }
+
+ if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
+
+ self.nextthink = time + self.ticrate;
+
+ //w_deathtypestring = "was phased out of existence";
+
+ makevectors(self.owner.v_angle);
+ vector angle;
+ angle = v_forward;
- traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_electro_primary_radius"), FALSE, self, ANTILAG_LATENCY(self));
+ vector force;
+ force = angle * cvar("g_balance_electro_primary_force");
- te_lightning1(self, w_shotorg, trace_endpos);
+ traceline_antilag(self.owner, self.owner.origin, self.owner.origin + angle * cvar("g_balance_electro_primary_range"), FALSE, self.owner, ANTILAG_LATENCY(self.owner));
- if (trace_fraction < 1)
- Damage(trace_ent, self, self, cvar("g_balance_electro_primary_damage"), WEP_ELECTRO | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_electro_primary_force") * w_shotdir);
+ // apply the damage
+ if(trace_fraction < 1)
+ {
+ Damage (trace_ent, self.owner, self.owner, cvar("g_balance_electro_primary_damage"), WEP_ELECTRO, trace_endpos, force);
+ trace_ent.velocity = trace_ent.velocity * cvar("g_balance_electro_primary_velocityfactor") + '0 0 1' * cvar("g_balance_electro_primary_force_up");
+ }
+
+ self.scale = vlen(self.owner.origin - trace_endpos) / 256 * (0.75 + 0.75 * random());
+}
+
+// experimental lightning gun
+void W_Electro_Attack3 (void)
+{
+ entity beam;
+
+ beam = spawn();
+ beam.ticrate = autocvar_sys_ticrate;
+ setmodel(beam,"models/turrets/phaser_beam.md3");
+ beam.effects = EF_LOWPRECISION;
+ beam.solid = SOLID_NOT;
+ beam.think = lgbeam_think;
+ beam.shot_spread = 0;
+ beam.scale = cvar("g_balance_electro_primary_range") / 256;
+ beam.nextthink = time;
+ beam.owner = self;
+ beam.movetype = MOVETYPE_NONE;
+ beam.bot_dodge = TRUE;
+ beam.bot_dodgerating = cvar("g_balance_electro_primary_damage")/autocvar_sys_ticrate;
+ setattachment(beam, self.weaponentity, "shot");
}
void spawnfunc_weapon_electro (void)
}
.float bot_secondary_electromooth;
+.float BUTTON_ATCK_prev;
float w_electro(float req)
{
if (req == WR_AIM)
if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
{
if(cvar("g_balance_electro_lightning"))
- W_Electro_Attack3();
+ {
+ if (self.BUTTON_ATCK_prev == 0)
+ {
+ W_Electro_Attack3();
+ }
+ }
else
+ {
W_Electro_Attack();
+ }
weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
}
- if (self.BUTTON_ATCK2 && !cvar("g_balance_electro_lightning"))
+ if (self.BUTTON_ATCK2)
if (time >= self.electro_secondarytime)
if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
{
return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
else if (req == WR_CHECKAMMO2)
return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
+ else if (req == WR_RESETPLAYER)
+ {
+ self.electro_secondarytime = time;
+ }
+ self.BUTTON_ATCK_prev = self.BUTTON_ATCK;
+ return TRUE;
+};
+#endif
+#ifdef CSQC
+float w_electro(float req)
+{
+ if(req == WR_IMPACTEFFECT)
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ {
+ // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
+ pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
+ }
+ else
+ {
+ pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+ }
+ }
+ else if(req == WR_PRECACHE)
+ {
+ precache_sound("weapons/electro_impact.wav");
+ precache_sound("weapons/electro_impact_combo.wav");
+ }
else if (req == WR_SUICIDEMESSAGE)
{
if(w_deathtype & HITTYPE_SECONDARY)
w_deathtypestring = "was blasted by #'s blue beam";
}
}
- else if (req == WR_RESETPLAYER)
- {
- self.electro_secondarytime = time;
- }
- return TRUE;
-};
-#endif
-#ifdef CSQC
-float w_electro(float req)
-{
return TRUE;
}
#endif