ACTOR UZI : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "9mm"
	Weapon.AmmoType2 "UZIAmmo"
	Obituary "%o was shot down by %k's assault AKM."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "You got an AK-47!"
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "UZI SMG"
    Scale 0.8
	States
	{
 	Spawn:
		WAK4 A 1
		TNT1 A 0 A_SpawnItemEx("UZIWeapon", 0, 0, 0, momx, momy, momz)
		Stop	
	
	Ready:
	Ready3:
		UZIG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		UZIG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        UZIG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		UZIG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
		
	Deselect:
		UZIG A 0
		UZIG A 0 A_TakeInventory("TossGrenade", 1)
        UZIG A 0 A_TakeInventory("Reloading",1)
		UZIG A 0 A_TakeInventory("Unloading",1)
        UZIG A 0 A_ZoomFactor(1.0)
		UZIG AAAAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	Drop:
		RIFF A 0
		TNT1 A 0 A_TakeInventory("DropWeapon", 1)
		RIFF A 0 A_SpawnItemEx("AK47Weapon", 0, 0, 30, 10, 0, 2)
		TNT1 A 0 A_TakeInventory("AK47", 1)
		TNT1 A 0 A_TakeInventory("Slot2Weapon", 1)
		Goto Ready
		
	Select:
		UZIG A 0
		UZIG AAAAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        UZIG A 0 A_JumpIfInventory("UZIAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		UZIG A 0 A_AlertMonsters
		UZIG A 0 A_PlaySound("PISFIRE", 1)
		SMGG A 0 A_PlaySound("FARM16", 6)
		
		UZIF A 1 BRIGHT A_FireBullets (4.0, 4.0, -1, 9, "HitPuff", FBF_NORANDOM)
		UZIG A 0 A_ZoomFactor(0.98)
		UZIF B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		UZIG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        UZIF A 0 A_FireCustomMissile("Tracer", random(-5,5), 0, 0, 0, 0, random(-5,5))
		UZIG A 0 A_SetPitch(pitch-0.4)
		UZIG A 0 A_Takeinventory("UZIAmmo",1)
		UZIF C 0 A_FireCustomMissile("PistolCaseSpawn",5,0,6,-14)
		UZIG A 0 A_SetPitch(pitch-0.4)
		UZIG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetANgle(angle+random(-2, 2))

		UZIG A 0 A_JumpIfInventory("UZIAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		UZIG A 0 A_AlertMonsters
		UZIG A 0 A_PlaySound("PISFIRE", 5)
		SMGG A 0 A_PlaySound("FARM16", 7)
		UZIF C 1 BRIGHT A_FireBullets (4.0, 4.0, -1, 9, "HitPuff", FBF_NORANDOM)
		UZIG A 0 A_ZoomFactor(0.99)
		UZIF D 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		UZIG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        UZIF A 0 A_FireCustomMissile("Tracer", random(-5,5), 0, 0, 0, 0, random(-5,5))
		UZIG A 0 A_SetPitch(pitch-0.4)
		UZIG A 0 A_Takeinventory("UZIAmmo",1)
		UZIF C 0 A_FireCustomMissile("PistolCaseSpawn",5,0,6,-14)
		UZIG A 0 A_SetPitch(pitch-0.4)
		UZIG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetANgle(angle+random(-2, 2))
	
		UZIG A 0 A_Refire
		Goto Ready3
	
     
	NoAmmo:
		UZIG A 0
		UZIG A 0 A_ZoomFactor(1.0)
		UZIG A 0 A_Takeinventory("Zoomed",1)
		UZIG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		TNT1 A 0 A_giveinventory("MAT49FiredUntilEmpty", 1)
	NoAmmo2:
		UZIG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        UZIG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		UZIG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		UZIG A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		UZIG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		UZIG A 0 A_JumpIfInventory("9mm",1,"Reload")
		Goto Ready3
	
    Reload:
		UZIG A 1 A_WeaponReady
		UZIG A 0 A_ZoomFactor(1.0)
		UZIG A 0 A_Takeinventory("Reloading",1)
		UZIG A 0 A_Takeinventory("ADSmode",1)
		UZIG A 0 A_Takeinventory("Zoomed",1)
		UZIG A 0 A_JumpIfInventory("UZIAmmo",40,"FinishReload")
        UZIG A 0 A_JumpIfInventory("9mm",1,3)
        Goto FinishReload
        TNT1 AAA 0
		UZIG A 0 A_Takeinventory("Zoomed",1)
		UZIG A 0 A_GiveInventory ("Pumping", 1)
		UZIG A 0 A_Takeinventory("Reloading",1)
		
		UZIR A 0
		TNT1 A 0 A_PLaySound("RELO1", 3)
		UZIR JIHGFED 1
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		
        UZIR CCCCCCCCCCCCCCCC 1  A_JumpIfInventory("Kicking",1,"DoKick")
		
		UZIR DE 1
		TNT1 A 0 A_PLaySound("RELO2", 3)
		UZIR F 3
		UZIR GHIJ 1
		UZIR J 6
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		UZIG A 0 A_JumpIfInventory("UZIAmmo",40,"FinishReload")
		UZIG A 0 A_JumpIfInventory("9mm",1,3)
		Goto FinishReload
        TNT1 AAAAAA 0
		UZIG A 0 A_Giveinventory("UZIAmmo",1)
		UZIG A 0 A_Takeinventory("9mm",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		UZIG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload	
		TNT1 AAAA 0
		UZIG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload
		
	FinishReload:
		TNT1 A 0
		//TNT1 A 0 A_JumpIfInventory("MAT49FiredUntilEmpty", 1, "Cook")
		UZIR J 1
		UZIG A 1
		UZIR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3
	Cook:
		UZIR CBA 1
		UZIR KLMMMM 1
		TNT1 A 0 A_PlaySound("RELO4", 1)
		UZIR NOOONMM 1
		UZIR M 4
		UZIR A 0 A_Takeinventory("MAT49FiredUntilEmpty",1)
		UZIR LK 1
		Goto Ready3
	}
}

ACTOR UZIAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 40
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 40
   Inventory.Icon "WAK4A0"
}