/*

==FISSION SWEEPER==
A plasma gun with an emphasis on sheer firerate,
the Fission Sweeper converts the normally blue plasma
into high velocity beams as heat builds, alongside this
the module shifts from full auto to a more intense burstfire
mode. At max heat, the module changes into blistering hyperburst
mode, and the beams achieve light speed, instantly
striking targets with searing plasma. The intense velocity
of this energy can actually launch targets away!
*/

actor BMPlasmaGun : weapon
{
	weapon.slotnumber 4
	Weapon.AmmoUse 1
	weapon.bobstyle alpha
	weapon.bobrangex 0.2
	weapon.bobrangey 0.2
	weapon.bobspeed 2
	+NOAUTOAIM
	Weapon.AmmoType "Cell"
	Inventory.RestrictedTo "Blastmaster"
	Inventory.PickupMessage "You got the Fission Sweeper!"
	Tag "Fission Sweeper"
	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 ("BMPlasGun/raise",0)
		BPGI ABCDEFGH 1
		BPGI IJKLMNOPQP 2 a_weaponready (WRF_NOBOB)
		TNT1 A 0 a_jumpifinventory ("Cell",1,"IgniteStart")
		goto EmptyReady
	IgniteStart:
		TNT1 A 0 
		TNT1 A 0 a_playsound ("BMPlasGun/Idle",6,1,1)
		TNT1 A 0 a_jumpifinventory ("BMheat",156,"RedIgnite")
		TNT1 A 0 a_jumpifinventory ("BMheat",91,"YellowIgnite")
		goto BlueIgnite
	BlueIgnite:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMPlasGun/Ready",0)
		BPGI RS 2 
		goto RealReady
	YellowIgnite:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMPlasGun/Ready",0)
		BPGI TU 2 
		goto RealReady
	RedIgnite:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMPlasGun/Ready",0)
		BPGI VW 2 
		goto RealReady
		
	Deselect:
		TNT1 A 0
		TNT1 A 0 a_stopsound (6)
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		TNT1 A 0 a_takeinventory ("secretaction", 99)
		TNT1 A 0
		TNT1 A 0 a_playsound ("BMPlasgun/lower",0)
		BPGI PNMLKHGFCBA 1
		BMST A 5
	holster:
        TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_lower
		TNT1 A 0 a_stopsound (6)
        TNT1 A 1 A_lower
		loop
	deadlower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 0 a_stopsound (6)
		TNT1 A 1 a_lower
		wait	
	RealReady:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BMoverheat",1,"LockDown")
		TNT1 A 0 a_jumpifinventory ("BMheat",156,"RedReady")
		TNT1 A 0 a_jumpifinventory ("BMheat",91,"YellowReady")
		BMPG AABBCCDD 1 a_weaponready
		loop
	YellowReady:
		B2PG AABBCCDD 1 a_weaponready
		goto RealReady
	RedReady:
		B3PG AABBCCDD 1 a_weaponready
		goto RealReady
	EmptyReady:
		BPGI P 3 a_weaponready
		TNT1 A 0 a_jumpifinventory ("Cell",1,"IgniteStart")
		loop
	LockDown:
		TNT1 A 0
		BPGI P 3 a_weaponready (WRF_NOPRIMARY)
		TNT1 A 0 a_firecustommissile ("smashersmokespawner",0,0,0,0,0,0)
		BPGI P 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_Giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_jumpifinventory ("BMheat",156,"HyperBurst")
		TNT1 A 0 a_jumpifinventory ("BMheat",91,"BurstFire")
		TNT1 A 0 a_playsound ("BMplasgun/BlueFission",CHAN_WEAPON)
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BMPG E 1 bright A_FireCustomMissile("BlueFissionBolt")
		BMPG F 1 bright a_giveinventory ("BMheat",2)
		BMPG GH 1 bright
		TNT1 A 0 a_giveinventory ("BMheat",1)
		TNT1 A 0 a_jumpifinventory ("Cell",1,"RealReady")
		goto EmptyReady
	BurstFire:
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		TNT1 A 0 A_Giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_playsound ("BMplasgun/YellowFission",CHAN_WEAPON)
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BM2G E 1 bright A_FireCustomMissile("YellowFissionBolt",Frandom(-2, 2), 1, 0, random(-1,1), 0, Frandom(-1, 1))
		TNT1 A 0 A_jumpifnoammo ("BurstEnd")
		TNT1 A 0 a_giveinventory ("BMheat",1)
		BM2G F 1 bright A_FireCustomMissile("YellowFissionBolt",Frandom(-2, 2), 1, 0, random(-1,1), 0, Frandom(-1, 1))
		TNT1 A 0 A_jumpifnoammo ("BurstEnd")
		TNT1 A 0 a_recoil (1)
		TNT1 A 0 a_playsound ("BMplasgun/YellowFission",CHAN_WEAPON)
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BM2G E 1 bright A_FireCustomMissile("YellowFissionBolt",Frandom(-2, 2), 1, 0, random(-1,1), 0, Frandom(-1, 1))
		TNT1 A 0 A_jumpifnoammo ("BurstEnd")
		TNT1 A 0 a_giveinventory ("BMheat",1)
		TNT1 A 0 a_playsound ("BMplasgun/YellowFission",CHAN_WEAPON)
		BM2G F 2 bright A_FireCustomMissile("YellowFissionBolt",Frandom(-2, 2), 1, 0, random(-1,1), 0, Frandom(-1, 1))
	BurstEnd:
		TNT1 A 0 a_recoil (1)
		TNT1 A 0 a_giveinventory ("BMheat",1)
		BM2G G 1
		BM2G H 2
		BPGI P 4
		TNT1 A 0 a_jumpifinventory ("Cell",1,"RealReady")
		goto EmptyReady
	HyperBurst:
		TNT1 A 0 A_Giveinventory ("BlastMasterFired",1)
		TNT1 A 0 a_playsound ("BMplasgun/RedFission",CHAN_WEAPON)
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BM3G E 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 a_playsound ("BMplasgun/RedFission",CHAN_WEAPON)
		TNT1 A 0 A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 A_Quake(1, 2, 0, 32)		
		BM3G F 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")		
		TNT1 A 0 a_setpitch (pitch-1,SPF_INTERPOLATE)
		TNT1 A 0 a_recoil (1)
		TNT1 A 0 a_giveinventory ("BMheat",1)
		TNT1 A 0 a_playsound ("BMplasgun/RedFission",CHAN_WEAPON)
		TNT1 A 0 A_FireBullets (3.5, 3.0, 1, 5, "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 A_Quake(1, 2, 0, 32)
		BM3G E 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 a_giveinventory ("BMheat",1)
		BM3G F 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 a_playsound ("BMplasgun/RedFission",CHAN_WEAPON)
		TNT1 A 0 a_setpitch (pitch-2,SPF_INTERPOLATE)
		TNT1 A 0 a_recoil (1)
		BM3G E 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 a_playsound ("BMplasgun/RedFission",CHAN_WEAPON)
		TNT1 A 0 A_jumpifnoammo ("HyperBurstEnd")
		TNT1 A 0 A_Quake(1, 2, 0, 32)		
		BM3G F 1 bright A_FireBullets (3.5, 3.0, -1, random(3,40), "RedFissionPuff",FBF_NORANDOM|FBF_USEAMMO)  
	HyperBurstEnd:	
		BM3G G 1 bright
		BM3G H 2 bright
		BPGI P 9
		TNT1 A 0 a_jumpifinventory ("Cell",1,"RealReady")
		goto EmptyReady
		





	//VENT ATTACKS------------------------------------------------------------------
	Altfire:
		TNT1 A 0
		BPGI P 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))
		BPGI P 0 A_jumpifinventory ("SuperVenter",1,"SuperBlueFire")
		BMV7 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)
		BMV7 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)
		BPGI P 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))
		BMV7 CD 1 bright
		BPGI P 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) 
		BMV7 C 1 bright
		TNT1 A 0 A_playsound ("BlastMaster/PowerGun",6)
		BMV7 D 1 bright
		BPGI P 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)
		BPGI P 0 A_jumpifinventory ("SuperVenter",1,"SuperGrenade")
		ESHG B 0 Bright A_FireCustomMissile("RedGrenade")
		BMV7 EFGHHIIJJKKLL 1 bright
		BPGI P 3
		goto VentFinish
	SuperGrenade:
		ESHG B 0 Bright A_FireCustomMissile("SuperRedGrenade")
		BMV7 EFGHH 1
		TNT1 A 0 a_playsound ("BlastMaster/PowerGrenade",0)		
		BMV7 IIJJKKLL 1 bright
		BPGI P 3
		goto VentFinish

		
	
	VentFinish:
		BPGI P 3
		BMP7 ABCC 2
		TNT1 A 0 A_takeinventory ("BlastMasterFired",99)
		TNT1 A 0 A_takeinventory ("BlastMasterVented",99)
		TNT1 A 0 A_playsound ("BlastMaster/PumpDown",0)
		BMP7 DEFFG 2 A_FireCustomMissile ("BlastMasterSmoker",0,0,6,6)
		TNT1 A 0 A_playsound ("BlastMaster/PumpUp",0)
		BMP7 CBA 2
		BPGI P 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)
		BPGI P 0 A_jumpifinventory ("SuperVenter",1,"SuperRedFire")
		BMV7 MN 1 bright
		TNT1 A 0 A_refire ("OverHeatCheck")
		TNT1 A 0 A_playsound ("BlastMaster/RedFireEnd",6)	
		BPGI P 0 A_jumpifinventory ("SuperVenter",1,"RedFinisherCheck")
		BPGI P 6 
		BPGI P 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)
		BMV7 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)
		BPGI P 0 A_jumpifinventory ("SuperVenter",1,"SuperGrenade")
		ESHG B 0 Bright A_FireCustomMissile("RedGrenade")
		BMV7 EFGHHIIJJKKLL 1 bright
		BPGI P 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
		
	}
}

