actor DrillBombBoss : MegaBuster
{
Weapon.AmmoUse 12
Weapon.AmmoGive 0
Weapon.SlotNumber 5
Obituary "%o was detonated by %k's Drill Bomb."
Inventory.Pickupmessage "Power up! Drill Bomb"
weapon.ammotype "DrillBombClassAmmo"
weapon.ammotype2 "DrillBombClassAmmo"
inventory.pickupsound "weapon/weaponup"
+WEAPON.AMMO_OPTIONAL
+WEAPON.Alt_AMMO_OPTIONAL
//inventory.icon "DRILLSI"
Scale 2.0
States
{
Spawn:
WEAP V 1
loop
Ready:
DRIA A 0 ACS_ExecuteAlways(998,0,19)
DRIA A 0 A_TakeInventory("DrillingFlag",1)
DRIA A 0 //A_JumpIfNoAmmo("ReadyEmpty")
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Ready2")
DRIA A 5 A_WeaponReady(WRF_NOSECONDARY)
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
TNT1 A 0 A_GiveInventory("DigLimit",10)
Goto Ready+2
Ready2:
DRIA A 5 A_WeaponReady
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
loop
ReadyEmpty:
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Ready2Empty")
DRIA B 5 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSECONDARY)
DRIA B 0 ACS_ExecuteAlways(137)
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
TNT1 A 0 A_GiveInventory("DigLimit",10)
DRIA A 0 A_JumpIfInventory("DrillBombClassAmmo",12,"Reload")
loop
Ready2Empty:
DRIA B 5 A_WeaponReady(WRF_NOPRIMARY)
DRIA B 0 ACS_ExecuteAlways(137)
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
DRIA A 0 A_JumpIfInventory("DrillBombClassAmmo",12,"Reload")
loop
Reload:
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Reload2")
DRIA C 5 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSECONDARY)
DRIA B 0 ACS_ExecuteAlways(137)
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
TNT1 A 0 A_GiveInventory("DigLimit",10)
Goto Ready+2
Reload2:
DRIA C 5 A_WeaponReady(WRF_NOPRIMARY)
DRIA B 0 ACS_ExecuteAlways(137)
TNT1 A 0 A_GiveInventory("DrillBombClassAmmo",1)
Goto Ready+2
Deselect:
ICEB A 0 A_TakeInventory("DrillBombBoss")
ICEB A 0 A_GiveInventory("DrillBombBoss")
DRIA A 1 A_SelectWeapon("DrillBombBoss")
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
DRIA A 1 A_Raise
Loop
Fire:
DRIA A 0 A_JumpIfNoAmmo("NoAmmo")
DRIA A 0 //A_PlaySoundEx("weapon/mbuster","Weapon")
DRIA A 0 A_TakeInventory("DrillBombClassAmmo",2)
DRIA A 0 A_FireCustomMissile("DMDrillBomb",0,0,10,0)
DRIA B 10
DRIA A 15 A_Refire
DRIA B 0 A_ClearRefire
Goto ReadyEmpty
Hold:
DRIA A 0 A_JumpIfInventory("DrillBombClassAmmo",1,"HoldContinue")
DRIA B 0 ACS_ExecuteAlways(137)
DRIA A 8 A_ClearRefire
Goto ReadyEmpty
HoldContinue:
DRIA A 0 //A_PlaySoundEx("weapon/mbuster","Weapon")
DRIA CA 6
DRIA B 6 A_FireCustomMissile("DMDrillBomb",0,0,10,0)
DRIA B 0 ACS_ExecuteAlways(137)
DRIA A 0 A_TakeInventory("DrillBombClassAmmo",2)
DRIA B 8 A_Refire
DRIA B 0 A_ClearRefire
Goto ReadyEmpty
AltFire:
DRIA B 1 A_JumpIfInventory("DigLimit",200,1)
Goto Air
DRIA A 0 ThrustThingZ(0,40,0,0)
DRIA A 0 A_GiveInventory("DrillingFlag",1)
DRIA B 20 
DRIA B 1 A_JumpIf(z-floorz==0, "DigStart") //The Ground and Air check
Goto Altfire+4
DigStart:
DRIA A 0 A_TakeInventory("DigLimit",40)
DRIA AAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,0,random(-30,30),random(-30,30),random(2,10),random(0,360))
Goto Dig
Dig:
DRIA A 0 A_ChangeFlag("SOLID",0)
DRIA A 0 A_ChangeFlag("SHOOTABLE",0)
DRIA A 0 A_ChangeFlag("PICKUP",0)
DRIA A 0 A_ChangeFlag("FLOORHUGGER",1)
DRIA A 0 A_SetTranslucent(0.0,0)
DRIA A 0 A_Stop // To make Drill stop to a dead hault
DRIA A 0 //SetPlayerProperty(0,1,4) // Makes Drill Man unable to move
TNT1 A 0 ThrustThingZ(0, 40, 1, 0) //Thrusts down
TNT1 A 0 A_Stop 
goto AltHold
AltHold:
DRIA A 0 A_TakeInventory("DrillingFlag",1)
TNT1 A 0 A_TakeInventory("DigLimit",3)
TNT1 A 2 A_PlayWeaponSound("classes/drilling")
TNT1 A 1 ThrustThingZ(0, 255, 1, 0) //Thrusts down
TNT1 A 0 A_JumpIfInventory("DigLimit",1,"KeepDiggin")
goto DigRelease
KeepDiggin:
TNT1 A 1 A_ReFire
goto DigRelease
DigRelease:
DRIA AAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,0,random(-20,20),random(-20,20),random(10,30),random(0,360))
DRIA A 0 A_TakeInventory("DrillingFlag",1)
DRIA A 0 A_ClearRefire
TNT1 A 0 A_Stop
TNT1 A 0 SetPlayerProperty(0,1,0)
DRIA A 0 A_SetTranslucent(1.0,0)
DRIA A 0 A_FireCustomMissile("DrillDamager",0,0,0)
TNT1 A 0 A_PlayWeaponSound("classes/drillout")
DRIA A 0 A_ChangeFlag("FLOORHUGGER",0)
DRIA A 0 A_ChangeFlag("PICKUP",1)
DRIA A 0 //A_ChangeFlag("NOBLOCKMAP",1)
DRIA B 10 ThrustThingZ(0, 60, 0, 0) //Thrusts Drill out.
DRIA A 0 A_ChangeFlag("SOLID",1)
DRIA A 0// A_ChangeFlag("NOBLOCKMAP",0)
TNT1 A 0 SetPlayerProperty(0,0,0)
DRIA A 0 A_ChangeFlag("SHOOTABLE",1)
DRIA A 0// SetPlayerProperty(0,0,4) //Restores movement.
DRIA B 2
DRIA B 15
Goto ReadyEmpty
Air:
BUST E 0 ACS_Execute(979,0)
Goto ReadyEmpty
NoAmmo:
DRIA B 0
//DRIA B 1 ACS_Execute(979,0)
Goto ReadyEmpty
}
}

actor DrillBombClassAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 12
}

actor DrillingFlag : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor DigLimit : Inventory
{
inventory.amount 1
inventory.maxamount 200
}

actor DMDrillBomb : DrillBomb
{
Translation "87:87=4:4"
States
{
Spawn:
DRIL A 0
DRIL A 0 A_PlaySoundEx("weapon/drillfly","Weapon")
DRIL ABC 2 
loop
Death:
DRIL A 0 A_Stop
DRIL A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
DRIL A 0 A_Explode(30, 96, 0)
TNT1 A 2 A_SpawnItem("DrillExplode")
stop
}
}

actor DrillDamager
{
+SOLID
+NOGRAVITY
+RIPPER
PROJECTILE
damage (5)
radius 96
height 20
damagetype "Drill"
Obituary "%o was drilled by %k."
States
{
Spawn:
TNT1 A 0
TNT1 A 1 ThrustThingZ(0,50,0,0)
TNT1 A 10
stop
}
}

actor DrillRocks
{
+MISSILE
-NOGRAVITY
Scale 2.5
//+NOINTERACTION
+CLIENTSIDEONLY
Speed 30
Height 5
Radius 5
Damage 0
+RIPPER
States
{
Spawn:
POWS A 30
stop
}
}