
ACTOR RLPP7 : RLPistolWeapon
{
  Obituary "%o was shaken, but not stirred by %k's PP7."
  Decal BulletChip
  Tag "PP7"
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 2
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPP7Clip"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "BPP7ICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLPP7NanoMod",1,2)
    BPP7 A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip",1,2)
    BPP7 A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    BPP7 A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 7, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 9, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 11, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPP7Clip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPP7NanoMod",2,2)
    BPP7 A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    BPP7 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_JumpIfInventory("RLPP7ModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPP7Pickup", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPP7PickupModded", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPP7ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPP7PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7TechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7NanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPP7Confirm",1)
	TNT1 A 0 A_TakeInventory("RLPP7Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLPP7",1)
	Stop
  AfterModDrop:
    BPP7 A 8 A_WeaponReady (WRF_ALLOWRELOAD)
    Goto Ready
  MisfirePrevention:
    BPP7 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("RLPP7Selected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 AA 0 A_Lower
    BPP7 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("RLPistolTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLSuperiorWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLPP7Selected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 AA 0 A_Raise
    BPP7 A 1 A_Raise
    Loop
// 8x damage with Scout, half spread
  Fire:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerPP7Confirm",1, "AssembleHighPowerPP7")
	
	BPP7 A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	BPP7 A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	BPP7 A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	BPP7 A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	BPP7 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("RLPP7SniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPP7PowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPP7AgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (3, 3, -1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 1.5, -1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLPP7PowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLPP7AgilityMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (3, 3, -1, 11, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 1.5, -1, (88), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLPP7PowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLPP7AgilityMod",2,"FireAA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (2.5, 2.5, -1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.25, 1.25, -1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FirePP:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (3, 3, -1, 12, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.5, 1.5, -1, (96), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FirePA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (2.5, 2.5, -1, 11, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1.25, 1.25, -1, (88), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireAA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (2, 2, -1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (1, 1, -1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLPP7SniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLPP7PowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLPP7AgilityMod",1,"FireSA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireSS:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireSP:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 11, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, (88), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    Goto FireFinish
  FireSA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireBullets (0, 0, 1, 10, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (0, 0, 1, (80), "RLBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
    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/PP7", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/PP7", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_JumpIfInventory("RLPP7FirestormMod",2,"FireFinishF2")
	TNT1 A 0 A_JumpIfInventory("RLPP7FirestormMod",1,"FireFinishF1")
    BPP7 B 2 Bright A_GunFlash
    BPP7 C 2
    BPP7 D 2
    BPP7 E 2
    BPP7 A 2
    BPP7 A 5 A_ReFire
    Goto Ready
  FireFinishF1:
    BPP7 B 1 Bright A_GunFlash
    BPP7 C 1
    BPP7 D 2
    BPP7 E 2
    BPP7 A 2
    BPP7 A 5 A_ReFire
    Goto Ready
  FireFinishF2:
    BPP7 B 1 Bright A_GunFlash
    BPP7 C 1
    BPP7 D 1
    BPP7 E 1
    BPP7 A 2
    BPP7 A 5 A_ReFire
    Goto Ready
  Reload:
	BPP7 A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 7, "Ready")
	Goto ReloadStartCheck
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 9, "Ready")
	Goto ReloadStartCheck
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip", 11, "Ready")
  ReloadStartCheck:
	TNT1 A 0 A_JumpIfInventory("Clip", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLPP7TechnicalMod",2,"Reload2")
	TNT1 A 0 A_JumpIfInventory("RLPP7TechnicalMod",1,"Reload1")
    BPP7 F 2
    BPP7 G 1
	TNT1 A 0 A_PlaySound("weapons/PP7unload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPP7 H 1
    BPP7 I 1
    BPP7 J 1
    BPP7 K 1
    BPP7 L 2
    BPP7 M 7
    BPP7 N 2
    BPP7 O 2
	Goto ReloadWorking
  Reload1:
    BPP7 F 2
    BPP7 G 1
	TNT1 A 0 A_PlaySound("weapons/PP7unload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPP7 H 1
    BPP7 I 1
    BPP7 J 1
    BPP7 K 1
    BPP7 L 2
    BPP7 M 4
    BPP7 N 2
    BPP7 O 2
	Goto ReloadWorking
  Reload2:
    BPP7 F 2
    BPP7 G 1
	TNT1 A 0 A_PlaySound("weapons/PP7unload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPP7 H 1
    BPP7 I 1
    BPP7 J 1
    BPP7 K 1
    BPP7 L 2
    BPP7 M 1
    BPP7 N 2
    BPP7 O 2
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Clip", 1)
	TNT1 A 0 A_GiveInventory("RLPP7Clip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip",7,"ReloadFinish")
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPP7BulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip",9,"ReloadFinish")
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPP7Clip",11,"ReloadFinish")
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Clip",1,"ReloadWorking")
	Goto ReloadFinish
  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_PlaySound("weapons/PP7load", CHAN_ITEM)
	TNT1 A 0 A_JumpIfInventory("RLPP7TechnicalMod",2,"ReloadFinish2")
	TNT1 A 0 A_JumpIfInventory("RLPP7TechnicalMod",1,"ReloadFinish1")
	BPP7 O 2
	BPP7 P 1
	BPP7 Q 1
	BPP7 R 1
	BPP7 S 1
	BPP7 G 1
	BPP7 F 2
	BPP7 A 2
	Goto Ready
  ReloadFinish1:
	BPP7 O 1
	BPP7 P 1
	BPP7 Q 1
	BPP7 R 1
	BPP7 S 1
	BPP7 G 1
	BPP7 F 1
	Goto Ready
  ReloadFinish2:
	BPP7 O 1
	BPP7 Q 1
	BPP7 S 1
	BPP7 F 1
	Goto Ready
  Flash:
    TNT1 A 1 A_Light2
    TNT1 A 1 A_Light1
    TNT1 A 0 A_Light0
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLPP7Pickup",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("RLHighPowerPP7Confirm",1, "CancelAssembly")
	Goto Ready
  CancelAssembly:
	TNT1 A 0 A_Print("Assembly canceled.")
  CancelAssembly2:
	TNT1 A 0 A_PlaySound("hud/assemblycancel", 5)
	TNT1 A 0 A_TakeInventory("RLHighPowerPP7Confirm",1)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	Goto MisfirePrevention
  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("RLPP7ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPP7PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7TechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7NanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPP7Confirm",1)
	TNT1 A 0 A_TakeInventory("RLPP7Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_JumpIfInventory("RLPP7ModLimit",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("RLPP7ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPP7PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7TechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7NanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPP7Confirm",1)
	TNT1 A 0 A_TakeInventory("RLPP7Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLEmitScavengedModSuperior", 1) // Determines what mods this can generate when scavenged.
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLPP7",1)
	Stop
  AssembleHighPowerPP7:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerPP7",1, "AlreadyHaveAssembly")
	TNT1 A 0 A_GiveInventory("RLDangerLevelBasicGiver",1, AAPTR_PLAYER1)
	TNT1 A 0 A_Print("\cvHigh Power PP7 \c-assembled.")
    TNT1 A 0 A_PlaySound("weapons/assembly", CHAN_ITEM)
	TNT1 A 0 A_TakeInventory("RLPP7Selected", 1)
    TNT1 A 0 A_TakeInventory("RLPP7ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLPP7PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7TechnicalMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLPP7NanoMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerPP7Confirm",1)
	TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, 2)
	TNT1 A 0 A_Jump(256, 2)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_GiveInventory("RLHighPowerPP7",1)
	TNT1 A 0 A_SelectWeapon("RLHighPowerPP7")
	TNT1 A 0 A_TakeInventory("RLPP7",1)
	Stop
  }
}

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

Actor RLPP7Selected : RLPermanentInventory {}

Actor RLPP7ModLimit : RLSuperiorModAmount {}
Actor RLPP7PowerMod : RLSuperiorModAmount {}
Actor RLPP7BulkMod : RLSuperiorModAmount {}
Actor RLPP7AgilityMod : RLSuperiorModAmount {}
Actor RLPP7TechnicalMod : RLSuperiorModAmount {}
Actor RLPP7NanoMod : RLSuperiorModAmount {}
Actor RLPP7FirestormMod : RLSuperiorModAmount {}
Actor RLPP7SniperMod : RLSuperiorModAmount {}

ACTOR RLPP7Clip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 11
   Inventory.Icon ""
}

ACTOR RLPP7Pickup : RLSuperiorWeaponPickup 17004
{
	//$Sprite BPP7X0
	Tag "PP7 [Pickup]"
	States
	{
	SpawnFrame:
		BPP7 X 4
	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("RLSynthFireReload",1,"AmmoPickup") // If the player is holding reload, pickup the gun for ammo.
		"####" "#" 0 A_JumpIfInventory("RLPP7",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("RLPP7",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \ciPP7.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickupNothing")
		Goto NotPickupNothing
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("Clip",0,"NotPickupNothing")
		Goto AmmoPickup
	NotPickupNothing:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\ci= PP7 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	AmmoPickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("Clip",0,"NotPickupNothing")
		"####" "#" 1 A_GiveInventory("Clip",7)
		Goto PickupSound
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/PP7pickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonPistolClip",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLPP7PickupModded : RLPP7Pickup
{
	+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:
		BPP7 X 4
	SpawnLoop:
		"####" "#" 0 A_JumpIf(VelZ <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 0 ACS_NamedExecuteAlways("RLWeaponModDisplay", 0)
		"####" "#" 1
		Loop
		
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLPP7",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("RLPP7",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \ciPP7.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\ci= PP7 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLPP7ModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\ci= PP7 =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Clip",7)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\ci= PP7 =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
