]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_nex.qc
only add a "base charge" up to 50%
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_nex.qc
index 3a85e113adc6a9ccbe7bd33469122e155664078f..c185e15ad13a62e4fa3c3d2c220b74957bd3572c 100644 (file)
@@ -43,6 +43,14 @@ void W_Nex_Attack (float issecondary)
        float flying;
        flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
 
+       if(cvar("g_balance_nex_charge"))
+       {
+               mydmg *= self.nex_charge;
+               myforce *= self.nex_charge;
+               //print("^1Damage: ^7", ftos(mydmg), "\n");
+               self.nex_charge *= cvar("g_balance_nex_charge_shot_multiplier"); // do this AFTER setting mydmg/myforce
+       }
+
        W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", mydmg);
 
        yoda = 0;
@@ -64,7 +72,6 @@ void W_Nex_Attack (float issecondary)
 
 void spawnfunc_weapon_nex (void); // defined in t_items.qc
 
-.float sent_nex_scope;
 float w_nex(float req)
 {
        if (req == WR_AIM)
@@ -74,6 +81,8 @@ float w_nex(float req)
        }
        else if (req == WR_THINK)
        {
+               if(cvar("g_balance_nex_charge") && self.nex_charge < cvar("g_balance_nex_charge_limit"))
+                       self.nex_charge = min(1, self.nex_charge + cvar("g_balance_nex_charge_rate") * frametime / W_TICSPERFRAME);
                if (self.BUTTON_ATCK)
                {
                        if (weapon_prepareattack(0, cvar("g_balance_nex_primary_refire")))
@@ -84,24 +93,21 @@ float w_nex(float req)
                }
                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.nex_charge = min(1, self.nex_charge + cvar("g_balance_nex_secondary_charge_rate") * frametime / W_TICSPERFRAME);
+                                       self.ammo_cells = max(0, self.ammo_cells - cvar("g_balance_nex_secondary_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);
+                               }
                        }
                }
        }