
ACTOR RLHighPowerNuclearBFG9000 : RLHeavyWeapon
{
  Obituary "%o faced %k's nuclear onslaught."
  Tag "High Power Nuclear BFG9000"
  Weapon.SelectionOrder 3900
  Weapon.SlotNumber 7
  Weapon.AmmoUse1 20
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLHighPowerNuclearBFG9000Clip"
  Inventory.Icon "NUK2ICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
    TNT1 A 0 A_PlaySound("weapons/hpnukebfgidle", 6, 1, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"ReadyFireangel")
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod", 2, 1)
	Goto ReadyUnstable
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 40, "ReadyCantAltFire")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyCanAltFire")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyCanAltFire")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
	Goto ReadyCycleCharging
  ReadyCanAltFire:
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	Goto ReadyCycleCharging
  ReadyCantAltFire:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyCanFire")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyCanFire")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
	Goto ReadyCycleCharged
  ReadyCanFire:
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_ALLOWZOOM)
	Goto ReadyCycleCharged
  ReadyUnstable:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyUnstable2")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyUnstable2")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
	Goto ReadyCycleCharging
  ReadyUnstable2:
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_ALLOWZOOM)
	Goto ReadyCycleCharging
//=================================================================================
  ReadyCycleCharging:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod", 2, 2)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,1)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 40, "ReadyBeep")
	Goto ReadyChargingAmmo
  ReadyChargingAmmo:
	QNB9 A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyChargingAmmo2")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyChargingAmmo2")
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
    QNB9 A 3 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
  ReadyChargingAmmo2:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
    QNB9 A 3 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
//=================================================================================
  ReadyCycleCharged:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 42, "Ready")
	Goto ReadyChargedAmmo
  ReadyChargedAmmo:
	QNB9 A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyChargedAmmo2")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyChargedAmmo2")
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    QNB9 A 3 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
  ReadyChargedAmmo2:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    QNB9 A 3 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
//=================================================================================
  ReadyBeep:
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Charged",1)
	TNT1 A 0 A_PlaySound("weapons/chargebeep", 7)
    TNT1 A 0
    Goto ReadyCycleCharged
//=================================================================================
//	SPECIAL SNOWFLAKE DEMOLITIONIST CODE BECAUSE I CAN'T BE FUCKED MAKING IT PROPERLY
//=================================================================================
  ReadyFireangel:
    TNT1 A 0 A_PlaySound("weapons/nuclearbfg9000idle", 6, 1, 1)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 20, "ReadyCantAltFireFireangel")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyCanAltFireFireangel")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyCanAltFireFireangel")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
	Goto ReadyCycleChargingFireangel
  ReadyCanAltFireFireangel:
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	Goto ReadyCycleChargingFireangel
  ReadyCantAltFireFireangel:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyCanFireFireangel")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyCanFireFireangel")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
	Goto ReadyCycleChargedFireangel
  ReadyCanFireFireangel:
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (WRF_ALLOWZOOM)
	Goto ReadyCycleChargedFireangel
//=================================================================================
  ReadyCycleChargingFireangel:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 20, "ReadyBeepFireangel")
	Goto ReadyChargingAmmoFireangel
  ReadyChargingAmmoFireangel:
	QNB9 A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyChargingAmmo2Fireangel")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyChargingAmmo2Fireangel")
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleChargingFireangel
    QNB9 A 3 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleChargingFireangel
  ReadyChargingAmmo2Fireangel:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleChargingFireangel
    QNB9 A 3 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleChargingFireangel
//=================================================================================
  ReadyCycleChargedFireangel:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 26, "ReadyFireangel")
	Goto ReadyChargedAmmoFireangel
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod",2,2)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 34, "ReadyFireangel")
	Goto ReadyChargedAmmoFireangel
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 42, "ReadyFireangel")
	Goto ReadyChargedAmmoFireangel
  ReadyChargedAmmoFireangel:
	QNB9 A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("FlashFireangel", GFF_NOEXTCHANGE)
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyChargedAmmo2Fireangel")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyChargedAmmo2Fireangel")
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleChargedFireangel
    QNB9 A 3 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleChargedFireangel
  ReadyChargedAmmo2Fireangel:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    QNB9 A 6 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleChargedFireangel
    QNB9 A 3 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleChargedFireangel
