Glad we're on the same page of rapid firing by holding a button and being willing to modify vanilla weapon code
But I'm guessing your current methodology is this, which would cause quite a bit of code bloat:
Every weapon
actor RollingCutterWep : MegaBuster 10056
...
Weapon.AmmoUse 4
weapon.ammotype "RollingCutterAmmo"
...
Fire:
->
actor RollingCutterWep : MegaBuster 10056
...
Weapon.AmmoUse 4
weapon.ammotype "RollingCutterAmmo"
weapon.ammotype2 "RollingCutterAmmo"
Weapon.AmmoUse2 4
...
Altfire:
Fire:
So I am making an alternate suggestion: http://www.best-ever.org/download?file=anotherturbobuttontest.pk3 (only atomic fire works)
Have the jump cancel script that checks your controls check for altfire/userbutton press, and then give/take a turbo toggle based on that.
And then just modify charge weapons like so
TNT1 A 0 A_Refire
->
TNT1 A 0 A_JumpIfInventory("TurboToggle",1,2)
TNT1 A 0 A_Refire
TNT1 A 0
A change that affects just charge weapon coding, AND mods that already use altfire for their weapons can have players use the userbutton to utilize turbo as well.
That actually just does the BaseWeapon's Altfire on inherited weapons.
WeaponA
...
AltFire:
Fire:
A_Log("A")
...
WeaponB : WeaponA
...
Fire:
A_Log("B")
...
Altfire with WeaponB results in "A"
You can indeed do this though
WeaponA
...
AltFire:
TNT1 A 1 A_Jump(256,"Fire")
wait
...
WeaponB : WeaponA
...
Fire:
A_Log("B")
...
Altfire with WeaponB results in "B"
But that is prone to desync online...
And doesn't change the fact that you have to define weapon.ammotype2 and Weapon.AmmoUse2 for each weapon if you want A_JumpIfNoAmmo and A_FireCustomMissile(,0,1 to work.
If one was willing to wait for version 3.0 to make this change, simply employing the following flags on the base weapon would suffice:
+WEAPON.ALT_USES_BOTH - Altfire now makes use of Ammo1 and the defined Ammo2 [if any]
+WEAPON.ALT_AMMO_OPTIONAL - Ammo is no longer required to enter the Altfire state.
Tested, you are completely correct.
Baseweapon would just need this
actor baseweapon
...
+WEAPON.ALT_USES_BOTH
+WEAPON.ALT_AMMO_OPTIONAL
...
AltFire:
TNT1 A 1 A_Jump(256,"Fire")
wait
As for the altfire jump desync, it seems 3.0 actually fixes that. (Though I just remembered that desync issue could be sidestepped in current version with an inventory jump like so)
AltFire:
TNT1 A 1 A_JumpIfInventory("BusterAmmo",1,"Fire")
wait
Welp, I'm satisfied. Altfire = rapid sounds good to me.
I'll just keep that turbo toggle code around for mods that decide they want to have a +user1 toggle rapid fire for main/alt.