void W_Nex_Attack (float issecondary)
{
- float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo;
+ float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, f;
if(issecondary)
{
mydmg = cvar("g_balance_nex_secondary_damage");
float flying;
flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
+ f = ExponentialFalloff(cvar("g_balance_nex_velocitydependent_minspeed"), cvar("g_balance_nex_velocitydependent_maxspeed"), cvar("g_balance_nex_velocitydependent_halflife"), self.nexspeed);
+
+ // TODO: make it more obvious (through effects, indicator on weapon) that damage increases when speed increases
+ mydmg *= f;
+ myforce *= f;
+ //print("^1Damage: ^7", ftos(mydmg), "\n");
+
W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", mydmg);
yoda = 0;
void spawnfunc_weapon_nex (void); // defined in t_items.qc
-.float sent_nex_scope;
float w_nex(float req)
{
if (req == WR_AIM)
}
if (self.BUTTON_ATCK2)
{
- if(cvar("g_balance_nex_secondary"))
+ if(cvar("g_balance_nex_secondary_charge"))
{
- if (weapon_prepareattack(0, cvar("g_balance_nex_secondary_refire")))
+ if(self.ammo_cells)
{
- W_Nex_Attack(1);
- weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_secondary_animtime"), w_ready);
+ self.nexspeed = min(cvar("g_balance_nex_velocitydependent_maxspeed"), self.nexspeed + cvar("g_balance_nex_secondary_charge_rate") * frametime / W_TICSPERFRAME);
+ self.ammo_cells = max(0, self.ammo_cells - cvar("g_balance_nex_secondary_charge_ammo") * frametime / W_TICSPERFRAME);
}
}
- else
+ else if(cvar("g_balance_nex_secondary"))
{
- if(clienttype(self) == CLIENTTYPE_REAL)
- if(!self.sent_nex_scope)
+ if (weapon_prepareattack(0, cvar("g_balance_nex_secondary_refire")))
{
- msg_entity = self;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_NEX_SCOPE);
- self.sent_nex_scope = 1;
- }
+ W_Nex_Attack(1);
+ weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_secondary_animtime"), w_ready);
+ }
}
}
}