
ACTOR RLPlasmaRifle : RLWeapon
{
  Obituary "%o was burnt to ashes by %k's plasma rifle."
  Tag "Plasma Rifle"
  Weapon.SelectionOrder 20
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPlasmaRifleClip"
  Weapon.AmmoType2 "Cell"
  Inventory.Icon "PLASICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleNanoMod",1,2)
    PLSR A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",1,2)
    PLSR A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    PLSR A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 40, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 52, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 64, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 76, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 88, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleNanoMod",2,2)
    PLSR A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    PLSR 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_JumpIfInventory("RLPlasmaRifleModLimit",1,2)
	TNT1 A 0 A_Print("Press again to drop current weapon.")
	Goto AfterModDrop
	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("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPlasmaRiflePickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPlasmaRiflePickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_TakeInventory("RLHighPowerPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleMkIIConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRiflePlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRefractorConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaCannonConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHyperBlasterConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 1 A_TakeInventory("RLPlasmaRifle",1)
	Stop
	
  AfterModDrop:
    PLSR A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    PLSR 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("RLPlasmaRifleSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    PLSR 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("RLRapidfireTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLStandardWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    PLSR A 1 A_Raise
    Loop
	
  Fire:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerPlasmaRifleConfirm",1, "AssembleHighPowerPlasmaRifle")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleMkIIConfirm",1, "AssemblePlasmaRifleMkII")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRiflePlasmaRifleConfirm",1, "AssembleAssaultRiflePlasmaRifle")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleConfirm",1, "AssembleBurstCannonPlasmaRifle")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRefractorConfirm",1, "AssemblePlasmaRefractor")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaCannonConfirm",1, "AssemblePlasmaCannon")
	TNT1 A 0 A_JumpIfInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1, "AssembleNanoManufactureAmmoPlasmaRifle")
	TNT1 A 0 A_JumpIfInventory("RLHyperblasterConfirm",1, "AssembleHyperblaster")
	
	PLSR A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	PLSR A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	PLSR A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	PLSR A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	PLSR 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("RLPlasmaRifleSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFire")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBall", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBall", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFire:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBall", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBall", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBall", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBall", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBall", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBall", frandom(29,31), 0)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallP", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallP", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFireP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallP", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallP", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallP", frandom(29,31), 0)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FireAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFireA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallA", frandom(29,31), 0)
    Goto FireFinish
  FirePP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",3,"FirePPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FirePPA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPP", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPP", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPP", frandom(29,31), 0)
    Goto FireFinish
  FirePA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FirePPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FirePAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPA", frandom(29,31), 0)
    Goto FireFinish
  FireAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FirePAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",3,"FireAAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFireAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAA", frandom(29,31), 0)
    Goto FireFinish
  FirePPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",4,"FirePPPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FirePPPA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPP", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPP", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPP", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPP", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPP", frandom(29,31), 0)
    Goto FireFinish
  FirePPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",3,"FirePPPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FirePPAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPA", frandom(29,31), 0)
    Goto FireFinish
  FirePAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FirePPAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",3,"FirePAAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAA", frandom(29,31), 0)
    Goto FireFinish
  FireAAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FirePAAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",4,"FireAAAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireAAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFireAAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAA", frandom(29,31), 0)
    Goto FireFinish
  FirePPPP:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePPPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPPP", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPPP", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePPPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPPP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPP", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPPP", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPP", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPP", frandom(29,31), 0)
    Goto FireFinish
  FirePPPA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePPPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPPA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPPA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePPPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPPA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPPA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPPA", frandom(29,31), 0)
    Goto FireFinish
  FirePPAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePPAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPPAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePPAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPPAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPPAA", frandom(29,31), 0)
    Goto FireFinish
  FirePAAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFirePAAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPAAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallPAAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFirePAAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPAAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallPAAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallPAAA", frandom(29,31), 0)
    Goto FireFinish
  FireAAAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireAAAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAAAA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallAAAA", frandom(-0.2,0.2), 0)
    Goto FireFinish
  XaserFireAAAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAAAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAAA", frandom(29,31), 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallAAAA", frandom(-0.2,0.2), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAAA", frandom(-29,-31), 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallAAAA", frandom(29,31), 0)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireSA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallS", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallS", 0, 0)
    Goto FireFinish
  XaserFireS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallS", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallS", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallS", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallS", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallS", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallS", 30, 0)
    Goto FireFinish
  FireSS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireSSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireSSA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSS", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSS", 0, 0)
    Goto FireFinish
  XaserFireSS:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSS", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSS", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSS", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSS", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSS", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSS", 30, 0)
    Goto FireFinish
  FireSP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FireSPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireSPA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSP", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSP", 0, 0)
    Goto FireFinish
  XaserFireSP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSP", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSP", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSP", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSP", 30, 0)
    Goto FireFinish
  FireSA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSSA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireSPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FireSAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSA", 0, 0)
    Goto FireFinish
  XaserFireSA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSA", 30, 0)
    Goto FireFinish
  FireSSP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FireSSPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSSP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSP", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSP", 0, 0)
    Goto FireFinish
  XaserFireSSP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSP", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSP", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSP", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSP", 30, 0)
    Goto FireFinish
  FireSSA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FireSSAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSSA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSA", 0, 0)
    Goto FireFinish
  XaserFireSSA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSA", 30, 0)
    Goto FireFinish
  FireSPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSSPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",3,"FireSPPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",1,"FireSPPA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPP", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPP", 0, 0)
    Goto FireFinish
  XaserFireSPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPP", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPP", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPP", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPP", 30, 0)
    Goto FireFinish
  FireSPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",2,"FireSPPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",2,"FireSPAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPA", 0, 0)
    Goto FireFinish
  XaserFireSPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPA", 30, 0)
    Goto FireFinish
  FireSAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleSniperMod",2,"FireSSAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRiflePowerMod",1,"FireSPAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAgilityMod",3,"FireSAAA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSAA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSAA", 0, 0)
    Goto FireFinish
  XaserFireSAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSAA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSAA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAA", 30, 0)
    Goto FireFinish
  FireSSPP:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSSPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSPP", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSPP", 0, 0)
    Goto FireFinish
  XaserFireSSPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSPP", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPP", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSPP", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPP", 30, 0)
    Goto FireFinish
  FireSSAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSSAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSAA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSAA", 0, 0)
    Goto FireFinish
  XaserFireSSAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSAA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSAA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSAA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSAA", 30, 0)
    Goto FireFinish
  FireSSPA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSPA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSSPA", 0, 0)
    Goto FireFinish
  XaserFireSSPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSPA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSSPA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSSPA", 30, 0)
    Goto FireFinish
  FireSPPP:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSPPP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPPP", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPPP", 0, 0)
    Goto FireFinish
  XaserFireSPPP:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPPP", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPP", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPPP", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPP", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPP", 30, 0)
    Goto FireFinish
  FireSPPA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSPPA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPPA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPPA", 0, 0)
    Goto FireFinish
  XaserFireSPPA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPPA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPPA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPPA", 30, 0)
    Goto FireFinish
  FireSPAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSPAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPAA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSPAA", 0, 0)
    Goto FireFinish
  XaserFireSPAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPAA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPAA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSPAA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSPAA", 30, 0)
    Goto FireFinish
  FireSAAA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireSAAA")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSAAA", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaBallSAAA", 0, 0)
    Goto FireFinish
  XaserFireSAAA:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSAAA", 0, 1)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAAA", 30, 0)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserPlasmaBallSAAA", 0, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAAA", -30, 0)
	TNT1 A 0 A_FireCustomMissile ("RLXaserSPlasmaBallSAAA", 30, 0)
    Goto FireFinish
	
  FireFinish:
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck") // Check for powerups.
  FireFinishPowerupCheckDone: // No valid powerups detected.
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleState",1,"FireState")
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",2,"FireFinishFF1")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",1,"FireFinishF1")
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifleRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR J 3 Bright A_GunFlash ("Flash")
    Goto FireFinishContinue
  FireFinishF1:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifle2Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR J 2 Bright A_GunFlash ("FlashF")
    Goto FireFinishContinue
  FireFinishFF1:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifle3Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR J 1 Bright A_GunFlash ("FlashFF")
    Goto FireFinishContinue
	
  FireState:
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",2,"FireFinishFF2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",1,"FireFinishF2")
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifleRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR K 3 Bright A_GunFlash ("Flash")
    Goto FireFinishContinue
  FireFinishF2:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifle2Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR K 2 Bright A_GunFlash ("FlashF")
    Goto FireFinishContinue
  FireFinishFF2:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifle3Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR K 1 Bright A_GunFlash ("FlashFF")
    Goto FireFinishContinue
	
  FireFinishContinue:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleAmmochain",0,2)
	TNT1 A 0 A_Jump(256,3)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleAmmochain",0)
    TNT1 A 0 A_ReFire
    Goto FireFinishEnd
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleAmmochain",1)
    TNT1 A 0 A_ReFire
    Goto FireFinishEnd
  FireFinishEnd:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifleCooldownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PKPL ABCDEF 2
    PKPL GFEDCB 1
    PKPL A 2 A_Refire
    Goto Ready

