
ACTOR RLAssaultRifleBattleRifle : RLWeapon
{
  Obituary "%o was sniped by %k's scoped rifle."
  Decal BulletChip
  Tag "Scoped Rifle"
  Weapon.SelectionOrder 25
  Weapon.SlotNumber 4
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLAssaultRifleBattleRifleClip"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "SCOPICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleNanoMod",1,"NanoRegenCheck")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,2)
    SCOP A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto Ready+1
    ZOOM A 1 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOBOB)
    Goto Ready+1
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"NanoRegenCheckZoomed")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 1, 2)
    SCOP A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckLoop
    SCOP A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckLoop
  NanoRegenCheckLoop:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 20, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLAssaultRifleBattleRifleClip", 1)
    SCOP A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckLoop
  NanoRegenCheckZoomed:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 1, 2)
    ZOOM B 70 Bright A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOBOB)
	Goto NanoRegenCheckZoomedLoop
    ZOOM A 70 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOBOB)
	Goto NanoRegenCheckZoomedLoop
  NanoRegenCheckZoomedLoop:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 20, "Ready")
	Goto NanoRegenZoomed
  NanoRegenZoomed:
	TNT1 A 0 A_GiveInventory("RLAssaultRifleBattleRifleClip", 1)
    ZOOM A 17 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOBOB)
    Goto NanoRegenCheckZoomedLoop
	
  ReadyAfterFire:
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"ReadyAfterFireInfinite")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleFirestormMod",1,"ReadyAfterFireF")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,3)
    SCOP A 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    SCOP A 10 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
    ZOOM B 14 Bright A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    ZOOM A 10 Bright A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
  ReadyAfterFireF:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,3)
    SCOP A 7 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    SCOP A 10 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
    ZOOM B 7 Bright A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    ZOOM A 10 Bright A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
	
  ReadyAfterFireInfinite:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleFirestormMod",1,"ReadyAfterFireInfiniteF")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,3)
    SCOP A 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    SCOP A 10 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
    ZOOM B 14 Bright A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    ZOOM A 10 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
  ReadyAfterFireInfiniteF:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,3)
    SCOP A 7 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    SCOP A 10 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
    ZOOM B 7 Bright A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    ZOOM A 10 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
	
  ScavengerDrop:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"WeaponDropConfirm")
	TNT1 A 0 A_GiveInventory("RLScavengerDrop",1)
	TNT1 A 0 A_Print("Press again to drop current weapon,\nor press \crAlt Fire\c- to scrap it to retrieve a Mod Pack.")
	Goto AfterModDrop
  WeaponDropConfirm:
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLAssaultRifleBattleRiflePickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLAssaultRifleBattleRiflePickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLAssaultRifleBattleRifle",1)
	Stop
  AfterModDrop:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,2)
    SCOP A 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleNanoMod",1,2)
    ZOOM A 8 Bright A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD | WRF_NOBOB)
    Goto Ready
    ZOOM A 8 Bright A_WeaponReady (WRF_NOSECONDARY | WRF_NOBOB)
    Goto Ready
  MisfirePrevention:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,3)
    SCOP A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
    ZOOM B 1 Bright 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("RLAssaultRifleBattleRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	Goto DeselectLoop
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    SCOP 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("RLAdvancedAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLSingleShotRifleTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLAssaultRifleBattleRifleSelected", 1)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 1)
    Goto SelectLoop
	TNT1 A 0 A_GiveInventory("PowerRLTechnicianAdvancedDamage", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    SCOP A 1 A_Raise
    Loop
  Fire:
	SCOP A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	SCOP A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	SCOP A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	SCOP A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	SCOP 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("RLAssaultRifleBattleRifleSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRiflePowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleAgilityMod",1,"FireA")
	TNT1 A 0 A_FireBullets (0, 0, -1, 15, "RLBulletPuff")
    Goto FireFinish
  FireP:
	TNT1 A 0 A_FireBullets (0, 0, -1, 20, "RLBulletPuff")
    Goto FireFinish
  FireA:
	TNT1 A 0 A_FireBullets (0, 0, -1, 15, "RLBulletPuff")
    Goto FireFinish
  FireS:
	TNT1 A 0 A_FireBullets (0, 0, 1, 15, "RLBulletPuff")
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLPistolRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/scopedrifle", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/scopedrifle", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"FireFinishZoomed")
    SCOP B 2 Bright A_GunFlash
    SCOP C 2 Bright
    SCOP D 2
    Goto ReadyAfterFire
  FireFinishZoomed:
    ZOOM B 6 Bright A_GunFlash
    Goto ReadyAfterFire
  ReloadCheckZoomed:
	TNT1 A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	Goto Reload+3
  Reload:
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"ReloadCheckZoomed")
	SCOP A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 20, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip", 26, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Clip", 1, 1)
	Goto Ready
	TNT1 A 0 A_JumpIf(CallACS("DRLA_ScopeStay"), 2)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleTechnicalMod",1,"Reload1")
    SCOP E 2
    SCOP F 2
    SCOP G 2
    SCOP H 2
    SCOP I 2
    SCOP J 2
    SCOP K 2
    SCOP L 2
    SCOP M 2
    SCOP N 2
    TNT1 A 0 A_PlaySound("weapons/assaultbattlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SCOP O 22
	Goto ReloadWorking
  Reload1:
    SCOP E 2
    SCOP F 2
    SCOP G 2
    SCOP H 2
    SCOP I 2
    SCOP J 2
    SCOP K 2
    SCOP L 2
    SCOP M 2
    SCOP N 2
    TNT1 A 0 A_PlaySound("weapons/assaultbattlerifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SCOP O 19
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Clip", 1)
	TNT1 A 0 A_GiveInventory("RLAssaultRifleBattleRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip",20,3)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleClip",26,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_PlaySound("weapons/assaultbattlerifleload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleTechnicalMod",1,"ReloadFinish1")
    SCOP P 4
    SCOP O 2
    SCOP N 2
    SCOP M 2
    SCOP L 2
    TNT1 A 0 A_PlaySound("weapons/assaultbattleriflecock", CHAN_ITEM)
    SCOP K 2
    SCOP J 2
    SCOP I 2
    SCOP H 2
    SCOP G 2
    SCOP F 2
    SCOP E 2
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"ZoomInReload")
	Goto Ready
  ReloadFinish1:
    SCOP P 4
    SCOP O 2
    SCOP N 2
    SCOP M 2
    SCOP L 2
    TNT1 A 0 A_PlaySound("weapons/assaultbattleriflecock", CHAN_ITEM)
    SCOP K 2
    SCOP J 2
    SCOP I 2
    SCOP H 2
    SCOP G 2
    SCOP F 2
    SCOP E 2
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"ZoomInReload")
	Goto Ready
  Flash:
    TNT1 A 2 A_Light1
    TNT1 A 2 A_Light2
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLAssaultRifleBattleRiflePickup",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("RLWeaponZoomCooldown",1,"Ready")
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleZoom",1,"ZoomOut")
	Goto ZoomIn
  ZoomIn:
	TNT1 A 0 A_GiveInventory("RLWeaponZoomCooldown",1)
	TNT1 A 0 A_GiveInventory("RLAssaultRifleBattleRifleZoom",1)
  ZoomInReload:
    TNT1 A 0 A_SetCrosshair (83)
    TNT1 A 0 A_PlaySound("weapons/marksmanriflezoomin", CHAN_ITEM, 1, 0, 4)
	ZOOM B 1 Bright A_ZoomFactor(1.25)
	ZOOM B 1 Bright A_ZoomFactor(1.5)
	ZOOM B 1 Bright A_ZoomFactor(1.75)
	TNT1 A 0 A_ZoomFactor(2.0)
	Goto Ready
  ZoomOut:
	TNT1 A 0 A_GiveInventory("RLWeaponZoomCooldown",1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleZoom",1)
    TNT1 A 0 A_PlaySound("weapons/marksmanriflezoomout", CHAN_ITEM, 1, 0, 4)
	ZOOM B 1 Bright A_ZoomFactor(1.75)
	ZOOM B 1 Bright A_ZoomFactor(1.5)
	ZOOM B 1 Bright A_ZoomFactor(1.25)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	Goto Ready
  ModDiscombobulation:
	TNT1 A 0 A_Print("Applied Mod pack extracted from discarded weapon.")
	TNT1 A 0 ACS_NamedExecuteAlways("ScavengeMods", 0)
	TNT1 A 3
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleFirestormMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLAssaultRifleAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_JumpIfInventory("RLAssaultRifleBattleRifleModLimit",1,"ModDiscombobulation")
	TNT1 A 0 A_Print("Mod pack extracted from discarded weapon.")
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleFirestormMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAssaultRifleBattleRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
    TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_FireCustomMissile("DroppedRLAgilityMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLAssaultRifleBattleRifle",1)
	Stop
  }
}

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

