]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Ver3, looking into balancing. 888/merge
authordrjaska <drjaska83@gmail.com>
Thu, 18 Mar 2021 11:38:50 +0000 (13:38 +0200)
committerdrjaska <drjaska83@gmail.com>
Thu, 18 Mar 2021 11:38:50 +0000 (13:38 +0200)
Added a block for alt fire so that it can't be fired with accumulated
spread. Made default decay value be 3 times higher than add so it takes
1/3rd of a second to decay the accumulation.

bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/machinegun.qc

index 6ec1b098a2e3fa8eca45208c7f05c1e2e9f4e6d5..936c39289b9f3a3a149f9a39b93012a3d1712d8b 100644 (file)
@@ -83,7 +83,7 @@ set g_balance_machinegun_reload_ammo 60
 set g_balance_machinegun_reload_time 2
 set g_balance_machinegun_solidpenetration 13.1
 set g_balance_machinegun_spread_add 0.012
-set g_balance_machinegun_spread_decay 0.024
+set g_balance_machinegun_spread_decay 0.036
 set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
 set g_balance_machinegun_sustained_ammo 1
index 74f0f1625d208767d609a397cfb03d38ccc1be0e..5278815d9f7187beac4d6250d566a187a3edaa49 100644 (file)
@@ -83,7 +83,7 @@ set g_balance_machinegun_reload_ammo 0
 set g_balance_machinegun_reload_time 2
 set g_balance_machinegun_solidpenetration 13.1
 set g_balance_machinegun_spread_add 0.02
-set g_balance_machinegun_spread_decay 0.04
+set g_balance_machinegun_spread_decay 0.06
 set g_balance_machinegun_spread_max 0.6
 set g_balance_machinegun_spread_min 0.02
 set g_balance_machinegun_sustained_ammo 1
index 18485da9a6f53fbb762c428d8c186de2ed6b1503..27856dfe8b999cd047f7b79db146c19a0b6e70f4 100644 (file)
@@ -83,7 +83,7 @@ set g_balance_machinegun_reload_ammo 60
 set g_balance_machinegun_reload_time 2
 set g_balance_machinegun_solidpenetration 13.1
 set g_balance_machinegun_spread_add 0.012
-set g_balance_machinegun_spread_decay 0.024
+set g_balance_machinegun_spread_decay 0.036
 set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
 set g_balance_machinegun_sustained_ammo 1
index c2feecccab24ddbed27f9c64f6d3f8dae1a074ac..30cbd51e41cbab34652ff61e2bf6cf087a2b60dc 100644 (file)
@@ -83,9 +83,9 @@ set g_balance_machinegun_reload_ammo 60
 set g_balance_machinegun_reload_time 2
 set g_balance_machinegun_solidpenetration 13.1
 set g_balance_machinegun_spread_add 0.012
-set g_balance_machinegun_spread_decay 0.024
-set g_balance_machinegun_spread_max 0.05
-set g_balance_machinegun_spread_min 0.02
+set g_balance_machinegun_spread_decay 0.036
+set g_balance_machinegun_spread_max 0.1
+set g_balance_machinegun_spread_min 0
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
 set g_balance_machinegun_sustained_force 3
index d009efe5cdf367ca04751393710f272c26317f14..dcfe5b477459a4ef0a7e408d5ab21a25906bde0b 100644 (file)
@@ -4,6 +4,8 @@
 
 .float machinegun_spread_accumulation;
 
+.float oldTime;
+
 void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
 {
        W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)), deathtype);
@@ -65,7 +67,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 {
        float machinegun_spread;
        
-       static float oldTime = 0;
+       
 
        if(!(fire & 1) || !weapon_prepareattack_check(thiswep, actor, weaponentity, false, -1))
        {
@@ -98,7 +100,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
        
        // seconds passed since the last shot
        // oldTime is given value at the end of the calculations
-       //float seconds = (newTime - oldTime);
+       //float seconds = (time - thiswep.oldTime);
        //print("\n seconds between last time and this time: ");
        //print(sprintf("%f ", seconds));
        
@@ -120,12 +122,12 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
        //}
        
        // store the time of the last shot
-       //oldTime = time;
+       //thiswep.oldTime = time;
        //print("\n Old time: ");
-       //print(sprintf("%f ", oldTime));
+       //print(sprintf("%f ", thiswep.oldTime));
        
-       thiswep.machinegun_spread_accumulation = max(thiswep.machinegun_spread_accumulation - ((time - oldTime) * WEP_CVAR(machinegun, spread_decay)), 0);
-       oldTime = time;
+       thiswep.machinegun_spread_accumulation = max(thiswep.machinegun_spread_accumulation - ((time - thiswep.oldTime) * WEP_CVAR(machinegun, spread_decay)), 0);
+       thiswep.oldTime = time;
 
        machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + thiswep.machinegun_spread_accumulation, WEP_CVAR(machinegun, spread_max));
        fireBullet(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), 0, WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
@@ -150,6 +152,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
 void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
+       
        W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage), thiswep.m_id);
        if(!autocvar_g_norecoil)
        {
@@ -213,6 +216,13 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(fire & 2)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
+            thiswep.machinegun_spread_accumulation = max(thiswep.machinegun_spread_accumulation - ((time - thiswep.oldTime) * WEP_CVAR(machinegun, spread_decay)), 0);
+            thiswep.oldTime = time;
+            if(thiswep.machinegun_spread_accumulation > 0){
+                w_ready(thiswep, actor, weaponentity, fire);
+                return;
+            }
+            
             if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
             if(!(actor.items & IT_UNLIMITED_AMMO))
             {