//-------------------------------------------------------------------------------------------------
  FireFinishPowerupCheck: // Marine fires one Firestorm's worth faster while affected by powerups.
	TNT1 A 0 A_JumpIfInventory("PowerInvulnerable",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInvisibility",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerIronFeet",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerLightAmp",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerDrain",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerRLBerserkResistance",1,"FireFinishPowerupCheckConfirmed")
	Goto FireFinishPowerupCheckDone
  FireFinishPowerupCheckConfirmed:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleState",1,3)
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",1,"FireFinishFF1")
	Goto FireFinishF1
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleFirestormMod",1,"FireFinishFF2")
	Goto FireFinishF2
//-------------------------------------------------------------------------------------------------
  
	
  Reload:
	PLSR A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 40, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 52, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 64, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 76, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip", 88, "Ready")
  ReloadStartAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",4,"Reload4")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",3,"Reload3")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",1,"Reload1")
    PLSR C 4
    PLSR D 4
    PLSR E 4
    PLSR F 4
    PLSR G 4
    PLSR H 4
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR I 4 A_PlaySound("weapons/plasmarifleunload", CHAN_ITEM)
    PLSR I 4
	Goto ReloadWorking
  Reload1:
    PLSR C 3
    PLSR D 3
    PLSR E 3
    PLSR F 4
    PLSR G 4
    PLSR H 4
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR I 4 A_PlaySound("weapons/plasmarifleunload", CHAN_ITEM)
    PLSR I 4
	Goto ReloadWorking
  Reload2:
    PLSR C 3
    PLSR D 3
    PLSR E 3
    PLSR F 3
    PLSR G 3
    PLSR H 3
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR I 4 A_PlaySound("weapons/plasmarifleunload", CHAN_ITEM)
    PLSR I 4
	Goto ReloadWorking
  Reload3:
    PLSR C 2
    PLSR D 3
    PLSR E 3
    PLSR F 3
    PLSR G 3
    PLSR H 3
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR I 3 A_PlaySound("weapons/plasmarifleunload", CHAN_ITEM)
    PLSR I 3
	Goto ReloadWorking
  Reload4:
    PLSR C 2
    PLSR D 2
    PLSR E 2
    PLSR F 2
    PLSR G 3
    PLSR H 3
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PLSR I 3 A_PlaySound("weapons/plasmarifleunload", CHAN_ITEM)
    PLSR I 3
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Cell", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",40,9)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",52,7)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",64,5)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",76,3)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleClip",88,2)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
    PLSR I 1
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/plasmarifleload", 7)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",4,"ReloadFinish4")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",3,"ReloadFinish3")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleTechnicalMod",1,"ReloadFinish1")
    PLSR H 4
	PLSR G 4
	PLSR F 4
	PLSR E 4
	PLSR D 4
	PLSR C 4
	Goto Ready
  ReloadFinish1:
    PLSR H 3
	PLSR G 3
	PLSR F 3
	PLSR E 4
	PLSR D 4
	PLSR C 4
	Goto Ready
  ReloadFinish2:
    PLSR H 3
	PLSR G 3
	PLSR F 3
	PLSR E 3
	PLSR D 3
	PLSR C 3
	Goto Ready
  ReloadFinish3:
    PLSR H 2
	PLSR G 2
	PLSR F 2
	PLSR E 3
	PLSR D 3
	PLSR C 3
	Goto Ready
  ReloadFinish4:
    PLSR H 2
	PLSR G 2
	PLSR F 2
	PLSR E 2
	PLSR D 2
	PLSR C 2
	Goto Ready
	
  Flash:
    TNT1 A 2 Bright A_Light2
    TNT1 A 1 Bright A_Light1
    TNT1 A 0 Bright A_Light0
    Goto LightDone
  FlashF:
    TNT1 A 1 Bright A_Light2
    TNT1 A 1 Bright A_Light1
    TNT1 A 0 Bright A_Light0
    Goto LightDone
  FlashFF:
    TNT1 A 1 Bright A_Light (random(1,2))
    TNT1 A 0 Bright A_Light0
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLPlasmaRiflePickup",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")
	TNT1 A 0 A_JumpIfInventory("RLHighPowerPlasmaRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleMkIIConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRiflePlasmaRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRefractorConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaCannonConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLHyperBlasterConfirm",1, "CancelAssembly")
	Goto Ready
  CancelAssembly:
	TNT1 A 0 A_Print("Assembly canceled.")
  CancelAssembly2:
	TNT1 A 0 A_PlaySound("hud/assemblycancel", 5)
	TNT1 A 0 A_TakeInventory("RLHighPowerPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleMkIIConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRiflePlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRefractorConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaCannonConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHyperBlasterConfirm",1)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	Goto MisfirePrevention
  ScavengerTime:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleModLimit",1,"ModDiscombobulation")
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_Print("This weapon cannot be scavenged.")
	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_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleMkIIConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHyperblasterConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRiflePlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRefractorConfirm",1)
	TNT1 A 0 A_TakeInventory("RLPlasmaCannonConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssembleHighPowerPlasmaRifle:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerPlasmaRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelBasicGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvHigh Power Plasma Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPlasmaRifleConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLHighPowerPlasmaRifle",1)
	TNT1 A 0 A_SelectWeapon("RLHighPowerPlasmaRifle")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssemblePlasmaRifleMkII:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRifleMkII",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvPlasma Rifle Mk.II \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleMkIIConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLPlasmaRifleMkII",1)
	TNT1 A 0 A_SelectWeapon("RLPlasmaRifleMkII")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssembleHyperBlaster:
	TNT1 A 0 A_JumpIfInventory("RLHyperblaster",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvHyperblaster \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHyperblasterConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLHyperblaster",1)
	TNT1 A 0 A_SelectWeapon("RLHyperblaster")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssembleAssaultRiflePlasmaRifle:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRiflePlasmaRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvAssault Plasma Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRiflePlasmaRifleConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLAssaultRiflePlasmaRifle",1)
	TNT1 A 0 A_SelectWeapon("RLAssaultRiflePlasmaRifle")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssembleBurstCannonPlasmaRifle:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvBurst Plasma Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifle",1)
	TNT1 A 0 A_SelectWeapon("RLBurstCannonPlasmaRifle")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssemblePlasmaRefractor:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaRefractor",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvPlasma Refractor \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/masterassembly", CHAN_ITEM)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 2)
	TNT1 A 0 A_Jump(256, 2)
    TNT1 A 0 A_PlaySound("technician/laugh", CHAN_VOICE)
    TNT1 A 0 A_PlaySound("weapons/masterassemblyfanfare", CHAN_AUTO)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaRefractorConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLPlasmaRefractor",1)
	TNT1 A 0 A_SelectWeapon("RLPlasmaRefractor")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssemblePlasmaCannon:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaCannon",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvPlasma Cannon \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/masterassembly", CHAN_ITEM)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 2)
	TNT1 A 0 A_Jump(256, 2)
    TNT1 A 0 A_PlaySound("technician/laugh", CHAN_VOICE)
    TNT1 A 0 A_PlaySound("weapons/masterassemblyfanfare", CHAN_AUTO)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaCannonConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLPlasmaCannon",1)
	TNT1 A 0 A_SelectWeapon("RLPlasmaCannon")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  AssembleNanoManufactureAmmoPlasmaRifle:
	TNT1 A 0 A_JumpIfInventory("RLNanomanufactureAmmoPlasmaRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvNanomachic Plasma Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/masterassembly", CHAN_ITEM)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 2)
	TNT1 A 0 A_Jump(256, 2)
    TNT1 A 0 A_PlaySound("technician/laugh", CHAN_VOICE)
    TNT1 A 0 A_PlaySound("weapons/masterassemblyfanfare", CHAN_AUTO)
	TNT1 A 0 A_TakeInventory("RLPlasmaRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPlasmaRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoPlasmaRifleConfirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLNanoManufactureAmmoPlasmaRifle",1)
	TNT1 A 0 A_SelectWeapon("RLNanoManufactureAmmoPlasmaRifle")
	TNT1 A 0 A_TakeInventory("RLPlasmaRifle",1)
	Stop
  }
}

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

