
ACTOR RLBattleRifle : RLWeapon
{
  Obituary "%o was riddled by %k's battle rifle."
  Decal BulletChip
  Tag "Battle Rifle"
  Weapon.SelectionOrder 25
  Weapon.SlotNumber 4
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLBattleRifleClip"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "UACRICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleNanoMod",1,"NanoRegenCheck")
    UACR A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"NanoRegenCheckBegin")
    UACR A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    UACR A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
  NanoRegenCheckBegin2:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 20, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 26, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 32, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 38, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 44, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLBattleRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleNanoMod",2,"NanoRegen2")
    UACR A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin2
  NanoRegen2:
    UACR A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin2
	
  ScavengerDrop:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"WeaponDropConfirm")
	TNT1 A 0 A_GiveInventory("RLScavengerDrop",1)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleModLimit",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("RLBattleRifleModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLBattleRiflePickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLBattleRiflePickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLStealthRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSniperRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHighPowerBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBulletstormRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAntiMaterielRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSuperMachinegunConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLBattleRifle",1)
	Stop
	
  AfterModDrop:
    UACR A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    UACR A 1 A_WeaponReady (16)
    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("RLBattleRifleSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    UACR 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("RLBattleRifleSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    UACR A 1 A_Raise
    Loop
	
  Fire:
	TNT1 A 0 A_JumpIfInventory("RLStealthRifleConfirm",1, "AssembleStealthRifle")
	TNT1 A 0 A_JumpIfInventory("RLSniperRifleConfirm",1, "AssembleSniperRifle")
	TNT1 A 0 A_JumpIfInventory("RLHighPowerBattleRifleConfirm",1, "AssembleHighPowerBattleRifle")
	TNT1 A 0 A_JumpIfInventory("RLBulletstormRifleConfirm",1, "AssembleBulletstormRifle")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleConfirm",1, "AssembleAssaultRifleBattleRifle")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonBattleRifleConfirm",1, "AssembleBurstCannonBattleRifle")
	TNT1 A 0 A_JumpIfInventory("RLAntiMaterielRifleConfirm",1, "AssembleAntiMaterielRifle")
	TNT1 A 0 A_JumpIfInventory("RLSuperMachinegunConfirm",1, "AssembleSuperMachinegun")
	TNT1 A 0 A_JumpIfInventory("RLNanoManufactureAmmoBattleRifleConfirm",1, "AssembleNanoManufactureAmmoBattleRifle")
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoBattleRifleConfirm",1, "AssembleDemolitionAmmoBattleRifle")
	
	UACR A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	UACR A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	UACR A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	UACR A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	UACR 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("RLBattleRifleSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FireAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FirePP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",3,"FirePPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FirePPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FirePA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FirePPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FirePAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FirePAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",3,"FireAAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1, 0, -1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FirePPP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",4,"FirePPPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FirePPPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 8, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 8, "RLBulletPuff", 0)
    Goto FireFinish
  FirePPA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",3,"FirePPPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FirePPAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FirePAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FirePPAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",3,"FirePAAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1, 0, -1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1, 0, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireAAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FirePAAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",4,"FireAAAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0.5, 0, -1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0.5, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FirePPPP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 9, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.5, -1, 9, "RLBulletPuff", 0)
    Goto FireFinish
  FirePPPA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 8, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 0, -1, 8, "RLBulletPuff", 0)
    Goto FireFinish
  FirePPAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (1, 0, -1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1, 0, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FirePAAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0.5, 0, -1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0.5, 0, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireAAAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, -1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireSA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSS:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireSSP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireSSA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSSP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FireSPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireSPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSSA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireSPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FireSAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSSP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FireSSPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSSA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FireSSAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSPP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSSPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",3,"FireSPPP")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",1,"FireSPPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSPA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSSPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",2,"FireSPPA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",2,"FireSPAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleSniperMod",2,"FireSSAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRiflePowerMod",1,"FireSPAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAgilityMod",3,"FireSAAA")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSSPP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FireSSAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSSPA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSPPP:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 8, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 8, "RLBulletPuff", 0)
    Goto FireFinish
  FireSPPA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FireSPAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSAAA:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
	
  FireFinish:
    TNT1 A 0 A_PlaySound("weapons/battlerifle", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/battlerifle", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck") // Check for powerups.
  FireFinishPowerupCheckDone: // No valid powerups detected.
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleFirestormMod",2,"FireFinishFF")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleFirestormMod",1,"FireFinishF")
    TNT1 A 0 A_SpawnItemEx ("RLBattleRifleRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Y 1 Bright A_GunFlash
    UACR Z 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,3)
    UACR VB 1
    Goto FireFinishContinue
    UACR WA 1
    Goto FireFinishContinue
  FireFinishF:
    TNT1 A 0 A_SpawnItemEx ("RLUziRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Y 1 Bright A_GunFlash
    UACR Z 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,2)
    UACR V 1
    Goto FireFinishContinue
    UACR W 1
    Goto FireFinishContinue
  FireFinishFF:
    TNT1 A 0 A_SpawnItemEx ("RLThompsonRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Y 1 Bright A_GunFlash
    UACR Z 1 Bright
    Goto FireFinishContinue

//-------------------------------------------------------------------------------------------------
  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("RLBattleRifleFirestormMod",1,"FireFinishFF")
	Goto FireFinishF
//-------------------------------------------------------------------------------------------------
  
  FireFinishContinue:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleAmmochain",0,2)
	TNT1 A 0 A_Jump(256,3)
	TNT1 A 0 A_TakeInventory("RLBattleRifleAmmochain",0)
    TNT1 A 0 A_ReFire
    Goto Ready
	TNT1 A 0 A_GiveInventory("RLBattleRifleAmmochain",1)
    TNT1 A 0 A_ReFire
    Goto Ready
	
  Reload:
	UACR A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 20, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 26, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 32, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 38, "Ready")
	Goto ReloadStartAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip", 44, "Ready")
  ReloadStartAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Clip", 1, 1)
	Goto Ready
  Reload0:
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",4,"Reload4")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",3,"Reload3")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",1,"Reload1")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"ReloadEmpty0")
    UACR N 2
    UACR O 2
    UACR P 2
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Q 2
    UACR R 8
    UACR S 2
    UACR T 2
    UACR U 2
