
ACTOR RLCombatTranslocator : RLWeapon
{
  Obituary "%o was somehow warped to death by %k's translocator."
  Decal BulletChip
  Tag "Combat Translocator"
  Weapon.Kickback 0
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 5
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLCombatTranslocatorClip"
  Weapon.AmmoType2 "Cell"
  Inventory.Icon "TRANICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "ReadyRecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "ReadyRecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "ReadyPlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "ReadyTranslocateSelf")
    CTLO B 8 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
    Goto Ready
  ReadyTranslocateSelf:
    CTLO O 8 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
    Goto Ready
  ReadyPlaceRecall:
    CTLO P 8 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
    Goto Ready
  ReadyRecallSelf:
    CTLO Q 8 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
    Goto Ready
  ReadyRecallDeath:
    CTLO R 8 A_WeaponReady (WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
    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("RLCombatTranslocatorMode", 4)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_SpawnItemEx("RLCombatTranslocatorPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLCombatTranslocatorSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLCombatTranslocator",1)
	Stop
  AfterModDrop:
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "AfterModDropRecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "AfterModDropRecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "AfterModDropPlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "AfterModDropTranslocateSelf")
    CTLO B 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  AfterModDropTranslocateSelf:
    CTLO O 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  AfterModDropPlaceRecall:
    CTLO P 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  AfterModDropRecallSelf:
    CTLO Q 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  AfterModDropRecallDeath:
    CTLO R 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
  MisfirePrevention:
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "AssemblyNoFireRecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "AssemblyNoFireRecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "AssemblyNoFirePlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "AssemblyNoFireTranslocateSelf")
    CTLO B 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  AssemblyNoFireTranslocateSelf:
    CTLO O 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  AssemblyNoFirePlaceRecall:
    CTLO P 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  AssemblyNoFireRecallSelf:
    CTLO Q 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
  AssemblyNoFireRecallDeath:
    CTLO R 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("RLCombatTranslocatorSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "DeselectRecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "DeselectRecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "DeselectPlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "DeselectTranslocateSelf")
    TNT1 A 0 A_Lower
    CTLO B 1 A_Lower
    Loop
  DeselectTranslocateSelf:
    TNT1 A 0 A_Lower
    CTLO O 1 A_Lower
    Loop
  DeselectPlaceRecall:
    TNT1 A 0 A_Lower
    CTLO P 1 A_Lower
    Loop
  DeselectRecallSelf:
    TNT1 A 0 A_Lower
    CTLO Q 1 A_Lower
    Loop
  DeselectRecallDeath:
    TNT1 A 0 A_Lower
    CTLO R 1 A_Lower
    Loop
  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("RLExoticWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "SelectRecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "SelectRecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "SelectPlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "SelectTranslocateSelf")
    TNT1 A 0 A_Raise
    CTLO B 1 A_Raise
    Loop
  SelectTranslocateSelf:
    TNT1 A 0 A_Raise
    CTLO O 1 A_Raise
    Loop
  SelectPlaceRecall:
    TNT1 A 0 A_Raise
    CTLO P 1 A_Raise
    Loop
  SelectRecallSelf:
    TNT1 A 0 A_Raise
    CTLO Q 1 A_Raise
    Loop
  SelectRecallDeath:
    TNT1 A 0 A_Raise
    CTLO R 1 A_Raise
    Loop
  Fire:
	
	CTLO A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	CTLO A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	CTLO A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorClip",10, 2)
	Goto Reload
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorClip",5, 1)
	Goto Reload
  DoorpegCheckStart:
	TNT1 A 0 A_JumpIfInventory("DRPGDRLAActive",1,"DoorpegOutpostCheck")
  FireCheckDone:
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",4, "RecallDeath")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",3, "RecallSelf")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",2, "PlaceRecall")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode",1, "TranslocateSelf")
  TranslocateTarget:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatoractivate", CHAN_WEAPON, 1, 0, 1.2)
	TNT1 A 0 A_AlertMonsters (128)
    CTLO A 8
	TNT1 A 0 A_FireCustomMissile("RLCombatTranslocatorShot",0,1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish")
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    Goto FireFinish
  FireFinish:
    CTLO A 2 A_GunFlash
    CTLO B 28 A_WeaponReady (62)
    CTLO B 3 A_ReFire
    Goto Ready
  TranslocateSelf:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatoractivate", CHAN_WEAPON, 1, 0, 1.2)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_FireCustomMissile("RLCombatTranslocatorTeleportLocator",0,1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish2")
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    Goto FireFinish2
  FireFinish2:
    CTLO A 2 A_GunFlash
    CTLO O 28 A_WeaponReady (62)
    CTLO O 3 A_ReFire
    Goto Ready
  PlaceRecall:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_TakeInventory("RLCombatTranslocatorRecallActive", 1)
    CTLO A 6
	TNT1 A 0 A_SpawnItemEx("RLCombatTranslocatorRecallSpot", 64, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
    CTLO A 2
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorRecallActive",1,"FireFinish3")
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorfail", CHAN_WEAPON, 1, 0, 1.2)
    Goto FireFinish3
  FireFinish3:
    CTLO P 12 A_WeaponReady (62)
    Goto Ready
  RecallSelf:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatoractivate", CHAN_WEAPON, 1, 0, 1.2)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("RLCombatTranslocatorRecallActivate", 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish4")
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    Goto FireFinish4
  FireFinish4:
    CTLO A 2 A_GunFlash
    CTLO Q 28 A_WeaponReady (62)
    CTLO Q 3 A_ReFire
    Goto Ready
  RecallDeath:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatoractivate", CHAN_WEAPON, 1, 0, 1.2)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    TNT1 A 0 A_GiveInventory("RLCombatTranslocatorRecallDeathActivate", 1)
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"FireFinish5")
	TNT1 A 0 A_TakeInventory ("RLCombatTranslocatorClip", 5, TIF_NOTAKEINFINITE)
    Goto FireFinish5
  FireFinish5:
    CTLO A 2 A_GunFlash
    CTLO R 28 A_WeaponReady (62)
    CTLO R 3 A_ReFire
    Goto Ready
  Reload:
	CTLO A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorClip", 60, "Ready")
	TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
    CTL2 A 2
    CTL2 B 2
    CTL2 C 2
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorunload", CHAN_ITEM)
    CTL2 C 16
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Cell", 1)
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorClip",60,2)
	TNT1 A 0 A_JumpIfInventory("Cell",1,2)
	TNT1 A 0
	Goto ReloadFinish
	TNT1 A 0
	Goto ReloadWorking
  ReloadFinish:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorload", 7)
    CTL2 C 6
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorpump", CHAN_ITEM)
    CTL2 D 2
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorspark", CHAN_WEAPON, 1, 0, 0.8)
    CTL2 E 2 A_GunFlash ("ReloadFlash")
    CTL2 F 2
    CTL2 G 2
    CTL2 H 2
    CTL2 I 2
    CTL2 J 2
    CTL2 K 2
    CTL2 L 2
	Goto Ready
  Flash:
    TNT1 A 2 A_Light (10)
    TNT1 A 2 A_Light1
    Goto LightDone
  ReloadFlash:
    CTL3 E 2 Bright A_Light (4)
    CTL3 F 2 Bright A_Light (2)
    CTL3 G 2 Bright A_Light1
    CTL3 H 2 Bright A_Light0
    CTL3 I 2 Bright
    CTL3 J 2 Bright
    CTL3 K 2 Bright
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLCombatTranslocatorPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode", 4, "TranslocateTargetMode")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode", 3, "RecallDeathMode")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode", 2, "RecallSelfMode")
	TNT1 A 0 A_JumpIfInventory("RLCombatTranslocatorMode", 1, "SetRecallPointMode")
    Goto TranslocateSelfMode
  TranslocateTargetMode:
	TNT1 A 0 A_TakeInventory("RLCombatTranslocatorMode", 4)
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cd< TRANSLOCATE TARGET MODE ACTIVE >", 2, "CONFONT")
    CTLO B 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  TranslocateSelfMode:
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorMode", 1)
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cd< TRANSLOCATE SELF MODE ACTIVE >", 2, "CONFONT")
    CTLO B 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  SetRecallPointMode:
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorMode", 1)
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cd< SET RECALL POINT MODE ACTIVE >", 2, "CONFONT")
    CTLO B 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  RecallSelfMode:
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorMode", 1)
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cd< RECALL SELF MODE ACTIVE >", 2, "CONFONT")
    CTLO B 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  RecallDeathMode:
	TNT1 A 0 A_GiveInventory("RLCombatTranslocatorMode", 1)
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cd< TERMINATION POINT RECALL MODE ACTIVE >", 2, "CONFONT")
    CTLO B 14 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_Print("Mod pack extracted from discarded weapon.")
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLCombatTranslocatorMode", 4)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLCombatTranslocatorSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLEmitScavengedModExotic", 1) // Determines what mods this can generate when scavenged.
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLCombatTranslocator",1)
	Stop
