const int RLRLPLeftTrailX = 2;
const int RLRLPRightTrailX = 14;
const int RLRLPTrailZ = 10;

ACTOR RLRevenantsLauncher : RLWeapon
{
  Inventory.Pickupsound "weapons/unique"
  Obituary "%o couldn't escape %k's revenant missiles."
  Weapon.BobRangeX 0
  Weapon.BobRangeY 0.6
  Weapon.BobStyle "Smooth"
  Tag "Revenant's Launcher"
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 5
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLRevenantsLauncherClip"
  Weapon.AmmoType2 "RocketAmmo"
  Inventory.Icon "REVLICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"ReadyF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"ReadyN")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherSniperMod",1,"ReadyS")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",3,2)
    REVL A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherClip", 1)
    Loop
  ReadyS:
    REVL A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  ReadyN:
    REVL N 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  ReadyF:
    REVL H 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
	
  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("RLRevenantsLauncherModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLRevenantsLauncherPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLRevenantsLauncher",1)
	Stop
	
  AfterModDrop:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"AfterModDropF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"AfterModDropN")
    REVL A 8 A_WeaponReady (16)
    Goto Ready
  AfterModDropN:
    REVL N 8 A_WeaponReady (16)
    Goto Ready
  AfterModDropF:
    REVL H 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"MisfirePreventionF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"MisfirePreventionN")
    REVL A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  MisfirePreventionN:
    REVL N 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  MisfirePreventionF:
    REVL H 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("RLRevenantsLauncherSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"DeselectF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"DeselectN")
    TNT1 A 0 A_Lower
    REVL A 1 A_Lower
    Goto DeselectLoop
  DeselectN:
    TNT1 A 0 A_Lower
    REVL N 1 A_Lower
    Goto DeselectLoop
  DeselectF:
    TNT1 A 0 A_Lower
    REVL H 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("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLUniqueWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLRevenantsLauncherSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"SelectF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"SelectN")
    TNT1 A 0 A_Raise
    REVL A 1 A_Raise
    Loop
  SelectN:
    TNT1 A 0 A_Raise
    REVL N 1 A_Raise
    Loop
  SelectF:
    TNT1 A 0 A_Raise
    REVL H 1 A_Raise
    Loop
	
  Fire:
	
	REVL A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	REVL A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	REVL A 0 A_JumpIfInventory("RLRestrictionNoBoom",1,"NoBoomRestricted") // Cannot fire in levels that restrict it
	REVL A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	REVL A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 1, "FireAmmoCheckDone")
	Goto Reload
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 2, "FireAmmoCheckDone")
	Goto Reload
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 1, "FireAmmoCheckDone")
	Goto Reload
  FireAmmoCheckDone:
	TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_SpawnItemEx ("RLRocketLauncherRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"FireN")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"FireF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherCount",1,4)
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissile", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHoming", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissile", 0, 1, -8, 8)
    Goto FireFinishLeft
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHoming", 0, 1, -8, 8)
    Goto FireFinishLeft
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherCount",1,4)
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileP", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingP", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileP", 0, 1, -8, 8)
    Goto FireFinishLeft
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingP", 0, 1, -8, 8)
    Goto FireFinishLeft
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherCount",1,4)
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileA", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingA", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileA", 0, 1, -8, 8)
    Goto FireFinishLeft
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingA", 0, 1, -8, 8)
    Goto FireFinishLeft
  FireB:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherCount",1,4)
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileB", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingB", 0, 1, 8, 8)
    Goto FireFinish
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileB", 0, 1, -8, 8)
    Goto FireFinishLeft
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHomingB", 0, 1, -8, 8)
    Goto FireFinishLeft
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherCount",1,4)
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissile", 0, 1, 8, 8)
    Goto FireFinishS
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHoming", 0, 1, 8, 8)
    Goto FireFinishS
	TNT1 A 0 A_Jump(128,2)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissile", 0, 1, -8, 8)
    Goto FireFinishSLeft
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherMissileHoming", 0, 1, -8, 8)
    Goto FireFinishSLeft
  FireF:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",2, 2)
	Goto Reload
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",1, 1)
	Goto Reload
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherHeavyMissile", 0, 1, -12, 5)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinishHeavy")
	TNT1 A 0 A_TakeInventory ("RLRevenantsLauncherClip", 1, TIF_NOTAKEINFINITE)
    Goto FireFinishHeavy
  FireN:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",2,1)
	Goto Reload
	TNT1 A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 0, 5)
	TNT1 A 0 A_FireCustomMissile("RLRevenantsLauncherPlasmaTrail", 0,0,RLRLPRightTrailX,RLRLPTrailZ)
	TNT1 A 0 A_FireCustomMissile("RLRevenantsLauncherPlasmaTrail2",0,0,RLRLPRightTrailX,RLRLPTrailZ)
	TNT1 A 0 A_FireCustomMissile("RLRevenantsLauncherPlasmaTrail", 0,0,RLRLPRightTrailX - 24,RLRLPTrailZ)
	TNT1 A 0 A_FireCustomMissile("RLRevenantsLauncherPlasmaTrail2",0,0,RLRLPRightTrailX - 24,RLRLPTrailZ)
	
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherPlasmaSkull", 0, 1, 12, 5)
	TNT1 A 0 A_FireCustomMissile ("RLRevenantsLauncherPlasmaSkull", 0, 1, -12, 5)
    Goto FireFinishNightmare
  FireFinish:
    REVL B 5 Bright A_GunFlash
    REVL A 12
	TNT1 A 0 A_GiveInventory("RLRevenantsLauncherCount",1)
    Goto Ready
  FireFinishLeft:
    REVL C 5 Bright A_GunFlash
    REVL A 12
	TNT1 A 0 A_TakeInventory("RLRevenantsLauncherCount",1)
    Goto Ready
  FireFinishS:
    REVL B 3 Bright A_GunFlash
    REVL A 6
	TNT1 A 0 A_GiveInventory("RLRevenantsLauncherCount",1)
    Goto Ready
  FireFinishSLeft:
    REVL C 3 Bright A_GunFlash
    REVL A 6
	TNT1 A 0 A_TakeInventory("RLRevenantsLauncherCount",1)
    Goto Ready
  FireFinishHeavy:
    REVL I 7 Bright A_GunFlash
    REVL JH 10
    Goto Ready
  FireFinishNightmare:
    REVL O 5 Bright A_GunFlash
    REVL N 12
    Goto Ready
  FireFinishDual:
    REVL D 5 Bright A_GunFlash
    REVL A 12
    Goto Ready
	
  Reload:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"ReloadF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"ReloadN")
	REVL A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherSniperMod",1,"ReloadS")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 2, "Ready")
	TNT1 A 0 A_JumpIfInventory("RocketAmmo", 1, "ReloadSequence")
	Goto Ready
  ReloadS:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 8, "Ready")
	TNT1 A 0 A_JumpIfInventory("RocketAmmo", 1, "ReloadSequence")
	Goto Ready
  ReloadN:
	REVL N 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 2, "Ready")
	TNT1 A 0 A_JumpIfInventory("RocketAmmo", 1, "ReloadSequence")
	Goto Ready
  ReloadF:
	REVL H 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip", 2, "Ready")
	TNT1 A 0 A_JumpIfInventory("RocketAmmo", 1, "ReloadSequence")
	Goto Ready
  ReloadSequence:
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"ReloadFirstF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"ReloadFirstN")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherTechnicalMod",1,"Reload1")
    REVL E 5
    REVL F 5
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    REVL G 40
    TNT1 A 0 A_PlaySound("weapons/revenantslauncherload", CHAN_ITEM)
	Goto ReloadWorking
  ReloadFirstN:
    REVL P 5
    REVL Q 5
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    REVL R 40
    TNT1 A 0 A_PlaySound("weapons/revenantslauncherload", CHAN_ITEM)
	Goto ReloadWorking
  ReloadFirstF:
    REVL K 5
    REVL L 5
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    REVL M 40
    TNT1 A 0 A_PlaySound("weapons/revenantslauncherload", CHAN_ITEM)
	Goto ReloadWorking
  Reload1:
    REVL E 5
    REVL F 5
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    REVL G 37
    TNT1 A 0 A_PlaySound("weapons/revenantslauncherload", CHAN_ITEM)
  ReloadWorking:
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherSniperMod",1,"ReloadWorkingS")
	TNT1 A 0 A_TakeInventory("RocketAmmo", 1)
	TNT1 A 0 A_GiveInventory("RLRevenantsLauncherClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",2,2)
	TNT1 A 0 A_JumpIfInventory("RocketAmmo",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadWorkingS:
	TNT1 A 0 A_TakeInventory("RocketAmmo", 1)
	TNT1 A 0 A_GiveInventory("RLRevenantsLauncherClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherClip",8,2)
	TNT1 A 0 A_JumpIfInventory("RocketAmmo",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorkingS
  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_JumpIfInventory("RLRevenantsLauncherFirestormMod",1,"ReloadFinishF")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherNanoMod",1,"ReloadFinishN")
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherTechnicalMod",1,"ReloadFinish1")
    REVL G 5
    REVL F 5
    REVL E 5
    REVL A 5
	Goto Ready
  ReloadFinishN:
    REVL R 5
    REVL Q 5
    REVL P 5
    REVL N 5
	Goto Ready
  ReloadFinishF:
    REVL M 5
    REVL L 5
    REVL K 5
    REVL H 5
	Goto Ready
  ReloadFinish1:
    REVL G 4
    REVL F 4
    REVL E 4
    REVL A 5
	Goto Ready
	
  Flash:
    TNT1 A 3 A_Light2
    TNT1 A 2 A_Light1
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLRevenantsLauncherPickup",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_TakeInventory("RLScavengerDrop",1)
	TNT1 A 3
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_JumpIfInventory("RLRevenantsLauncherModLimit",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("RLRevenantsLauncherModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLRevenantsLauncherNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLRevenantsLauncherSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_FireCustomMissile("DroppedRLSniperMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLRevenantsLauncher",1)
	Stop
  }
}

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

ACTOR RLRevenantsLauncherMissile : Rocket
{
  Radius 11
  Height 8
  Speed 30
  Damage (random(1,3)*80)
  Damagetype "Fire"
  PainType "Explosion"
  DeathType "Explosion"
  Scale 0.8
  Species "Player"
  +THRUSPECIES
  -ROCKETTRAIL
  -DEHEXPLOSION
  +SPAWNSOUNDSOURCE
  +THRUGHOST
  +FORCEXYBILLBOARD
  Decal "RevenantScorch"
  SeeSound "weapons/revenantslauncher"
  DeathSound ""
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			FATB AB 2 Bright
			Loop
		Spawn.Fancy:
			FATB A 0 A_ChangeFlag("ROCKETTRAIL", false)
			FATB ABAB 1 Bright A_SpawnItemEx("RLRevenantsLauncherTrail", -5, 0, 3)
			Loop
			
		Death:
			TNT1 A 0 A_GiveToTarget ("RLFireangelBonusCheck", 1)
			TNT1 A 0 A_RadiusGive ("RLFireangelRadiusBonusCheck", 64, RGF_PLAYERS)
			TNT1 A 0 A_SetTranslucent (0.95, 1)
			TNT1 A 0 A_Explode (32,64)
			TNT1 A 0 A_SetScale (0.65)
			TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 3)
			TNT1 A 0 A_Quake (1, 8, 0, 500, "")
			TNT1 A 0 A_Quake (6, 8, 0, 150, "")
			TNT1 A 0 A_PlaySound ("weapons/smallexp", 7, 1, 0, 0.5)
			TNT1 A 0 A_PlaySound("weapons/smallexp", CHAN_ITEM, 0.05, 0, 0.05)
			TNT1 A 0 A_Jump (256, "DeathAnimation")
			Goto DeathAnimation
		DeathAnimation:
			MEXP A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "DeathAnimation.Fancy")
			MEXP A 4 Bright
			MEXP B 4 Bright
			MEXP C 3 Bright
			MEXP D 3 Bright
			MEXP E 2 Bright
			MEXP F 2 Bright
			Stop
		DeathAnimation.Fancy:
			MEXP A 4 Bright
			MEXP B 4 Bright
			MEXP C 3 Bright
			MEXP D 3 Bright
			MEXP E 2 Bright
			MEXP F 2 Bright
			Stop
	}
}