//    TNT1 A 0 A_PlaySound("weapons/battleriflecock", 7)
	Goto ReloadWorking
  ReloadEmpty0:
    UACR C 2
    UACR D 2
    UACR E 2
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR F 2
    UACR G 8
    UACR H 2
    UACR I 2
    UACR J 2
	Goto ReloadWorking
  Reload1:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"ReloadEmpty1")
    UACR N 1
    UACR O 1
    UACR P 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Q 2
    UACR R 8
    UACR S 2
    UACR T 2
    UACR U 2
//    TNT1 A 0 A_PlaySound("weapons/battleriflecock", 7)
	Goto ReloadWorking
  ReloadEmpty1:
    UACR C 1
    UACR D 1
    UACR E 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR F 2
    UACR G 8
    UACR H 2
    UACR I 2
    UACR J 2
	Goto ReloadWorking
  Reload2:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"ReloadEmpty2")
    UACR N 1
    UACR O 1
    UACR P 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Q 2
    UACR R 8
    UACR S 1
    UACR T 1
    UACR U 1
//    TNT1 A 0 A_PlaySound("weapons/battleriflecock", 7)
	Goto ReloadWorking
  ReloadEmpty2:
    UACR C 1
    UACR D 1
    UACR E 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR F 2
    UACR G 8
    UACR H 1
    UACR I 1
    UACR J 1
	Goto ReloadWorking
  Reload3:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"ReloadEmpty3")
    UACR N 1
    UACR O 1
    UACR P 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Q 1
    UACR R 6
    UACR S 1
    UACR T 1
    UACR U 1