ACTOR RLPlasmaBall : PlasmaBall
{
	Species "Player"
	+THRUSPECIES
	+THRUGHOST
	+FORCEXYBILLBOARD
	Decal "PlasmaScorch"
	Alpha 0.85
	Damagetype "Plasma"
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "FancyLoop")
			TNT1 A 0 A_Jump (256, "SpawnLoop")
			Goto SpawnLoop
		SpawnLoop:
			PLSS AB 6 Bright
			Loop
		Death:
			TNT1 A 0 A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "FancyDeath")
			PLSE ABCDE 4 Bright
			Stop

		FancyLoop:
			PLSS AAABBB 1 Bright A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
		FancyDeath:
			PLSE ABCDE 4 Bright
			Stop
	}
}

ACTOR RLPlasmaFancyTrail
{
	Renderstyle Add
	Scale 0.7
	Alpha 0.5
	var int user_pftweave;
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			PLFT A 0 NoDelay A_SetUserVar("user_pftweave", randompick(-1,1))
		Spawn.GoDojo:
			PLFT AAAA 1 Bright A_SetScale(scalex - frandom(0.05,0.1))
			PLFT AAAA 0 A_Weave(user_pftweave,user_pftweave,1,1)
			
			PLFT BBB 1 Bright A_SetScale(scalex - frandom(0.05,0.1))
			PLFT BBB 0 A_Weave(user_pftweave,user_pftweave,1,1)
			
			PLFT CC 1 Bright A_SetScale(scalex - frandom(0.025,0.05))
			PLFT CC 0 A_Weave(user_pftweave,user_pftweave,1,1)
			
			PLFT D 1 Bright A_SetScale(scalex - frandom(0.025,0.05))
			PLFT D 0 A_Weave(user_pftweave,user_pftweave,1,1)
			Stop
	}
}

