actor Drillman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_4C"
dropitem "DrillBombWep"
Weapon.AmmoUse 9
Weapon.AmmoGive 0
Obituary "$OB_DRILLBOMB"
Inventory.Pickupmessage "Power up! Drill Bomb"
weapon.ammotype "MyDrillIsTheBombAmmo"
weapon.ammotype2 "DigLimit"
States
{
Spawn:
C_04 C 1
loop

Deselect:
DRIA A 0
goto DeselectSwap
Select:
DRIA A 0
goto SelectSwap

Ready:
DRIA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DRILLMAN)
DRIA A 0 A_TakeInventory("VivifyCycle1")
goto Ready1
Ready1:
DRIA A 0 A_JumpIfInventory("MyDrillIsTheBombAmmo",9,"Ready3")
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Ready2")
DRIA A 4 A_WeaponReady(12)
DRIA A 0 A_GiveInventory("MyDrillIsTheBombAmmo",1)
DRIA A 0 A_GiveInventory("DigLimit",6)
loop
Ready2:
DRIA A 0 A_JumpIfInventory("MyDrillIsTheBombAmmo",9,"Ready4")
DRIA A 4 A_WeaponReady(4)
DRIA A 0 A_GiveInventory("MyDrillIsTheBombAmmo",1)
DRIA A 0 A_GiveInventory("DigLimit",6)
loop
Ready3:
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Ready4")
DRIA A 4 A_WeaponReady(8)
DRIA A 0 A_GiveInventory("MyDrillIsTheBombAmmo",1)
DRIA A 0 A_GiveInventory("DigLimit",6)
loop
Ready4:
DRIA A 4 A_WeaponReady
DRIA A 0 A_GiveInventory("MyDrillIsTheBombAmmo",1)
DRIA A 0 A_GiveInventory("DigLimit",6)
loop

Fire:
//DRIA A 0 A_JumpIfInventory("MyDrillIsTheBombAmmo",1,"Fire2")
//goto Ready1
Fire2:
//DRIA A 0 A_JumpIfNoAmmo("FireEnd")
DRIA A 0 A_PlaySoundEx("weapons/mm4/drillbombfire","Weapon")
DRIA A 0 A_FireCustomMissile("DMDrillBomb",0,1,8,0)
DRIA BBCCAAA 2 A_GiveInventory("DigLimit",2)
DRIA A 0 A_JumpIfNoAmmo("FireEnd")
DRIA A 0 A_Refire("Fire2")
Goto FireEnd
FireEnd:
DRIA A 0
goto Ready1

Flash.DrillUp:
TNT1 A 2 A_SpawnItemEx("DrillDigCrushUp",0,0,66,0,0,10)
loop
Flash.DrillDown:
TNT1 A 2 A_SpawnItemEx("DrillDigCrush",0,0,-10,0,0,-10)
loop

AltFire:
DRIA B 1 A_JumpIfInventory("DigLimit",200,"AltDrill")
Goto Ready1
AltDrill:
DRIA B 0 A_GiveInventory("VivifyCycle1",1)
DRIA B 0 A_ReFire(1)
DRIA B 0 A_GiveInventory("NoJumpCancel",1)
DRIA B 0 ThrustThingZ(0,50,0,0)
DRIA B 0 A_GunFlash("Flash.DrillUp",1)
DRIA B 0 A_TakeInventory("JumpCancler",2)
AltDrillUp:
DRIA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_JumpIf(momz<=0,"AltDrillDown")
DRIA B 0 A_GiveInventory("VivifyCycle1",1)
AltDrillUp2:
DRIA B 0 A_ReFire("AltDrillCancel")
DRIA B 1 A_JumpIf(momz<=0,1)
loop
DRIA B 0 A_GunFlash("Flash.DrillDown",1)
goto AltDrillDown2

AltDrillDown:
DRIA B 0 A_GunFlash("Flash.DrillDown",1)
DRIA B 0 A_GiveInventory("VivifyCycle1",1)
DRIA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_JumpIf(z-floorz==0,"DigStart")
AltDrillDown2:
DRIA B 0 A_ReFire("AltDrillCancel")
DRIA B 1 A_JumpIf(z-floorz==0,"DigStart")
loop
AltDrillCancel:
DRIA B 0 A_TakeInventory("DigLimit",25)
DRIA B 0 A_TakeInventory("VivifyCycle1")
DRIA B 0 A_PlaySound("S3_K/MetalSpark",1)
DRIA BC 3
goto Ready1

DigStart:
DRIA B 0 A_GiveInventory("Drillman_DigStart_P")
DRIA B 0 A_GiveInventory("VivifyCycle1",1)
goto DigHold
DigHold:
TNT1 A 2 A_GiveInventory("Drillman_Digging_P")
TNT1 A 0 A_JumpIfInventory("DigLimit",1,"KeepDiggin")
goto DigRelease
KeepDiggin:
TNT1 A 0 A_ReFire("DigHold")
goto DigRelease
DigRelease:
DRIA A 0 A_GiveInventory("Drillman_DigEnd_P1")
DRIA CCCCC 2 A_SpawnItemEx("DrillDamager",0,0,52)
DRIA B 4 A_GiveInventory("Drillman_DigEnd_P2")
Goto Ready1
}
}

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

