
ACTOR RLPlasmaticShrapnelCombatShotgun : RLWeapon
{
  Obituary "%o was shredded by %k's combat shotgun."
  Decal BulletChip
  Tag "Plasmatic Combat Shotgun"
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPlasmaticShrapnelCombatShotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "COMSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunNanoMod",1,2)
    CSHO A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip",1,2)
    CSHO A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    CSHO A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 5, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 6, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 7, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelCombatShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunNanoMod",2,2)
    CSHO A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    CSHO A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+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("RLPlasmaticShrapnelCombatShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPlasmaticShrapnelCombatShotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPlasmaticShrapnelCombatShotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLPlasmaticShrapnelCombatShotgun",1)
	Stop
  AfterModDrop:
    CSHO A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    CSHO 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("RLPlasmaticShrapnelCombatShotgunSelected", 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
    CSHO 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("RLPlasmaticShrapnelCombatShotgunSelected", 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
    CSHO A 1 A_Raise
    Loop
  Fire:
	CSHO A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	CSHO A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	CSHO A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	CSHO A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	CSHO A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfNoAmmo("Reload")
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunFirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegade:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod",1,"FirePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeP:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod",2,"FireAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 AAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeA:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FirePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePP")
	TNT1 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*7)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadePP:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*7)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FirePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePA")
	TNT1 AAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadePA:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeAA")
	TNT1 AAAAAAA 0 A_FireBullets (3.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeAA:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (3.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod",1,"FireSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 AAAAAA 0 A_FireBullets (2.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeS:
	TNT1 AAAAAAAAAA 0 A_FireBullets (2.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSS")
	TNT1 AAAAAAA 0 A_FireBullets (1, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeSS:
	TNT1 AAAAAAAAAAA 0 A_FireBullets (1, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSP")
	TNT1 AAAAAA 0 A_FireBullets (2.5, 10, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeSP:
	TNT1 AAAAAAAAAA 0 A_FireBullets (2.5, 0, -1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*6)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSA")
	TNT1 AAAAAA 0 A_FireBullets (2, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeSA:
	TNT1 AAAAAAAAAA 0 A_FireBullets (2, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuff", FBF_NORANDOM)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunFirestormMod",2,"FireFF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunSniperMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunPowerMod",1,"FireFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod",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 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireFF:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 128)
	TNT1 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuffFF", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeFF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 128)
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*5)-1, "RLPlasmaPuffFF", FBF_NORANDOM)
    Goto FireFinish
  FireFP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFP")
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*6)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeFP:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4.5, 1, -1, (random(1,3)*6)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireFA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFA")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeFA:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAAAAAA 0 A_FireBullets (4, 0.5, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireFS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFS")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAA 0 A_FireBullets (2.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireRenegadeFS:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NOPITCH | FBF_NORANDOM, 96)
	TNT1 AAAAAAAAAAA 0 A_FireBullets (2.5, 0, -1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
	TNT1 A 0 A_FireBullets (0, 0, 1, (random(1,3)*5)-1, "RLPlasmaPuffF", FBF_NORANDOM)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunRecoil", 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 ("RLPlasmaticShrapnelCombatShotgunClip", 1, TIF_NOTAKEINFINITE)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
    TNT1 A 0 A_PlaySound("weapons/plasmaticcombatshotgun", CHAN_WEAPON, 1, 0, 0.6)
    TNT1 A 0 A_PlaySound("weapons/plasmaticcombatshotgun", 7, 0.05, 0, 0.20)
    CSPS A 2 Bright A_GunFlash
    CSPS B 2 Bright
    CSHO M 3
    CSHO RS 2
	TNT1 A 0 A_JumpIfNoAmmo(1)
    Goto FireFinishContinue
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1)
    Goto Ready
  FireFinishContinue:
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    CSHO D 3
    CSHO E 3 A_PlaySound("weapons/pscombatshotgunpump", CHAN_ITEM)
    CSHO D 3
    CSHO A 3
    Goto Ready
  Reload:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunReloadSequence",1,"ReloadWorking")
	CSHO A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 5, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 6, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip", 7, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
	Goto Ready
	CSHO A 1
    CSHO FG 2
    CSHO H 2
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelCombatShotgunReloadSequence", 1)
	TNT1 A 0 A_JumpIfInventory("Shell",1,1)
	Goto ReloadFinish
	TNT1 A 0 A_TakeInventory("Shell", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelCombatShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip",5, "ReloadFinishing")
	Goto ReloadTechnical
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip",6, "ReloadFinishing")
	Goto ReloadTechnical
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunClip",7, "ReloadFinishing")
	Goto ReloadTechnical
  ReloadFinishing:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelCombatShotgunReloadDone", 1)
	TNT1 A 0 // Play the reload animation.
  ReloadTechnical:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod",1,"Reload1")
  Reload0:
    CSHO N 4 A_PlaySound("weapons/pscombatshotgunload", CHAN_ITEM)
    CSHO O 4
    CSHO P 4
    CSHO Q 2
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunReloadDone",1,"ReloadFinish")
	CSHO Q 2 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB | WRF_NOSWITCH | WRF_ALLOWRELOAD)
	Goto ReloadFinish
  Reload1:
    CSHO N 3 A_PlaySound("weapons/pscombatshotgunload", CHAN_ITEM)
    CSHO O 3
    CSHO P 3
    CSHO Q 2
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunReloadDone",1,"ReloadFinish")
	CSHO Q 2 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB | WRF_NOSWITCH | WRF_ALLOWRELOAD)
	Goto ReloadFinish
  Reload2:
    CSHO N 2 A_PlaySound("weapons/pscombatshotgunload", CHAN_ITEM)
    CSHO O 2
    CSHO P 3
    CSHO Q 1
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunReloadDone",1,"ReloadFinish")
	CSHO Q 2 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB | WRF_NOSWITCH | WRF_ALLOWRELOAD)
	Goto ReloadFinish
  ReloadFinish:
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunReloadSequence", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunReloadDone", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod",1,"ReloadFinish1")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1,1)
	Goto ReloadFinish+12
    CSHO I 2
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    CSHO J 2 A_PlaySound("weapons/pscombatshotgunpump", 7)
    CSHO K 2
    CSHO L 2
    CSHO K 2
    CSHO J 2
    CSHO I 2
    CSHO H 2
    CSHO G 2
    CSHO F 2
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1)
    CSHO A 7 A_ReFire
	Goto Ready
  ReloadFinish1:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1,1)
	Goto ReloadFinish1+8
    CSHO I 1
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    CSHO J 1 A_PlaySound("weapons/pscombatshotgunpump", 7)
    CSHO K 1
    CSHO L 2
    CSHO K 2
    CSHO J 2
    CSHO I 2
    CSHO H 2
    CSHO G 2
    CSHO F 2
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1)
    CSHO A 7 A_ReFire
	Goto Ready
  ReloadFinish2:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1,1)
	Goto ReloadFinish2+8
    CSHO I 1
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunPumpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    CSHO J 1 A_PlaySound("weapons/pscombatshotgunpump", 7)
    CSHO K 1
    CSHO L 1
    CSHO K 1
    CSHO J 1
    CSHO I 2
    CSHO H 2
    CSHO G 2
    CSHO F 2
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFinalPump",1)
    CSHO A 7 A_ReFire
	Goto Ready
	
  Flash:
    TNT1 A 2 A_Light1
    TNT1 A 2 A_Light2
	TNT1 A 0 A_Light0
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLPlasmaticShrapnelCombatShotgunPickup",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("RLPlasmaticShrapnelCombatShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSelected", 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("RLPlasmaticShrapnelCombatShotgunModLimit",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("RLPlasmaticShrapnelCombatShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelCombatShotgunSelected", 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("RLPlasmaticShrapnelCombatShotgun",1)
	Stop
  }
}

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