ACTOR RLRevenantsLauncherTrail
{
	Renderstyle Add
	Scale 0.6
	Alpha 0.7
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			BAL2 C 2
			BAL2 DD 2 A_FadeOut
			"####" "#" 0 A_SetScale(scalex + 0.05)
			BAL2 EEE 3 A_FadeOut
			"####" "#" 0 A_SetScale(scalex + 0.1)
			Stop
	}
}

ACTOR RLRevenantsLauncherMissileHoming : RLRevenantsLauncherMissile
{
	Speed 10
	+SEEKERMISSILE
	+SCREENSEEKER
	+DONTSEEKINVISIBLE
	+ROCKETTRAIL
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			Loop
		Spawn.Fancy:
			FATB A 0 A_ChangeFlag("ROCKETTRAIL", false)
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			"####" "##" 0 A_SpawnItemEx("RLRevenantsLauncherTrail", -5, 0, 3)
			Loop
	}
}

ACTOR RLRevenantsLauncherMissileP : RLRevenantsLauncherMissile
{
	States
	{
		Death:
			TNT1 A 0 A_GiveToTarget ("RLFireangelBonusCheck", 1)
			TNT1 A 0 A_RadiusGive ("RLFireangelRadiusBonusCheck", 64, RGF_PLAYERS)
			TNT1 A 0 A_SetTranslucent (0.95, 1)
			TNT1 A 0 A_Explode (80,64)
			TNT1 A 0 A_SetScale (0.70)
			TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 3)
			TNT1 A 0 A_Quake (1, 8, 0, 500, "")
			TNT1 A 0 A_Quake (6, 8, 0, 150, "")
			TNT1 A 0 A_PlaySound ("weapons/smallexp", 7, 1, 0, 0.5)
			TNT1 A 0 A_PlaySound("weapons/smallexp", CHAN_ITEM, 0.05, 0, 0.05)
			TNT1 A 0 A_Jump (256, "DeathAnimation")
			Goto DeathAnimation
	}
}

