/*

==QUICKSILVER SHOTGUN==
A fast firing and loading automatic shotgun, the Quicksilver
ejects spent shells and loads them with surprising speed. As
the module builds heat, it begins to fire and eject even faster
than normal. At max heat, the module is running so hot that it 
obliterates the shells inside the chamber as it fires, removing
the need to eject, raising the fire rate even further!
*/

actor BmShotgun : weapon
{
	weapon.slotnumber 3
	Weapon.AmmoUse 1
	weapon.bobstyle alpha
	weapon.bobrangex 0.2
	weapon.bobrangey 0.2
	weapon.bobspeed 2
	Weapon.AmmoType "Shell"
	Inventory.RestrictedTo "Blastmaster"
	Inventory.PickupMessage "You got the Quicksilver shotgun!"
	+NOAUTOAIM
	Tag "Quicksilver shotgun"
	states
	{
	Select:
		TNT1 A 0
        TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_Raise
        TNT1 A 1 A_Raise
		goto ready
	Ready:
		BMST A 2
		TNT1 A 0 a_playsound ("BMshotgun/raise",0)
		SGIQ ABCDE 1 
		TNT1 A 0 a_playsound ("BMshotgun/raiseend",0)
		SGIQ FGHIJKLMNOPQR 1 a_weaponready (WRF_NOBOB)
		goto realready 
	Deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		TNT1 A 0 a_takeinventory ("secretaction", 99)
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMshotgun/lower",0)
		SGIQ RQJIHFDBA 1
		BMST A 5
	holster:
        TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_lower
        TNT1 A 1 A_lower
		loop
	deadlower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 1 a_lower
		wait	
	Realready:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BMoverheat",1,"lockdown")
		BMSG A 1 a_weaponready
		TNT1 A 0 a_jumpifinventory ("BMoverheat",1,"lockdown")
		loop
	lockdown:
		TNT1 A 0
		BMSG A 3 a_weaponready (WRF_NOPRIMARY)
		TNT1 A 0 a_firecustommissile ("smashersmokespawner",0,0,0,0,0,0)
		BMSG A 3 a_weaponready (WRF_NOPRIMARY)
		TNT1 A 0 a_jumpifinventory ("BMoverheat",1,"lockdown")
		goto realready
	
	fire:
		TNT1 A 0 
		TNT1 A 0 a_jumpifinventory ("BMoverheat",1,"lockdown")
		TNT1 A 0 a_jumpifinventory ("BMheat",156,"FastestShot")
		TNT1 A 0 a_jumpifinventory ("BMheat",91,"SpeedShot")
		BMSG A 1
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_gunflash
		SHTG A 0 A_FireBullets (5.6, 0, 7, 5, "BlueShotgunPuff")
		SHTG A 0 A_PlaySound ("BMShotgun/fire", CHAN_WEAPON)		
		TNT1 A 0 A_Quake(2, 5, 0, 32)
		TNT1 A 0 a_giveinventory ("BMheat", 3)
		BMSG BCDE 1 a_giveinventory ("BMheat", 2)
		BMSG E 1 
		TNT1 A 0 a_playsound ("BMShotgun/open",0)
		BMSG FGIKL 2
		BMSG MN 1
		TNT1 A 0 A_FireCustomMissile ("Shellcasingspawner",-20,0,-8,6)
		TNT1 A 0 a_jumpifinventory ("shell", 1, "load")
		BMSG UVWST 2 a_weaponready (WRF_NOPRIMARY)
		BMSG A 1 a_weaponready (WRF_NOPRIMARY)
		goto realready
	Load:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMShotgun/load",0)
		BMSG OPRST 2 a_weaponready (WRF_NOPRIMARY)
		BMSG A 1 a_weaponready (WRF_NOPRIMARY)
		goto realready

	SpeedShot:
		BMSG A 1
		TNT1 A 0 a_jumpifinventory ("BMheat",156,"FastestShot")
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_gunflash
		SHTG A 0 A_FireBullets (5.6, 0, 7, 5, "YellowShotgunPuff")
		TNT1 A 0 a_playsound ("Blastmaster/Mediumheat",0,0.50)
		SHTG A 0 A_PlaySound ("BMShotgun/Lv2Fire", CHAN_WEAPON)		
		TNT1 A 0 A_Quake(2, 5, 0, 32)
		TNT1 A 0 a_giveinventory ("BMheat", 3)
		BMS2 BCD 1 bright a_giveinventory ("BMheat", 2)
		BMSG E 1 a_giveinventory ("BMheat", 2)
		TNT1 A 0 a_playsound ("BMShotgun/open",0)
		BMSG FGJKLM 2
		BMSG N 1
		TNT1 A 0 A_FireCustomMissile ("Shellcasingspawner",-20,0,-8,6)

		TNT1 A 0 a_jumpifinventory ("shell", 1, "SpeedLoad")
		BMSG ST 2 a_weaponready (WRF_NOPRIMARY)
		BMSG A 1 a_weaponready (WRF_NOPRIMARY)
		goto realready	
	SpeedLoad:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMShotgun/load",0)
		BMSG PRST 1 a_weaponready (WRF_NOPRIMARY)
		BMSG A 1 a_weaponready (WRF_NOPRIMARY)
		goto realready


	FastestShot:
		BMSG A 1
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_gunflash
		SHTG A 0 A_FireBullets (5.6, 0, 7, 5, "RedShotgunPuff")
		
		TNT1 A 0 a_playsound ("Blastmaster/HighHeat",0)
		SHTG A 0 A_PlaySound ("BMShotgun/Lv3Fire", CHAN_WEAPON)		
		TNT1 A 0 A_Quake(1, 5, 0, 32)
		BMS3 BCD 1 bright a_giveinventory ("BMheat", 1)
		BMSG E 1 a_giveinventory ("BMheat", 1)
		BMSG A 3 a_weaponready (WRF_NOPRIMARY)
		goto realready	




	//VENT ATTACKS------------------------------------------------------------------
	Altfire:
		TNT1 A 0
		BMSG A 2 A_weaponready (WRF_NOFIRE)
		TNT1 A 0 A_jumpifinventory ("BMoverheat",1,"OverHeatFire")
		TNT1 A 0 A_jumpifinventory ("BMheat",156,"RedGrenade")
		TNT1 A 0 A_jumpifinventory ("BMheat",91,"YellowMachineGun")
		TNT1 A 0 A_jumpifinventory ("BMheat",1,"BlueFire")
		goto realready

	//Blue Fire (Tier one)----------------------------------------------------------
	BlueFire:
		TNT1 A 0 A_playsound ("BlastMaster/BlueFireStart",0)
		TNT1 A 0 A_playsound ("BlastMaster/BlueFireLoop",6,1,1)
	BlueFireLoop:
		TNT1 A 0 A_gunflash
		TNT1 A 0 A_takeinventory ("BMheat",2)
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 A_giveinventory ("BlastMasterVented",1)
		TNT1 A 0 A_recoil (0.10)
		TNT1 A 0 Bright A_FireCustomMissile ("BlueVentFire",Frandom(-5, 5), 0, random(-1,1), random(-2,-1), 0, Frandom(-2, 2))
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"SuperBlueFire")
		BMV3 AB 1 bright
		TNT1 A 0 A_jumpifinventory ("BMHeat",1,"BlueFireLoop")
		TNT1 A 0 A_playsound ("BlastMaster/BlueFireEnd",6)
		goto VentFinish
	SuperBlueFire:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile ("BlueVentEmber1",Frandom(-5, 5), 0, random(-4,4), random(1,4), 0, Frandom(-5, 5))
		TNT1 A 0 A_FireCustomMissile ("BlueVentEmber2",Frandom(-5, 5), 0, random(-4,4), random(1,4), 0, Frandom(-5, 5))
		TNT1 A 0 Bright A_FireCustomMissile ("BlueVentFire",Frandom(-9, 9), 0, random(-3,3), random(-2,-1), 0, Frandom(-4, 4))
		TNT1 A 0 A_playsound ("BlastMaster/PowerFire",0)
		BMV3 AB 1 bright
		TNT1 A 0 A_jumpifinventory ("BMHeat",1,"BlueFireLoop")
		TNT1 A 0 A_playsound ("BlastMaster/BlueFireEnd",6)
		goto VentFinish

	//Yellow Machine Gun (Tier two)--------------------------------------------------
	YellowMachineGun:
		TNT1 A 0 A_gunflash
		TNT1 A 0 A_takeinventory ("BMheat",4)
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 A_giveinventory ("BlastMasterVented",1)
		TNT1 A 0 A_playsound ("BlastMaster/YellowShot",6)
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"YellowHitScan")
		ESHG B 0 Bright A_FireCustomMissile("YellowVentBullet",Frandom(-2, 2), 0, 0, random(-1,1), 0, Frandom(-2, 2))
		BMV3 CD 1 bright
		BMSG A 1
		TNT1 A 0 A_jumpifinventory ("BMHeat",1,"YellowMachineGun")
		goto VentFinish
	YellowHitScan:
		ESHG B 0 Bright A_FireBullets (3.5, 2.0, -1, 9, "YellowCAPuff",FBF_NORANDOM) 
		BMV3 C 1 bright
		TNT1 A 0 A_playsound ("BlastMaster/PowerGun",6)
		BMV3 D 1 bright
		BMSG A 1
		TNT1 A 0 A_jumpifinventory ("BMHeat",1,"YellowMachineGun")
		goto VentFinish

	//Red Grenade (Tier three)--------------------------------------------------------
	RedGrenade:
		TNT1 A 0 A_gunflash
		TNT1 A 0 A_playsound ("BlastMaster/RedGrenade",6)		
		TNT1 A 0 A_takeinventory ("BMheat",999)
		TNT1 A 0 A_giveinventory ("BlastMasterVented",1)
		TNT1 A 0 A_giveinventory ("BlastMasterFired",1)
		TNT1 A 0 A_Quake(2, 6, 0, 32)
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"SuperGrenade")
		ESHG B 0 Bright A_FireCustomMissile("RedGrenade")
		BMV3 EFGHHIIJJKKLL 1 bright
		BMSG A 3
		goto VentFinish
	SuperGrenade:
		ESHG B 0 Bright A_FireCustomMissile("SuperRedGrenade")
		BMV3 EFGHH 1
		TNT1 A 0 a_playsound ("BlastMaster/PowerGrenade",0)		
		BMV3 IIJJKKLL 1 bright
		BMSG A 3
		goto VentFinish

		
	
	VentFinish:
		BMSG A 3
		BMP3 ABCC 2
		TNT1 A 0 A_takeinventory ("BlastMasterFired",99)
		TNT1 A 0 A_takeinventory ("BlastMasterVented",99)
		TNT1 A 0 A_playsound ("BlastMaster/PumpDown",0)
		BMP3 DEFFG 2 A_FireCustomMissile ("BlastMasterSmoker",0,0,6,6)
		TNT1 A 0 A_playsound ("BlastMaster/PumpUp",0)
		BMP3 CBA 2
		BMSG A 1
		goto realready

	//Super Flamer (Overheat)--------------------------------------------------------
	OverHeatFire:
		TNT1 A 0 A_takeinventory ("BlastMasterFired",99)
		TNT1 A 0 A_takeinventory ("BlastMasterVented",99)
		TNT1 A 0 A_playsound ("BlastMaster/BlueFireStart",0)
		TNT1 A 0 A_playsound ("BlastMaster/RedFireStart",0)
		TNT1 A 0 A_playsound ("BlastMaster/RedFireLoop",6,1,1)
	OverHeatFireLoop:
		TNT1 A 0 A_gunflash
		TNT1 A 0 Bright A_FireCustomMissile ("RedVentFire",Frandom(-5, 5), 0, random(-1,1), random(-2,-1), 0, Frandom(-2, 2))
		TNT1 A 0 A_takeinventory ("BMOverHeat",1)
		TNT1 A 0 A_recoil (0.15)
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"SuperRedFire")
		BMV3 MN 1 bright
		TNT1 A 0 A_refire ("OverHeatCheck")
		TNT1 A 0 A_playsound ("BlastMaster/RedFireEnd",6)	
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"RedFinisherCheck")
		BMSG A 6 
		BMSG A 6 A_weaponready (WRF_NOPRIMARY)
		goto LockDown	
	OverHeatCheck:
		TNT1 A 0 A_jumpifinventory ("BMOverHeat",1,"OverHeatFireLoop")
		TNT1 A 0 A_playsound ("BlastMaster/RedFireEnd",6)	
		goto VentFinish

	SuperRedFire:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile ("RedVentEmber1",Frandom(-5, 5), 0, random(-4,4), random(1,4), 0, Frandom(-5, 5))
		TNT1 A 0 A_FireCustomMissile ("RedVentEmber2",Frandom(-5, 5), 0, random(-4,4), random(1,4), 0, Frandom(-5, 5))
		TNT1 A 0 Bright A_FireCustomMissile ("RedVentFire",Frandom(-9, 9), 0, random(-3,3), random(-2,-1), 0, Frandom(-4, 4))
		TNT1 A 0 A_playsound ("BlastMaster/PowerFire",0)
		BMV3 MN 1 bright
		TNT1 A 0 A_refire ("OverHeatCheck")
		TNT1 A 0 A_playsound ("BlastMaster/RedFireEnd",6)
		goto RedFinisherCheck
	RedFinisherCheck:
		TNT1 A 0 A_jumpifinventory ("BMOverHeat",60,"SuperFinisher")
		goto LockDown
	SuperFinisher:
		TNT1 A 0 A_gunflash
		TNT1 A 0 A_playsound ("BlastMaster/RedGrenade",6)		
		TNT1 A 0 A_takeinventory ("BMOverHeat",60)
		BMSG A 0 A_jumpifinventory ("SuperVenter",1,"SuperGrenade")
		ESHG B 0 Bright A_FireCustomMissile("RedGrenade")
		BMV3 EFGHHIIJJKKLL 1 bright
		BMSG A 6
		goto LockDown

	
	Flash:
		TNT1 A 2 Bright A_Light(3)
		TNT1 A 2 Bright A_Light2
		TNT1 A 2 Bright A_Light1
		Goto LightDone
	}
}