ACTOR RLPlasmaBallP : RLPlasmaBall
{
  Damage 6
}

ACTOR RLPlasmaBallA : RLPlasmaBall
{
  Speed 35
}

ACTOR RLPlasmaBallPP : RLPlasmaBall
{
  Damage 7
}

ACTOR RLPlasmaBallPA : RLPlasmaBall
{
  Speed 35
  Damage 6
}

ACTOR RLPlasmaBallAA : RLPlasmaBall
{
  Speed 45
}

ACTOR RLPlasmaBallPPP : RLPlasmaBall
{
  Damage 8
}

ACTOR RLPlasmaBallPPA : RLPlasmaBall
{
  Speed 35
  Damage 7
}

ACTOR RLPlasmaBallPAA : RLPlasmaBall
{
  Speed 45
  Damage 6
}

ACTOR RLPlasmaBallAAA : RLPlasmaBall
{
  Speed 55
}

ACTOR RLPlasmaBallPPPP : RLPlasmaBall
{
  Damage 9
}

ACTOR RLPlasmaBallPPPA : RLPlasmaBall
{
  Speed 35
  Damage 8
}

ACTOR RLPlasmaBallPPAA : RLPlasmaBall
{
  Speed 45
  Damage 7
}

ACTOR RLPlasmaBallPAAA : RLPlasmaBall
{
  Speed 55
  Damage 6
}

