Actor PlasmaShotgunGiver : CustomInventory
{
  Scale 0.9
  Inventory.Amount 1
  Inventory.MaxAmount 0
  Inventory.InterHubAmount 0
  Inventory.PickupSound "DTShotgun/Pickup"
  Inventory.PickupMessage "$NEPlShotPick"
  Obituary "imagine playing deathmatch."
  Tag "$NEPlShot"
  States
  {
  Spawn:
	STBE A 0 NoDelay ACS_NamedExecuteWithResult("WeaponListCheck",3,0)
  SpawnLoop:
	STBE A -1
	Loop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("PlasmaShotgun",1,"JustAmmo")
  All:
	TNT1 A 0 A_GiveInventory("PlasmaShotgun",1)
	TNT1 A 0 A_JumpIfInventory("PlasmaShotgunGiverCheck",1,"HoldAndDestroy")
	TNT1 A 0 A_GiveInventory("PlasmaShotgunGiverCheck",1)
	TNT1 A 0 A_GiveInventory("NewCell",40)
	Stop
  JustAmmo:
    TNT1 A 0 A_JumpIfInventory("PlasmaShotgunGiverCheck",1,"Null")
	TNT1 A 0 A_GiveInventory("PlasmaShotgunGiverCheck",1)
	TNT1 A 0 A_GiveInventory("NewCell",40)
	TNT1 A 0 A_SpawnItemEx("PlasmaShotgun")
	Stop
  }
}

Actor PlasmaShotgunSpawnerGiver : PlasmaShotgunGiver
{
  States
  {
  JustAmmo:
    TNT1 A 0 A_JumpIfInventory("PlasmaShotgunGiverCheck",1,"Null")
	TNT1 A 0 A_GiveInventory("PlasmaShotgunGiverCheck",1)
	TNT1 A 0 A_GiveInventory("NewCell",40)
	Stop
  }
}

Actor PlasmaShotgunGiverCheck : Inventory { Inventory.Amount 1 Inventory.MaxAmount 1 Inventory.InterHubAmount 0 }