//=================================================================================
  ReadyBeepFireangel:
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Charged",1)
	TNT1 A 0 A_PlaySound("weapons/chargebeep", 7)
    TNT1 A 0
    Goto ReadyCycleChargedFireangel
//=================================================================================
  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 ACS_NamedExecuteWithResult("RLNuclearSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
    TNT1 A 0 A_StopSound(6)
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Firing",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("RLHighPowerNuclearBFG9000ModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLHighPowerNuclearBFG9000Pickup", 0, 0, 40, 8, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLHighPowerNuclearBFG9000PickupModded", 0, 0, 40, 8, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000SniperMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLHighPowerNuclearBFG9000",1)
	Stop
  AfterModDrop:
	TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (16)
	TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
	TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 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_StopSound(6)
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Selected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    QNB9 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("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLNuclearAmmoWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Selected", 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")
    QNB9 A 1 A_Raise
    Loop
  Fire:
	QNB9 A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	QNB9 A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	QNB9 A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	QNB9 A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	QNB9 A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFireangel")
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Charged",1)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod",2,"FireStable")
    Goto FireUnstable
  FireStable:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip",40, 1)
	Goto Ready
	TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_PlaySound("weapons/hpnukebfg9000fire", CHAN_WEAPON)
    QNB9 AAA 5 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 B 10 Bright A_GunFlash ("FlashFiring")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBall", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLBFG9000Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    QNB9 B 1 Bright
    QNB9 C 6 Bright
    QNB9 A 5 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_Refire
    Goto Ready
	
  FireFireangel:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip",20, 1)
	Goto Ready
	TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 A 5 A_PlaySound("weapons/hpnukebfg9000fire", CHAN_WEAPON)
    QNB9 AAA 5 A_GunFlash ("Flash", GFF_NOEXTCHANGE)
    QNB9 B 10 Bright A_GunFlash ("FlashFiring")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000FirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000SniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000PowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000AgilityMod",1,"FireA")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBall", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000PowerMod",2,"FirePP")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000AgilityMod",1,"FirePA")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000PowerMod",1,"FirePA")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000AgilityMod",2,"FireAA")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FirePP:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallPP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FirePA:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallPA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireAA:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallAA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000SniperMod",2,"FireSS")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000FirestormMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000PowerMod",1,"FireSP")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000AgilityMod",1,"FireSA")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallS", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSS:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallSS", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSP:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallSP", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireSA:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallSA", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000FirestormMod",2,"FireFF")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000SniperMod",1,"FireFS")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000PowerMod",1,"FireFP")
	TNT1 A 0 A_JumpIfInventory("RLNuclearBFG9000AgilityMod",1,"FireFA")
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallF", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFF:
	TNT1 A 0 A_FireCustomMissile ("RLBFGBallFF", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFP:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallFP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFA:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallFA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFS:
	TNT1 A 0 A_FireCustomMissile ("RLHighPowerBFGBallFS", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLHighPowerNuclearBFG9000Clip", 20, TIF_NOTAKEINFINITE)
    Goto FireFinish
	
  Flash:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FlashFireangel")
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000BulkMod",2,"FlashStable")
	TNT1 A 0 A_Jump(128, 2)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Unstable", 1)
    Goto Flash+5
	TNT1 A 0 A_GiveInventory("RLHighPowerNuclearBFG9000Unstable", 1)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Unstable", 5, 9)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Unstable", 4, 7)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Unstable", 3, 5)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Unstable", 2, 3)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Unstable", 1, 1)
    Goto LightDone
    NUKB B 5 Bright A_Light0
    Goto LightDone
    NUKB C 5 Bright A_Light0
    Goto LightDone
    NUKB D 5 Bright A_Light0
    Goto LightDone
    NUKB E 5 Bright A_Light0
    Goto LightDone
    NUKB F 5 Bright A_Light0
    Goto LightDone
  FlashStable:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 40, 9)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 32, 7)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 24, 5)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 16, 3)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 8, 1)
    Goto LightDone
    NUKB B 6 Bright A_Light0
    Goto LightDone
    NUKB C 6 Bright A_Light0
    Goto LightDone
    NUKB D 6 Bright A_Light0
    Goto LightDone
    NUKB E 6 Bright A_Light0
    Goto LightDone
    NUKB F 6 Bright A_Light0
    Goto LightDone
  FlashFireangel:
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 20, 9)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 16, 7)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 12, 5)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 8, 3)
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000Clip", 4, 1)
    Goto LightDone
    NUKB B 6 Bright A_Light0
    Goto LightDone
    NUKB C 6 Bright A_Light0
    Goto LightDone
    NUKB D 6 Bright A_Light0
    Goto LightDone
    NUKB E 6 Bright A_Light0
    Goto LightDone
    NUKB F 6 Bright A_Light0
    Goto LightDone
  FlashFiring:
    TNT1 A 11 A_Light1
    TNT1 A 6 A_Light2
    Goto LightDone
  FlashOverload:
    NUKB F 26 Bright A_Light0
    Goto LightDone
  FlashDrop:
    TNT1 A 0 A_Light0
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLHighPowerNuclearBFG9000Pickup",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 0 A_StopSound(6)
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
	TNT1 A 3
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000FirestormMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
    TNT1 A 0 A_StopSound(6)
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
	TNT1 A 0 ACS_NamedExecuteWithResult("RLNuclearSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLHighPowerWeaponAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000ModLimit",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("RLHighPowerNuclearBFG9000ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000SniperMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000FirestormMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianBasicDamage", 1)
    TNT1 A 0 A_StopSound(6)
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
	TNT1 A 0 ACS_NamedExecuteWithResult("RLNuclearSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
  ScavengerContinue:
	TNT1 A 0 A_Jump(256,1,2)
	TNT1 A 0 A_FireCustomMissile("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLHighPowerNuclearBFG9000",1)
	Stop
	
  FireUnstable:
    TNT1 A 0 A_GunFlash ("FlashDrop", GFF_NOEXTCHANGE)
    QNB8 A 2
	TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000sparking", 6, 1, 1, 1.5)
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000zap", 7, 1, 0, 1.25)
    QNB8 BCDE 2 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000zap", 7, 1, 0, 1.25)
    QNB8 FGH 2 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000zap", 7, 1, 0, 1.25)
    QNB8 IJKL 2 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000zap", 7, 1, 0, 1.25)
    QNB8 MNOPQR 2 Bright
    TNT1 A 0 A_Refire ("Overload")
    TNT1 A 0 A_StopSound(6)
    QNB8 S 2
    Goto Ready
  Overload:
    QNB7 ABCDE 2 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000metal1", CHAN_WEAPON, 1, 0, 1.15)
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000vent", 7, 1, 0, 1.5)
    QNB7 FGHI 3 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000metal3", 5, 1, 0, 1.15)
    TNT1 A 0 A_PlaySound("weapons/tristarblasterhit", 7, 1, 0, 1.5)
    QNB7 JK 3 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000metal2", CHAN_WEAPON, 1, 0, 1.15)
    QNB7 L 3 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000zap", 7, 1, 0, 1.25)
    QNB7 MNO 3 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000rays", 6, 1, 0, 0.85)
    QNB7 PQR 3 Bright
    TNT1 A 0 A_PlaySound("highpower/nuclearbfg9000rays", CHAN_WEAPON, 1, 0, 0.85)
    QNB7 STUV 3 Bright
    TNT1 A 0 A_PlaySound("weapons/hptristarblasterhit", 7, 1, 0, 1.5)
    QNB7 W 1 Bright A_SetBlend("White", 0.10, 100)
    QNB7 W 1 Bright A_SetBlend("White", 0.3, 100)
    QNB7 X 1 Bright A_SetBlend("White", 0.5, 100)
    QNB7 X 1 Bright A_SetBlend("White", 0.85, 100)
	// boombombooombomb
    TNT1 A 0 A_SetBlend("White", 1, 300)
	TNT1 A 0 A_FireCustomMissile ("RLNuke", 0, 0)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000ModLimit", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000PowerMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000BulkMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000AgilityMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000FirestormMod", 2)
    TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000SniperMod", 2)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLHighPowerNuclearBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 ACS_NamedExecuteWithResult("RLNuclearSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
  OverloadContinue:
    TNT1 A 0 A_StopSound(6)
	TNT1 A 1 A_TakeInventory("RLHighPowerNuclearBFG9000",1)
    TNT1 A 70
    Goto Ready
  }
}

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

