actor PowerAdaptorUpgrade : BaseMM8BDMBusterUpgrade 
{
//$Category MM8BDM-Weapons
//$Title Power Upgrade
//Inventory.RespawnTics 350
inventory.amount 1
inventory.maxamount 1
inventory.pickupmessage "$PU_POWERADAPTOR"
Tag "$TAG_POWERUPGRADE"
inventory.icon "POWUP"
Inventory.PickupSound "item/1up"
Inventory.RespawnTics 350
scale 2.0
+COUNTITEM
+INVBAR
states
{
SpawnLoop:
UPGR B 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TNT1 A 0 A_GiveInventory("PowerAdaptor",1)
TNT1 A 0 A_SelectWeapon("PowerAdaptor")
stop
}
}

actor PowerAdaptorUpgrade_Respawn : 8BDMItemRespawn
{
	translation "192:192=4:4", "198:198=176:176"
	mass 350
}
actor PowerAdaptorUpgrade_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 350
	States
	{
	Spawn:
		UPGR B 0
		goto Super::Spawn
	}
}


actor PowerAdaptor : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Weapon.SlotNumber 1
Inventory.Pickupmessage "$PU_POWERADAPTOR"
Obituary "$OB_POWERADAPTOR"
Tag "$TAG_POWERADAPTOR"
Weapon.ammotype "BusterAmmo"
inventory.icon "NULLICON"
Dropitem ""
States
{
Spawn:
UPGR B 1
loop
Ready:
POWA A 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
POWA A 0 A_GiveInventory("TakeBuster", 1)
Goto Ready2
Ready2:
POWA A 0 ACS_ExecuteAlways(998,0,DYE_POWERFLIGHT)
POWA A 0 A_SpawnItemEx("PowerShoulderLF",0,0,0,0,0,0,0,0)
POWA A 0 A_SpawnItemEx("PowerShoulderRF",0,0,0,0,0,0,0,0)
POWA A 0 A_SpawnItemEx("PowerShoulderLB",0,0,0,0,0,0,0,0)
POWA A 0 A_SpawnItemEx("PowerShoulderRB",0,0,0,0,0,0,0,0)
Ready3:
POWA A 1 A_WeaponReady
goto Ready3
Deselect:
POWA A 0 
goto DeselectSwap
Select:
POWA A 0 
goto SelectSwap
Fire:
Altfire:
Fire1:
PROC D 0 A_TakeInventory("PowerMeter",999)
DWRA J 0 A_PlaySoundEx("weapon/wrapfire","Weapon")
POWA A 0 A_FireCustomMissile("PowerShot",0,0,8,0)
POWA A 0 A_FireCustomMissile("PowerShotMini",0,0,8,0)
POWA K 1
POWA LM 2
POWA A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
TNT1 A 1
POWA NO 2
FireEnd:
POWA A 0 A_JumpIfInventory("IsBot",1,"FireEndBot")
FireEndd:
POWA B 0 A_Refire
goto Ready3
Fire2:
PROC J 0 ACS_ExecuteAlways(991,0,DYE_POWERFLIGHT)
PROC D 0 A_TakeInventory("PowerMeter",999)
POWA K 0 A_PlaySound("weapon/mbuster",1)
POWA K 2 A_FireCustomMissile("PowerShot2",0,0,8,0)
POWA LM 2
TNT1 A 4
POWA NO 2
goto FireEnd
Fire3:
PROC J 0 ACS_ExecuteAlways(991,0,DYE_POWERFLIGHT)
BUST B 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_TakeInventory("PowerMeter",999)
POWA K 0 A_PlaySound("Weapon/napalm",1)
POWA J 2 A_FireCustomMissile("PowerShot3",0,0,8,0)
POWA K 0 A_Quake(2,14,0,8,"none")
POWA KLM 2 
TNT1 A 6
POWA NO 2
goto FireEnd

Fire0:
POWA A 0 A_TakeInventory("PowerMeter",999)
goto Ready3

Hold:
POWA A 0 A_JumpIfInventory("PowerMeter",14,"Charge1Start")
POWA B 1 A_GiveInventory("PowerMeter",1)
POWA A 0 A_Refire
//goto Fire0
goto Fire1
Charge1Start:
POWA A 0 A_PlaySoundEx("weapon/coilstart","Weapon")
Charge1:
POWA B 0 A_JumpIfInventory("PowerMeter",35,"Charge2Start")
POWA B 0 ACS_ExecuteAlways(991,0,DYE_POWERCHARGEAA)
POWA B 1 A_GiveInventory("PowerMeter",1)
POWA A 0 A_JumpIfInventory("IsBot",1,"Charge1EndBot")
Charge1Endd:
POWA B 0 A_Refire("Charge1.a")
Goto Fire2
Charge1.a:
POWA B 0 A_JumpIfInventory("PowerMeter",35,"Charge2Start")
POWA C 0 ACS_ExecuteAlways(991,0,DYE_POWERCHARGEAB)
POWA C 1 A_GiveInventory("PowerMeter",1)
POWA C 0 A_Refire("Charge1")
Goto Fire2
Charge2Start:
BUST B 0 A_GiveInventory("WeaponCharge",1)
BUST B 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Charge2:
POWA D 1 ACS_ExecuteAlways(991,0,DYE_POWERCHARGEBA)
POWA A 0 A_JumpIfInventory("IsBot",1,"Charge2EndBot")
Charge2Endd:
POWA D 0 A_Refire("Charge2.a")
Goto Fire3
Charge2.a:
POWA E 1 ACS_ExecuteAlways(991,0,DYE_POWERCHARGEBB)
POWA E 0 A_Refire("Charge2.b")
Goto Fire3
Charge2.b:
POWA E 1 ACS_ExecuteAlways(991,0,DYE_POWERCHARGEBB)
POWA E 0 A_Refire("Charge2")
Goto Fire3

FireEndBot:
POWA A 0 A_Jump(128,"FireEndd")
POWA B 0 A_Refire("AltFire")
goto Ready3
Charge1EndBot:
POWA B 0 A_Jump(240,"Charge1Endd")
Goto Fire2
Charge2EndBot:
POWA B 0 A_Jump(128,"Charge2Endd")
Goto Fire3
}
}

