ACTOR Weapon_Shotgun : Weapon_Base
{
  Weapon.AmmoUse 1
  Weapon.AmmoGive 6
  Weapon.AmmoType "Weapon_Shotgun_Mag"
  Obituary "$OB_MPPISTOL"
  +WEAPON.NOAUTOFIRE
  +WEAPON.AMMO_OPTIONAL
  
  Weapon.SlotNumber 3
  
  States
  {
  Ready:
	PISG A 0
	PISG A 0 A_PlaySound("weapons/equip",CHAN_6)
	  PISG A 1 Offset(0,8)
	  PISG A 1 Offset(0,12)
	  PISG A 1 Offset(0,18)
	  PISG A 1 Offset(0,24)
	  PISG A 1 Offset(0,28)
	  PISG A 0 Offset(0,32)
	  PISG A 1 A_WeaponReady
	  Goto Idle
  
  Idle:
	PISG A 0 A_GiveInventory("YouPlayer_HoldingRifle",1)
    PISG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Loop
	Empty:
	PISG A 1
	PISG A 0 A_PlaySound("weapons/empty",CHAN_VOICE)
	Goto Reload
	
  Fire:
	PISG A 0 A_JumpIfNoAmmo("Empty")
    PISG A 0
	PISG A 0 A_FireBullets (6, 6, 10, 7, "BulletPuff")
	PISG A 0 A_PlaySound("weapons/shotgun/fire", CHAN_WEAPON, 1.0, false, 0.8)
	PISG A 0 A_PlaySound ("weapons/shotgun/pump",CHAN_7)
	
	PISG A 0 A_FireCustomMissile ("MuzzleFlash_ShotgunHandler",0,false,30,5)
	PISG A 0 A_SetPitch(pitch-6.5,SPF_INTERPOLATE)
	
	MDL1 FGHI 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
    MDL1 JKLM 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	MDL1 NOPQ 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	MDL1 RSTU 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	MDL1 VW 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	MDL1 XYZ 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	MDL2 ABCDEFGHIJKL 3 A_WeaponReady(WRF_ALLOWRELOAD)
	PISG A 0
    Goto Idle
	Reload:
	PISG A 1 A_WeaponReady
	PISG A 0 A_JumpIfInventory("Weapon_Shotgun_Mag",0,"Idle")
	PISG A 0 A_JumpIfInventory("Weapon_Shotgun_Ammo",1,"ReloadYes")
	Goto Idle
	ReloadYes:
	PISG A 0
	MDL2 MOQST 3 A_WeaponReady(WRF_NOFIRE)
	MDL3 A 0
	Goto ReloadLoop
	ReloadLoop:
	MDL3 A 2 A_WeaponReady(WRF_NOFIRE)
	MDL3 B 0 A_PlaySound ("weapons/shotgun/reload",CHAN_7)
	MDL3 BCDEF 2 A_WeaponReady(WRF_NOFIRE)
	MDL3 G 0 A_GiveInventory("Weapon_Shotgun_Mag",1)
	MDL3 G 0 A_TakeInventory("Weapon_Shotgun_Ammo",1)
	MDL3 GHI 2 A_WeaponReady(WRF_NOFIRE)
	MDL3 KM 2 A_WeaponReady(WRF_NOFIRE)
	MDL3 A 0 A_JumpIfInventory("Weapon_Shotgun_Mag",0,"ReloadEnd")
	MDL3 A 0 A_JumpIfInventory("Weapon_Shotgun_Ammo",1,"ReloadLoop")
	Goto ReloadEnd
	ReloadEnd:
	MDL3 A 0
	MDL2 TSRQPONM 1 A_WeaponReady(WRF_NOFIRE)
	PISG A 0
	Goto Idle
  Spawn:
    PIST A -1
    Stop
	Done:
	MDL1 A 0
	MDL2 A 0
	MDL3 A 0
	MDL4 A 0
	MDL5 A 0
	MDL6 A 0
	MDL7 A 0
	MDL8 A 0
	MDL9 A 0
	Stop
  }
}

ACTOR Weapon_Shotgun_Mag : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 6
}

ACTOR GunPkup_Shotgun : CustomInventory Replaces SuperShotgun
{
	Scale 0.5
	+QUIET
	+COUNTITEM
	States
	{
	Spawn:
	GUNN C -1
	Stop
	Pickup:
	TNT1 A 0 A_JumpIfInventory("Weapon_Shotgun",0,"FailPickup")
	TNT1 A 0 A_GiveInventory("Weapon_Shotgun",1)
	TNT1 A 0 ACS_NamedExecute("PlayerPickupMessage",0,8)
	Fail
	FailPickup:
	TNT1 A 1
	Fail
	}
}