ACTOR Storm : Weapon 26302
{
  Tag "EX-36 Storm"
   Inventory.PickupMessage "You got the APS-EX36 'Storm' Machine Pistol."
    Inventory.PickupSound "misc/w_pkup"
	Weapon.UpSound "Weapons/StormUp"
    Weapon.AmmoGive2 1
    Weapon.AmmoType "StormClip"
    Weapon.AmmoType2 "Pistol_Magazine"
    Weapon.AmmoUse 1
    Weapon.Kickback 100
    Weapon.Slotnumber 2
	Weapon.PreferredSkin "Pistol"
	weapon.bobstyle inversesmooth
   weapon.bobrangeX 0.4
   weapon.bobrangeY 0.6
   weapon.bobspeed 2.5
    Obituary "%o was picked off by %k and %p Auto Pistol."
    decal "BlazeChip"
    Scale 0.8
    +Weapon.NoAutoFire
	+Weapon.Ammo_Optional
	+CHEATNOTWEAPON
	+NOALERT
    States
    {
    Spawn:
        APSP X -1
        loop
    Ready:
        APSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        loop
	ReadyEmpty:
        APSE A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        loop
    Deselect:
        TNT1 A 0 SetPlayerProperty(0,1,2)
		TNT1 A 0 A_SetCrosshair(1)
		TNT1 A 0 A_StopSoundEX("Weapon")
	    APSS ABCDE 1
	    Goto DeselectLoop
    DeselectLoop:
        TNT1 A 1 A_Lower
        Loop
    Select:
	    TNT1 A 0 A_JumpIfInventory("SemiToken",1,"SelectSemi")
        TNT1 A 0 SetPlayerProperty(0,0,2)
		TNT1 A 0 A_SetCrosshair(12)
        APSS EDCBA 1
        Goto SelectLoop
	SelectSemi:
        TNT1 A 0 SetPlayerProperty(0,0,2)
		TNT1 A 0 A_SetCrosshair(13)
        APSS EDCBA 1
        Goto SelectLoop
    SelectLoop:
        APSG A 1 A_Raise
	    loop
    Fire: //Semi Auto, Spam the mouse button.
		TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_JumpIfInventory("StormClip", 2, 1)
		Goto FireAutoLast
		TNT1 A 0 A_JumpIfInventory("SemiToken", 1, "FireSemi")
		TNT1 A 0 A_Jump(255,"FireAuto1","FireAuto2","FireAuto3")
	FireAuto1:
	    TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_JumpIfInventory("StormClip", 2, 1)
		Goto FireAutoLast
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireLoop","Weapon",1)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_autopistol_tracer", random(-3, 3), 1, 2.5, 5, 0,random(-3, 3))
		APSF B 1 BRIGHT A_WeaponReady(WRF_NOFIRE)
		APSG D 1 A_WeaponReady(WRF_NOFIRE)
		APSF B 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ReFire
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireStop","Weapon",0)
		APSG A 1 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	FireAuto2:
		TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_JumpIfInventory("StormClip", 2, 1)
		Goto FireAutoLast
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireLoop","Weapon",1)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_autopistol_tracer", random(-3, 3), 1, 2.5, 5, 0,random(-3, 3))
		APSF C 1 BRIGHT A_WeaponReady(WRF_NOFIRE)
		APSG C 1 A_WeaponReady(WRF_NOFIRE)
		APSF A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ReFire
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireStop","Weapon",0)
		APSG A 1 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	FireAuto3:
	    TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_JumpIfInventory("StormClip", 2, 1)
		Goto FireAutoLast
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireLoop","Weapon",1)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_autopistol_tracer", random(-3, 3), 1, 2.5, 5, 0,random(-3, 3))
		APSF B 1 BRIGHT A_WeaponReady(WRF_NOFIRE)
		APSG C 1 A_WeaponReady(WRF_NOFIRE)
		APSG D 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ReFire
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireStop","Weapon",0)
		APSG A 1 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	FireAutoLast: //Semi Auto, Spam the mouse button.
		TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySoundEX("Weapons/StormFireStop","Weapon",0)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_autopistol_tracer", random(-1, 1), 1, 2.5, 5, 0,random(-0.75, 0.75))
		APSF A 1 A_WeaponReady(WRF_NOFIRE)
		APSF BC 1 Bright A_WeaponReady(WRF_NOFIRE)
		APSF A 0 A_ZoomFactor(0.99)
		APSE D 1 A_WeaponReady(WRF_NOFIRE)
		KNSF B 0 A_ZoomFactor(0.98)
		APSE C 1 A_WeaponReady(WRF_NOFIRE)
		KNSF C 0 A_ZoomFactor(0.99)
		APSE B 1 A_WeaponReady(WRF_NOFIRE)
	    KNSF D 0 A_ZoomFactor(1.00)
		APSE A 1 A_WeaponReady(WRF_NOFIRE)
		Goto ReadyEmpty
	FireSemi:
	    TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_JumpIfInventory("StormClip", 2, 1)
		Goto FireSemiLast
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/StormFireSemi",81,0.65)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_autopistol_tracer", random(-1, 1), 1, 2.5, 5, 0,random(-0.75, 0.75))
		APSF A 1 A_WeaponReady(WRF_NOFIRE)
		APSF BC 1 Bright A_WeaponReady(WRF_NOFIRE)
		APSF A 0 A_ZoomFactor(0.99)
		APSG D 1 A_WeaponReady(WRF_NOFIRE)
		KNSF B 0 A_ZoomFactor(0.98)
		APSG C 1 A_WeaponReady(WRF_NOFIRE)
		KNSF C 0 A_ZoomFactor(0.99)
		APSG B 1 A_WeaponReady
	    KNSF D 0 A_ZoomFactor(1.00)
		APSG A 1 A_WeaponReady
		Goto Ready
	FireSemiLast: //Semi Auto, Spam the mouse button.
		TNT1 A 0 A_JumpIfInventory("StormClip", 1, 1)
		Goto DryFire
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.6)
		TNT1 A 0 A_SpawnItem("Lightprojectile",0,0,0,0)
		TNT1 A 0 A_PlaySound("Weapons/StormFireSemi",81,0.65)
		TNT1 A 0 A_FireCustomMissile("pcasing_spawner",0,0,1,3,0)
		TNT1 A 0 A_FireCustomMissile("p_pistol_tracer", random(-1, 1), 1, 2.5, 5, 0,random(-0.75, 0.75))
		APSF A 1 A_WeaponReady(WRF_NOFIRE)
		APSF BC 1 Bright A_WeaponReady(WRF_NOFIRE)
		APSF A 0 A_ZoomFactor(0.99)
		APSE D 1 A_WeaponReady(WRF_NOFIRE)
		KNSF B 0 A_ZoomFactor(0.98)
		APSE C 1 A_WeaponReady(WRF_NOFIRE)
		KNSF C 0 A_ZoomFactor(0.99)
		APSE B 1 A_WeaponReady
	    KNSF D 0 A_ZoomFactor(1.00)
		APSE A 1 A_WeaponReady
		Goto ReadyEmpty
	AltFire: //Does checks, if you have no dummy actors, select semi auto
		TNT1 A 0 A_PlaySoundEX("Weapons/FireSelector","Body",0,0)
		SHTG A 0 A_JumpIfInventory("SemiToken", 1, "AltFire2")
		SHTG A 0 A_GiveInventory("SemiToken", 1)
		TNT1 A 0 A_SetCrosshair(13)
		APSG A 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	AltFire2: //Clears dummy actors, to use full auto
		TNT1 A 0 A_PlaySoundEX("Weapons/FireSelector","Body",0,0)
		SHTG A 0 A_TakeInventory("SemiToken", 1)
		TNT1 A 0 A_SetCrosshair(12)
		APSG A 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	DryFire:
		KNSG A 0 A_PlaySound("Pistol/Empty") // Play the clicky noise.
		APSE A 5 A_WeaponReady(WRF_NOFIRE)
		Goto ReadyEmpty
	Reload:
	ReloadBegin:
		TNT1 A 0 A_JumpIfInventory("StormClip",36,"Ready")
		TNT1 A 0 A_JumpIfInventory("Pistol_Magazine",1,1)
		Goto DryFire
		TNT1 A 0 A_PlaySoundEX("Weapons/StormMagOut", "SoundSlot66", 0)
		APSR A 2 A_WeaponReady(WRF_NOFIRE)
		APSR BCDDCC 1 A_WeaponReady(WRF_NOFIRE)
		APSR C 5 A_WeaponReady(WRF_NOFIRE)
		APSR DDEEFF 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_SpawnItemEx("PunisherClipDrop",0,0,20)
	ReloadWork:
		TNT1 A 0 A_TakeInventory("Pistol_Magazine",1)
		TNT1 A 0 A_GiveInventory("StormClip",36)
		TNT1 A 0 A_JumpIfInventory("StormClip",36,"ReloadFinish")
		TNT1 A 0 A_JumpIfInventory("Pistol_Magazine",1,"ReloadWork")
	ReloadFinish:
		TNT1 A 0 A_PlaySoundEX("Weapons/StormMagIn", "SoundSlot77", 0)
		APSR GH 2 A_WeaponReady(WRF_NOFIRE)
		APSR IIJKL 1 A_WeaponReady(WRF_NOFIRE)
		APSR L 8 A_WeaponReady(WRF_NOFIRE)
		APSR M 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_PlaySoundEX("Weapons/StormMagLock", "SoundSlot88", 0)
		APSR OP 1 A_WeaponReady(WRF_NOFIRE)
		APSG A 3 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
	}
}

ACTOR SemiToken : Inventory {Inventory.MaxAmount 1}

ACTOR StormClip : Ammo
{
Inventory.Amount 0
Inventory.MaxAmount 36
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 36
+IGNORESKILL
}