//==============================================================================
//					--	DRPG Compatibility Stuff  --
//==============================================================================
  DoorpegOutpostCheck:
	TNT1 A 0// ACS_NamedExecuteAlways("InOutpost", "HEYSTOPTHAT") // I dun fuckin know what am i made of scripts
	Goto FireCheckDone
  HEYSTOPTHAT:
    TNT1 A 0 A_PlaySound("weapons/combattranslocatorbeep", CHAN_WEAPON, 1, 0, 1.2)
    TNT1 A 0 A_Print("\cg< TRANSLOCATOR DISABLED WHILE >\n\cg<        IN THE OUTPOST       >", 10, "CONFONT")
    CTLO B 35 A_WeaponReady (WRF_NOFIRE | WRF_ALLOWZOOM)
    Goto Ready
  }
}

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

ACTOR RLCombatTranslocatorShot : TelOtherFX1
{
  Radius 6
  Height 1
  Speed 100
  States
  {
  Spawn:
    TNT1 A 1
    Loop
  Death:
    TNT1 A 1
    Stop
  }
}

ACTOR RLCombatTranslocatorTeleportLocator : FastProjectile
{
  Radius 16
  Height 56
  Speed 100
  Damage 0
  +MTHRUSPECIES
  SeeSound ""
  DeathSound ""
  States
  {
  Spawn:
    TNT1 A 1
    Loop
  Death:
    TNT1 A 1 A_SpawnItemEx("RLCombatTranslocatorTeleportSpot", 0, 0, 0)
    TNT1 A 1 A_GiveToTarget("RLCombatTranslocatorTeleportActivate", 1)
    Stop
  }
}