ACTOR RLRevenantsLauncherMissileHomingP : RLRevenantsLauncherMissileP
{
	Speed 10
	+SEEKERMISSILE
	+SCREENSEEKER
	+DONTSEEKINVISIBLE
	+ROCKETTRAIL
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			Loop
		Spawn.Fancy:
			FATB A 0 A_ChangeFlag("ROCKETTRAIL", false)
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			"####" "##" 0 A_SpawnItemEx("RLRevenantsLauncherTrail", -5, 0, 3)
			Loop
	}
}

ACTOR RLRevenantsLauncherMissileA : RLRevenantsLauncherMissile
{
	Speed 60
}

ACTOR RLRevenantsLauncherMissileHomingA : RLRevenantsLauncherMissileA
{
	Speed 50
	+SEEKERMISSILE
	+SCREENSEEKER
	+DONTSEEKINVISIBLE
	+ROCKETTRAIL
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			Loop
		Spawn.Fancy:
			FATB A 0 A_ChangeFlag("ROCKETTRAIL", false)
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			"####" "##" 0 A_SpawnItemEx("RLRevenantsLauncherTrail", -5, 0, 3)
			Loop
	}
}

ACTOR RLRevenantsLauncherMissileB : RLRevenantsLauncherMissile
{
  Damage (random(1,3)*200)
}

