
ACTOR RLQuadShotgun : RLWeapon
{
  Inventory.Pickupsound "weapons/unique"
  Obituary "%o was pounded into the dust by %k's quad shotgun."
  Decal BulletChip
  Tag "Quad Shotgun"
  Weapon.Kickback 200
  Weapon.SelectionOrder 11
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 4
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLQuadShotgunClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "QUADICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
    SHT4 A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
	
  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_JumpIfInventory("RLQuadShotgunModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLQuadShotgunPickup", 0, 0, 40, 10, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLQuadShotgunPickupModded", 0, 0, 40, 10, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLQuadShotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLQuadShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLQuadShotgun",1)
	Stop
	
  AfterModDrop:
    SHT4 A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    SHT4 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("RLQuadShotgunSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    SHT4 A 1 A_Lower
    Goto DeselectLoop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLShotgunTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLUniqueWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLQuadShotgunSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    SHT4 A 1 A_Raise
    Loop
	
  Fire:
	
	SHT4 A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	SHT4 A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	SHT4 A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	SHT4 A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	SHT4 A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip", 4, 1)
	Goto Reload
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunNanoMod",1,"FireN")
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunFirestormMod",1,"FireF")
	TNT1 A 0 A_FireBullets (0, 0, 4, 150, "RLQuadImpactPuff", FBF_NORANDOM, 128)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunBulkMod",1,"FireB")
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunAgilityMod",1,"FireA")
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegade")
	TNT1 A 0 A_FireBullets (15, 7, 40, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegade:
	TNT1 A 0 A_FireBullets (15, 7, 60, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireP:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeP")
	TNT1 A 0 A_FireBullets (15, 7, 40, 8, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeP:
	TNT1 A 0 A_FireBullets (15, 7, 60, 8, "RLBulletPuff", 0)
    Goto FireFinish
  FireA:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeA")
	TNT1 A 0 A_FireBullets (13.5, 5.5, 40, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeA:
	TNT1 A 0 A_FireBullets (13.5, 5.5, 60, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireB:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeB")
	TNT1 A 0 A_FireBullets (15, 7, 52, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeB:
	TNT1 A 0 A_FireBullets (15, 7, 78, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireF:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeF")
	TNT1 A 0 A_FireBullets (0, 0, 4, 250, "RLQuadImpactPuff", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (15, 7, 40, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeF:
	TNT1 A 0 A_FireBullets (0, 0, 4, 250, "RLQuadImpactPuff", FBF_NORANDOM, 128)
	TNT1 A 0 A_FireBullets (15, 7, 60, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireS:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeS")
	TNT1 A 0 A_FireBullets (3, 3, 40, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireRenegadeS:
	TNT1 A 0 A_FireBullets (3, 3, 60, 5, "RLBulletPuff", 0)
    Goto FireFinish
  FireN:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "FireRenegadeN")
	TNT1 A 0 A_FireBullets (5, 5, 5, 5, "RLQuadShotgunSinglePuff", 0)
    Goto FireFinishN
  FireRenegadeN:
	TNT1 A 0 A_FireBullets (5, 5, 8, 5, "RLQuadShotgunSinglePuff", 0)
    Goto FireFinishN
	
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLRocketLauncherRecoil", 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("RLQuadShotgunClip", 4)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
    TNT1 A 0 A_PlaySound("weapons/quadshotgun4X", CHAN_WEAPON, 1, 0, 0.5)
    TNT1 A 0 A_PlaySound("weapons/quadshotgun4X", 7, 0.05, 0, 0.10)
	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) * -6, 0, Sin(Pitch) * 6, 1)
    SHT4 A 10 A_GunFlash
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  FireFinishN:
    TNT1 A 0 A_SpawnItemEx ("RLChaingunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/quadshotgunsingle", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/quadshotgunsingle", 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.4, 0, Sin(Pitch) * 0.4, 1)
    SHT4 A 2 A_GunFlash ("FlashNano")
    SHT4 BCBA 1
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunBurst",0,2)
	TNT1 A 0 A_GiveInventory("RLQuadShotgunBurst",1)
    Goto Ready
	TNT1 A 0 A_TakeInventory("RLQuadShotgunBurst",0)
    Goto Ready
	
  Reload:
	SHT4 A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip", 4, "Ready")
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip", 3, 6)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip", 2, 4)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip", 1, 2)
	TNT1 A 0 A_JumpIfInventory("Shell", 4, "ReloadSequence")
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("Shell", 3, "ReloadSequence")
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("Shell", 2, "ReloadSequence")
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("Shell", 1, "ReloadSequence")
	Goto Ready
  ReloadSequence:
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunTechnicalMod",1,"Reload1")
    SHT4 D 2
    SHT4 E 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadDownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SHT4 E 1
    SHT4 F 1
    SHT4 G 1
    SHT4 H 1
    SHT4 I 1
    SHT4 J 1
	TNT1 A 0 A_PlaySound("weapons/quadshotgunopen", CHAN_ITEM)
	TNT1 A 10
    SHT4 K 3
    SHT4 L 3
    SHT4 M 3
	Goto ReloadWorking
  Reload1:
    SHT4 D 2
    SHT4 E 1
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadDownRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SHT4 E 1
    SHT4 F 1
    SHT4 G 1
    SHT4 H 1
    SHT4 I 1
    SHT4 J 1
	TNT1 A 0 A_PlaySound("weapons/quadshotgunopen", CHAN_ITEM)
	TNT1 A 7
    SHT4 K 3
    SHT4 L 3
    SHT4 M 3
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("RLQuadShotgunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunClip",4,2)
	Goto ReloadWorking+3
	TNT1 A 0 A_JumpIfInventory("Shell",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunTechnicalMod",1,"ReloadFinish1")
    SHT4 N 3 A_PlaySound("weapons/quadshotgunload", CHAN_WEAPON)
    SHT4 O 3
	TNT1 A 7
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadUpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SHT4 P 2 A_PlaySound("weapons/quadshotgunclose", CHAN_ITEM)
    SHT4 Q 2
    SHT4 R 1
    SHT4 S 1
    SHT4 A 5 A_ReFire
	Goto Ready
  ReloadFinish1:
    SHT4 N 3 A_PlaySound("weapons/quadshotgunload", CHAN_WEAPON)
    SHT4 O 3
	TNT1 A 4
    TNT1 A 0 A_SpawnItemEx ("RLDoubleShotgunReloadUpRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    SHT4 P 2 A_PlaySound("weapons/quadshotgunclose", CHAN_ITEM)
    SHT4 Q 2
    SHT4 R 1
    SHT4 S 1
    SHT4 A 5 A_ReFire
	Goto Ready
	
  Flash:
    SH4X I 4 Bright A_Light1
    SH4X J 3 Bright A_Light2
	TNT1 A 0 A_Light0
    Goto LightDone
  FlashNano:
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunBurst",1,3)
    SH4X A 1 Bright A_Light1
    SH4X E 1 Bright A_Light2
    Goto LightDone
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunBurst",2,3)
    SH4X B 1 Bright A_Light1
    SH4X F 1 Bright A_Light2
    Goto LightDone
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunBurst",3,3)
    SH4X C 1 Bright A_Light1
    SH4X G 1 Bright A_Light2
    Goto LightDone
    SH4X D 1 Bright A_Light1
    SH4X H 1 Bright A_Light2
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLQuadShotgunPickup",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("RLQuadShotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLQuadShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_JumpIfInventory("RLQuadShotgunModLimit",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("RLQuadShotgunModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLQuadShotgunNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLQuadShotgunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLEmitScavengedModUnique", 1) // Determines what mods this can generate when scavenged.
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLQuadShotgun",1)
	Stop
  }
}

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

ACTOR RLQuadImpactPuff : BulletPuff
{
  +EXTREMEDEATH
  +FORCEPAIN
  +PUFFONACTORS
  -ALLOWPARTICLES
  +THRUGHOST
  +MTHRUSPECIES
  ProjectileKickBack 1000
  DamageType "Bullet"
  States
  {
  Spawn:
    TNT1 A 1
  Melee:
    TNT1 A 1
    Stop
  }
}

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

Actor RLQuadShotgunSelected : RLPermanentInventory {}
Actor RLQuadShotgunBurst : RLPermanentInventory
{
inventory.maxamount 3
}

Actor RLQuadShotgunModLimit : RLUniqueModAmount {}
Actor RLQuadShotgunPowerMod : RLUniqueModAmount {}
Actor RLQuadShotgunBulkMod : RLUniqueModAmount {}
Actor RLQuadShotgunAgilityMod : RLUniqueModAmount {}
Actor RLQuadShotgunTechnicalMod : RLUniqueModAmount {}
Actor RLQuadShotgunNanoMod : RLUniqueModAmount {}
Actor RLQuadShotgunFirestormMod : RLUniqueModAmount {}
Actor RLQuadShotgunSniperMod : RLUniqueModAmount {}

ACTOR RLQuadShotgunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 4
   Inventory.Icon ""
}

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

ACTOR RLQuadShotgunPickup : RLUniqueWeaponPickup
{
	//$Sprite SHT4X0
	Tag "Quad Shotgun [Pickup]"
	States
	{
	SpawnFrame:
		SHT4 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/gundropbig")
		"####" "#" 0 A_ScaleVelocity (0.25)
		"####" "#" 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("RLQuadShotgun",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("RLQuadShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdQuad 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("\cd= Quad Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/QuadShotgunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	SuperweaponStuff:
		"####" "#" 0 A_Jump(256, "NoSpecialStartsStuff")
		Goto NoSpecialStartsStuff
	}
}

ACTOR RLQuadShotgunWorldSpawnPickup : RLQuadShotgunPickup 17106
{
	States
	{
	NoSpecialStartsStuff:
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamUniqueWorld", 0,0,0, 0,0,0, 0, SXF_SETMASTER)
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "DRPGInit")
		"####" "#" 0 A_Jump(256, "SpawnFrame")
		Goto SpawnFrame
		
	SpawnFrame:
		SHT4 X 4
		"####" "#" 0 A_GiveInventory("RLUniqueItemSpawnMessageSender",1)
		"####" "#" 0 A_PlaySound("weapons/uniquespawned", 7, 0.25, 0, 0)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
		
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLQuadShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdQuad Shotgun.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelUniqueGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}

ACTOR RLQuadShotgunPickupModded : RLQuadShotgunPickup
{
	+INVENTORY.TRANSFER
	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:
		SHT4 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("RLQuadShotgun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cdQuad Shotgun.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Quad Shotgun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLQuadShotgunModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Quad Shotgun =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Shell",4)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cd= Quad Shotgun =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