actor PowerMeter : Ammo
{
inventory.amount 1
inventory.maxamount 35
+INVENTORY.IGNORESKILL
}

actor PowerShotBase
{
PROJECTILE
Speed 27
scale 2.5
damagetype "PowerShot"
Obituary "$OB_POWERADAPTOR"
Damage (0)
}

actor PowerShotMini : PowerShotBase
{
Damage (5)
radius 5
height 5
damagetype "Buster"
States
{
Spawn:
POWW E 0
Spawn2:
POWW E 1
loop
}
}

actor PowerShot : PowerShotBase
{
radius 10
height 10
reactiontime 20
States
{
Spawn:
POWW A 0
Spawn2:
POWW AABB 1 A_CountDown
loop
Death:
TNT1 A 0 A_Explode(10, 50, 0, 0, 20)
MMFX EDCB 2
POWW F 2
stop
}
}

actor PowerShot2 : PowerShotBase
{
radius 15
height 15
reactiontime 15
damagetype "PowerShot2"
States
{
Spawn:
POWW C 0
Spawn2:
POWW CCDD 1 A_CountDown
loop
Death:
TNT1 A 0 A_Explode(35, 65, 0, 0, 30)
MMFX EDCB 2
POWW G 2
stop
}
}

actor PowerShot3 : PowerShotBase
{
radius 20
height 20
reactiontime 10
damagetype "PowerShot3"
States
{
Spawn:
MMFX C 0
Spawn2:
MMFX CCBB 1 A_CountDown
loop
Death:
TNT1 A 0 A_Explode(80, 80, 0, 0, 40)
MMFX CBCBC 2
stop
}
}

actor PowerShoulder : BasicShieldWarper
{
speed 100
translation "192:192=4:4", "198:198=176:176"
states
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteAlways("core_shieldwarper", 0, 1)
TNT1 A 0 A_Jump(256, "Shield")
Goto Shield
}
}


actor PowerShoulderLF : PowerShoulder
{
states
{
Shield:
POAD A 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POAD A 1 A_Warp(AAPTR_TARGET, -18, -1, 30, -90, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
loop
}
}

actor PowerShoulderRF : PowerShoulder
{
states
{
Shield:
POAD A 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POAD A 1 A_Warp(AAPTR_TARGET, -18, 1, 30, 90, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
loop
}
}

actor PowerShoulderLB : PowerShoulder
{
states
{
Shield:
POAD A 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POAD A 1 A_Warp(AAPTR_TARGET, -18, 1, 30, -90, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
loop
}
}

actor PowerShoulderRB : PowerShoulder
{
states
{
Shield:
POAD A 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
POAD A 1 A_Warp(AAPTR_TARGET, -18, -1, 30, 90, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
loop
}
}

actor PowerAdaptorPush : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("PowerAdaptorPush2")
stop
}
}

actor PowerAdaptorPush2
{
//+SERVERSIDEONLY
PROJECTILE
+NOINTERACTION
+NOCLIP
+DONTBLAST
damage 0
radius 1
height 1
speed 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_TransferPointer(AAPTR_TARGET,AAPTR_DEFAULT,AAPTR_TARGET,AAPTR_TRACER) //target's target to self's tracer
TNT1 A 0 A_FaceTracer
TNT1 A 0 ThrustThing(angle*256/360,-16,1,ACS_ExecuteWithResult(257,0))
stop
}
}