//    TNT1 A 0 A_PlaySound("weapons/battleriflecock", 7)
	Goto ReloadWorking
  ReloadEmpty3:
    UACR C 1
    UACR D 1
    UACR E 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR F 1
    UACR G 6
    UACR H 1
    UACR I 1
    UACR J 1
	Goto ReloadWorking
  Reload4:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",1,"ReloadEmpty4")
    UACR N 1
    UACR O 1
    UACR P 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR Q 1
    UACR R 3
    UACR S 1
    UACR T 1
    UACR U 1
//    TNT1 A 0 A_PlaySound("weapons/battleriflecock", 7)
	Goto ReloadWorking
  ReloadEmpty4:
    UACR C 1
    UACR D 1
    UACR E 1
    TNT1 A 0 A_PlaySound("weapons/battlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    UACR F 1
    UACR G 3
    UACR H 1
    UACR I 1
    UACR J 1
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Clip", 1)
	TNT1 A 0 A_GiveInventory("RLBattleRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",20,9)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",26,7)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",3,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",32,5)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleBulkMod",4,2)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",38,3)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleClip",44,2)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Clip",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
    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/battlerifleload", 7)
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",4,"ReloadFinish4")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",3,"ReloadFinish3")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleTechnicalMod",1,"ReloadFinish1")
    UACR K 3
    UACR L 5
    UACR M 3
    UACR A 6
	Goto Ready
  ReloadFinish1:
    UACR K 2
    UACR L 5
    UACR M 2
    UACR A 5
	Goto Ready
  ReloadFinish2:
    UACR K 2
    UACR L 5
    UACR M 2
    UACR A 2
	Goto Ready
  ReloadFinish3:
    UACR K 1
    UACR L 5
    UACR M 1
    UACR A 1
	Goto Ready
  ReloadFinish4:
    UACR K 1
    UACR L 2
    UACR M 1
    UACR A 1
	Goto Ready
	
  Flash:
    TNT1 A 1 A_Light1
    TNT1 A 1 A_Light2
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLBattleRiflePickup",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("RLStealthRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLSniperRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLHighPowerBattleRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLBulletstormRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonBattleRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLAntiMaterielRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLSuperMachinegunConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLNanoManufactureAmmoBattleRifleConfirm",1, "CancelAssembly")
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoBattleRifleConfirm",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("RLStealthRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSniperRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHighPowerBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBulletstormRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAntiMaterielRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSuperMachinegunConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	Goto MisfirePrevention
  ScavengerTime:
	TNT1 A 0 A_JumpIfInventory("RLBattleRifleModLimit",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("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLStealthRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSniperRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLHighPowerBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBulletstormRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLAntiMaterielRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLSuperMachinegunConfirm",1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoBattleRifleConfirm",1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleStealthRifle:
	TNT1 A 0 A_JumpIfInventory("RLStealthRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelBasicGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvStealth Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLStealthRifleConfirm",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("RLStealthRifle",1)
	TNT1 A 0 A_SelectWeapon("RLStealthRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleSniperRifle:
	TNT1 A 0 A_JumpIfInventory("RLSniperRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelBasicGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvSniper Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLSniperRifleConfirm",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("RLSniperRifle",1)
	TNT1 A 0 A_SelectWeapon("RLSniperRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleHighPowerBattleRifle:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerBattleRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelBasicGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvHigh Power Battle Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerBattleRifleConfirm",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("RLHighPowerBattleRifle",1)
	TNT1 A 0 A_SelectWeapon("RLHighPowerBattleRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleBulletstormRifle:
	TNT1 A 0 A_JumpIfInventory("RLBulletstormRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvBulletstorm Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBulletstormRifleConfirm",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("RLBulletstormRifle",1)
	TNT1 A 0 A_SelectWeapon("RLBulletstormRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleAssaultRifleBattleRifle:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvScoped Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleConfirm",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("RLAssaultRifleBattleRifle",1)
	TNT1 A 0 A_SelectWeapon("RLAssaultRifleBattleRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleBurstCannonBattleRifle:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonBattleRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelAdvancedGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvBurst-Fire Rifle \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonBattleRifleConfirm",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("RLBurstCannonBattleRifle",1)
	TNT1 A 0 A_SelectWeapon("RLBurstCannonBattleRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleAntiMaterielRifle:
	TNT1 A 0 A_JumpIfInventory("RLAntiMaterielRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvAnti-materiel 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("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAntiMaterielRifleConfirm",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("RLAntiMaterielRifle",1)
	TNT1 A 0 A_SelectWeapon("RLAntiMaterielRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleSuperMachinegun:
	TNT1 A 0 A_JumpIfInventory("RLSuperMachinegun",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvSuper Machinegun \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("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLSuperMachinegunConfirm",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("RLSuperMachinegun",1)
	TNT1 A 0 A_SelectWeapon("RLSuperMachinegun")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleNanoManufactureAmmoBattleRifle:
	TNT1 A 0 A_JumpIfInventory("RLNanomanufactureAmmoBattleRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvNanomachic Battle 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("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLNanoManufactureAmmoBattleRifleConfirm",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("RLNanoManufactureAmmoBattleRifle",1)
	TNT1 A 0 A_SelectWeapon("RLNanoManufactureAmmoBattleRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  AssembleDemolitionAmmoBattleRifle:
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoBattleRifle",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvDemolition Ammo Battle 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("RLBattleRifleSelected", 1)
    TNT1 A 0 A_TakeInventory("RLBattleRifleModLimit", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRiflePowerMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleBulkMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleAgilityMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleTechnicalMod", 4)
    TNT1 A 0 A_TakeInventory("RLBattleRifleFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLBattleRifleNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoBattleRifleConfirm",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("RLDemolitionAmmoBattleRifle",1)
	TNT1 A 0 A_SelectWeapon("RLDemolitionAmmoBattleRifle")
	TNT1 A 0 A_TakeInventory("RLBattleRifle",1)
	Stop
  }
}

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

Actor RLBattleRifleSelected : RLPermanentInventory {}
Actor RLBattleRifleAmmochain : RLAmmochainDefault {}

Actor RLBattleRifleModLimit : RLStandardModAmount {}
Actor RLBattleRiflePowerMod : RLStandardModAmount {}
Actor RLBattleRifleBulkMod : RLStandardModAmount {}
Actor RLBattleRifleAgilityMod : RLStandardModAmount {}
Actor RLBattleRifleTechnicalMod : RLStandardModAmount {}
Actor RLBattleRifleFirestormMod : RLExoticModAmount {}
Actor RLBattleRifleNanoMod : RLExoticModAmount {}
Actor RLBattleRifleSniperMod : RLExoticModAmount {}

ACTOR RLBattleRifleClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 44
   Inventory.Icon ""
}

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

ACTOR RLBattleRiflePickup : RLStandardWeaponPickup 16806
{
	//$Sprite UACRX0
	Tag "Battle Rifle [Pickup]"
	States
	{
	SpawnFrame:
		UACR 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("RLBattleRifle",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("RLBattleRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cjBattle Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickup")
		Goto NotPickup
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("Clip",0,"NotPickupNothing")
		Goto AmmoPickup
	NotPickupNothing:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Battle Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	AmmoPickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("Clip",0,"NotPickupNothing")
		"####" "#" 1 A_GiveInventory("Clip",20)
		Goto PickupSound
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/BattleRiflepickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonClip",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLBattleRiflePickupModded : RLBattleRiflePickup
{
	+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:
		UACR 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("RLBattleRifle",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("RLBattleRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cjBattle Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Battle Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLBattleRifleModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cj= Battle Rifle =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Clip",20)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cj= Battle Rifle =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