ACTOR RLRevenantsLauncherMissileHomingB : RLRevenantsLauncherMissileB
{
	Speed 10
	+SEEKERMISSILE
	+SCREENSEEKER
	+DONTSEEKINVISIBLE
	+ROCKETTRAIL
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			FATB AB 2 Bright A_SeekerMissile (9, 9,SMF_LOOK,128)
			Loop
	}
}
ACTOR RLRevenantsLauncherPlasmaSkull : RevenantTracer
{
	Species "Player"
	+THRUSPECIES
	+THRUGHOST
	+FORCEXYBILLBOARD
	Speed 9
	Scale 0.7
	Decal "Scorch"
	Damage (random(2,6)*111)
	DamageType "Plasma"
	SeeSound "weapons/revenantslaunchernightmarefire"
	DeathSound "weapons/revenantslaunchernightmareimpact"
	States
	{
		Spawn:
			FATB A 0
			FATB A 0 A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			NREB A 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB A 1 Bright A_ScaleVelocity(1.05)
			NREB A 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB A 1 Bright A_ScaleVelocity(1.05)
			NREB B 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB B 1 Bright A_ScaleVelocity(1.05)
			NREB B 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB B 1 Bright A_ScaleVelocity(1.05)
			Loop
		Spawn.Fancy:
			NREB A 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB A 1 Bright A_ScaleVelocity(1.05)
			NREB A 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB A 1 Bright A_ScaleVelocity(1.05)

			NREB B 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB B 1 Bright A_ScaleVelocity(1.05)
			NREB B 1 Bright A_SeekerMissile(0, 1, SMF_PRECISE | SMF_CURSPEED)
			NREB B 1 Bright A_ScaleVelocity(1.05)
			Loop
		Death:
			NREB CDEFGHIJKL 3 Bright
			Stop
	}
}