actor BlueFissionBolt
{
	Radius 13
	Height 8
	Speed 30
	Damage (random(18,40))
	Projectile
	species "Player"
	+thruspecies
	+RANDOMIZE
	+bright
	RenderStyle add
	Alpha 0.80
	//SeeSound "weapons/plasmaf"
	DeathSound "BMPlasgun/BlueHit"
	Obituary "%o was vaporized by %k's plasma gun."
	Decal BlueFissionScorch
	scale 0.80
	ProjectileKickback 200
	States
	{
	spawn:
		FSB1 I 6
	Flight:
		FSB1 ACBD 1
		loop
	death:
		FSB1 EFGHI 1
		stop
	}
}


actor YellowFissionBolt : FastProjectile
{
	Radius 8
	Height 5
	Speed 80
	Damage (random(5,40))
	Projectile
	species "Player"
	+thruspecies
	+RANDOMIZE
	+bright
	RenderStyle add
	Alpha 0.80
	DeathSound "BMPlasgun/YellowHit"
	scale 0.40
	Decal YellowFissionScorch
	Missileheight 8
	MissileType "YellowFissionTrail"
	ProjectileKickback 400
	States
	{
	spawn:
		FSB2 I 2
	Flight:
		FSB2 ACBD 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0 a_setscale (0.60,0.60)
		FSB2 EFGHI 1
		stop
	}
}

ACTOR YellowFissionTrail
{
	+NOINTERACTION
	+NOCLIP
    +BRIGHT
	+clientsideonly
	Radius 1
	Height 1
	Renderstyle Add
	Alpha 0.40
	Scale 0.10
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		FSB2 E 1
		FSB2 E 1 A_SetScale(0.15)
		FSB2 E 1 A_SetScale(0.10)
		Stop
	}
}


