
ACTOR RLAutoshotgun : RLWeapon
{
  Obituary "%o was abolished by %k's autoshotgun."
  Decal BulletChip
  Tag "Autoshotgun"
  Weapon.SelectionOrder 11
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLAutoshotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "AUTSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunNanoMod",1,2)
    AUTS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip",1,2)
    AUTS A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    AUTS A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip", 20, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip", 26, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLAutoshotgunClip", 1)
    AUTS A 17 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("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLAutoshotgunPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLAutoshotgunPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLAutoshotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAutoshotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLAutoshotgun",1)
	Stop
	
  AfterModDrop:
    AUTS A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    AUTS 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("RLAutoshotgunSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    AUTS 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("RLRapidfireTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLShotgunTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLAutoshotgunSelected", 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
    AUTS A 1 A_Raise
    Loop
	
  Fire:
	AUTS A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	AUTS A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	AUTS A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	AUTS A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	AUTS 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("RLAutoshotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireBullets (6.5, 3, 7, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_FireBullets (6.5, 3, 11, 6, "RLBulletPuff", 0)
    Goto FireFinish
  FireA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireBullets (6, 2.5, 7, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_FireBullets (6, 2.5, 11, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireBullets (4.5, 1, 6, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_FireBullets (4.5, 1, 10, 5, "RLBulletPuff", 0)
	TNT1 A 0 A_FireBullets (0, 0, -1, 5, "RLBulletPuff", 0)
    Goto FireFinish
	
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLShotgunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	
    TNT1 A 0 A_JumpIfInventory ("RLRenegadeExtraShot", 1, "FireFinishAmmoConsumptionDoneExtra")
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishAmmoConsumptionDone")
    TNT1 A 0 A_TakeInventory ("RLAutoshotgunClip", 1, TIF_NOTAKEINFINITE)
	Goto FireFinishAmmoConsumptionDone
	
  FireFinishAmmoConsumptionDoneExtra:
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
  FireFinishAmmoConsumptionDone:
    TNT1 A 0 A_PlaySound("weapons/autoshotgun", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/autoshotgun", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_CheckFloor (2)
	TNT1 A 0 A_Jump(256,4)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingSteelBootsToken",1,4)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingProtectiveBootsToken",1,3)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingPlasteelBootsToken",1,2)
    TNT1 A 0 A_ChangeVelocity (Cos(Pitch) * -0.8, 0, Sin(Pitch) * 0.8, 1)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck") // Check for powerups.
  FireFinishPowerupCheckDone: // No valid powerups detected.
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunFirestormMod",1,"FireFinish2")
    AUTS B 2 Bright A_GunFlash
    AUTS C 2 Bright
    AUTS A 2
    Goto FireFinishContinue
  FireFinish2:
    AUTS B 1 Bright A_GunFlash
    AUTS C 1 Bright
    AUTS D 1
    Goto FireFinishContinue
  FireFinishContinue:
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunAmmochain",0,2)
	TNT1 A 0 A_Jump(256,3)
	TNT1 A 0 A_TakeInventory("RLAutoshotgunAmmochain",0)
    TNT1 A 0 A_ReFire
    Goto Ready
	TNT1 A 0 A_GiveInventory("RLAutoshotgunAmmochain",1)
    TNT1 A 0 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("RLAutoshotgunFirestormMod",1,1)
	Goto FireFinish2
    AUTS B 1 Bright A_GunFlash
    AUTS C 1 Bright
    Goto FireFinishContinue
//-------------------------------------------------------------------------------------------------
  
  Reload:
	AUTS A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip", 20, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip", 26, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunTechnicalMod",1,"Reload1")
    AUTS D 4
    AUTS E 4
    AUTS F 4
	TNT1 A 0 A_PlaySound("weapons/autoshotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    AUTS G 4
    AUTS H 4
    AUTS I 4
    AUTS J 4
    TNT1 A 35
	Goto ReloadWorking
  Reload1:
    AUTS D 3
    AUTS E 3
    AUTS F 3
	TNT1 A 0 A_PlaySound("weapons/autoshotgununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    AUTS G 4
    AUTS H 4
    AUTS I 4
    AUTS J 4
    TNT1 A 35
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1)
	TNT1 A 0 A_GiveInventory("RLAutoshotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip",20,9)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunClip",26,7)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunTechnicalMod",1,"ReloadFinish1")
    AUTS J 2
    AUTS I 2
    AUTS H 2
    AUTS G 2
	TNT1 A 0 A_PlaySound("weapons/autoshotgunload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    AUTS F 2
    AUTS E 2
    AUTS D 2
    AUTS A 7 A_ReFire
	Goto Ready
  ReloadFinish1:
    AUTS J 2
    AUTS I 1
    AUTS K 1
    AUTS L 1
	TNT1 A 0 A_PlaySound("weapons/autoshotgunload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    AUTS F 2
    AUTS E 2
    AUTS D 2
    AUTS A 7 A_ReFire
	Goto Ready
	
  Flash:
    TNT1 A 2 A_Light1
    TNT1 A 2 A_Light2
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLAutoshotgunPickup",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("RLAutoshotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAutoshotgunSelected", 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("RLAutoshotgunAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLAutoshotgunModLimit",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("RLAutoshotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLAutoshotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLAutoshotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_Jump(256,1,2,3)
	TNT1 A 0 A_FireCustomMissile("DroppedRLFirestormMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLAutoshotgun",1)
	Stop
  }
}

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

Actor RLAutoshotgunSelected : RLPermanentInventory {}
Actor RLAutoshotgunAmmochain : RLAmmochainDefault {}
Actor RLAutoshotgunModLimit : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunPowerMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunBulkMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunAgilityMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunTechnicalMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunNanoMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunFirestormMod : RLAdvancedAssemblyModAmount {}
Actor RLAutoshotgunSniperMod : RLAdvancedAssemblyModAmount {}

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

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

ACTOR RLAutoshotgunPickup : RLAdvancedAssembledWeaponPickup 17642
{
	//$Sprite AUTSX0
	Tag "Autoshotgun [Pickup]"
	States
	{
	SpawnFrame:
		AUTS 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("RLAutoshotgun",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("RLAutoshotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up an \cvAutoshotgun.")
		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= Autoshotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/Autoshotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

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