
ACTOR RLBurstCannonPlasmaRifle : RLWeapon
{
  Obituary "%o was burnt to ashes by %k's plasma rifle."
  Tag "Burst Plasma Rifle"
  Weapon.SelectionOrder 20
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLBurstCannonPlasmaRifleClip"
  Weapon.AmmoType2 "Cell"
  Inventory.Icon "BPLSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleState",1)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleNanoMod",1,2)
    BPLS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip",1,2)
    BPLS A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    BPLS A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip", 80, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip", 104, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleNanoMod",2,2)
    BPLS A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
    BPLS A 9 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
	
  ReadyAfterFire:
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"ReadyAfterFireInfinite")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleFirestormMod",1,"ReadyAfterFireF")
    BPLS D 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 8 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 10 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
  ReadyAfterFireF:
    BPLS D 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 1 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 10 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
  ReadyAfterFireInfinite:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleFirestormMod",1,"ReadyAfterFireInfiniteF")
    BPLS D 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 8 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 10 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
  ReadyAfterFireInfiniteF:
    BPLS D 6 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 1 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM | WRF_NOBOB)
    BPLS A 10 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
	
  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("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLBurstCannonPlasmaRiflePickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLBurstCannonPlasmaRiflePickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLBurstCannonPlasmaRifle",1)
	Stop
	
  AfterModDrop:
    BPLS A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    BPLS 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("RLBurstCannonPlasmaRifleSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	Goto DeselectLoop
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    BPLS 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("RLRapidfireTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleSelected", 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")
    TNT1 A 0 A_Raise
    BPLS A 1 A_Raise
    Loop
	
  Fire:
	BPLS A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	BPLS A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	BPLS A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	BPLS A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	BPLS 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("RLBurstCannonPlasmaRifleSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRiflePowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFire")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBall", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBall", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  XaserFire:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBall", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBall", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBall", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBall", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBall", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBall", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireP")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallP", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallP", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  XaserFireP:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallP", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallP", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallP", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallP", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallP", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallP", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireA")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallA", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallA", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  XaserFireA:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallA", frandom(2,-2), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallA", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallA", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallA", frandom(2,-2), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallA", frandom(-28,-32), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallA", frandom(28,32), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLXaserPowerArmorToken",1,"XaserFireS")
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallS", frandom(1,-1), 1, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLBurstPlasmaBallS", frandom(1,-1), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
  XaserFireS:
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,4)
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallS", frandom(1,-1), 1, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallS", frandom(-29,-31), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallS", frandom(29,31), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLXaserBurstPlasmaBallS", frandom(1,-1), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallS", frandom(-29,-31), 0, 0, 0, 0, frandom(1,-1))
	TNT1 A 0 A_FireCustomMissile ("RLXaserSBurstPlasmaBallS", frandom(29,31), 0, 0, 0, 0, frandom(1,-1))
    Goto FireFinish
	
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLPlasmaRifle3Recoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleState",1,"FireState")
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleState",1)
    BPLS B 2 Bright A_GunFlash
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleBurst",1)
    Goto Fire
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBurst",0)
    Goto ReadyAfterFire
  FireState:
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleState",1)
    BPLS C 2 Bright A_GunFlash
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBurst",0,2)
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleBurst",1)
    Goto Fire
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBurst",0)
    Goto ReadyAfterFire
	
  Reload:
	BPLS A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip", 80, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip", 104, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleTechnicalMod",1,"Reload1")
    BPLS E 4
    BPLS F 4
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPLS G 4 A_PlaySound("weapons/burstplasmarifleunload", CHAN_ITEM)
    BPLS H 4
    BPLS I 4
    BPLS J 4
	Goto ReloadWorking
  Reload1:
    BPLS E 3
    BPLS F 3
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPLS G 3 A_PlaySound("weapons/burstplasmarifleunload", CHAN_ITEM)
    BPLS H 4
    BPLS I 4
    BPLS J 4
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Cell", 1)
	TNT1 A 0 A_GiveInventory("RLBurstCannonPlasmaRifleClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip",80,3)
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleClip",104,2)
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell",1,2)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBurst", 0)
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    BPLS K 10 A_PlaySound("weapons/burstplasmarifleload", 7)
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleTechnicalMod",1,"ReloadFinish1")
    BPLS J 4
	BPLS I 4
	BPLS H 4
	BPLS G 4
	BPLS F 4
	BPLS E 4
	Goto Ready
  ReloadFinish1:
    BPLS J 3
	BPLS I 3
	BPLS H 3
	BPLS G 4
	BPLS F 4
	BPLS E 4
	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("RLBurstCannonPlasmaRiflePickup",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("RLBurstCannonPlasmaRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLBurstCannonAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleModLimit",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("RLBurstCannonPlasmaRifleModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRiflePowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLBurstCannonPlasmaRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
	TNT1 A 0 A_Jump(256,1,2,3)
	TNT1 A 0 A_FireCustomMissile("DroppedRLBulkMod",0,0,0)
	Goto ScavengerTimeEnd
	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("RLBurstCannonPlasmaRifle",1)
	Stop
  }
}

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

ACTOR RLBurstPlasmaBall : RLPlasmaBall
{
	Speed 35
	Damage 10
	Scale 1.2
	SeeSound "weapons/burstplasma"
	Decal "BlueSmallLightning"
	States
	{
		Spawn:
			PX2B D 0 NoDelay A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
			TNT1 A 0 A_Jump (256, "Spawn.Normal")
			Goto Spawn.Normal
		Spawn.Normal:
			BPLX AB 2 Bright
			Loop
		Spawn.Fancy:
			BPLX ABAB 1 Bright A_SpawnItemEx("RLBurstPlasmaBallTrail",-5)
			Loop
		Death:
			//TNT1 A 0 A_SetScale (1.2)
			BPLX CDEFGHI 3 Bright
			Stop
	}
}

ACTOR RLBurstPlasmaBallTrail
{
	Renderstyle Add
	Scale 0.55
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			WPLZ A 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ A 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ B 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ B 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ A 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ A 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ B 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			WPLZ B 1 A_SetScale(scalex - 0.05)
			"####" "#" 0 A_FadeOut
			Stop
	}
}

