actor SubMachineGun : AOWWeapon 21043 {
	//$Category Weapons
	tag "Sub-Machine Gun"
	obituary "$OB_SUBBY"
	inventory.pickupmessage "You got the submachinegun!"
	attacksound "subby/fire"
	weapon.selectionorder 15
	weapon.kickback 80
	weapon.ammotype "NewClipAmmo"
	weapon.ammouse 1
	weapon.ammogive 15
	weapon.ammotype2 "NewClipAmmo"
	weapon.ammouse2 1
	weapon.preferredskin "MarineSMG"
	states {
	Ready:
		SUBR A 0 A_JumpIfInventory ("IsBlue", 1, "Ready.Blue")
		SUBR A 1 A_WeaponReady
		wait
	Deselect:
		SUBR A 0 A_JumpIfInventory ("IsBlue", 1, "Deselect.Blue")
		SUBR A 1 A_Lower
		wait
	Select:
		SUBR A 0 A_JumpIfInventory ("IsBlue", 1, "Select.Blue")
		SUBR A 1 A_Raise
		wait
	Ready.Blue:
		SUBB A 1 A_WeaponReady
		wait
	Deselect.Blue:
		SUBB A 1 A_Lower
		wait
	Select.Blue:
		SUBB A 1 A_Raise
		wait
	Fire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory("IsBlue",1,"Fire.Blue")
		SUBR A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBR A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBR A 1 bright offset (3, 35)
		SUBR A 1 offset (6, 37)
		
		SUBR A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBR A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBR A 1 bright offset (3, 35)
		SUBR A 1 offset (5, 37)
		SUBR A 1 offset (7, 39)
		
		SUBR A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBR A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBR A 1 bright offset (3, 35)
		SUBR A 1 offset (6, 37)
		
		SUBR A 9 offset (1, 32)
		SUBR A 2 A_ReFire
		goto Ready
	AltFire: 
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		SUBR A 0 A_JumpIfInventory("IsBlue",1,"AltFire.Blue")
		SUBR A 0 A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBR A 1 bright offset (1, 32) A_FireBullets (3.75, 3.75, -1, 5, "HandgunPuff",1,3072)
		SUBR A 1 bright offset (3, 35)
		SUBR A 1 offset (5, 37)
		SUBR A 1 offset (7, 39)
		SUBR A 2 offset (1, 32) A_ReFire
		goto Ready
	Fire.Blue:
		SUBB A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBB A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBB A 1 bright offset (3, 35)
		SUBB A 1 offset (6, 37)
		
		SUBB A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBB A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBB A 1 bright offset (3, 35)
		SUBB A 1 offset (5, 37)
		SUBB A 1 offset (7, 39)
		
		SUBB A 0 bright A_GunFlash
		SUBR A 0 bright A_SpawnItemEx("ShellCasing",4,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBB A 1 bright offset (1, 32) A_FireBullets (1.5, 1.5, -1, 5, "HandgunPuff", true, 3072)
		SUBB A 1 bright offset (3, 35)
		SUBB A 1 offset (6, 37)
		
		SUBB A 9 offset (1, 32)
		SUBB A 2 A_ReFire
		goto Ready
	AltFire.Blue:
		SUBB A 0 A_GunFlash
		SUBB A 0 bright A_SpawnItemEx("ShellCasing",3,15,36,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		SUBB A 1 bright offset (1, 32) A_FireBullets (3.75, 3.75, -1, 5, "HandgunPuff",1,3072)
		SUBB A 1 bright offset (3, 35)
		SUBB A 1 offset (5, 37)
		SUBB A 1 offset (7, 39)
		SUBB A 2 offset (1, 32) A_ReFire
		goto Ready
	Flash:
		//TNT1 A 0 bright A_FireCustomMissile("MuzzleFlashSpawner",0,0,5,5)
		//TNT1 A 0 Bright A_SpawnItemEx("MuzzleFlashSpawner",32,5,36,momx*sin(angle)*cos(angle)*1.414,momy*sin(angle)*cos(angle)*1.414,0,0,SXF_ABSOLUTEMOMENTUM)
		TNT1 A 0 Bright A_SpawnItemEx("MuzzleFlashSpawner",27,5,35*(1+(-sin(pitch)*0.707)),momx*2.332*(sin(angle)*cos(angle)/2.332),momy*2.332*(sin(angle)*cos(angle)/2.332),momz*0.1415,0,SXF_ABSOLUTEMOMENTUM)
		TNT1 A 2 Bright A_Light2
		TNT1 A 2 Bright A_Light1
		Goto LightDone
	Spawn:
		SUBR X -1
		stop
	}
}