actor DigLimit : Ammo
{
inventory.amount 1
inventory.maxamount 200
+INVENTORY.IGNORESKILL
}

actor Drillman_DigStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("DigLimit",8)
TNT1 A 0 A_SpawnItemEx("DrillDigCrushFX",0,0,0,0,0,0,0,1)
TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-30,30),0,random(3,14),random(0,359),1)

TNT1 A 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEON)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,true)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,true)
TNT1 A 0 A_GiveInventory("CBM_00_AlphaPowerGiver",1)
TNT1 A 0 ThrustThingZ(0,40,1,0)
TNT1 A 0 A_GiveInventory("CBM_200_SpeedPowerGiver",1)
TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
stop
}
}

actor Drillman_Digging_P : CustomInventory
{
States
{
Pickup:
TNT1 AA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-10,10),0,random(2,12),random(0,359),1)
TNT1 A 0 A_TakeInventory("DigLimit",4-CallACS("core_checkrune",RUNE_RAGE)*2)
TNT1 A 0 A_TakeInventory("DigLimit",4-CallACS("core_checkrune",RUNE_RAGE)*2,1)
TNT1 A 0 A_PlaySound("classes/drilling",1)
TNT1 A 0 ThrustThingZ(0,0,1,0)//Fix running over fans/bubbles
TNT1 A 0 A_GiveInventory("MyDrillIsTheBombAmmo",1)
stop
}
}

actor Drillman_DigEnd_P1 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("classes/drillout",1)
TNT1 A 0 A_SpawnItemEx("DrillDigCrushFX",0,0,0,0,0,0,0,1)
TNT1 AAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-20,20),0,random(10,30),random(0,359),1)
TNT1 A 0 A_TakeInventory("DigLimit",40,1)//999
//TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,false)
TNT1 A 0 A_TakeInventory("CBM_00_AlphaPower")
TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,false)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",0)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,false)
TNT1 A 0 A_TakeInventory("CBM_200_SpeedPower")
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
TNT1 A 0 A_SpawnItemEx("DrillDamager",0,0,32)
TNT1 A 0 ThrustThingZ(0,70,0,0)//60
stop
}
}
actor Drillman_DigEnd_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("VivifyCycle1")
//TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_DAMAGE,CallACS("core_getmaxhealth")/10)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,0)
TNT1 A 0 A_TakeInventory("NoJumpCancel",1)
stop
}
}

actor DMDrillBomb : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DrillM_Bomb"
Obituary "$OB_DRILLBOMB"
+SKYEXPLODE
+EXPLODEONWATER
Damage (50)
Radius 10
Height 10
speed 34
Scale 2.5
States
{
Spawn:
DRIA R 0
DRIA R 0 A_PlaySoundEx("weapon/drillfly","Weapon")
DRIA RST 2 A_SpawnItemEx("DMDrillBombFX2",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 0 A_PlaySoundEx("classes/drillexplode", "Weapon")
TNT1 A 0 A_Explode(240,96,0,0,8)
TNT1 A 0 A_SpawnItemEx("BasicBoom5FX_4_210",0,0,0,0,0,0,0,1+32)
TNT1 A 2
stop
}
}

actor DMDrillBombFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
Scale 3.0
States
{
SpawnFrame:
DRIA MNOPQ 5
stop
}
}

actor DMDrillBombFX2 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
Speed 100
Scale 2.0
States
{
SpawnFrame:
TNT1 A 1
DRIA MNOPQ 2
stop
}
}

actor DrillDigCrush
{
PROJECTILE
+DONTBLAST
Obituary "$OB_DRILLDIG"
damagetype "DrillM_Stab"
renderstyle none
damage (40+CallACS("core_checkrune",RUNE_SPREAD,2)*80)
Radius 15
Height 2
States
{
Spawn:
TNT1 A 1
stop
}
}
actor DrillDigCrushUp : DrillDigCrush{Obituary "$OB_DRILLDIGUP"}

actor DrillDigCrushFX : BasicExplosion
{
ReactionTime 4
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,3,5)
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,36),0,random(0,16),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,30),0,random(20,36),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,24),0,random(40,56),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
goto Spawn+2
}
}


actor DrillDamager : BasicImplosion
{
Damagetype "DrillM_DigUp"
Obituary "$OB_DRILLDIG"
States
{
Spawn:
TNT1 A 0
TNT1 A 3 A_Explode(50+CallACS("core_checkrune",RUNE_SPREAD,2)*100,72,0,0,72)
stop
}
}

actor DrillRocks : BasicGraphicEffectM
{
-NOGRAVITY
+RIPPER
+THRUACTORS
+FLOORCLIP
//+NOCLIP
Height 5
Radius 5
Speed 30
States
{
SpawnFrame:
DRIA U 30
stop
}
}


actor Drillman_W_NormalBar : NormalBar {Args 87,227}
actor Drillman_W_SecondBar : SecondBar {Args 4,94}