/*
DIRECT HIT

If it will be a blueprint:
Advanced assembly, Power-Agility-Agility, Missile Launcher

Stats, compared to base weapon:
+High missile speed
+High impact damage
+Mini-crits airborne targets
+Occasionally fires a crit missile
+Tremendous knockback
+Can knock monsters into the air if fired at their feet
+Faster lower/raise of weapon during reload

-Probably slower loading speed
-Lower splash damage
-Lower splash range

If it will be unique, ideas for mod effects:
Firestorm - Negates the Splash Damage penalty, making it more viable for crow control again
Nano - If the missile hits the monster, it replenishes the rocket inside the clip (but still draws from your ammo pool), making it more viable for brawling
Sniper - Airborne shots are treated as crit shots, giving it extra damage
*/

// This gun was made and contributed by everyone's favourite boomboi, Pillowblaster!
// Thank him for giving you all a new shootbanger in 1.1!

ACTOR RLDirectHit : RLHeavyWeapon
{
  Inventory.Pickupsound "weapons/unique"
  Obituary "%o was intercepted by %k's Direct Hit."
  Tag "Direct Hit"
  Weapon.SelectionOrder 32167
  Weapon.SlotNumber 5
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLDirectHitClip"
  Weapon.AmmoType2 "RocketAmmo"
  Inventory.Icon "DHTGICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
    DHTG A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  ReadyNoFire:
    DHTG A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOFIRE)
    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_JumpIfInventory("RLDirectHitModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLDirectHitPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLDirectHitPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLDirectHitModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDirectHitSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLDirectHit",1)
	Stop
  AfterModDrop:
    DHTG A 8 A_WeaponReady (WRF_NOSECONDARY)
    Goto Ready
  MisfirePrevention:
    DHTG A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
	
  Deselect:
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLDirectHitSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    DHTG 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("RLUniqueWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLDirectHitSelected", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    DHTG A 1 A_Raise
    Loop
	
  Fire:
	DHTG A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	DHTG A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	DHTG A 0 A_JumpIfInventory("RLRestrictionNoBoom",1,"NoBoomRestricted") // Cannot fire in levels that restrict it
	DHTG A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	DHTG A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	// THE PILLOW ZONE BECKONS YOU IN
	// ACCEPT THE EXPLODE INTO YOUR HEART
	
		DHTG A 0 A_JumpIfInventory("RLDirectHitReloading",1,"ReloadEnd")
		DHTG A 0 A_JumpIfInventory("RLDirectHitClip",1,1)
		Goto Reload
		DHTF A 0 A_AlertMonsters
		DHTF A 0 A_Gunflash
		DHTF A 0 A_Jump(8,"CritShot")
		DHTF A 0 A_PlaySound("weapons/directhit",CHAN_WEAPON,0.7)
		TNT1 A 0 A_TakeInventory("RLDirectHitClip", 1)
		DHTF A 0 A_FireCustomMissile("RLDirectHitMissile", 0,0)
		
	FireFinish:
		DHTF A 1 Bright Offset(0,33)
		DHTF A 1 Bright Offset(0,37)
		DHTF B 1 Bright Offset(0,42)
		DHTF B 1 Bright Offset(0,45)
		DHTF C 1 Bright Offset(0,47)
		DHTF C 1 Bright Offset(0,48)
		DHTG A 4 Offset(0,49)
		DHTG A 1 Offset(0,48)
		DHTG A 1 Offset(0,45)
		DHTG A 1 Offset(0,41)
		DHTG A 1 Offset(0,38)
		DHTG A 1 Offset(0,35)
		DHTG A 1 Offset(0,32)
		DHTG A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOBOB) //to reset horseshit offsets. Hopefully.
		DHTG A 8
		DHTG A 0 A_ReFire
		Goto Ready
		
	CritShot:
		DHTF A 0 A_PlaySound("weapons/directhitcrit",CHAN_WEAPON,0.7)
		TNT1 A 0 A_TakeInventory("RLDirectHitClip", 1)
		DHTF A 0 A_FireCustomMissile("RLDirectHitCritMissile", 0,0,0,0,FPF_TRANSFERTRANSLATION)
		Goto FireFinish
	
	Flash:
		TNT1 A 6 A_Light2
		TNT1 A 6 A_Light1
		TNT1 A 0 A_Light0
		Stop
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLDirectHitPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
	
  Reload:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	
		DHTG A 0 A_JumpIfInventory("RLDirectHitClip",4,"ReadyNoFire")
		DHTG A 0 A_JumpIfInventory("RocketAmmo",1,1)
		Goto ReadyNoFire
		DHTG A 1 Offset(0,33)
		DHTG A 1 Offset(0,35)
		DHTG A 1 Offset(0,39)
		DHTG A 1 Offset(0,43)
		DHTG A 1 Offset(0,54)
		DHTG A 1 Offset(0,67)
		DHTG A 1 Offset(0,86)
		TNT1 A 10 A_GiveInventory("RLDirectHitReloading",1)
	ReloadLoop:
		TNT1 A 0 A_JumpIfInventory("RocketAmmo",1,1)
		Goto ReloadEnd
		TNT1 A 25 A_PlaySound("weapons/directhitreload",5)
		TNT1 A 0 A_GiveInventory("RLDirectHitClip",1)
		TNT1 A 0 A_TakeInventory("RocketAmmo",1, TIF_NOTAKEINFINITE)
		TNT1 A 1 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIfInventory("RLDirectHitClip",0,"ReloadEnd")
		TNT1 A 0 A_JumpIf(CallACS("DRLA_MultiReload") == 0, 2)
		TNT1 A 0 A_JumpIfInventory("RLSynthFireReload",1,"ReloadLoop")
		Goto ReloadEnd
		TNT1 A 0 A_Refire ("ReloadEnd")
		Goto ReloadLoop
	ReloadEnd:
		DHTG A 1 Offset(0,86)
		DHTG A 1 Offset(0,67)
		DHTG A 1 Offset(0,54)
		DHTG A 1 Offset(0,43)
		DHTG A 1 Offset(0,37)
		DHTG A 1 Offset(0,34)
		DHTG A 1 Offset(0,33)
		DHTG A 0 A_TakeInventory("RLDirectHitReloading",1)
		DHTG A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOBOB)
		Goto Ready
		
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	Goto ReadyNoFire
  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("RLDirectHitModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDirectHitSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_JumpIfInventory("RLDirectHitModLimit",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("RLDirectHitModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLDirectHitNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDirectHitSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLEmitScavengedModUnique", 1) // Determines what mods this can generate when scavenged.
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLDirectHit",1)
	Stop
  }
}

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