ACTOR RLPlasmaBallAAAA : RLPlasmaBall
{
  Speed 65
}

ACTOR RLPlasmaBallS : RLPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.10)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLPlasmaBallSS : RLPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.25)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLPlasmaBallSP : RLPlasmaBallS
{
  Damage 6
}

ACTOR RLPlasmaBallSA : RLPlasmaBallS
{
  Speed 35
}

ACTOR RLPlasmaBallSPP : RLPlasmaBallS
{
  Damage 7
}

ACTOR RLPlasmaBallSSA : RLPlasmaBallSS
{
  Speed 35
}

ACTOR RLPlasmaBallSSP : RLPlasmaBallSS
{
  Damage 6
}

ACTOR RLPlasmaBallSPA : RLPlasmaBallS
{
  Speed 35
  Damage 6
}

ACTOR RLPlasmaBallSAA : RLPlasmaBallS
{
  Speed 45
}

ACTOR RLPlasmaBallSSPP : RLPlasmaBallSS
{
  Damage 7
}

ACTOR RLPlasmaBallSSAA : RLPlasmaBallSS
{
  Speed 45
}

ACTOR RLPlasmaBallSSPA : RLPlasmaBallSS
{
  Speed 35
  Damage 6
}

ACTOR RLPlasmaBallSPPP : RLPlasmaBallS
{
  Damage 8
}

ACTOR RLPlasmaBallSPPA : RLPlasmaBallS
{
  Speed 35
  Damage 7
}

ACTOR RLPlasmaBallSPAA : RLPlasmaBallS
{
  Speed 45
  Damage 6
}

ACTOR RLPlasmaBallSAAA : RLPlasmaBallS
{
  Speed 55
}

ACTOR RLWWPlasmaBall : RLPlasmaBall
{
  Damage 8
}

ACTOR RLWWPlasmaBallA : RLPlasmaBallA
{
  Damage 8
}

ACTOR RLWWPlasmaBallP : RLPlasmaBallP
{
  Damage 9
}

//-------------------------------------------------------------------
//		XASER PROJECTILES

