// }}}
// {{{ electro // TODO
set g_balance_electro_lightning 1
-set g_balance_electro_primary_damage 5
+set g_balance_electro_primary_damage 2,
set g_balance_electro_primary_edgedamage 0
-set g_balance_electro_primary_force 60 // todo: probaby needs movement nerfing code when hit?
+set g_balance_electro_primary_force 30
set g_balance_electro_primary_radius 850
set g_balance_electro_primary_comboradius 0
set g_balance_electro_primary_speed 0
set g_balance_electro_primary_spread 0
set g_balance_electro_primary_lifetime 0
-set g_balance_electro_primary_refire 0.066
-set g_balance_electro_primary_animtime 0.066
+set g_balance_electro_primary_refire 0
+set g_balance_electro_primary_animtime 0
set g_balance_electro_primary_ammo 0.66
+set g_balance_electro_primary_range 800
+set g_balance_electro_primary_velocityfactor 0.75
set g_balance_electro_secondary_damage 50
set g_balance_electro_secondary_spread 0.05
set g_balance_electro_secondary_edgedamage 0
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;
+ }
- WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_electro_primary_radius"), FALSE, self, ANTILAG_LATENCY(self));
+ 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);
+ }
- float i;
- for (i = 0; i < vlen(trace_endpos - w_shotorg)/25; ++i)
- {
- pointparticles(particleeffectnum("electro_lightning"), w_shotorg + (i / floor(vlen(w_shotorg - trace_endpos)/25)) * (trace_endpos - w_shotorg), w_shotdir * 1000, 1);
- }
+ 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;
+
+ vector force;
+ force = angle * cvar("g_balance_electro_primary_force");
+
+ 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");
+ }
+
+ self.scale = vlen(self.owner.origin - trace_endpos) / 256;
+}
+
+// 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)
{
self.electro_secondarytime = time;
}
+ self.BUTTON_ATCK_prev = self.BUTTON_ATCK;
return TRUE;
};
#endif