ACTOR RLBurstPlasmaBallP : RLBurstPlasmaBall
{
  Damage 15
}

ACTOR RLBurstPlasmaBallA : RLBurstPlasmaBall
{
  Speed 45
}

ACTOR RLBurstPlasmaBallS : RLBurstPlasmaBall
{
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			TNT1 A 0 A_ScaleVelocity(1.10)
			BPLX AB 2 Bright
			Loop
		Spawn.Fancy:
			TNT1 A 0 A_ScaleVelocity(1.10)
			BPLX AB 2 Bright A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserBurstPlasmaBall : RLBurstPlasmaBall
{
  Speed 35
  Damage 10
  SeeSound "weapons/xaserplasma"
}

ACTOR RLXaserBurstPlasmaBallP : RLBurstPlasmaBall
{
  Damage 15
  SeeSound "weapons/xaserplasma"
}

ACTOR RLXaserBurstPlasmaBallA : RLBurstPlasmaBall
{
  Speed 45
  SeeSound "weapons/xaserplasma"
}

ACTOR RLXaserBurstPlasmaBallS : RLBurstPlasmaBall
{
	SeeSound "weapons/xaserplasma"
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			BPLX AB 2 Bright A_ScaleVelocity(1.05)
			Loop
		Spawn.Fancy:
			BPLX A 1 Bright A_ScaleVelocity(1.05)
			"####" "#" 0 A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			BPLX B 1 Bright A_ScaleVelocity(1.05)
			"####" "#" 0 A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

ACTOR RLXaserSBurstPlasmaBall : RLBurstPlasmaBall
{
  Speed 35
  Damage 10
  SeeSound ""
}

ACTOR RLXaserSBurstPlasmaBallP : RLBurstPlasmaBall
{
  Damage 15
  SeeSound ""
}

ACTOR RLXaserSBurstPlasmaBallA : RLBurstPlasmaBall
{
  Speed 45
  SeeSound ""
}

ACTOR RLXaserSBurstPlasmaBallS : RLBurstPlasmaBall
{
	SeeSound ""
	States
	{
		Spawn:
			TNT1 A 0 NoDelay A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			BPLX AB 2 Bright A_ScaleVelocity(1.05)
			Loop
		Spawn.Fancy:
			BPLX A 1 Bright A_ScaleVelocity(1.05)
			"####" "#" 0 A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			BPLX B 1 Bright A_ScaleVelocity(1.05)
			"####" "#" 0 A_CustomMissile("RLPlasmaFancyTrail", frandom(-1.0,1.0), frandom(-1.0,1.0))
			Loop
	}
}

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

Actor RLBurstCannonPlasmaRifleSelected : RLPermanentInventory {}
Actor RLBurstCannonPlasmaRifleState : RLPermanentInventory {}
Actor RLBurstCannonPlasmaRifleBurst : RLBurstCannonDefault {}
Actor RLBurstCannonPlasmaRifleModLimit : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRiflePowerMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleBulkMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleAgilityMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleTechnicalMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleFirestormMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleNanoMod : RLAdvancedAssemblyModAmount {}
Actor RLBurstCannonPlasmaRifleSniperMod : RLAdvancedAssemblyModAmount {}

ACTOR RLBurstCannonPlasmaRifleClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 104
   Inventory.Icon ""
}

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

ACTOR RLBurstCannonPlasmaRiflePickup : RLAdvancedAssembledWeaponPickup 17609
{
	//$Sprite BPLSX0
	Tag "Burst Plasma Rifle [Pickup]"
	States
	{
	SpawnFrame:
		BPLS 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/gundropmedium")
		"####" "#" 0 A_ScaleVelocity (0.5)
		"####" "#" 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("RLBurstCannonPlasmaRifle",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("RLBurstCannonPlasmaRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvBurst Plasma Rifle.")
		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= Burst Plasma Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/BurstPlasmaRiflepickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

ACTOR RLBurstCannonPlasmaRiflePickupModded : RLBurstCannonPlasmaRiflePickup
{
	+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:
		BPLS 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("RLBurstCannonPlasmaRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cvBurst Plasma Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Burst Plasma Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLBurstCannonPlasmaRifleModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Burst Plasma Rifle =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Cell",80)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cv= Burst Plasma Rifle =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