ACTOR RLXaserPlasmaBall : RLPlasmaBall
{
  Scale 0.9
  SeeSound "weapons/xaserplasma"
}

ACTOR RLXaserPlasmaBallP : RLXaserPlasmaBall
{
  Damage 6
}

ACTOR RLXaserPlasmaBallA : RLXaserPlasmaBall
{
  Speed 35
}

ACTOR RLXaserPlasmaBallPP : RLXaserPlasmaBall
{
  Damage 7
}

ACTOR RLXaserPlasmaBallPA : RLXaserPlasmaBall
{
  Speed 35
  Damage 6
}

ACTOR RLXaserPlasmaBallAA : RLXaserPlasmaBall
{
  Speed 45
}

ACTOR RLXaserPlasmaBallPPP : RLXaserPlasmaBall
{
  Damage 8
}

ACTOR RLXaserPlasmaBallPPA : RLXaserPlasmaBall
{
  Speed 35
  Damage 7
}

ACTOR RLXaserPlasmaBallPAA : RLXaserPlasmaBall
{
  Speed 45
  Damage 6
}

ACTOR RLXaserPlasmaBallAAA : RLXaserPlasmaBall
{
  Speed 55
}

ACTOR RLXaserPlasmaBallPPPP : RLXaserPlasmaBall
{
  Damage 9
}

ACTOR RLXaserPlasmaBallPPPA : RLXaserPlasmaBall
{
  Speed 35
  Damage 8
}

ACTOR RLXaserPlasmaBallPPAA : RLXaserPlasmaBall
{
  Speed 45
  Damage 7
}

ACTOR RLXaserPlasmaBallPAAA : RLXaserPlasmaBall
{
  Speed 55
  Damage 6
}

ACTOR RLXaserPlasmaBallAAAA : RLXaserPlasmaBall
{
  Speed 65
}

ACTOR RLXaserPlasmaBallS : RLXaserPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.10)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserPlasmaBallSS : RLXaserPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.25)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserPlasmaBallSP : RLXaserPlasmaBallS
{
  Damage 6
}

ACTOR RLXaserPlasmaBallSA : RLXaserPlasmaBallS
{
  Speed 35
}

ACTOR RLXaserPlasmaBallSPP : RLXaserPlasmaBallS
{
  Damage 7
}

ACTOR RLXaserPlasmaBallSSA : RLXaserPlasmaBallSS
{
  Speed 35
}

ACTOR RLXaserPlasmaBallSSP : RLXaserPlasmaBallSS
{
  Damage 6
}

ACTOR RLXaserPlasmaBallSPA : RLXaserPlasmaBallS
{
  Speed 35
  Damage 6
}

ACTOR RLXaserPlasmaBallSAA : RLXaserPlasmaBallS
{
  Speed 45
}

ACTOR RLXaserPlasmaBallSSPP : RLXaserPlasmaBallSS
{
  Damage 7
}

ACTOR RLXaserPlasmaBallSSAA : RLXaserPlasmaBallSS
{
  Speed 45
}

ACTOR RLXaserPlasmaBallSSPA : RLXaserPlasmaBallSS
{
  Speed 35
  Damage 6
}

ACTOR RLXaserPlasmaBallSPPP : RLXaserPlasmaBallS
{
  Damage 8
}

ACTOR RLXaserPlasmaBallSPPA : RLXaserPlasmaBallS
{
  Speed 35
  Damage 7
}

ACTOR RLXaserPlasmaBallSPAA : RLXaserPlasmaBallS
{
  Speed 45
  Damage 6
}

ACTOR RLXaserPlasmaBallSAAA : RLXaserPlasmaBallS
{
  Speed 55
}

//-------------------------------------------------------------------
//		XASER SILENT PROJECTILES

ACTOR RLXaserSPlasmaBall : RLPlasmaBall
{
  Scale 0.75
  SeeSound ""
}

ACTOR RLXaserSPlasmaBallP : RLXaserSPlasmaBall
{
  Damage 6
}

ACTOR RLXaserSPlasmaBallA : RLXaserSPlasmaBall
{
  Speed 35
}

ACTOR RLXaserSPlasmaBallPP : RLXaserSPlasmaBall
{
  Damage 7
}

ACTOR RLXaserSPlasmaBallPA : RLXaserSPlasmaBall
{
  Speed 35
  Damage 6
}

ACTOR RLXaserSPlasmaBallAA : RLXaserSPlasmaBall
{
  Speed 45
}

ACTOR RLXaserSPlasmaBallPPP : RLXaserSPlasmaBall
{
  Damage 8
}