ACTOR RLHighPowerNuclearBFGSparks
{
	radius 3
	height 6
	speed 36
	RenderStyle ADD
	Alpha		0.9
	Scale		0.25
	Mass		0
	Gravity 0.4
	Translation "112:127=192:207"
	+MISSILE
	+FLOORCLIP
	+DONTSPLASH
	+NOTELEPORT
	+FORCEXYBILLBOARD
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_ScaleVelocity (frandom (0.5, 1.5))
	PLBS DDDDD 1  Bright A_SetTranslucent(.8,1)
	PLBS CCCCCC 1  Bright A_SetTranslucent(.6,1)
	PLBS BBBBBBB 1  Bright A_SetTranslucent(.4,1)
	PLBS AAAAAAAAAA 1 Bright A_SetTranslucent(.2,1)
	Stop
  }
}

ACTOR RLNuke : BFGBall
{
  Radius 14
  Height 9
  Alpha 0.95
  Scale 50
  Speed 0
  DamageType "Extreme"
  +FULLVOLDEATH
  +FORCERADIUSDMG
  +THRUGHOST
  +NOCLIP
  +FORCEXYBILLBOARD
  SeeSound ""
  DeathSound "weapons/nuclearboom"
  States
  {
  Spawn:
    TNT1 A 0
  Death:
    TNT1 A 0 A_ClearTarget
	TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 4)
    TNT1 A 0 A_Quake (1, 70, 0, 30000, "")
    TNT1 A 0 A_Quake (6, 26, 0, 30000, "")
    TNT1 A 0 A_Quake (9, 18, 0, 20000, "")
    TNT1 A 0 A_Explode (200000, 20000, XF_HURTSOURCE, 1, 20000)
    TNT1 A 0 A_RadiusGive ("RLItMightBeSmallButItsStillAFuckingNuke", 512, RGF_PLAYERS | RGF_NOSIGHT, 1)
    TNT1 A 0 A_RadiusGive ("RLItMightBeSmallButItsStillAFuckingNuke", 2048, RGF_PLAYERS | RGF_EXFILTER, 1, "DoomRLDemolitionist")
    TNT1 A 0 A_PlaySound ("weapons/hugeexp", CHAN_WEAPON, 1, 0, 0.3)
    TNT1 A 0 A_PlaySound ("weapons/distantexp", 7, 1, 0, 0)
    TNT1 A 0 A_PlaySound("weapons/nuclearboom", CHAN_BODY, 1, 0, 0)
    R053 KL 3 Bright
    R053 MNOPQ 8 Bright
    Stop
  }
}

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