actor RLDirectHitMissile : Rocket
{
	Speed 60
	Damage (250+random(1,3)*30)
	ProjectileKickback 400
	SeeSound "weapons/directhit"
	Damagetype "Fire"
	PainType "Explosion"
    DeathType "Explosion"
	Species "Player"
	+THRUSPECIES
	+THRUGHOST
	+HITTRACER
	States
	{
	Spawn:
		MISL A 1 Bright
		Loop
	XDeath:
		//Clip replenish on monster hit.
		TNT1 A 0 A_JumpIfInTargetInventory("RLDirectHitNanoMod",1,2)
		TNT1 A 0 A_Jump(256, "Death")
		TNT1 A 0 A_JumpIfInTargetInventory("RocketAmmo",1,2)
		TNT1 A 0 A_Jump(256, "Death")
		TNT1 A 0 A_GiveToTarget("RLDirectHitClip",1)
		TNT1 A 0 A_TakeFromTarget("RocketAmmo",1)
	Death:
		//Airborne damage.
		TNT1 A 0 A_JumpIfInTargetInventory("RLDirectHitSniperMod",1,3)
		TNT1 A 0 A_GiveInventory("RLDirectHitExtra",1,AAPTR_TRACER)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_GiveInventory("RLDirectHitExtraSniper",1,AAPTR_TRACER)
		
		//Damage.
	DeathDamage:
		TNT1 A 0 A_JumpIfInTargetInventory("RLDirectHitFirestormMod",1,2)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_Explode(256,160)
		TNT1 A 0 A_Explode(96,108)
		
		//Extra Knockback.
		TNT1 A 0 A_RadiusThrust(1500,108,RTF_AFFECTSOURCE|RTF_NOIMPACTDAMAGE)
		
		//Air thrust.
	DeathThrust:
		TNT1 A 0 A_CheckFlag ("SPECIAL", "DeathBlast", AAPTR_TRACER)
		TNT1 A 0 A_CheckFlag ("ISMONSTER", 1, AAPTR_TRACER)
		Goto DeathBlast
		TNT1 A 0 A_JumpIf(Z <= (FloorZ + 16.0),2)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_ChangeVelocity(0,0,15,0,AAPTR_TRACER)
		
		//Blast anim.
	DeathBlast:
		TNT1 A 0 A_JumpIfInTargetInventory("RLDirectHitFirestormMod",1,2)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_SetScale(1.5)
	DeathAnimation:
		TNT1 A 0 A_GiveToTarget ("RLFireangelBonusCheck", 1)
		TNT1 A 0 A_RadiusGive ("RLFireangelRadiusBonusCheck", 128, RGF_PLAYERS)
		TNT1 A 0 A_SetTranslucent (0.95, 1)
		TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 3)
		TNT1 A 0 A_Quake (1, 8, 0, 1024, "")
		TNT1 A 0 A_Quake (6, 8, 0, 512, "")
		TNT1 A 0 A_PlaySound ("weapons/directhitexplode", 7, 1, 0, 0.5)
		TNT1 A 0 A_PlaySound("weapons/directhitexplode", CHAN_ITEM, 0.05, 0, 0.05)
		TNT1 A 0 A_Jump (256, "DeathAnimation")
		Goto DeathAnimation
	DeathAnimation:
		TNT1 A 0 A_JumpIf(CallACS("DRLA_FancyProjectiles") == 1, "DeathAnimation.Fancy")
		MEXP AB 4 Bright
		MEXP CD 3 Bright
		MEXP EF 2 Bright
		Stop
	DeathAnimation.Fancy:
		MEXP AAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("RLRocketShrapnel", 0, 0, 0, frandom(-5.0,5.0), frandom(-5.0,5.0), frandom(-5.0,5.0), frandom(0.0,360.0),0,58)
		MEXP AAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("RLBulletPuffShrapnel", 0, 0, 0, frandom(-5.0,5.0), frandom(-5.0,5.0), frandom(-5.0,5.0), frandom(0.0,360.0),0,58)
		MEXP A 1 Bright
		MEXP B 1 Bright
		MEXP B 0 A_SpawnItemEx("RLRocketPuff")
		MEXP C 2 Bright
		MEXP D 2 Bright
		MEXP E 3 Bright
		MEXP F 4 Bright
		Stop
	}
}