ACTOR RLXaserSPlasmaBallPPA : RLXaserSPlasmaBall
{
  Speed 35
  Damage 7
}

ACTOR RLXaserSPlasmaBallPAA : RLXaserSPlasmaBall
{
  Speed 45
  Damage 6
}

ACTOR RLXaserSPlasmaBallAAA : RLXaserSPlasmaBall
{
  Speed 55
}

ACTOR RLXaserSPlasmaBallPPPP : RLXaserSPlasmaBall
{
  Damage 9
}

ACTOR RLXaserSPlasmaBallPPPA : RLXaserSPlasmaBall
{
  Speed 35
  Damage 8
}

ACTOR RLXaserSPlasmaBallPPAA : RLXaserSPlasmaBall
{
  Speed 45
  Damage 7
}

ACTOR RLXaserSPlasmaBallPAAA : RLXaserSPlasmaBall
{
  Speed 55
  Damage 6
}

ACTOR RLXaserSPlasmaBallAAAA : RLXaserSPlasmaBall
{
  Speed 65
}

ACTOR RLXaserSPlasmaBallS : RLXaserSPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.10)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserSPlasmaBallSS : RLXaserSPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.25)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserSPlasmaBallSP : RLXaserSPlasmaBallS
{
  Damage 6
}

ACTOR RLXaserSPlasmaBallSA : RLXaserSPlasmaBallS
{
  Speed 35
}

ACTOR RLXaserSPlasmaBallSPP : RLXaserSPlasmaBallS
{
  Damage 7
}

ACTOR RLXaserSPlasmaBallSSA : RLXaserSPlasmaBallSS
{
  Speed 35
}

ACTOR RLXaserSPlasmaBallSSP : RLXaserSPlasmaBallSS
{
  Damage 6
}

ACTOR RLXaserSPlasmaBallSPA : RLXaserSPlasmaBallS
{
  Speed 35
  Damage 6
}

ACTOR RLXaserSPlasmaBallSAA : RLXaserSPlasmaBallS
{
  Speed 45
}

ACTOR RLXaserSPlasmaBallSSPP : RLXaserSPlasmaBallSS
{
  Damage 7
}

ACTOR RLXaserSPlasmaBallSSAA : RLXaserSPlasmaBallSS
{
  Speed 45
}

ACTOR RLXaserSPlasmaBallSSPA : RLXaserSPlasmaBallSS
{
  Speed 35
  Damage 6
}

ACTOR RLXaserSPlasmaBallSPPP : RLXaserSPlasmaBallS
{
  Damage 8
}

ACTOR RLXaserSPlasmaBallSPPA : RLXaserSPlasmaBallS
{
  Speed 35
  Damage 7
}

ACTOR RLXaserSPlasmaBallSPAA : RLXaserSPlasmaBallS
{
  Speed 45
  Damage 6
}

ACTOR RLXaserSPlasmaBallSAAA : RLXaserSPlasmaBallS
{
  Speed 55
}

//-------------------------------------------------------------------
//		SHARPSHOOTER PROJECTILES

ACTOR RLPlasmaBallSharpshooter : RLPlasmaBall
{
  Damage (40)
}

ACTOR RLPlasmaBallPSharpshooter : RLPlasmaBallSharpshooter
{
  Damage (48)
}

ACTOR RLPlasmaBallASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 35
}

ACTOR RLPlasmaBallPPSharpshooter : RLPlasmaBallSharpshooter
{
  Damage (56)
}

ACTOR RLPlasmaBallPASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 35
  Damage (48)
}

ACTOR RLPlasmaBallAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 45
}

ACTOR RLPlasmaBallPPPSharpshooter : RLPlasmaBallSharpshooter
{
  Damage (64)
}

ACTOR RLPlasmaBallPPASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 35
  Damage (56)
}

ACTOR RLPlasmaBallPAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 45
  Damage (48)
}

ACTOR RLPlasmaBallAAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 55
}

ACTOR RLPlasmaBallPPPPSharpshooter : RLPlasmaBallSharpshooter
{
  Damage (72)
}

ACTOR RLPlasmaBallPPPASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 35
  Damage (64)
}

ACTOR RLPlasmaBallPPAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 45
  Damage (56)
}

ACTOR RLPlasmaBallPAAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 55
  Damage (48)
}

ACTOR RLPlasmaBallAAAASharpshooter : RLPlasmaBallSharpshooter
{
  Speed 65
}

