]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a burst option to the Arc secondary (available in testing)
authorMario <mario.mario@y7mail.com>
Wed, 7 Oct 2020 12:27:41 +0000 (22:27 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 7 Oct 2020 12:27:41 +0000 (22:27 +1000)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/arc.qh
testing.cfg

index e4f2f84f94316a3b4e63b3729b6af02a2dc68717..218a807bb8b0241ba9367d5c92d11db9d9129717 100644 (file)
@@ -766,6 +766,7 @@ set g_balance_arc_bolt_ammo 1
 set g_balance_arc_bolt_bounce_count 0
 set g_balance_arc_bolt_bounce_damage 0
 set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -774,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index 779104e14800e5d20aeb854527e0ea5de3895214..2f68b17cbb809b2f83f0005d48305aaf4980d2bc 100644 (file)
@@ -766,6 +766,7 @@ set g_balance_arc_bolt_ammo 1
 set g_balance_arc_bolt_bounce_count 0
 set g_balance_arc_bolt_bounce_damage 0
 set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -774,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2200
 set g_balance_arc_bolt_spread 0.03
 set g_balance_arc_burst_ammo 15
index 9df95a0559cc3d39e55a7fcd215d1951cb31ab8b..bb231b6855bcc02ef54a986a78259de98323ae34 100644 (file)
@@ -766,6 +766,7 @@ set g_balance_arc_bolt_ammo 1
 set g_balance_arc_bolt_bounce_count 0
 set g_balance_arc_bolt_bounce_damage 0
 set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -774,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2200
 set g_balance_arc_bolt_spread 0.03
 set g_balance_arc_burst_ammo 0
index 8b9155abc27eb8e790db7716edf1b18811044244..7f6237e37712545898efc45abdafa5c3f10cca96 100644 (file)
@@ -766,6 +766,7 @@ set g_balance_arc_bolt_ammo 1
 set g_balance_arc_bolt_bounce_count 0
 set g_balance_arc_bolt_bounce_damage 0
 set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -774,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.033333
+set g_balance_arc_bolt_refire2 0.03333
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index 12f1089584cdbd7f4a8d01b62befc7e02c429548..69715d5583c940877cbbb2725ed17bbf227ee7b2 100644 (file)
@@ -766,6 +766,7 @@ set g_balance_arc_bolt_ammo 1
 set g_balance_arc_bolt_bounce_count 0
 set g_balance_arc_bolt_bounce_damage 0
 set g_balance_arc_bolt_bounce_lifetime 0
+set g_balance_arc_bolt_count 1
 set g_balance_arc_bolt_damage 25
 set g_balance_arc_bolt_damageforcescale 0
 set g_balance_arc_bolt_edgedamage 12.5
@@ -774,6 +775,7 @@ set g_balance_arc_bolt_health 15
 set g_balance_arc_bolt_lifetime 5
 set g_balance_arc_bolt_radius 65
 set g_balance_arc_bolt_refire 0.16667
+set g_balance_arc_bolt_refire2 0.16667
 set g_balance_arc_bolt_speed 2300
 set g_balance_arc_bolt_spread 0
 set g_balance_arc_burst_ammo 15
index f8bad1f2b79cfccbe87c05c9ed75ca474330d367..2f9b84ed551852c6effa4b17a9b7e5fc0d509fca 100644 (file)
@@ -134,17 +134,13 @@ void W_Arc_Bolt_Touch(entity this, entity toucher)
        }
 }
 
-void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
+void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       entity missile;
-
-       W_DecreaseAmmo(thiswep, actor, WEP_CVAR(arc, bolt_ammo), weaponentity);
-
        W_SetupShot(actor, weaponentity, false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), thiswep.m_id | HITTYPE_SECONDARY);
 
        W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
 
-       missile = new(missile);
+       entity missile = new(missile);
        missile.owner = missile.realowner = actor;
        missile.bot_dodge = true;
        IL_PUSH(g_bot_dodge, missile);
@@ -179,6 +175,17 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
        CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
 
        MUTATOR_CALLHOOK(EditProjectile, actor, missile);
+
+       actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+       if(actor.(weaponentity).misc_bulletcounter == 0)
+       {
+               ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(arc, bolt_refire2) * W_WeaponRateFactor(actor);
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+       }
+       else
+       {
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), W_Arc_Attack_Bolt);
+       }
 }
 
 void W_Arc_Beam_Think(entity this)