Actor RLHighPowerNuclearBFG9000Selected : RLPermanentInventory {}
Actor RLHighPowerNuclearBFG9000Charged : RLPermanentInventory {}
Actor RLHighPowerNuclearBFG9000Unstable : RLPermanentInventory
{
inventory.maxamount 5
}

Actor RLHighPowerNuclearBFG9000Firing : RLPermanentInventory {}
Actor RLHighPowerNuclearBFG9000ModLimit : RLBasicAssemblyModAmount {}
Actor RLHighPowerNuclearBFG9000PowerMod : RLBasicAssemblyModAmount {}
Actor RLHighPowerNuclearBFG9000BulkMod : RLBasicAssemblyModAmount {}
Actor RLHighPowerNuclearBFG9000AgilityMod : RLBasicAssemblyModAmount {}
Actor RLHighPowerNuclearBFG9000FirestormMod : RLBasicAssemblyModAmount {}
Actor RLHighPowerNuclearBFG9000SniperMod : RLBasicAssemblyModAmount {}

ACTOR RLHighPowerNuclearBFG9000Clip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 42
   Inventory.Icon ""
}

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

ACTOR RLHighPowerNuclearBFG9000Pickup : RLBasicAssembledWeaponPickup 17422
{
	//$Sprite NUKBX0
	Tag "High Power Nuclear BFG 9000 [Pickup]"
	States
	{
	SpawnFrame:
		NUKB 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
	SpawnLoop2:
		NUKB X 105
		TNT1 A 0 A_PlaySound("weapons/chargebeep", CHAN_AUTO, 1, 0, 1.6)
		NUKB Y 5
		NUKB X 5
		TNT1 A 0 A_PlaySound("weapons/chargebeep", CHAN_AUTO, 1, 0, 1.6)
		NUKB Y 5
		NUKB X 5
		TNT1 A 0 A_PlaySound("weapons/chargebeep", CHAN_AUTO, 1, 0, 1.6)
		NUKB Y 5
		Loop
	FloorHit:
		"####" "#" 0 A_PlaySound("weapons/gundropbigger")
		"####" "#" 0 A_ScaleVelocity (0.15)
		"####" "#" 0 A_ChangeFlag("SPECIAL", true)
		"####" "#" 0 A_ChangeFlag("THRUACTORS", false)
		"####" "#" 0 A_SetUserVar("user_floorhit", 1)
		"####" "#" 0 A_Jump(256, "SpawnLoop2")
		Stop
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000",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 ACS_NamedExecuteWithResult("RLNuclearSetBonusCheck", 1) // Checks for all parts of the set bonus, gives or removes it accordingly - argument is tic delay before checking
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLHighPowerNuclearBFG9000",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvHigh Power Nuclear BFG9000.")
		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= High Power Nuclear BFG9000 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/hpnukeBFG9000pickup")
		Stop
/*	SetBonusStart:
		"####" "#" 0 A_GiveInventory("RLNuclearWeaponSetBonusWeapon",1)
		"####" "#" 0 A_JumpIfInventory("RLNuclearWeaponSetBonusArmor",1,"SetBonusCheck")
		"####" "#" 0 A_Print("\ccPicked up a \cvHigh Power Nuclear BFG9000.")
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon
	SetBonusCheck:
		"####" "#" 0 A_GiveInventory("RLNuclearWeaponSetBonusActive",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvHigh Power Nuclear BFG9000.\n\c-= FURIOUS FUSION =\n\ccNuclear weaponry recharges twice as fast", 8, "CONFONT")
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon*/
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLHighPowerNuclearBFG9000PickupModded : RLHighPowerNuclearBFG9000Pickup
{
	+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:
		NUKB 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("RLHighPowerNuclearBFG9000",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvHigh Power Nuclear BFG9000.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= High Power Nuclear BFG9000 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLHighPowerNuclearBFG9000ModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= High Power Nuclear BFG9000 =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= High Power Nuclear BFG9000 =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
/*	SetBonusStart:
		"####" "#" 0 A_GiveInventory("RLNuclearWeaponSetBonusWeapon",1)
		"####" "#" 0 A_JumpIfInventory("RLNuclearWeaponSetBonusArmor",1,"SetBonusCheck")
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvHigh Power Nuclear BFG9000.")
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon*/
	}
}