actor RLDirectHitCritMissile : RLDirectHitMissile
{
	Damage (750+random(1,3)*30)
	
	States
	{
	Spawn:
		MISL A 1 Bright A_SpawnItemEx("RLDirectHitCritTrail",0,0,0,frandom(1.0,-1.0),0,frandom(1.0,-1.0),frandom(205.0,155.0),SXF_TRANSFERTRANSLATION)
		Loop
	}
}

//Player-colored particles for crit missile.
actor RLDirectHitCritTrail
{
	Renderstyle "Add"
	Scale 0.2
	+NOINTERACTION
	
	States
	{
	Spawn:
		DHTC A 1 Bright A_FadeOut(0.075)
		Loop
	}
}

//Do you like, my Hax (my Hax)~ [/dejavu]
actor RLDirectHitExtra : CustomInventory
{
	Inventory.MaxAmount 0
	+Inventory.Autoactivate
	+Inventory.Alwayspickup
	
	States
	{
	Use:
		TNT1 A 0 A_JumpIf(Z > FloorZ,1)
		Stop
		TNT1 A 0 A_DamageSelf((150),"Fire")
		Stop
	}
}

actor RLDirectHitExtraSniper : RLDirectHitExtra
{
	States
	{
	Use:
		TNT1 A 0 A_JumpIf(Z > FloorZ,1)
		Stop
		TNT1 A 0 A_DamageSelf((450),"Fire")
		Stop
	}
}

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

Actor RLDirectHitSelected : RLPermanentInventory {}
actor RLDirectHitReloading : RLPermanentInventory {}
Actor RLDirectHitModLimit : RLUniqueModAmount {}
Actor RLDirectHitFirestormMod : RLUniqueModAmount {}
Actor RLDirectHitNanoMod : RLUniqueModAmount {}
Actor RLDirectHitSniperMod : RLUniqueModAmount {}

actor RLDirectHitClip : Ammo
{
	Inventory.MaxAmount 4
	Inventory.Icon ""
	+INVENTORY.IGNORESKILL
}


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

ACTOR RLDirectHitPickup : RLUniqueWeaponPickup
{
	//$Sprite DHTGX0
	Scale 0.75
	Tag "Direct Hit [Pickup]"
	States
	{
	SpawnFrame:
		DHTG 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("RLDirectHit",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("RLDirectHit",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdDirect Hit.")
		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= Direct Hit =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/DirectHitpickup")
		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 RLDirectHitWorldSpawnPickup : RLDirectHitPickup 17128
{
	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:
		DHTG 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("RLDirectHit",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdDirect Hit.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelUniqueGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}

ACTOR RLDirectHitPickupModded : RLDirectHitPickup
{
	+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:
		DHTG 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("RLDirectHit",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cdDirect Hit.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Direct Hit =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLDirectHitModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Direct Hit =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cd= Direct Hit =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