Actor PlasmaShotgun : Weapon
{
 Tag "$NEPlShot"
 Weapon.AmmoType "NewCell"
 Weapon.AmmoUse 10
 Weapon.AmmoGive 80
 Weapon.SlotNumber 3
 Weapon.SlotPriority 5.1
 Weapon.PreferredSkin "CombatSG-Marine"
 Inventory.PickupMessage "$NEPlShotPick"
 Obituary "%o got turned into a spec of dust by %k's Plasma Shotgun"
 AttackSound "plasmashotgun/fire"
 Inventory.PickupSound "weapons/plasmashotgun/pump"
 Weapon.Upsound "weapons/plasmashotgun/pump"
 Decal DoomImpScorch
 +WEAPON.NOAUTOAIM
 States
 {
  Spawn:
  	STBE X 0 NoDelay ACS_NamedExecuteWithResult("WeaponListCheck",3,0)
  SpawnLoop:
	STBE X -1
	Loop
  Ready:
    TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	PSGA A 1 A_WeaponReady
	Loop
   Select:
	TNT1 A 0 A_Raise
	PSGA A 1 A_Raise
	Loop
   Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_Lower
	PSGA A 1 A_Lower
	Goto Deselect+1
  Fire:
	TNT1 A 0 A_JumpIfInventory("PowerSpreadRune",1,"FireSpread")
	TNT1 A 0 A_PlaySound("weapons/plasmashotgun/add",7)
	TNT1 A 0 A_FireBullets(5,6,7,24,"PlayerShotgunPlasmaPuff")
	TNT1 A 0 Radius_Quake(3,3,0,1,0)
	PSGF AB 1 Bright
	PSGF CDE 1
	PSGA A 3
	PSGR ABCDEFGHIJK 1
	TNT1 A 0 A_PlaySound("plasmashotgun/load")
	TNT1 A 0 A_PlaySound("weapons/pulseshotgun/pump",7)
	TNT1 A 0 A_SpawnItemEx("ShotgunCellCasing",30,-6,25,frandom(2,4),frandom(3,6),frandom(3,6),0)
	PSGR LM 1
	PSGR N 2
	PSGR MLKJIHGFEDCBA 1
	Goto Ready
  FireSpread:
	TNT1 A 0 A_PlaySound("weapons/plasmashotgun/add",7)
	TNT1 A 0 A_FireBullets(5+15.0,6,7*3,24,"PlayerShotgunPlasmaPuff")
	TNT1 A 0 Radius_Quake(3,3,0,1,0)
	PSGF AB 1 Bright
	PSGF CDE 1
	PSGA A 3
	PSGR ABCDEFGHIJK 1
	TNT1 A 0 A_PlaySound("plasmashotgun/load")
	TNT1 A 0 A_PlaySound("weapons/pulseshotgun/pump",7)
	TNT1 A 0 A_SpawnItemEx("ShotgunCellCasing",30,-6,25,frandom(2,4),frandom(3,6),frandom(3,6),0)
	PSGR LM 1
	PSGR N 2
	PSGR MLKJIHGFEDCBA 1
	Goto Ready
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready
  GrenadeToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	PSGA A 1 Offset(0,30)
	PSGA A 1 Offset(0,40)
	PSGA A 1 Offset(0,50)
	PSGA A 1 Offset(0,60)
	PSGA A 1 Offset(0,70)
	TNT1 A 4 Offset(0,10)
	HGRN ABC 1 
	HGRN D 2
	HGRN EFG 1
	HGRN HI 2
	TNT1 A 15 A_PlayWeaponSound("weapons/hgrenadepin")
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1)
	HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN J 1
	HGRN KLM 2
	HGRN NO 1
	TNT1 A 6
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Hand Grenade",1)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	PSGA A 1 Offset(0,70)
	PSGA A 1 Offset(0,60)
	PSGA A 1 Offset(0,50)
	PSGA A 1 Offset(0,40)
	PSGA A 1 Offset(0,30)
	Goto Ready
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto Ready
  MineToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	PSGA A 1 Offset(0,30)
	PSGA A 1 Offset(0,40)
	PSGA A 1 Offset(0,50)
	PSGA A 1 Offset(0,60)
	PSGA A 1 Offset(0,70)
	TNT1 A 8 Offset(0,10)
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1		
	TNT1 A 0 A_TakeInventory("MineAmmo",1)	  
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0)
	MINE HI 1
	MINE JK 2
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Land Mine",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 5
	PSGA A 1 Offset(0,70)
	PSGA A 1 Offset(0,60)
	PSGA A 1 Offset(0,50)
	PSGA A 1 Offset(0,40)
	PSGA A 1 Offset(0,30)
	Goto Ready	
 }
}

Actor PlayerShotgunPlasmaPuff 
{
 Radius 6
 Height 6
 +NOBLOCKMAP
 +DONTHARMSPECIES
 +NOGRAVITY
 +ACTIVATEIMPACT
 +ACTIVATEPCROSS
 +NOTELEPORT 
 +PUFFONACTORS
 +BLOODLESSIMPACT
 +FORCERADIUSDMG
 +ALWAYSPUFF
 +MTHRUSPECIES
 +THRUSPECIES
 +DONTHARMSPECIES
 Scale 0.5 
 Renderstyle Add
 Alpha 0.75
 Decal Bulletchip
 DamageType "Player"
 Species "Player"
 States
 {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("BlueParticleSpawner",0,0,0,0,0,0,0,128)
	TNT1 AAA 0 A_CustomMissile("Kaboom6", 0, 0, random(0,360), 2, random(0,360))
	TNT1 AAA 0 A_CustomMissile("SmokeFX4", 0, 0, random(0,360), 2, random(0,360))
	PSBO A 3 Bright A_Explode(4,64)
	PSBO BCDEF 3 Bright
	Stop
 }
}

Actor ShotgunCellCasing : CellCasing
{
 Scale 0.25
 States
 {
  Spawn:
	EWAM ABCD 3 
	Loop
  Death:
	TNT1 A 0
	TNT1 A 0 A_Jump(128,3)
	EWAM A 100
	EWAM A 5 A_FadeOut(0.10)
	Goto Death+3
	EWAM C 100
	EWAM C 5 A_FadeOut(0.10)
	Goto Death+5
 }
}