
ACTOR RLHeavyPlasmaShotgun : RLWeapon
{
  Obituary "%o was removed from play by %k's heavy plasma shotgun."
  Tag "Heavy Plasma Shotgun"
  Weapon.SelectionOrder 20
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLHeavyPlasmaShotgunClip"
  Weapon.AmmoType2 "Cell"
  Inventory.Icon "PLSHICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunNanoMod",1,2)
    PSHO A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",3,2)
    PSHO A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    PSHO A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 30, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 39, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 48, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLHeavyPlasmaShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunNanoMod",2,2)
    PSHO A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    PSHO 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("RLHeavyPlasmaShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLHeavyPlasmaShotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLHeavyPlasmaShotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunNanoMod", 2)
	TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 1 A_TakeInventory("RLHeavyPlasmaShotgun",1)
	Stop
  AfterModDrop:
    PSHO A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    PSHO 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("RLHeavyPlasmaShotgunSelected", 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
    PSHO 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("RLHeavyPlasmaShotgunSelected", 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
    PSHO A 1 A_Raise
    Loop
  Fire:
	PSHO A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	PSHO A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	PSHO A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	PSHO A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	PSHO A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",3, 2)
	Goto Reload
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",1, 1)
	Goto Reload
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunAgilityMod",1,"FirePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunAgilityMod",2,"FireAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4.5,-4.5), 1, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4.5,-4.5), 1, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FirePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPP", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPP", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPPSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadePP:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPP", frandom(5,-5), 1, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPP", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPPSilent", frandom(5,-5), 0, 0, 0, 0, frandom(2,-2))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FirePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePA")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(4.5,-4.5), 1, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPSilent", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadePA:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(4.5,-4.5), 1, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallP", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallPSilent", frandom(4.5,-4.5), 0, 0, 0, 0, frandom(1.5,-1.5))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeAA")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4,-4), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4,-4), 0, 0, 0, 0, frandom(1,-1))
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(4,-4), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeAA:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4,-4), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(4,-4), 0, 0, 0, 0, frandom(1,-1))
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(4,-4), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunAgilityMod",1,"FireSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSS")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(1,-1), 0, 0, 0, 0, 0)
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(1,-1), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeSS:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(1,-1), 0, 0, 0, 0, 0)
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(1,-1), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSP")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeSP:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(3,-3), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSA")
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(2.5,-2.5), 0, 0, 0, 0, 0)
	TNT1 AAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(2.5,-2.5), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireRenegadeSA:
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", 0, 1, 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBall", frandom(2.5,-2.5), 0, 0, 0, 0, 0)
	TNT1 AAAAAAAAA 0 A_FireCustomMissile ("RLHeavyPlasmaShotgunBallSilent", frandom(2.5,-2.5), 0, 0, 0, 0, 0)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHeavyPlasmaShotgunClip", 2, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaShotgunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgun", CHAN_WEAPON, 1.0, 0, 0.9)
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgun2", 7, 1.0, 0, 0.6)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunFirestormMod",2,"FireFinishF2")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunFirestormMod",1,"FireFinishF1")
    PSHO B 5 Bright A_GunFlash
    PSHO CD 5 Bright
    PSHO A 5
    PSHO A 5 A_Refire
    Goto Ready
  FireFinishF1:
    PSHO B 4 Bright A_GunFlash
    PSHO CD 4 Bright
    PSHO A 4
    PSHO A 4 A_Refire
    Goto Ready
  FireFinishF2:
    PSHO B 3 Bright A_GunFlash
    PSHO CD 3 Bright
    PSHO A 3
    PSHO A 3 A_Refire
    Goto Ready
	
  Reload:
	PSHO A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 30, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 39, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip", 48, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunTechnicalMod",1,"Reload1")
    PSHO A 2
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PSHO J 2
    PSHO K 24
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunload", 7)
    PSHO J 2
    PSHO A 2
	Goto ReloadWorking
  Reload1:
    PSHO A 2
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PSHO J 2
    PSHO K 21
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunload", 7)
    PSHO J 2
    PSHO A 2
	Goto ReloadWorking
  Reload2:
    PSHO A 2
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PSHO J 2
    PSHO K 18
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunload", 7)
    PSHO J 2
    PSHO A 2
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Cell", 1)
	TNT1 A 0 A_GiveInventory("RLHeavyPlasmaShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",30,5)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",39,3)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunClip",48,2)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunpump", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunTechnicalMod",1,"ReloadFinish1")
    PSHO E 4
    PSHO F 3
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunspark", 7)
    PSHO F 6 A_GunFlash ("ReloadFlash", GFF_NOEXTCHANGE)
    PSHO F 3
	PSHO E 4
	PSHO A 5
	Goto Ready
  ReloadFinish1:
    PSHO E 3
    PSHO F 3
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunspark", 7)
    PSHO F 6 A_GunFlash ("ReloadFlash", GFF_NOEXTCHANGE)
    PSHO F 3
	PSHO E 3
	PSHO A 4
	Goto Ready
  ReloadFinish2:
    PSHO E 2
    PSHO F 2
    TNT1 A 0 A_PlaySound("weapons/heavyplasmashotgunspark", 7)
    PSHO F 6 A_GunFlash ("ReloadFlash", GFF_NOEXTCHANGE)
    PSHO F 2
	PSHO E 3
	PSHO A 4
	Goto Ready
  Flash:
    TNT1 A 4 A_Light2
    TNT1 A 1 A_Light1
    Goto LightDone
  ReloadFlash:
    PSHO G 2 Bright A_Light (3)
    PSHO H 2 Bright A_Light2
    PSHO I 2 Bright A_Light1
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLHeavyPlasmaShotgunPickup",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("RLHeavyPlasmaShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSelected", 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("RLHeavyShotgunAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLHeavyPlasmaShotgunModLimit",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("RLHeavyPlasmaShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHeavyPlasmaShotgunSelected", 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("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLHeavyPlasmaShotgun",1)
	Stop
  }
}

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

