
ACTOR RLShredderPistol : RLPistolWeapon
{
  Obituary "%o was torn apart by %k's shredder pistol."
  Decal BulletChip
  Tag "Shredder Pistol"
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 3
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLShredderPistolClip"
  Weapon.AmmoType2 "Shell"
  Inventory.Icon "SRPSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolNanoMod",1,2)
    SRPS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip",1,2)
    SRPS A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    SRPS A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 10, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 13, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 16, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolNanoMod",2,2)
    SRPS A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    SRPS 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("RLShredderPistolModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLShredderPistolPickup", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLShredderPistolPickupModded", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLShredderPistolModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLShredderPistolSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLShredderPistol",1)
	Stop
  AfterModDrop:
    SRPS A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    SRPS 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("RLShredderPistolSelected", 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 AA 0 A_Lower
    SRPS 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("RLBasicAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLPistolTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLShredderPistolSelected", 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 AA 0 A_Raise
    SRPS A 1 A_Raise
    Loop
// 5x damage with Scout, half spread
  Fire:
	SRPS A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	SRPS A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	SRPS A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	SRPS A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	SRPS A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip",1,1)
	Goto Reload
    SRPS BCDE 1
  FireContinue:
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (6.5, 3, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (3.25, 1.5, -1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolPowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolAgilityMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (6.5, 3, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (3.25, 1.5, -1, (35), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolPowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolAgilityMod",2,"FireAA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (6, 2.5, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (3, 1.75, -1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FirePP:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (6.5, 3, -1, 8, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (3.25, 1.5, -1, (40), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FirePA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (6, 2.5, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (3, 1.25, -1, (35), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireAA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (5.5, 2, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2.75, 1, -1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolSniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolPowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolAgilityMod",1,"FireSA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (4.5, 1, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2.25, 0.5, -1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSS:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSP:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (4.5, 1, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2.25, 0.5, -1, (35), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireSA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (4, 0.5, -1, 6, "RLBulletPuff", 0)
    Goto FireFinish
	TNT1 A 0 A_FireBullets (2, 0.25, -1, (30), "RLBulletPuff", FBF_NORANDOM)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLMinigunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/shredderpistol", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/shredderpistol", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_TakeInventory("RLShredderPistolClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolState",1,"FireFinish2")
	TNT1 A 0 A_GiveInventory("RLShredderPistolState",1)
    TNT1 A 0 A_GunFlash
    SRPS I 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolFirestormMod",1,2)
    SRPS I 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip",1,"FireContinue")
    TNT1 A 0 A_JumpIfInventory ("RLRenegadeExtraShot", 1, 2)
    TNT1 A 0 A_Jump (256, 3)
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 10)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
	Goto FireContinue
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolFirestormMod",2,"FireEnd")
    SRPS FGHGFE 2
    SRPS DCBA 1
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  FireEnd:
    SRPS FGHGFE 1
    SRPS DCBA 1
    Goto Ready
  FireFinish2:
	TNT1 A 0 A_TakeInventory("RLShredderPistolState",1)
    TNT1 A 0 A_GunFlash ("Flash2")
    SRPS J 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolFirestormMod",1,2)
    SRPS J 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip",1,"FireContinue")
    TNT1 A 0 A_JumpIfInventory ("RLRenegadeExtraShot", 1, 2)
    TNT1 A 0 A_Jump (256, 3)
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 10)
    TNT1 A 0 A_TakeInventory ("RLRenegadeExtraShot", 1)
	Goto FireContinue
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolFirestormMod",2,"FireEnd2")
    SRPS GHGFE 2
    SRPS DCBA 1
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  FireEnd2:
    SRPS GHGFE 1
    SRPS DCBA 1
    Goto Ready
	
  Reload:
	SRPS A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 10, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 13, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolClip", 16, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolTechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolTechnicalMod",1,"Reload1")
    SRPS K 2
    SRPS L 2
    SRPS M 2
	SRPS N 2
	SRPS O 2
	SRPS P 2
    TNT1 A 0 A_PlaySound("weapons/shredderpistolload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 12
	Goto ReloadWorking
  Reload1:
    SRPS K 2
    SRPS L 2
    SRPS M 2
	SRPS N 2
	SRPS O 2
	SRPS P 2
    TNT1 A 0 A_PlaySound("weapons/shredderpistolload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 9
	Goto ReloadWorking
  Reload2:
    SRPS K 2
    SRPS L 2
    SRPS M 2
	SRPS N 2
	SRPS O 2
	SRPS P 2
    TNT1 A 0 A_PlaySound("weapons/shredderpistolload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 6
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Shell", 1, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",1,2)
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 10)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolBulkMod",2,2)
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 13)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_GiveInventory("RLShredderPistolClip", 16)
  ReloadWorkingAmmoCheck:
	TNT1 A 0
	Goto ReloadFinish
  ReloadFinish:
    TNT1 A 0 A_PlaySound("weapons/shredderpistolcock", 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("RLShredderPistolTechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolTechnicalMod",1,"ReloadFinish1")
    SRPS P 2
    SRPS O 2
    SRPS N 2
	SRPS M 2
	SRPS L 2
	SRPS K 2
	Goto Ready
  ReloadFinish1:
    SRPS P 2
    SRPS O 2
    SRPS N 2
	SRPS M 2
	SRPS L 2
	SRPS K 2
	Goto Ready
  ReloadFinish2:
    SRPS P 2
    SRPS O 2
    SRPS N 2
	SRPS M 2
	SRPS L 2
	SRPS K 2
	Goto Ready
	
  Flash:
    TNT1 A 2 Bright A_Light1
    Goto LightDone
  Flash2:
    TNT1 A 2 Bright A_Light2
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLShredderPistolPickup",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("RLShredderPistolModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLShredderPistolSelected", 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("RLShredderPistolAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLShredderPistolModLimit",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("RLShredderPistolModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolPowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolBulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolAgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolTechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolSniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolFirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLShredderPistolNanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLShredderPistolSelected", 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("RLShredderPistol",1)
	Stop
//==============================================================================
//					--	DRPG Compatibility Stuff  --
//==============================================================================
  DoorpegHealthDamager:
	TNT1 A 0 ACS_NamedExecuteAlways("AddHealthDirect", 0, -5, 100)
	Goto FireFinish
  }
}

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

Actor RLShredderPistolSelected : RLPermanentInventory {}
Actor RLShredderPistolState : RLPermanentInventory {}
Actor RLShredderPistolModLimit : RLBasicAssemblyModAmount {}
Actor RLShredderPistolPowerMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolBulkMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolAgilityMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolTechnicalMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolNanoMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolFirestormMod : RLBasicAssemblyModAmount {}
Actor RLShredderPistolSniperMod : RLBasicAssemblyModAmount {}

ACTOR RLShredderPistolClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 16
   Inventory.Icon ""
}

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

ACTOR RLShredderPistolPickup : RLBasicAssembledWeaponPickup 17439
{
	//$Sprite SRPSX0
	Tag "Shredder Pistol [Pickup]"
	States
	{
	SpawnFrame:
		SRPS 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/gundropsmall")
		"####" "#" 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("RLShredderPistol",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("RLShredderPistol",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvShredder Pistol.")
		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= Shredder Pistol =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/ShredderPistolpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

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

Actor DRPGDarkBlueAuraInfiniteAmmo : Inventory
{
inventory.maxamount 1
}

Actor DRPGPowerStimInfinity : Inventory
{
inventory.maxamount 1
}