ACTOR RLPlasmaBallSSharpshooter : RLPlasmaBallSharpshooter
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.10)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.10)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLPlasmaBallSSSharpshooter : RLPlasmaBallSharpshooter
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PLSS AB 2 Bright A_ScaleVelocity(1.25)
			Loop
		Spawn.Fancy:
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS A 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			PLSS B 1 Bright A_ScaleVelocity(1.25)
			"####" "#" 0 A_CustomMissile("RLNuclearPlasmaPistolFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLPlasmaBallSPSharpshooter : RLPlasmaBallSSharpshooter
{
  Damage (48)
}

ACTOR RLPlasmaBallSASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 35
}

ACTOR RLPlasmaBallSPPSharpshooter : RLPlasmaBallSSharpshooter
{
  Damage (56)
}

ACTOR RLPlasmaBallSSASharpshooter : RLPlasmaBallSSSharpshooter
{
  Speed 35
}

ACTOR RLPlasmaBallSSPSharpshooter : RLPlasmaBallSSSharpshooter
{
  Damage (48)
}

ACTOR RLPlasmaBallSPASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 35
  Damage (48)
}

ACTOR RLPlasmaBallSAASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 45
}

ACTOR RLPlasmaBallSSPPSharpshooter : RLPlasmaBallSSSharpshooter
{
  Damage (56)
}

ACTOR RLPlasmaBallSSAASharpshooter : RLPlasmaBallSSSharpshooter
{
  Speed 45
}

ACTOR RLPlasmaBallSSPASharpshooter : RLPlasmaBallSSSharpshooter
{
  Speed 35
  Damage (48)
}

ACTOR RLPlasmaBallSPPPSharpshooter : RLPlasmaBallSSharpshooter
{
  Damage (64)
}

ACTOR RLPlasmaBallSPPASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 35
  Damage (56)
}

ACTOR RLPlasmaBallSPAASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 45
  Damage (48)
}

ACTOR RLPlasmaBallSAAASharpshooter : RLPlasmaBallSSharpshooter
{
  Speed 55
}

ACTOR RLWWPlasmaBallSharpshooter : RLPlasmaBallSharpshooter
{
  Damage (64)
}

ACTOR RLWWPlasmaBallASharpshooter : RLPlasmaBallASharpshooter
{
  Damage (64)
}

ACTOR RLWWPlasmaBallPSharpshooter : RLPlasmaBallPSharpshooter
{
  Damage (72)
}

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

Actor RLPlasmaRifleSelected : RLPermanentInventory {}
Actor RLPlasmaRifleState : RLPermanentInventory {}
Actor RLPlasmaRifleAmmochain : RLAmmochainDefault {}

Actor RLPlasmaRifleModLimit : RLStandardModAmount {}
Actor RLPlasmaRiflePowerMod : RLStandardModAmount {}
Actor RLPlasmaRifleBulkMod : RLStandardModAmount {}
Actor RLPlasmaRifleAgilityMod : RLStandardModAmount {}
Actor RLPlasmaRifleTechnicalMod : RLStandardModAmount {}
Actor RLPlasmaRifleFirestormMod : RLExoticModAmount {}
Actor RLPlasmaRifleNanoMod : RLExoticModAmount {}
Actor RLPlasmaRifleSniperMod : RLExoticModAmount {}

ACTOR RLPlasmaRifleClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 88
   Inventory.Icon ""
}

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

ACTOR RLPlasmaRiflePickup : RLStandardWeaponPickup 16808
{
	//$Sprite PLSRX0
	Tag "Plasma Rifle [Pickup]"
	States
	{
	SpawnFrame:
		PLSR X 4
	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("RLSynthFireReload",1,"AmmoPickup") // If the player is holding reload, pickup the gun for ammo.
		"####" "#" 0 A_JumpIfInventory("RLPlasmaRifle",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("RLPlasmaRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cjPlasma Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickupNothing")
		Goto NotPickupNothing
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("Cell",0,"NotPickupNothing")
		Goto AmmoPickup
	NotPickupNothing:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Plasma Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	AmmoPickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("Cell",0,"NotPickupNothing")
		"####" "#" 1 A_GiveInventory("Cell",40)
		Goto PickupSound
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/PlasmaRiflepickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLPlasmaRiflePickupModded : RLPlasmaRiflePickup
{
	+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:
		PLSR X 4
	SpawnLoop:
		"####" "#" 0 A_JumpIf(VelZ <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 0 ACS_NamedExecuteAlways("RLWeaponModDisplay", 0)
		"####" "#" 1
		Loop
		
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLPlasmaRifle",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("RLPlasmaRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cjPlasma Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Plasma Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLPlasmaRifleModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Plasma Rifle =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Cell",40)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cj= Plasma Rifle =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
