
ACTOR RLPlasmaticShrapnelShotgun : RLWeapon
{
  Obituary "%o was put down by %k's shotgun."
  Decal BulletChip
  Tag "Plasmatic Shotgun"
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPlasmaticShrapnelShotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "SHOTICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunNanoMod",1,2)
    PKSG A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
    PKSG A 35 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunClip", 1, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunNanoMod",2,2)
    PKSG A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheck+1
    PKSG A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheck+1
	
  ScavengerDrop:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"WeaponDropConfirm")
	TNT1 A 0 A_GiveInventory("RLScavengerDrop",1)
	TNT1 A 0 A_Print("Press again to drop current weapon,\nor press \crAlt Fire\c- to scrap it to retrieve a Mod Pack.")
	Goto AfterModDrop
  WeaponDropConfirm:
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPlasmaticShrapnelShotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPlasmaticShrapnelShotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLPlasmaticShrapnelShotgun",1)
	Stop
  AfterModDrop:
    PKSG A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    PKSG A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
	
  Deselect:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    PKSG A 1 A_Lower
    Loop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLBasicAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLShotgunTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelShotgunSelected", 1)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 1)
    Goto SelectLoop
	TNT1 A 0 A_GiveInventory("PowerRLTechnicianBasicDamage", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    PKSG A 1 A_Raise
    Loop
  Fire:
	PKSG A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	PKSG A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	PKSG A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	PKSG A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	PKSG A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunClip", 1, 1)
	Goto Reload
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunFirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 1, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",2,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 12, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 14, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FirePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 1, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 12, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",2,"FireAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireBullets (6, 2.5, 7, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6, 2.5, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (6, 2.5, 11, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6, 2.5, 12, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FirePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePP")
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 7, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadePP:
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 7, "RLPlasmaPuff", 0)
    Goto FireFinish
  FirePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePA")
	TNT1 A 0 A_FireBullets (6, 2.5, 7, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadePA:
	TNT1 A 0 A_FireBullets (6, 2.5, 11, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeAA")
	TNT1 A 0 A_FireBullets (5.5, 2, 7, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeAA:
	TNT1 A 0 A_FireBullets (5.5, 2, 11, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireSA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",2,"FireSS")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireBullets (4.5, 1, 6, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (4.5, 1, 10, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireSS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSS")
	TNT1 A 0 A_FireBullets (1, 1, 7, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSS:
	TNT1 A 0 A_FireBullets (1, 1, 11, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSP")
	TNT1 A 0 A_FireBullets (4.5, 1, 6, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSP:
	TNT1 A 0 A_FireBullets (4.5, 1, 10, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireSA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSA")
	TNT1 A 0 A_FireBullets (4, 0.5, 6, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSA:
	TNT1 A 0 A_FireBullets (4, 0.5, 10, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunFirestormMod",2,"FireFF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireFA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6.5, 3, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6.5, 3, 12, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",1,"FireFFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireFFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireFFA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 5, "RLPlasmaPuffFF")
    Goto FireFinish
  FireRenegadeFF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (6.5, 3, 10, 5, "RLPlasmaPuffFF")
    Goto FireFinish
  FireFP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunFirestormMod",2,"FireFFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",1,"FireFSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",2,"FireFPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireFPA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFP")
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 6, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeFP:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 6, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunFirestormMod",2,"FireFFA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",1,"FireFSA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireFPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",2,"FireFAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFA")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6, 2.5, 7, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeFA:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6, 2.5, 11, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunFirestormMod",2,"FireFFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunSniperMod",2,"FireFSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunPowerMod",1,"FireFSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunAgilityMod",1,"FireFSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFS")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 6, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeFS:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 10, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLShotgunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_JumpIfInventory ("RLRenegadeExtraShot", 1, 2)
    TNT1 A 0 A_TakeInventory ("RLPlasmaticShrapnelShotgunClip", 1)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
    TNT1 A 0 A_PlaySound("weapons/plasmaticshotgun", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/plasmaticshotgun", 7, 0.05, 0, 0.20)
    PKSG I 2 A_GunFlash
    PKSG J 2
    PKSG KJI 1
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  Reload:
	TNT1 A 0 A_JumpIfInventory("Shell",1,1)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunClip",1,"Ready")
	PKSG A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunTechnicalMod",1,"Reload1")
    PKSG B 2
    PKSG C 1
    PKSG D 2
    PKSG E 3
    PKSG F 4
	TNT1 A 0 A_PlaySound("weapons/psshotgunpump", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PKSG G 1
	Goto ReloadWorking
  Reload1:
    PKSG B 2
    PKSG C 1
    PKSG D 1
    PKSG E 2
    PKSG F 3
	TNT1 A 0 A_PlaySound("weapons/psshotgunpump", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PKSG G 1
	Goto ReloadWorking
  Reload2:
    PKSG B 2
    PKSG C 1
    PKSG D 1
    PKSG E 1
    PKSG F 2
	TNT1 A 0 A_PlaySound("weapons/psshotgunpump", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PKSG G 1
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelShotgunClip", 1)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunTechnicalMod",1,"ReloadFinish1")
    PKSG H 3
    PKSG G 2
    PKSG F 2
    PKSG E 2
    PKSG D 2
    PKSG C 2
    PKSG B 2
    PKSG A 4
    PKSG A 7 A_ReFire
	Goto Ready
  ReloadFinish1:
    PKSG H 1
    PKSG G 1
    PKSG F 2
    PKSG E 2
    PKSG D 2
    PKSG C 2
    PKSG B 2
    PKSG A 4
    PKSG A 7 A_ReFire
	Goto Ready
  ReloadFinish2:
    PKSG H 1
    PKSG G 1
    PKSG F 1
    PKSG E 1
    PKSG D 1
    PKSG C 2
    PKSG B 2
    PKSG A 4
    PKSG A 7 A_ReFire
	Goto Ready
  Flash:
    SHPS A 2 Bright A_Light1
    SHPS B 2 Bright A_Light2
	TNT1 A 0 A_Light0
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLPlasmaticShrapnelShotgunPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	Goto Ready
  ModDiscombobulation:
	TNT1 A 0 A_Print("Applied Mod pack extracted from discarded weapon.")
	TNT1 A 0 ACS_NamedExecuteAlways("ScavengeMods", 0)
	TNT1 A 3
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunModLimit",1,"ModDiscombobulation")
	TNT1 A 0 A_Print("Mod pack extracted from discarded weapon.")
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	TNT1 A 0 A_Jump(256,1,2)
	TNT1 A 0 A_FireCustomMissile("DroppedRLSniperMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLPlasmaticShrapnelShotgun",1)
	Stop
  }
}

//-------------------------------------------------------------------
//		PROJECTILES

//-------------------------------------------------------------------
//		MECHANICS

Actor RLPlasmaticShrapnelShotgunSelected : RLPermanentInventory {}
Actor RLPlasmaticShrapnelShotgunModLimit : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunPowerMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunBulkMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunAgilityMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunNanoMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunFirestormMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelShotgunSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLPlasmaticShrapnelShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 1
   Inventory.Icon ""
}

//-------------------------------------------------------------------
//		PICKUPS

ACTOR RLPlasmaticShrapnelShotgunPickup : RLBasicAssembledWeaponPickup 17430
{
	//$Sprite PKSGX0
	Tag "Plasmatic Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		PKSG X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	FloorHit:
		"####" "#" 0 A_PlaySound("weapons/gundropmedium")
		"####" "#" 0 A_ScaleVelocity (0.5)
		"####" "#" 0 A_ChangeFlag("SPECIAL", true)
		"####" "#" 0 A_ChangeFlag("THRUACTORS", false)
		"####" "#" 0 A_SetUserVar("user_floorhit", 1)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Stop
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgun",1,"NotPickup") // If the player already has this weapon, they are not given the weapon
		"####" "#" 0 A_JumpIfInventory("RLWeaponLimit",0,"NotPickupLimit") // The absolute max limit check for weapons
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLPlasmaticShrapnelShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvPlasmatic Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickup")
		Goto NotPickup
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/psShotgunpickup")
		Stop
//==============================================================================
	SpecialStartsStuff:
		"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 1, "KeenStuff")
		"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 2, "Duke2Stuff")
		"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 3, "MarathonStuff")
		"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 4, "SuperweaponStuff")
		Goto Spawn+1
	KeenStuff:
		"####" "#" 0 A_SpawnItemEx("RLNeuralStunnerPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	Duke2Stuff:
		"####" "#" 0 A_SpawnItemEx("RLDuke2WeaponCrate",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	SuperweaponStuff:
		"####" "#" 0 A_SpawnItemEx("RLSuperweaponModeSpawner",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLPlasmaticShrapnelShotgunPickupModded : RLPlasmaticShrapnelShotgunPickup
{
	+INVENTORY.TRANSFER
	+DONTGIB
	States
	{
	Spawn:
		TNT1 A 0 NoDelay ACS_NamedExecuteAlways("GetWeaponMods", 0)
		TNT1 A 0 A_JumpIf(CallACS("DRLA_specialstarts") == 0, "NoSpecialStartsStuff")
		"####" "#" 0 A_Jump(256, "SpecialStartsStuff")
		Goto SpecialStartsStuff
		
	SpawnFrame:
		PKSG X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(VelZ <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 0 ACS_NamedExecuteAlways("RLWeaponModDisplay", 0)
		"####" "#" 1
		Loop
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLPlasmaticShrapnelShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvPlasmatic Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLPlasmaticShrapnelShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Shotgun =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Shell",4)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Plasmatic Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
