
ACTOR RLNuclearVBFG9000 : RLHeavyWeapon
{
  Obituary "%o was utterly annihilated by %k's VBFG."
  Tag "Nuclear VBFG9000"
  Weapon.SelectionOrder 3900
  Weapon.SlotNumber 7
  Weapon.AmmoUse1 30
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLNuclearVBFG9000Clip"
  Inventory.Icon "VBFGICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
    TNT1 A 0 A_PlaySound("weapons/nukevbfg9000idle", 6, 1, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,3)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 60, "ReadyCantAltFire")
	TNT1 A 0 A_Jump (256, 2)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 30, "ReadyCantAltFire")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyCanAltFire")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyCanAltFire")
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG A 5 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
	Goto ReadyCycleCharging
  ReadyCanAltFire:
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG 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("RLNuclearVBFG9000Charged",1)
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG A 5 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
	Goto ReadyCycleCharged
  ReadyCanFire:
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG A 5 A_WeaponReady (WRF_ALLOWZOOM)
	Goto ReadyCycleCharged
//=================================================================================
  ReadyCycleCharging:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 60, "ReadyBeep")
	Goto ReadyChargingAmmo
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 30, "ReadyBeep")
	Goto ReadyChargingAmmo
  ReadyChargingAmmo:
	DBFG A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLNuclearVBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("FlashAmmo", 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)
    DBFG A 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
    DBFG A 3 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
  ReadyChargingAmmo2:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    DBFG A 6 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
    DBFG A 3 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharging
//=================================================================================
  ReadyCycleCharged:
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000BulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 60, "Ready")
	Goto ReadyChargedAmmo
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 78, "Ready")
	Goto ReadyChargedAmmo
  ReadyChargedAmmo:
	DBFG A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLNuclearVBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("FlashAmmo", 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)
    DBFG A 6 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    DBFG A 3 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
  ReadyChargedAmmo2:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    DBFG A 6 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    DBFG A 3 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
//=================================================================================
  ReadyBeep:
	DBFG A 0 A_JumpIfInventory("RLRestrictionNoRecharge",1,"RechargeRestricted") // Cannot recharge in levels that restrict it
	TNT1 A 0 A_GiveInventory("RLNuclearVBFG9000Charged",1)
	TNT1 A 0 A_PlaySound("weapons/nukevbfg9000beep", 7)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000BulkMod",1,1)
	Goto ReadyBeep+6
	TNT1 A 0 A_GiveInventory("RLNuclearVBFG9000Clip", 1)
    TNT1 A 0 A_GunFlash ("FlashBeep", GFF_NOEXTCHANGE)
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop", 1, "ReadyBeep2")
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate", 1, "ReadyBeep2")
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    DBFG B 6 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    DBFG B 3 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
  ReadyBeep2:
	TNT1 A 0 A_JumpIfInventory("RLNuclearWeaponSetBonusActive", 1, 2)
    DBFG B 6 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
    DBFG B 3 A_WeaponReady (WRF_ALLOWZOOM)
    Goto ReadyCycleCharged
	
  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("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000ModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLNuclearVBFG9000Pickup", 0, 0, 40, 8, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLNuclearVBFG9000PickupModded", 0, 0, 40, 8, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000ModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000PowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000BulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000AgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000FirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000SniperMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLNuclearVBFG9000",1)
	Stop
  AfterModDrop:
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG A 5 A_WeaponReady (16)
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG A 5 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    TNT1 A 0 A_GunFlash ("FlashAmmo", GFF_NOEXTCHANGE)
    DBFG 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(CHAN_WEAPON)
    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("RLNuclearVBFG9000Selected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    DBFG A 1 A_Lower
    Loop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLAdvancedAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLNuclearAmmoWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLNuclearVBFG9000Selected", 1)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 1)
    Goto SelectLoop
	TNT1 A 0 A_GiveInventory("PowerRLTechnicianAdvancedDamage", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    DBFG A 1 A_Raise
    Loop
  Fire:
	DBFG A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	DBFG A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	DBFG A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	DBFG A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	DBFG A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip",60, 2)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip",30, 1)
	Goto Ready
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Charged",1)
    DBFG B 10 A_PlaySound("weapons/nukevbfg9000charge", CHAN_WEAPON)
	TNT1 A 0 A_GunFlash
	DBFC ABCDE 2 Bright
	DBFC FGHIJFGHIJFGHIJFGHIJFGHIJFGHIJ 2 Bright
	DBFC FGHIJFGHIJFGHIJFGH 1 Bright
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000FirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000SniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000PowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000AgilityMod",1,"FireA")
	TNT1 A 0 A_FireCustomMissile ("RLVBFGBall", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLNuclearVBFG9000Clip", 30, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_FireCustomMissile ("RLVBFGBallP", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLNuclearVBFG9000Clip", 30, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_FireCustomMissile ("RLVBFGBallA", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLNuclearVBFG9000Clip", 30, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_FireCustomMissile ("RLVBFGBallS", 0, 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLNuclearVBFG9000Clip", 30, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireF:
	TNT1 A 0 A_FireCustomMissile ("RLVBFGBallF", frandom(-0.2,0.2), 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLNuclearVBFG9000Clip", 30, 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
    DBFF AB 2 Bright
    DBFG CDA 4 Bright
    DBFG A 20 A_Refire
    Goto Ready
  Flash:
	NVBX EGEEG 2 Bright A_Light(random(1,4))
	NVBX EGEEGEGEEGEGEEGEGEEGEGEEGEGEEG 2 Bright A_Light(random(1,4))
	NVBX EGEEGEGEEGEGEEGEGE 1 Bright A_Light(random(1,4))
	TNT1 A 1 A_Light(8)
	TNT1 A 1 A_Light(6)
	TNT1 A 1 A_Light(4)
	TNT1 A 1 A_Light(2)
	Goto LightDone
  FlashAmmo:
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 60, 9)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 48, 7)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 36, 5)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 24, 3)
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000Clip", 12, 1)
    Goto LightDone
    NVBX A 6 Bright
    Goto LightDone
    NVBX B 6 Bright
    Goto LightDone
    NVBX C 6 Bright
    Goto LightDone
    NVBX D 6 Bright
    Goto LightDone
    NVBX E 6 Bright
    Goto LightDone
  FlashBeep:
    NVBX F 6 Bright
    Goto LightDone
  FlashDrop:
    TNT1 A 0
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLNuclearVBFG9000Pickup",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("RLNuclearVBFG9000ModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000PowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000BulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000AgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000SniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000FirestormMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 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("RLVBFG9000AssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLNuclearVBFG9000ModLimit",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("RLNuclearVBFG9000ModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000PowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000BulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000AgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000SniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000FirestormMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLNuclearVBFG9000Selected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 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_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLNuclearVBFG9000",1)
	Stop
  }
}

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