ACTOR RLCombatTranslocatorTeleportSpot : SpecialSpot
{
  +NOSECTOR
  +NOBLOCKMAP
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 2
    Stop
  }
}

ACTOR RLCombatTranslocatorTeleportActivate : RLExoticWeaponPickup
{
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 0 
	TNT1 A 0 A_Teleport("Teleport", "RLCombatTranslocatorTeleportSpot", "TeleportFog", TF_TELEFRAG)
  Teleport:
	TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallSpot : SpecialSpot
{
  +NOBLOCKMAP 
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_GiveInventory ("RLCombatTranslocatorRecallSuccess", 1, AAPTR_MASTER)
  SpawnLoop:
    TNT1 A 1
    TNT1 A 0 A_Jump (250, 2)
	TNT1 A 0 A_SpawnItemEx ("RLCombatTranslocatorRecallSpark", frandom(-24, 24), frandom(-24, 24), frandom(0, 64), 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    TNT1 A 0 A_JumpIfInventory ("RLCombatTranslocatorRecallActive", 1, "SpawnLoop", AAPTR_MASTER)
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallDeathSpot : SpecialSpot
{
  +NOSECTOR
  +NOBLOCKMAP
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 63000
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallSpark
{
  +NOBLOCKMAP
  +NOGRAVITY
  +NOTELEPORT
  +THRUACTORS
  +FORCEXYBILLBOARD
  RenderStyle Add
  Alpha 0.88
  Scale 0.3
  States
  {	
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_SetScale (ScaleX+frandom(-0.2, 0.5))
    AEFG GHIJIHG 1 Bright
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallSuccess : CustomInventory
{
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 0 
    TNT1 A 0 A_GiveInventory ("RLCombatTranslocatorRecallActive", 1)
    TNT1 A 0 A_Print("\cd< RECALL POINT SET >", 2, "CONFONT")
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallActivate : CustomInventory
{
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 0 
	TNT1 A 0 A_Teleport("Teleport", "RLCombatTranslocatorRecallSpot", "TeleportFog", TF_TELEFRAG)
  Teleport:
	TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    Stop
  }
}

ACTOR RLCombatTranslocatorRecallDeathActivate : CustomInventory
{
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 0 
	TNT1 A 0 A_Teleport("Teleport", "RLCombatTranslocatorRecallDeathSpot", "TeleportFog", TF_TELEFRAG)
  Teleport:
	TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    Stop
  }
}

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

Actor RLCombatTranslocatorSelected : RLPermanentInventory {}
Actor RLCombatTranslocatorRecallActive : RLPermanentInventory {}
Actor RLCombatTranslocatorMode : RLPermanentInventory
{
inventory.maxamount 4
}


ACTOR RLCombatTranslocatorClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 60
   Inventory.Icon ""
}

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

ACTOR RLCombatTranslocatorPickup : RLExoticWeaponPickup 16915
{
	//$Sprite CTLOX0
	Tag "Combat Translocator [Pickup]"
	States
	{
	SpawnFrame:
		CTLO X 4
	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("RLSynthFireReload",1,"AmmoPickup") // If the player is holding reload, pickup the gun for ammo.
		"####" "#" 0 A_JumpIfInventory("RLCombatTranslocator",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("RLCombatTranslocator",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \ctCombat Translocator.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickupNothing")
		Goto NotPickupNothing
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("Cell",0,"NotPickupNothing")
		Goto AmmoPickup
	NotPickupNothing:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\ct= Combat Translocator =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	AmmoPickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("Cell",0,"NotPickupNothing")
		"####" "#" 1 A_GiveInventory("Cell",60)
		Goto PickupSound
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/CombatTranslocatorpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}
