
ACTOR RLTacticalShotgun : RLWeapon
{
  Obituary "%o was battered by %k's tactical shotgun."
  Decal BulletChip
  Tag "Tactical Shotgun"
  Weapon.SelectionOrder 11
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLTacticalShotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "AA12ICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunNanoMod",1,2)
    TSHO A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip",1,2)
    TSHO A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    TSHO A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 5, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 6, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 7, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLTacticalShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunNanoMod",2,2)
    TSHO A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    TSHO A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
	
  ScavengerDrop:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"WeaponDropConfirm")
	TNT1 A 0 A_GiveInventory("RLScavengerDrop",1)
	TNT1 A 0 A_Print("Press again to drop current weapon,\nor press \crAlt Fire\c- to scrap it to retrieve a Mod Pack.")
	Goto AfterModDrop
  WeaponDropConfirm:
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLTacticalShotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLTacticalShotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLTacticalShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLTacticalShotgun",1)
	Stop
  AfterModDrop:
    TSHO A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    TSHO 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("RLTacticalShotgunSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    TSHO A 1 A_Lower
    Loop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLBasicAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLShotgunTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLTacticalShotgunSelected", 1)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 1)
    Goto SelectLoop
	TNT1 A 0 A_GiveInventory("PowerRLTechnicianBasicDamage", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    TSHO A 1 A_Raise
    Loop
  Fire:
	TSHO A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	TSHO A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	TSHO A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	TSHO A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	TSHO 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("RLTacticalShotgunFirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunAgilityMod",1,"FirePA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunAgilityMod",2,"FireAA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireBullets (4, 0.5, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_FireBullets (4, 0.5, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FirePP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePP")
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadePP:
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FirePA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadePA")
	TNT1 A 0 A_FireBullets (4, 0.5, 7, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadePA:
	TNT1 A 0 A_FireBullets (4, 0.5, 11, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireAA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeAA")
	TNT1 A 0 A_FireBullets (3.5, 0, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeAA:
	TNT1 A 0 A_FireBullets (3.5, 0, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunAgilityMod",1,"FireSA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireBullets (2.5, 0, 6, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_FireBullets (2.5, 0, 10, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSS")
	TNT1 A 0 A_FireBullets (1, 1, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeSS:
	TNT1 A 0 A_FireBullets (1, 1, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireSP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSP")
	TNT1 A 0 A_FireBullets (2.5, 0, 6, 6, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeSP:
	TNT1 A 0 A_FireBullets (2.5, 0, 10, 6, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireSA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeSA")
	TNT1 A 0 A_FireBullets (2, 0, 6, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeSA:
	TNT1 A 0 A_FireBullets (2, 0, 10, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunFirestormMod",2,"FireFF")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunSniperMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunPowerMod",1,"FireFP")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunAgilityMod",1,"FireFA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireRenegadeF:
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",1,3)
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireFF:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFF")
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 5, "RLShotgunPuffFF", 0)
    Goto FireFinish
  FireRenegadeFF:
	TNT1 A 0 A_FireBullets (0, 0, 1, 50, "RLShotgunPuffCloseRange", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 5, "RLShotgunPuffFF", 0)
    Goto FireFinish
  FireFP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFP")
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 7, 6, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireRenegadeFP:
	TNT1 A 0 A_FireBullets (0, 0, 1, 30, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4.5, 1, 11, 6, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireFA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFA")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4, 0.5, 7, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireRenegadeFA:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (4, 0.5, 11, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireFS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeFS")
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (2.5, 0, 6, 5, "RLShotgunPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireRenegadeFS:
	TNT1 A 0 A_FireBullets (0, 0, 1, 25, "RLShotgunPuffCloseRange", FBF_NORANDOM, 96)
	TNT1 A 0 A_FireBullets (2.5, 0, 10, 5, "RLShotgunPuffF", 0)
	TNT1 A 0 A_FireBullets (0, 0, 1, 5, "RLShotgunPuffF", 0)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLCombatShotgunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_JumpIfInventory ("RLRenegadeExtraShot", 1, 2)
    TNT1 A 0 A_TakeInventory ("RLTacticalShotgunClip", 1, TIF_NOTAKEINFINITE)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
    TNT1 A 0 A_PlaySound("weapons/tacticalshotgun", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/tacticalshotgun", 7, 0.05, 0, 0.20)
    TSHO B 4 Bright A_GunFlash
    TSHO C 3 Bright
    TSHO A 5
    Goto Ready
  Reload:
	TSHO A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 5, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 6, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip", 7, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunTechnicalMod",1,"Reload1")
    TSHO D 3
    TSHO E 3
    TSHO F 3
    TSHO G 3
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TSHO H 3
    TSHO I 3
    TSHO J 15
    TSHO L 3
	Goto ReloadWorking
  Reload1:
    TSHO D 3
    TSHO E 3
    TSHO F 3
    TSHO G 3
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TSHO H 3
    TSHO I 3
    TSHO J 12
    TSHO L 3
	Goto ReloadWorking
  Reload2:
    TSHO D 3
    TSHO E 3
    TSHO F 3
    TSHO G 3
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TSHO H 3
    TSHO I 3
    TSHO J 9
    TSHO L 3
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1)
	TNT1 A 0 A_GiveInventory("RLTacticalShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip",5,9)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip",6,7)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunClip",7,5)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell",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_JumpIfInventory("RLTacticalShotgunTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunTechnicalMod",1,"ReloadFinish1")
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgunload", 7)
    TSHO M 3
    TSHO N 3
    TSHO O 3
    TSHO A 7 A_ReFire
	Goto Ready
  ReloadFinish1:
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgunload", 7)
    TSHO M 2
    TSHO N 2
    TSHO O 2
    TSHO A 7 A_ReFire
	Goto Ready
  ReloadFinish2:
	TNT1 A 0 A_PlaySound("weapons/tacticalshotgunload", 7)
    TSHO M 1
    TSHO N 1
    TSHO O 1
    TSHO A 7 A_ReFire
	Goto Ready
  Flash:
    TNT1 A 4 A_Light1
    TNT1 A 3 A_Light2
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLTacticalShotgunPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	Goto Ready
  ModDiscombobulation:
	TNT1 A 0 A_Print("Applied Mod pack extracted from discarded weapon.")
	TNT1 A 0 ACS_NamedExecuteAlways("ScavengeMods", 0)
	TNT1 A 3
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLTacticalShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLTacticalShotgunAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLTacticalShotgunModLimit",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("RLTacticalShotgunModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLTacticalShotgunNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLTacticalShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
	TNT1 A 0 A_Jump(256,1,2)
	TNT1 A 0 A_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLTechnicalMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLTacticalShotgun",1)
	Stop
  }
}

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

Actor RLTacticalShotgunReloadDone : RLPermanentInventory {}
Actor RLTacticalShotgunSelected : RLPermanentInventory {}
Actor RLTacticalShotgunModLimit : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunPowerMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunBulkMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunAgilityMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunNanoMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunFirestormMod : RLBasicAssemblyModAmount {}
Actor RLTacticalShotgunSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLTacticalShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 9
   Inventory.Icon ""
}

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

ACTOR RLTacticalShotgunPickup : RLBasicAssembledWeaponPickup 17445
{
	//$Sprite ASHOX0
	Scale 0.8
	Tag "Tactical Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		ASHO 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("RLTacticalShotgun",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("RLTacticalShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvTactical Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickup")
		Goto NotPickup
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Tactical Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/TacticalShotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLTacticalShotgunPickupModded : RLTacticalShotgunPickup
{
	+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:
		ASHO 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("RLTacticalShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvTactical Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Tactical Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLTacticalShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Tactical Shotgun =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Shell",5)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Tactical Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
