actor DrillPikeWep : BaseMM8BDMWep
{
//$Category MM8BDM-Weapons
//$Title Drill Pike
//$Sprite DOSWF0
Weapon.AmmoUse 2
Weapon.AmmoGive 28
Weapon.SlotNumber 5
Inventory.Pickupmessage "$PU_DRILLPIKE"
Obituary "$OB_DRILLPIKE"
Tag "$TAG_DRILLPIKE"
weapon.ammotype "DrillPikeAmmo"
inventory.icon "DRILLP"
States
{
SpawnLoop:
DOSW F -1
loop
Ready:
DPKE E 0 ACS_ExecuteAlways(998,0,DOSREBORN_COLOR_BIT)
DPKE E 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
DPKE E 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
DPKE E 1 A_Raise
Loop
Fire:
DPKE E 0 A_JumpIfNoAmmo("NoAmmo")
DPKE E 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DPKE E 0 A_FireCustomMissile("DrillPike",0,1,8,0)
DPKE FGE 6
DPKE E 10 
Goto Ready+1
NoAmmo:
DPKE E 1 ACS_Execute(979,0)
Goto Ready+1
}
}
actor DrillPikeWepSH : DrillPikeWep replaces DrillPikeWep {+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans}


actor DrillPikeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor DrillPike
{
PROJECTILE
+EXPLODEONWATER
+NOINTERACTION
+NOCLIP
Speed 35
Damage (0)
damagetype "DrillPike"
Obituary "$OB_DRILLPIKE"
Scale 2.5
Height 6
Radius 6
States
{
Spawn:
DPKE A 0
DPKE A 0 A_GiveInventory("DrillPikeSpawned",1)
DPKE A 0 A_RearrangePointers(AAPTR_NULL,AAPTR_TARGET,AAPTR_DEFAULT) //clear target, put target in master
DPKE A 1 A_Jump(256,"Spawn2")
wait
Spawn2:
DPKE A 0 A_PlaySoundEx("weapon/drillfly","Weapon")
DPKE AAA 1 A_SpawnItemEx("DrillPikeHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
DPKE C 0 A_SpawnItemEX("DrillPikeTravel",-32,0,0)
DPKE BBB 1 A_SpawnItemEx("DrillPikeHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
DPKE C 0 A_SpawnItemEX("DrillPikeTravel",-32,0,0)
DPKE CCC 1 A_SpawnItemEx("DrillPikeHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
DPKE D 0 A_SpawnItemEX("DrillPikeTravel",-32,0,0)
DPKE DDD 1 A_SpawnItemEx("DrillPikeHitter",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
TNT1 A 10 A_SpawnItemEx("DrillPikeHitterExplode",0,0,0,momx,momy,momz,0,SXF_ABSOLUTEVELOCITY)
stop
}
}

actor DrillPikeSpawned : Once {}

actor DrillPikeHitter : DrillPike
{
-NOCLIP
+HITTRACER
+DONTREFLECT
+NOINTERACTION
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("DrillPikeSpawned",1,"Spawn2")
stop
Spawn2:
TNT1 A 0 A_RearrangePointers(AAPTR_DEFAULT,AAPTR_TARGET,AAPTR_DEFAULT) //save target to master
TNT1 A 0 A_TransferPointer(AAPTR_MASTER,AAPTR_DEFAULT,AAPTR_MASTER,AAPTR_TARGET) //Master's master -> this thing's target
TNT1 A 0 A_ChangeFlag("NOINTERACTION",0)
TNT1 A 1
stop
XDeathTrue:
TNT1 A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
TNT1 A 0 A_SpawnItemEx("ExplosionEffect2")
Crash:
XDeath:
TNT1 A 0 A_GiveInventory("DrillPikeExplode",1,AAPTR_TRACER)
goto XDeathCont
XDeathTrue:
TNT1 A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
TNT1 A 0 A_SpawnItemEx("ExplosionEffect2")
goto XDeathCont
XDeathCont:
TNT1 A 0 A_RemoveMaster
TNT1 A 0 A_Stop
TNT1 A 0 A_Explode(60, 96, 0)
TNT1 A 35
stop
Death:
TNT1 A 0 A_JumpIf(z-floorz > -5 && z-floorz<5, "XDeathTrue")
TNT1 A 0 A_JumpIf(z-ceilingz==0-6, "XDeathTrue")
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),0)
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),60)
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),120)
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),180)
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),240)
TNT1 A 0 A_SpawnItemEX("DrillPikeBurrow",20,0,0,random(5,10),0,random(0,5),300)
TNT1 A 35
stop
}
}

actor DrillPikeHitterExplode : DrillPikeHitter
{
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("DrillPikeSpawned",1,"Spawn2")
stop
Spawn2:
TNT1 A 0 A_RearrangePointers(AAPTR_DEFAULT,AAPTR_TARGET,AAPTR_DEFAULT) //save target to master
TNT1 A 0 A_TransferPointer(AAPTR_MASTER,AAPTR_DEFAULT,AAPTR_MASTER,AAPTR_TARGET) //Master's master -> this thing's target
TNT1 A 0 A_ChangeFlag("NOINTERACTION",0)
TNT1 A 1
TNT1 A 1 A_JumpIf(true,"XDeathTrue")
wait
}
}

actor DrillPikeExplode : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/drillexplode", "SoundSlot6")
TNT1 A 0 A_SpawnItemEx("ExplosionEffect2",0,0,(radius/2)+4)
stop
}
}

actor DrillPikeTravel : ExplosionEffect1 
{
scale 1.0
States
{
Spawn:
ASEX ABCDEF 1 
stop
}
}

actor DrillPikeBurrow
{
PROJECTILE
-NOGRAVITY
+THRUACTORS
Damage (0)
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Jump(256,"FX1","FX2","FX3")
FX1:
DPKE HHKHHKHHKHHKHHK 1
stop
FX2:
DPKE IIKIIKIIKIIKIIK 1
stop
FX3:
DPKE JJKJJKJJKJJKJJK 1
stop
}
}