ACTOR RLRevenantsLauncherPlasmaTrail
{
	WeaveIndexXY 32
	Speed 9
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct1")
			TNT1 A 0 A_ScaleVelocity(1.05)
			Loop
	}
}

ACTOR RLRevenantsLauncherPlasmaTrail2 : RLRevenantsLauncherPlasmaTrail
{
	WeaveIndexXY 0
	States
	{
		Spawn:
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			TNT1 AA 1 A_Weave(5,0,1,0)
			TNT1 A 0 A_SpawnItemEx("RLRevenantsLauncherPlasmaTrailAct2")
			TNT1 A 0 A_ScaleVelocity(1.05)
			Loop
	}
}

ACTOR RLRevenantsLauncherPlasmaTrailAct1
{
	WeaveIndexXY 32
	Renderstyle Add
	Scale 0.5
	Alpha 0.7
	+NOINTERACTION
	+FORCEXYBILLBOARD
	States
	{
		Spawn:
			DEPL FFGGHHHIIII 2 A_Weave(10,0,0.5,0)
			DEPL FGHI 0 A_FadeOut
			Stop
	}
}

ACTOR RLRevenantsLauncherPlasmaTrailAct2 : RLRevenantsLauncherPlasmaTrailAct1
{
	WeaveIndexXY 0
	States
	{
		Spawn:
			DEPL FFGGHHHIIII 2 A_Weave(10,0,0.5,0)
			DEPL FGHI 0 A_FadeOut
			Stop
	}
}