@@ -671,10 +678,28 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     }
     else if(fire & 2)
     {
-        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(arc, bolt_refire)))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
-            W_Arc_Attack_Bolt(thiswep, actor, weaponentity);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
+               if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
+            if(!(actor.items & IT_UNLIMITED_AMMO))
+            {
+                W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+                w_ready(thiswep, actor, weaponentity, fire);
+                return;
+            }
+            float ammo_available = GetResource(actor, thiswep.ammo_type);
+            // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction.
+            // Also keep the fraction <= 1 otherwise we'd mag dump in one burst.
+            float burst_fraction = min(1, ammo_available / WEP_CVAR(arc, bolt_ammo));
+            int to_shoot = floor(WEP_CVAR(arc, bolt_count) * burst_fraction);
+
+            // We also don't want to use 3 rounds if there's only 2 left.
+            int to_use = min(WEP_CVAR(arc, bolt_ammo), ammo_available);
+            W_DecreaseAmmo(thiswep, actor, to_use, weaponentity);
+
+            // Bursting counts up to 0 from a negative.
+            actor.(weaponentity).misc_bulletcounter = -to_shoot;
+            W_Arc_Attack_Bolt(thiswep, actor, weaponentity, fire);
         }
     }
 
index 8e56c10df4f60cc04bf4ae4c6a0885feb5685ccb..ec15d8db7e09eba29e991575c54d057aa5ba36b7 100644 (file)
@@ -26,6 +26,7 @@ CLASS(Arc, Weapon)
         P(class, prefix, bolt_bounce_count, float, NONE) \
         P(class, prefix, bolt_bounce_damage, float, NONE) \
         P(class, prefix, bolt_bounce_lifetime, float, NONE) \
+        P(class, prefix, bolt_count, float, NONE) \
         P(class, prefix, bolt_damageforcescale, float, NONE) \
         P(class, prefix, bolt_damage, float, NONE) \
         P(class, prefix, bolt_edgedamage, float, NONE) \
@@ -34,6 +35,7 @@ CLASS(Arc, Weapon)
         P(class, prefix, bolt_lifetime, float, NONE) \
         P(class, prefix, bolt_radius, float, NONE) \
         P(class, prefix, bolt_refire, float, NONE) \
+        P(class, prefix, bolt_refire2, float, NONE) \
         P(class, prefix, bolt_speed, float, NONE) \
         P(class, prefix, bolt_spread, float, NONE) \
                P(class, prefix, beam_ammo, float, NONE) \
index 2eee874eb8f5c975b896e215f234d7e004710a16..b2ca934a2ee3351dbf1fb5a4557b30d0b1c0276d 100644 (file)
@@ -7,11 +7,12 @@ alias test_crylink_sec_horizontal "settemp g_balance_crylink_secondary_linkexplo
 alias test_rocket_flying "settemp g_balance_devastator_remote_jump 1"
 
 alias test_arc_bounce "settemp g_balance_arc_bolt_bounce_count 3 ; settemp g_balance_arc_bolt_bounce_lifetime 0.5 ; settemp g_balance_arc_bolt_bounce_damage 1 ; settemp g_balance_arc_bolt_ammo 2"
+alias test_arc_bounce_burst "settemp g_balance_arc_bolt_bounce_count 3 ; settemp g_balance_arc_bolt_bounce_lifetime 0.5 ; settemp g_balance_arc_bolt_bounce_damage 1 ; settemp g_balance_arc_bolt_ammo 3 ; settemp g_balance_arc_bolt_refire2 0.33333 ; settemp g_balance_arc_bolt_count 3"
 
 // https://forums.xonotic.org/showthread.php?tid=8192
 // https://gitlab.com/xonotic/xonotic-data.pk3dir/merge_requests/736
 alias test_ctf_stalemate90 "settemp g_ctf_stalemate_time 90"
 alias test_ctf_stalemate120 "settemp g_ctf_stalemate_time 120"
 
-alias testing_enable "addvote test_blaster_switch ; addvote test_crylink_sec_horizontal ; addvote test_rocket_flying ; addvote test_ctf_stalemate90 ; addvote test_ctf_stalemate120 ; addvote test_arc_bounce"
-alias testing_disable "delvote test_blaster_switch ; delvote test_crylink_sec_horizontal ; delvote test_rocket_flying ; delvote test_ctf_stalemate90 ; delvote test_ctf_stalemate120 ; delvote test_arc_bounce"
+alias testing_enable "addvote test_blaster_switch ; addvote test_crylink_sec_horizontal ; addvote test_rocket_flying ; addvote test_ctf_stalemate90 ; addvote test_ctf_stalemate120 ; addvote test_arc_bounce ; addvote test_arc_bounce_burst"
+alias testing_disable "delvote test_blaster_switch ; delvote test_crylink_sec_horizontal ; delvote test_rocket_flying ; delvote test_ctf_stalemate90 ; delvote test_ctf_stalemate120 ; delvote test_arc_bounce ; delvote test_arc_bounce_burst"