ACTOR RLHeavyPlasmaShotgunBall : PlasmaBall
{
	Species "Player"
	+THRUSPECIES
	+THRUGHOST
	+FORCEXYBILLBOARD
	Radius 4
	Height 2
	Alpha 0.85
	Scale 0.15
	Speed 50
	Damage (random(1,8)*5)
	Damagetype "Plasma"
	Decal "BlueBFGLightning"
	SeeSound ""
	DeathSound "weapons/heavyplasmashotgunimpact"
	States
	{
		Spawn:
			PPCS A 0 NoDelay A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PPCS AB 1 Bright
			Loop
		Spawn.Fancy:
			PPCS AB 1 Bright A_SpawnItemEx("RLHeavyPlasmaShotgunBallTrail",-5,0,-2)
			Loop
		Death:
			BBB1 ABCDE 4 Bright
			Stop
	}
}

ACTOR RLHeavyPlasmaShotgunBallTrail
{
	Renderstyle Add
	Scale 0.1
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			PBSH ABCDEFGHIJ 1 A_FadeOut
			Stop
	}
}

ACTOR RLHeavyPlasmaShotgunBallSilent : RLHeavyPlasmaShotgunBall
{
  SeeSound ""
  DeathSound ""
}

ACTOR RLHeavyPlasmaShotgunBallP : RLHeavyPlasmaShotgunBall
{
  Damage (random(1,8)*6)
}

ACTOR RLHeavyPlasmaShotgunBallPSilent : RLHeavyPlasmaShotgunBallP
{
  SeeSound ""
  DeathSound ""
}

ACTOR RLHeavyPlasmaShotgunBallPP : RLHeavyPlasmaShotgunBall
{
  Damage (random(1,8)*7)
}

ACTOR RLHeavyPlasmaShotgunBallPPSilent : RLHeavyPlasmaShotgunBallPP
{
  SeeSound ""
  DeathSound ""
}

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

Actor RLHeavyPlasmaShotgunSelected : RLPermanentInventory {}
Actor RLHeavyPlasmaShotgunModLimit : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunPowerMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunBulkMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunAgilityMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunNanoMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunFirestormMod : RLBasicAssemblyModAmount {}
Actor RLHeavyPlasmaShotgunSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLHeavyPlasmaShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 48
   Inventory.Icon ""
}

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

ACTOR RLHeavyPlasmaShotgunPickup : RLBasicAssembledWeaponPickup 17405
{
	//$Sprite PSHOX0
	Tag "Heavy Plasma Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		PSHO 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("RLHeavyPlasmaShotgun",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("RLHeavyPlasmaShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvHeavy Plasma 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= Heavy Plasma Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/HeavyPlasmaShotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLHeavyPlasmaShotgunPickupModded : RLHeavyPlasmaShotgunPickup
{
	+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:
		PSHO 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("RLHeavyPlasmaShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvHeavy Plasma Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Heavy Plasma Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLHeavyPlasmaShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Heavy Plasma Shotgun =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Cell",30)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Heavy Plasma Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