Actor RLNuclearVBFG9000Selected : RLPermanentInventory {}
Actor RLNuclearVBFG9000Charged : RLPermanentInventory {}
Actor RLNuclearVBFG9000ModLimit : RLAdvancedAssemblyModAmount {}
Actor RLNuclearVBFG9000PowerMod : RLAdvancedAssemblyModAmount {}
Actor RLNuclearVBFG9000BulkMod : RLAdvancedAssemblyModAmount {}
Actor RLNuclearVBFG9000AgilityMod : RLAdvancedAssemblyModAmount {}
Actor RLNuclearVBFG9000FirestormMod : RLAdvancedAssemblyModAmount {}
Actor RLNuclearVBFG9000SniperMod : RLAdvancedAssemblyModAmount {}

ACTOR RLNuclearVBFG9000Clip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 78
   Inventory.Icon ""
}

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

ACTOR RLNuclearVBFG9000Pickup : RLAdvancedAssembledWeaponPickup 17637
{
	//$Sprite DBFGX0
	Tag "Nuclear VBFG 9000 [Pickup]"
	States
	{
	SpawnFrame:
		DBFG 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/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, "SpawnLoop")
		Stop
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLNuclearVBFG9000",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("RLNuclearVBFG9000",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvNuclear VBFG 9000.")
		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= Nuclear VBFG 9000 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/NukeVBFG9000pickup")
		Stop
/*	SetBonusStart:
		"####" "#" 0 A_GiveInventory("RLNuclearWeaponSetBonusWeapon",1)
		"####" "#" 0 A_JumpIfInventory("RLNuclearWeaponSetBonusArmor",1,"SetBonusCheck")
		"####" "#" 0 A_Print("\ccPicked up a \cvNuclear VBFG 9000.")
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon
	SetBonusCheck:
		"####" "#" 0 A_GiveInventory("RLNuclearWeaponSetBonusActive",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvNuclear VBFG 9000.\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 RLNuclearVBFG9000PickupModded : RLNuclearVBFG9000Pickup
{
	+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:
		DBFG 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("RLNuclearVBFG9000",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Nuclear VBFG 9000 =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLNuclearVBFG9000ModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Nuclear VBFG 9000 =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Nuclear VBFG 9000 =\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 \cvNuclear VBFG 9000.")
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon*/
	}
}
