actor Uzi : AliensWeapon replaces chainsaw
{
 weapon.ammotype "UziAmmo"
 weapon.ammotype2 "Ninemm"
 weapon.selectionorder 2500
 weapon.kickback 2
 +weapon.noalert
 +weapon.noautofire
 +WEAPON.AMMO_OPTIONAL
 weapon.ammogive 0
 weapon.ammogive2 80
 weapon.ammouse 0
 weapon.slotnumber 2
 inventory.pickupmessage "You got the IMI UZI!"
 scale 0.8
 tag "UZI"
 states
 {
  spawn:
	USMG A -1
	loop
  Ready:
	UZIG A 0 A_JumpIfInventory("ReloadItem", 1, "Reload")
	UZIG A 0 A_JumpIfInventory("KickItem", 1, "PreKick")
	TNT1 A 0 A_JumpIfInventory("TrackerToggle", 1, "PreTrack")
	UZIG A 1 A_WeaponReady
	loop
  Select:
	UZIG A 0 A_Raise
	UZIG A 1 A_Raise
	loop
  Deselect:
	UZIG A 0 A_Lower
	UZIG A 1 A_Lower
	loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("RadarActive", 1, "TrackerLower")
	UZIG A 0 A_JumpIfInventory("UziAmmo",1,1)
	goto Click
	TNT1 A 0 A_PlaySound("weapons/uzifire", CHAN_WEAPON)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 Radius_Quake(6,2,0,1,0)
	TNT1 A 0 A_Recoil(0.2)
	TNT1 A 0 A_TakeInventory("UziAmmo", 1)
	UZIG B 1 BRIGHT offset(0, 34) A_FireCustomMissile("UziTracer", Frandom(-3,3), 1, 0, 0, 0, Frandom(-3,3))
	TNT1 AA 0 A_FireCustomMissile("GunSpark",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
    TNT1 AA 0 A_FireCustomMissile("GunSpark2",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
	TNT1 A 0 A_FireBullets(0, 0, 1, 0, "InvisiPuff")
	TNT1 A 0 A_FireCustomMissile("BulletCasingSpawner", 3, 0, 0, -1)
	UZIG C 1 BRIGHT offset(0, 36) A_SetPitch (pitch-0.7)
	TNT1 A 0 A_SetPitch (pitch+0.5)
	UZIG D 1 offset(0, 38) A_Refire
	goto Ready
  Click:
    UZIG A 1 A_PlaySound ("weapons/VP70click")
  Reload:
	UZIG A 1 A_WeaponReady
    TNT1 A 0 A_JumpIfInventory("UziAmmo",80,"Ready")
    TNT1 A 0 A_JumpIfInventory("Ninemm",1,2)
	UZIG A 0
    Goto Ready
	TNT1 A 0 A_TakeInventory("UziAmmo", 80)
	UZIG A 0 A_PlaySound ("weapons/VP70reload")
	TNT1 A 0 A_FireCustomMissile("SpentMagC",frandom(-12,-6),0,0,-8,0,frandom(-3,3))
	UZIG A 1 offset(-8, 40)
    UZIG D 2 offset(-24, 56)
    UZIG D 5 offset(-40, 72)
	Loading:
    TNT1 A 0 A_TakeInventory("Ninemm", 1)
    TNT1 A 0 A_GiveInventory("UziAmmo", 1)
	TNT1 A 0 A_JumpIfInventory("Ninemm",1,1)
	Goto EndReloading
	TNT1 A 0 A_JumpIfInventory("UziAmmo",80,1)
	Loop
    EndReloading:
    UZIG D 2 offset(-40, 72)
    UZIG A 5 offset(-24, 56)
	UZIG A 2 offset(-8, 40)
    Goto Ready
  PreKick:
	UZIG A 1 offset(-8, 40)
	UZIG A 1 offset(-24, 56)
	UZIG A 1 offset(-40, 72)
	UZIG A 1 offset(-50, 88)
	UZIG A 1 offset(-66, 104)
	goto Kick
  PostKick:
	UZIG A 1 offset(-66, 104)
	UZIG A 1 offset(-50, 88)
	UZIG A 1 offset(-40, 72)
	UZIG A 1 offset(-24, 56)
	UZIG A 1 offset(-8, 40)
	goto ready
  PreTrack:
	UZIG A 1 offset(-8, 40)
	UZIG A 1 offset(-24, 56)
	UZIG A 1 offset(-40, 72)
	UZIG A 1 offset(-50, 88)
	UZIG A 1 offset(-66, 104)
	goto TrackRaise
  PostTrack:
	UZIG A 1 offset(-66, 104)
    UZIG A 1 offset(-50, 88)
	UZIG A 1 offset(-40, 72)
	UZIG A 1 offset(-24, 56)
	UZIG A 1 offset(-8, 40)
	goto ready
  }
}

ACTOR UziAmmo : Ammo
{
 Inventory.PickupMessage "You shouldn't see this!"
 Inventory.Amount 80
 Inventory.MaxAmount 80
 +IGNORESKILL
 Ammo.BackpackAmount 0
 Ammo.BackpackMaxAmount 80
}