
ACTOR RLPlasmaHandcannon : RLPistolWeapon
{
  Obituary "%o was atomized by %k's plasma handcannon."
  Decal BulletChip
  Tag "Plasma Handcannon"
  Weapon.SelectionOrder 1899
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLPlasmaHandcannonClip"
  Weapon.AmmoType2 "Cell"
  Inventory.Icon "PDEAICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonNanoMod",1,2)
    PDEA A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Loop
  NanoRegenCheck:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip",1,2)
    PDEA A 70 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto NanoRegenCheckBegin
  NanoRegenCheckBegin:
    PDEA A 70 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip", 7, "Ready")
	Goto NanoRegen
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip", 9, "Ready")
	Goto NanoRegen
  NanoRegen:
	TNT1 A 0 A_GiveInventory("RLPlasmaHandcannonClip", 1)
    PDEA A 17 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto NanoRegenCheckBegin+1
	
  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("RLPlasmaHandcannonModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLPlasmaHandcannonPickup", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLPlasmaHandcannonPickupModded", 0, 0, 40, 16, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLPlasmaHandcannon",1)
	Stop
  AfterModDrop:
    PDEA A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    PDEA 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("RLPlasmaHandcannonSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianAdvancedDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 AA 0 A_Lower
    PDEA 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("RLPistolTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaHandcannonSelected", 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 AA 0 A_Raise
    PDEA A 1 A_Raise
    Loop
// 8x damage with Scout, no deviation
  Fire:
	PDEA A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	PDEA A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	PDEA A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	PDEA A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	PDEA 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("RLPlasmaHandcannonSniperMod",1,"FireS")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonPowerMod",1,"FireP")
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonAgilityMod",1,"FireA")
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBall", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallSharpshooter", 0, 1)
    Goto FireFinish
  FireP:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallP", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallPSharpshooter", 0, 1)
    Goto FireFinish
  FireA:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallA", frandom(-0.2,0.2), 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallASharpshooter", 0, 1)
    Goto FireFinish
  FireS:
	TNT1 A 0 A_JumpIfInventory("RLSharpshooterPerk",1,2)
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallS", 0, 1)
    Goto FireFinish
	TNT1 A 0 A_FireCustomMissile ("RLPlasmaHandcannonBallSSharpshooter", 0, 1)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLHandcannonRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonFirestormMod",1,"FireFinishF1")
    TNT1 A 0 A_GunFlash
    PDEA B 3 Bright
    PDEA C 3 Bright
    PDEA D 3
    PDEA A 5
    PDEA A 3 A_ReFire
    Goto Ready
  FireFinishF1:
    TNT1 A 0 A_GunFlash ("Flash2")
    PDEA B 2 Bright
    PDEA C 2 Bright
    PDEA D 2
    PDEA A 5
    PDEA A 3 A_ReFire
    Goto Ready
	
  Reload:
	PDEA A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip", 7, "Ready")
	Goto ReloadStartingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip", 9, "Ready")
  ReloadStartingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("Cell", 2, 2)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonTechnicalMod",1,"Reload1")
    PDEA D 3
    PDEA E 2
    PDEA F 2
    PDEA G 1
	TNT1 A 0 A_PlaySound("weapons/plasmahandcannonunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PDEA H 1
    PDEA I 1
    PDEA J 1
    PDEA K 1
    PDEA L 1
    PDEA M 1
    PDEA N 1
    PDEA O 1
    PDEA G 13
    PDEA O 1
    PDEA N 1
    PDEA M 1
    PDEA L 1
    PDEA K 1
    PDEA J 1
    TNT1 A 0 A_PlaySound("weapons/plasmahandcannonload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PDEA I 1
    PDEA H 1
	Goto ReloadWorking
  Reload1:
    PDEA D 3
    PDEA E 2
    PDEA F 2
    PDEA G 1
	TNT1 A 0 A_PlaySound("weapons/plasmahandcannonunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PDEA H 1
    PDEA I 1
    PDEA J 1
    PDEA K 1
    PDEA L 1
    PDEA M 1
    PDEA N 1
    PDEA O 1
    PDEA G 10
    PDEA O 1
    PDEA N 1
    PDEA M 1
    PDEA L 1
    PDEA K 1
    PDEA J 1
    TNT1 A 0 A_PlaySound("weapons/plasmahandcannonload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    PDEA I 1
    PDEA H 1
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,"ReloadWorkingDemo")
	TNT1 A 0 A_TakeInventory("Cell", 2)
	TNT1 A 0 A_GiveInventory("RLPlasmaHandcannonClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip",7,"ReloadFinish")
	Goto ReloadWorkingAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip",9,"ReloadFinish")
  ReloadWorkingAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell",2,"ReloadWorking")
	Goto ReloadFinish
  ReloadWorkingDemo:
	TNT1 A 0 A_TakeInventory("Cell", 1)
	TNT1 A 0 A_GiveInventory("RLPlasmaHandcannonClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonBulkMod",1,2)
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip",7,"ReloadFinish")
	Goto ReloadWorkingDemoAmmoCheck
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonClip",9,"ReloadFinish")
  ReloadWorkingDemoAmmoCheck:
	TNT1 A 0 A_JumpIfInventory("Cell",1,"ReloadWorkingDemo")
	Goto ReloadFinish
  ReloadFinish:
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonTechnicalMod",1,"ReloadFinish1")
    TNT1 A 0 A_PlaySound("weapons/plasmahandcannonraise", CHAN_ITEM)
    PDEA G 1
    PDEA F 2
    PDEA E 2
    PDEA D 3
    PDEA A 3
	Goto Ready
  ReloadFinish1:
    TNT1 A 0 A_PlaySound("weapons/plasmahandcannonraise", CHAN_ITEM)
    PDEA G 1
    PDEA F 2
    PDEA E 2
    PDEA D 2
    PDEA A 1
	Goto Ready
  Flash:
    TNT1 A 3 A_Light2
    TNT1 A 3 A_Light1
    Goto LightDone
  Flash2:
    TNT1 A 2 A_Light2
    TNT1 A 2 A_Light1
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLPlasmaHandcannonPickup",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("RLPlasmaHandcannonModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSelected", 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("RLPlasmaPistolAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_JumpIfInventory("RLPlasmaHandcannonModLimit",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("RLPlasmaHandcannonModLimit", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonPowerMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonBulkMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonAgilityMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonTechnicalMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLPlasmaHandcannonSelected", 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("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLTechnicalMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLPlasmaHandcannon",1)
	Stop
  }
}

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

ACTOR RLPlasmaHandcannonBall : RLPlasmaBall
{
	SeeSound "weapons/plasmahandcannon"
	Damage 26
	States
	{
		Spawn:
			PBSS A 0 NoDelay A_JumpIf(CallACS("DRLA_Fancyprojectiles") == 1, "Spawn.Fancy")
		Spawn.Normal:
			PBSS AB 6 Bright
			Loop
		Spawn.Fancy:
			PBSS ABABAB 2 Bright A_SpawnItemEx("RLPlasmaHandcannonBallTrail", -5)
			Loop
		Death:
			TNT1 A 0 A_Explode (8,32, 0, 1)
			PBSE ABCDE 4 Bright
			Stop
	}
}

ACTOR RLPlasmaHandcannonBallTrail
{
	Renderstyle Add
	Scale 0.7
	Alpha 0.6
	+NOINTERACTION
	States
	{
		Spawn:
			PBSE BCDE 4 A_FadeOut
			Stop
	}
}

ACTOR RLPlasmaHandcannonBallP : RLPlasmaHandcannonBall
{
  Damage 28
}

ACTOR RLPlasmaHandcannonBallA : RLPlasmaHandcannonBall
{
  Speed 35
}

ACTOR RLPlasmaHandcannonBallS : RLPlasmaHandcannonBall
{
  States
  {
  Spawn:
    PBSS AB 6 Bright A_ScaleVelocity(1.15)
    Loop
  }
}

//-------------------------------------------------------------------
//		SHARPSHOOTER PROJECTILES

ACTOR RLPlasmaHandcannonBallSharpshooter : RLPlasmaHandcannonBall
{
  Damage (208)
}

ACTOR RLPlasmaHandcannonBallPSharpshooter : RLPlasmaHandcannonBallSharpshooter
{
  Damage (224)
}

ACTOR RLPlasmaHandcannonBallASharpshooter : RLPlasmaHandcannonBallSharpshooter
{
  Speed 35
}

ACTOR RLPlasmaHandcannonBallSSharpshooter : RLPlasmaHandcannonBallSharpshooter
{
  States
  {
  Spawn:
    PBSS AB 6 Bright A_ScaleVelocity(1.15)
    Loop
  }
}

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

Actor RLPlasmaHandcannonSelected : RLPermanentInventory {}
Actor RLPlasmaHandcannonModLimit : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonPowerMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonBulkMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonAgilityMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonTechnicalMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonNanoMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonFirestormMod : RLAdvancedAssemblyModAmount {}
Actor RLPlasmaHandcannonSniperMod : RLAdvancedAssemblyModAmount {}

ACTOR RLPlasmaHandcannonClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 9
   Inventory.Icon ""
}

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

ACTOR RLPlasmaHandcannonPickup : RLAdvancedAssembledWeaponPickup 17630
{
	//$Sprite PDEAX0
	Tag "Plasma Handcannon [Pickup]"
	States
	{
	SpawnFrame:
		PDEA 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/gundropsmall")
		"####" "#" 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("RLPlasmaHandcannon",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("RLPlasmaHandcannon",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvPlasma Handcannon.")
		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= Plasma Handcannon =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/plasmahandcannonpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonShells",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	}
}

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