
ACTOR RLPlasmaticShrapnelDoubleShotgun : RLWeapon
{
  Obituary "%o was deaded by %k's palsma double shatgern."
  Decal BulletChip
  Tag "Plasmatic Double Shotgun"
  Weapon.SelectionOrder 30
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 2
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPlasmaticShrapnelDoubleShotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "DBLSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunNanoMod",1,2)
    DBLS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
    DBLS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 2, "Ready")
    DBLS A 34 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 2, "Ready")
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunNanoMod",2,2)
    DBLS A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheck+3
    DBLS A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheck+3
	
  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("RLPlasmaticShrapnelDoubleShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPlasmaticShrapnelDoubleShotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPlasmaticShrapnelDoubleShotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgun",1)
	Stop
  AfterModDrop:
    DBLS A 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  MisfirePrevention:
    DBLS 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("RLPlasmaticShrapnelDoubleShotgunSelected", 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
    DBLS 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("RLPlasmaticShrapnelDoubleShotgunSelected", 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
    DBLS A 1 A_Raise
    Loop
  Fire:
	DBLS A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	DBLS A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	DBLS A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	DBLS A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	DBLS A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 2, 2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1, "AltFireNoCheck")
    Goto Reload
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 2, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 2, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 24, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 27, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FirePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 2, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 24, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 27, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",2,"FireAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireBullets (11.5, 7, 14, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11.5, 7, 2, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (11.5, 7, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11.5, 7, 24, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11.5, 7, 27, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FirePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePP")
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 7, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadePP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 24, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 27, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FirePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePA")
	TNT1 A 0 A_FireBullets (11.5, 7, 14, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadePA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (11.5, 7, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11.5, 7, 24, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11.5, 7, 27, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeAA")
	TNT1 A 0 A_FireBullets (11, 6.5, 14, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (11, 6.5, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11, 6.5, 24, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (11, 6.5, 27, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireBullets (10, 5.5, 13, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (10, 5.5, 2, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (10, 5.5, 20, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (10, 5.5, 23, 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, 14, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSS:
	TNT1 A 0 A_FireBullets (1, 1, 21, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSP")
	TNT1 A 0 A_FireBullets (10, 5.5, 13, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSP:
	TNT1 A 0 A_FireBullets (10, 5.5, 20, 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 (9.5, 5, 13, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireRenegadeSA:
	TNT1 A 0 A_FireBullets (9.5, 5, 20, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod",2,"FireFF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireFA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (12, 7.5, 2, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (12, 7.5, 24, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFF:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 5, "RLPlasmaPuffFF")
    Goto FireFinish
  FireRenegadeFF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 5, "RLPlasmaPuffFF")
    Goto FireFinish
  FireFP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFP")
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (12, 7.5, 14, 6, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeFP:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (12, 7.5, 21, 6, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFA")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (11.5, 7, 14, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireRenegadeFA:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (11.5, 7, 21, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
  FireFS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFS")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (10, 5.5, 13, 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_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (10, 5.5, 20, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireFinish
	
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunRecoil", 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 ("RLPlasmaticShrapnelDoubleShotgunClip", 2)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
    TNT1 A 0 A_PlaySound("weapons/plasmaticdoubleshotgun", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/plasmaticdoubleshotgun", 7, 0.05, 0, 0.20)
    DBPS A 2 Bright A_GunFlash
    DBPS B 2 Bright
    DBLS YZA 1
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
	
  Reload:
	TNT1 A 0 A_JumpIfInventory("Shell",2,1)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip",2,"Ready")
	DBLS A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod",1,"Reload1")
    DBLS D 2
    DBLS E 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadDownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS E 1
    DBLS F 1
    DBLS G 1
    DBLS H 1
    DBLS I 1
    DBLS J 1
	TNT1 A 0 A_PlaySound("weapons/psdoubleshotgunopen", CHAN_ITEM)
	TNT1 A 10
    DBLS K 3
    DBLS L 3
    DBLS M 3
	Goto ReloadWorking
  Reload1:
    DBLS D 2
    DBLS E 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadDownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS E 1
    DBLS F 1
    DBLS G 1
    DBLS H 1
    DBLS I 1
    DBLS J 1
	TNT1 A 0 A_PlaySound("weapons/psdoubleshotgunopen", CHAN_ITEM)
	TNT1 A 7
    DBLS K 3
    DBLS L 3
    DBLS M 3
	Goto ReloadWorking
  Reload2:
    DBLS D 2
    DBLS E 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadDownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS E 1
    DBLS F 1
    DBLS G 1
    DBLS H 1
    DBLS I 1
    DBLS J 1
	TNT1 A 0 A_PlaySound("weapons/psdoubleshotgunopen", CHAN_ITEM)
	TNT1 A 4
    DBLS K 3
    DBLS L 3
    DBLS M 3
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip",2,"ReloadFinish")
	Goto ReloadWorking
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod",1,"ReloadFinish1")
    DBLS N 3 A_PlaySound("weapons/psdoubleshotgunload", CHAN_WEAPON)
    DBLS O 3
	TNT1 A 7
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadUpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS P 2 A_PlaySound("weapons/psdoubleshotgunclose", CHAN_ITEM)
    DBLS Q 2
    DBLS R 1
    DBLS S 1
    DBLS A 3
    DBLS A 5 A_ReFire
	Goto Ready
  ReloadFinish1:
    DBLS N 3 A_PlaySound("weapons/psdoubleshotgunload", CHAN_WEAPON)
    DBLS O 3
	TNT1 A 4
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadUpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS P 2 A_PlaySound("weapons/psdoubleshotgunclose", CHAN_ITEM)
    DBLS Q 2
    DBLS R 1
    DBLS S 1
    DBLS A 3
    DBLS A 5 A_ReFire
	Goto Ready
  ReloadFinish2:
    DBLS N 3 A_PlaySound("weapons/psdoubleshotgunload", CHAN_WEAPON)
    DBLS O 3
	TNT1 A 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadUpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    DBLS P 2 A_PlaySound("weapons/psdoubleshotgunclose", CHAN_ITEM)
    DBLS Q 2
    DBLS R 1
    DBLS S 1
    DBLS A 3
    DBLS A 5 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("RLPlasmaticShrapnelDoubleShotgunPickup",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")
  AltfireNoCheck:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1, 1)
	Goto Reload
    DBLS A 3
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod",1,"FireSingleF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",1,"FireSingleS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireSingleP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireSingleA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegade")
	TNT1 A 0 A_FireBullets (8, 5, 7, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, -1, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, -1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegade:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",2,4)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (8, 5, 11, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, 12, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, 14, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",2,"FireSinglePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireSinglePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeP")
	TNT1 A 0 A_FireBullets (8, 5, 7, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, -1, 6, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (8, 5, 11, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, 12, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireSinglePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",2,"FireSingleAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeA")
	TNT1 A 0 A_FireBullets (7.5, 4.5, 7, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (7.5, 4.5, -1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,2)
	TNT1 A 0 A_FireBullets (7.5, 4.5, 11, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (7.5, 4.5, 12, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSinglePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadePP")
	TNT1 A 0 A_FireBullets (8, 5, 7, 7, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadePP:
	TNT1 A 0 A_FireBullets (8, 5, 11, 7, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSinglePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadePA")
	TNT1 A 0 A_FireBullets (7.5, 4.5, 7, 6, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadePA:
	TNT1 A 0 A_FireBullets (7.5, 4.5, 11, 6, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeAA")
	TNT1 A 0 A_FireBullets (7, 4, 7, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeAA:
	TNT1 A 0 A_FireBullets (7, 4, 11, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",2,"FireSingleSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireSingleSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireSingleSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeS")
	TNT1 A 0 A_FireBullets (6, 3, 6, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (6, 3, -1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (6, 3, 10, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (6, 3, 23, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleSS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeSS")
	TNT1 A 0 A_FireBullets (1, 1, 7, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeSS:
	TNT1 A 0 A_FireBullets (1, 1, 11, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeSP")
	TNT1 A 0 A_FireBullets (6, 3, 6, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeSP:
	TNT1 A 0 A_FireBullets (6, 3, 10, 6, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleSA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeSA")
	TNT1 A 0 A_FireBullets (5.5, 2.5, 6, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
    Goto FireSingleFinish
  FireSingleRenegadeSA:
	TNT1 A 0 A_FireBullets (5.5, 2.5, 10, 5, "RLPlasmaPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuff", 0)
  FireSingleF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod",2,"FireSingleFF")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod",1,"FireSingleFS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod",1,"FireSingleFP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod",1,"FireSingleFA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (8, 5, 7, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,1)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (8, 5, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleRenegadeF:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (8, 5, 11, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (8, 5, 12, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleFF:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeFF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (8, 5, 7, 5, "RLPlasmaPuffFF", 0)
    Goto FireSingleFinish
  FireSingleRenegadeFF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (8, 5, 11, 5, "RLPlasmaPuffFF", 0)
    Goto FireSingleFinish
  FireSingleFP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeFP")
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (8, 5, 7, 6, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleRenegadeFP:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (8, 5, 11, 6, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleFA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireSingleRenegadeFA")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (7.5, 4.5, 7, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleRenegadeFA:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (7.5, 4.5, 11, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleFS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFS")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6, 3, 6, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleRenegadeFS:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (6, 3, 10, 5, "RLPlasmaPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLPlasmaPuffF", 0)
    Goto FireSingleFinish
  FireSingleFinish:
    TNT1 A 0 A_SpawnItemEx ("RLShotgunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/psdoubleshotgunsingle", CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunClip",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunState", 1, "FireSingleFinish2")
	TNT1 A 0 A_GiveInventory("RLPlasmaticShrapnelDoubleShotgunState",1)
    DBPS C 2 Bright A_GunFlash
    DBPS D 2 Bright
    DBLS A 3
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1, "Ready")
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  FireSingleFinish2:
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunState",1)
    DBPS E 2 Bright A_GunFlash
    DBPS F 2 Bright
    DBLS A 3
	TNT1 A 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunClip", 1, "Ready")
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    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("RLPlasmaticShrapnelDoubleShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSelected", 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("RLPlasmaticShrapnelDoubleShotgunModLimit",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("RLPlasmaticShrapnelDoubleShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaticShrapnelDoubleShotgunSelected", 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("RLPlasmaticShrapnelDoubleShotgun",1)
	Stop
  }
}

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

Actor RLPlasmaticShrapnelDoubleShotgunSelected : RLPermanentInventory {}
Actor RLPlasmaticShrapnelDoubleShotgunState : RLPermanentInventory {}
Actor RLPlasmaticShrapnelDoubleShotgunModLimit : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunPowerMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunBulkMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunAgilityMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunNanoMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunFirestormMod : RLBasicAssemblyModAmount {}
Actor RLPlasmaticShrapnelDoubleShotgunSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLPlasmaticShrapnelDoubleShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 2
   Inventory.Icon ""
}

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

ACTOR RLPlasmaticShrapnelDoubleShotgunPickup : RLBasicAssembledWeaponPickup 17432
{
	//$Sprite DBLSX0
	Tag "Plasmatic Double Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		DBLS 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("RLPlasmaticShrapnelDoubleShotgun",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("RLPlasmaticShrapnelDoubleShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvPlasmatic Double 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 Double Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/psDoubleShotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLPlasmaticShrapnelDoubleShotgunPickupModded : RLPlasmaticShrapnelDoubleShotgunPickup
{
	+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:
		DBLS 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("RLPlasmaticShrapnelDoubleShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvPlasmatic Double Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Double Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLPlasmaticShrapnelDoubleShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Plasmatic Double 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 Double Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