Actor RLPlasmaticShrapnelCombatShotgunSelected : RLPermanentInventory {}
Actor RLPlasmaticShrapnelCombatShotgunReloadDone : RLPermanentInventory {}
Actor RLPlasmaticShrapnelCombatShotgunFinalPump : RLPermanentInventory {}
Actor RLPlasmaticShrapnelCombatShotgunReloadSequence : RLPermanentInventory {}
Actor RLPlasmaticShrapnelCombatShotgunModLimit : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunPowerMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunBulkMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunAgilityMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunNanoMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunFirestormMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelCombatShotgunSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLPlasmaticShrapnelCombatShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 7
   Inventory.Icon ""
}

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

ACTOR RLPlasmaticShrapnelCombatShotgunPickup : RLBasicAssembledWeaponPickup 17431
{
	//$Sprite CSHOX0
	Tag "Plasmatic Combat Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		CSHO 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("RLPlasmaticShrapnelCombatShotgun",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("RLPlasmaticShrapnelCombatShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvPlasmatic Combat 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 Combat Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/psCombatShotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLPlasmaticShrapnelCombatShotgunPickupModded : RLPlasmaticShrapnelCombatShotgunPickup
{
	+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:
		CSHO 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("RLPlasmaticShrapnelCombatShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvPlasmatic Combat Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Combat Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLPlasmaticShrapnelCombatShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Combat Shotgun =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Shell",5)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Plasmatic Combat Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