Actor RLAssaultRifleBattleRifleSelected : RLPermanentInventory {}
Actor RLAssaultRifleBattleRifleZoom : RLPermanentInventory {}
Actor RLAssaultRifleBattleRifleModLimit : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRiflePowerMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleBulkMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleAgilityMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleTechnicalMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleFirestormMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleNanoMod : RLAdvancedAssemblyModAmount {}
Actor RLAssaultRifleBattleRifleSniperMod : RLAdvancedAssemblyModAmount {}

ACTOR RLAssaultRifleBattleRifleClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 26
   Inventory.Icon ""
}

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

ACTOR RLAssaultRifleBattleRiflePickup : RLAdvancedAssembledWeaponPickup 17601
{
	//$Sprite SCOPX0
	Tag "Scoped Rifle [Pickup]"
	States
	{
	SpawnFrame:
		SCOP X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	FloorHit:
		"####" "#" 0 A_PlaySound("weapons/gundropmedium")
		"####" "#" 0 A_ScaleVelocity (0.5)
		"####" "#" 0 A_ChangeFlag("SPECIAL", true)
		"####" "#" 0 A_ChangeFlag("THRUACTORS", false)
		"####" "#" 0 A_SetUserVar("user_floorhit", 1)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Stop
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLAssaultRifleBattleRifle",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("RLAssaultRifleBattleRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvScoped Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickup")
		Goto NotPickup
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Scoped Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/AssaultRiflepickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonClip",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLAssaultRifleBattleRiflePickupModded : RLAssaultRifleBattleRiflePickup
{
	+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:
		SCOP X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(VelZ <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 0 ACS_NamedExecuteAlways("RLWeaponModDisplay", 0)
		"####" "#" 1
		Loop
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLAssaultRifleBattleRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvScoped Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Scoped Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLAssaultRifleBattleRifleModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Scoped 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("\cv= Scoped Rifle =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