ACTOR RLRevenantsLauncherHeavyMissile : RevenantTracer
{
	Species "Player"
	+THRUSPECIES
	+THRUGHOST
	+SEEKERMISSILE
	+DONTSEEKINVISIBLE
	+FORCEXYBILLBOARD
	RenderStyle Normal
	Speed 16
	Damage (random(1,3)*120)
	DamageType "Fire"
    PainType "Explosion"
    DeathType "Explosion"
	Decal "Scorch"
	SeeSound "weapons/revenantslauncherheavyfire"
	DeathSound "weapons/mediumexp"
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("weapons/revenantslauncherheavyloop", CHAN_BODY, 0.6, 1, 1.2)
			TNT1 A 0 A_SpawnItemEx ("RLRevenantsLauncherHeavyMissileTrail", 16, 0, 0, 0, 0, 0, 180, SXF_NOCHECKPOSITION)
			PPSR A 1 Bright A_SeekerMissile (5, 5, SMF_LOOK | SMF_PRECISE | SMF_CURSPEED, 256, 25)
			TNT1 A 0 A_JumpIfTracerCloser (128, "Beep1")
			TNT1 A 0 A_JumpIfTracerCloser (256, "Beep2")
			TNT1 A 0 A_JumpIfTracerCloser (384, "Beep3")
			TNT1 A 0 A_JumpIfTracerCloser (512, "Beep4")
			TNT1 A 0 A_JumpIfTracerCloser (640, "Beep5")
			TNT1 A 0 A_JumpIfTracerCloser (768, "Beep6")
			TNT1 A 0 A_JumpIfTracerCloser (896, "Beep7")
			TNT1 A 0 A_JumpIfTracerCloser (1024, "Beep8")
			Goto Beep9
		Beep1:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep1", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep2:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep2", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep3:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep3", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep4:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep4", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep5:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep5", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep6:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep6", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep7:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep7", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep8:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep8", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Beep9:
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep1", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep2", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep3", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep4", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep5", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep6", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep7", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep8", 1, "Spawn")
			TNT1 A 0 A_JumpIfInventory ("PowerRLRevenantsLauncherHeavyMissileBeep9", 1, "Spawn")
			TNT1 A 0 A_GiveInventory("PowerRLRevenantsLauncherHeavyMissileBeep9", 1)
			TNT1 A 0 A_PlaySound ("weapons/revenantslauncherheavyhoming", 5)
			Goto Spawn
		Death:
			TNT1 A 0 A_GiveToTarget ("RLFireangelBonusCheck", 1)
			TNT1 A 0 A_RadiusGive ("RLFireangelRadiusBonusCheck", 64, RGF_PLAYERS)
			TNT1 A 0 A_StopSound(CHAN_BODY)
			TNT1 A 0 A_SetTranslucent (0.95, 1)
			TNT1 A 0 A_Explode (512,192)
			TNT1 A 0 A_SetScale (1.65)
			TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 3)
			TNT1 A 0 A_Quake (1, 8, 0, 500, "")
			TNT1 A 0 A_Quake (6, 8, 0, 150, "")
			TNT1 A 0 A_PlaySound ("weapons/mediumexp", 7, 1, 0, 0.3)
			TNT1 A 0 A_PlaySound("weapons/mediumexp", CHAN_ITEM, 0.05, 0, 0.05)
			MEXP A 4 Bright
			MEXP B 4 Bright
			MEXP C 3 Bright
			MEXP D 3 Bright
			MEXP E 2 Bright
			MEXP F 2 Bright
			Stop
	}
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep1 : Powerup
{
	Powerup.Duration 6
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep2 : Powerup
{
	Powerup.Duration 9
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep3 : Powerup
{
	Powerup.Duration 12
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep4 : Powerup
{
	Powerup.Duration 15
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep5 : Powerup
{
	Powerup.Duration 18
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep6 : Powerup
{
	Powerup.Duration 21
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep7 : Powerup
{
	Powerup.Duration 24
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep8 : Powerup
{
	Powerup.Duration 27
}

ACTOR PowerRLRevenantsLauncherHeavyMissileBeep9 : Powerup
{
	Powerup.Duration 30
}

ACTOR RLRevenantsLauncherHeavyMissileTrail
{
   Projectile
   Radius 8
   Height 8
   Speed 1
   Scale 0.4
   Damage 0
   RENDERSTYLE ADD
   Alpha 0.75
   +NOCLIP
   +NOINTERACTION
   +FORCEXYBILLBOARD
   States
   {
   Spawn:
   CRES ABCDE 3 A_SetScale (ScaleX+0.2)
   Stop
   }
}

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

Actor RLRevenantsLauncherSelected : RLPermanentInventory {}
Actor RLRevenantsLauncherCount : RLPermanentInventory {}
Actor RLRevenantsLauncherModLimit : RLUniqueModAmount {}
Actor RLRevenantsLauncherPowerMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherBulkMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherAgilityMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherTechnicalMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherNanoMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherFirestormMod : RLUniqueModAmount {}
Actor RLRevenantsLauncherSniperMod : RLUniqueModAmount {}

ACTOR RLRevenantsLauncherClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 8
   Inventory.Icon ""
}

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

ACTOR RLRevenantsLauncherPickup : RLUniqueWeaponPickup
{
	//$Sprite REVLX0
	Tag "Revenant's Launcher [Pickup]"
	States
	{
	SpawnFrame:
		REVL 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("RLRevenantsLauncher",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("RLRevenantsLauncher",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdRevenant's Launcher.")
		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("\cd= Revenant's Launcher =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/RevenantsLauncherpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	SuperweaponStuff:
		"####" "#" 0 A_Jump(256, "NoSpecialStartsStuff")
		Goto NoSpecialStartsStuff
	}
}

ACTOR RLRevenantsLauncherWorldSpawnPickup : RLRevenantsLauncherPickup 17113
{
	States
	{
	NoSpecialStartsStuff:
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamUniqueWorld", 0,0,0, 0,0,0, 0, SXF_SETMASTER)
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "DRPGInit")
		"####" "#" 0 A_Jump(256, "SpawnFrame")
		Goto SpawnFrame
		
	SpawnFrame:
		REVL X 4
		"####" "#" 0 A_GiveInventory("RLUniqueItemSpawnMessageSender",1)
		"####" "#" 0 A_PlaySound("weapons/uniquespawned", 7, 0.25, 0, 0)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
		
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLRevenantsLauncher",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdRevenant's Launcher.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelUniqueGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}

ACTOR RLRevenantsLauncherPickupModded : RLRevenantsLauncherPickup
{
	+INVENTORY.TRANSFER
	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:
		REVL 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("RLRevenantsLauncher",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cdRevenant's Launcher.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Revenant's Launcher =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLRevenantsLauncherModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Revenant's Launcher =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("RocketAmmo",4)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cd= Revenant's Launcher =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
