actor Groundman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_BC"
dropitem "SpreadDrillWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Weapon.AmmoUse2 1
inventory.pickupmessage "*Sonic 2 Boss theme*"
Obituary "$OB_SPREADDIG"
weapon.ammotype "GroundFuryAmmo"
weapon.ammotype2 "SandAngerAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_0B C 1
loop

Deselect:
GRDH A 0 A_GiveInventory("GroundWasTankX",1)
GRDH A 0 A_GiveInventory("GroundWasDigX",1)
GRDH A 0 A_GiveInventory("GroundWasCeilX",1)
GRDH A 0 A_JumpIfInventory("GroundInCeiling",1,"Deselect_C")
GRDH A 0 A_TakeInventory("GroundWasCeilX")
GRDH A 0 A_JumpIfInventory("GroundInGround",1,"Deselect_G")
GRDH A 0 A_TakeInventory("GroundWasDigX")
GRDH A 0 A_JumpIfInventory("GroundIsATank",1,"Deselect_T")
GRDH A 0 A_TakeInventory("GroundWasTankX")
goto DeselectSwap
Deselect_C:
GRDH F 0 A_GiveInventory("Groundman_EndRoof_P")
goto DeselectSwap
Deselect_G:
GRDH F 0 A_GiveInventory("Groundman_EndFloor_P")
goto DeselectSwap
Deselect_T:
GRDH F 0 A_GiveInventory("Groundman_EndTank_P")
goto DeselectSwap

Select:
GRDH A 0
goto SelectSwap

Ready:
GRDH A 0 A_GunFlash("Flash",1)
GRDH A 0 A_JumpIfInventory("GroundWasCeilX",1,"ReadyC")
GRDH A 0 A_JumpIfInventory("GroundWasDigX",1,"ReadyD")
GRDH A 0 A_JumpIfInventory("GroundWasTankX",1,"ReadyT")
GRDH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_GROUNDMAN)
goto Ready1
Ready1:
//GRDH A 0 A_JumpIfInventory("GroundIsATank",1,"AltTank")
GRDH A 0 A_JumpIfInventory("SandAngerAmmo",0,"Ready3")
GRDH A 0 A_JumpIfInventory("GroundFuryAmmo",8,"Ready2")
GRDH A 2 A_WeaponReady(WRF_NOFIRE)
GRDH A 0 A_GiveInventory("Groundman_ReadyAmmo_P")
//GRDH A 0 A_GiveInventory("GroundFuryAmmo",1)
//GRDH A 0 A_GiveInventory("SandAngerAmmo",4)
loop
Ready2:
GRDH A 0 A_JumpIfInventory("SandAngerAmmo",0,"Ready4")
GRDH A 2 A_WeaponReady(WRF_NOSECONDARY)
GRDH A 0 A_GiveInventory("Groundman_ReadyAmmo_P")
loop
Ready3:
GRDH A 0 A_JumpIfInventory("GroundFuryAmmo",8,"Ready4")
GRDH A 2 A_WeaponReady(WRF_NOPRIMARY)
GRDH A 0 A_GiveInventory("Groundman_ReadyAmmo_P")
loop
Ready4:
GRDH A 2 A_WeaponReady
GRDH A 0 A_GiveInventory("Groundman_ReadyAmmo_P")
loop


ReadyC:
GRDH D 2 offset(0,52)ACS_NamedExecuteWithResult("core_weaponcolor",DYE_GROUNDMAN,1)
GRDH D 2 offset(0,50)
GRDH D 2 offset(0,48)
GRDH D 2 offset(0,46)
GRDH C 2 offset(0,44)
GRDH C 2 offset(0,42)
GRDH B 2 offset(0,40)
GRDH B 2 offset(0,38)
GRDH A 2 offset(0,36)
GRDH A 2 offset(0,34)
Goto ReadyX
ReadyD:
GRDH F 2 Offset(0,82)ACS_NamedExecuteWithResult("core_weaponcolor",DYE_GROUNDMAN,1)
GRDH E 2 Offset(0,76)
GRDH F 2 Offset(0,70)
GRDH E 2 Offset(0,64)
GRDH F 2 Offset(0,58)
GRDH E 2 Offset(0,52)
GRDH F 2 Offset(0,46)
GRDH E 2 Offset(0,40)
GRDH D 2 offset(0,38)
GRDH C 2 offset(0,36)
GRDH B 2 offset(0,34)
Goto ReadyX
ReadyT:
GRDH D 2 offset(0,38)ACS_NamedExecuteWithResult("core_weaponcolor",DYE_GROUNDMAN,1)
GRDH C 2 offset(0,36)
GRDH B 2 offset(0,34)
Goto ReadyX
ReadyX:
TNT1 A 0 A_TakeInventory("GroundWasCeilX")
TNT1 A 0 A_TakeInventory("GroundWasDigX")
TNT1 A 0 A_TakeInventory("GroundWasTankX")
goto Ready1

BotAmmo:
GRDH A 0 A_GiveInventory("SandAngerAmmo",400)
GRDH A 25 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
GRDH A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
Goto Ready1

Fire:
GRDH BC 3
GRDH D 3 A_GiveInventory("Groundman_Fire_P")
GRDH CBA 3 A_GiveInventory("SandAngerAmmo",6)
GRDH AA 2 A_GiveInventory("SandAngerAmmo",5)
Goto Ready1

Flash:
TNT1 A 1 A_RailWait
TNT1 A 0 A_JumpIfInventory("GroundInCeiling",1,"Flash.TankC")
TNT1 A 0 A_JumpIfInventory("GroundInGround",1,"Flash.TankF")
TNT1 A 0 A_JumpIfInventory("GroundIsATank",2,"Flash.Tank")
TNT1 A 0 A_JumpIfInventory("GroundIsATank",1,"Flash.Tank")
loop
Flash.Tank:
TNT1 A 0 A_SpawnItemEx("GroundTankDustFXR",-2, 24,0,-2,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("GroundTankDustFXL",-2,-24,0,-2,0,0,0,1)
goto Flash
Flash.Tank2:
TNT1 A 0 A_SpawnItemEx("GroundM_RockFX",0,0,8,random(-10,10),random(-10,10),random(2,10),random(0,179),1)
TNT1 A 0 A_SpawnItemEx("GroundM_RockFX",0,0,8,random(-10,10),random(-10,10),random(2,10),random(180,359),1)
TNT1 AA 0 A_SpawnItemEx("GroundM_RockFX",0,0,8,random(-10,10),random(-10,10),random(2,10),random(0,359),1,64)
TNT1 A 2
goto Flash+1
Flash.TankF:
TNT1 AA 0 A_SpawnItemEx("GroundM_RockFX",0,0,8,random(-10,10),random(-10,10),random(2,10),random(0,359),1)
goto Flash
Flash.TankC:
TNT1 AA 0 A_SpawnItemEx("GroundM_RockFX",0,0,48,random(-10,10),random(-10,10),random(0,-10),random(0,359),1)
goto Flash

Altfire:
//GRDH B 3
//Altfire_H:
//GRDH C 1 A_GiveInventory("Groundman_AltSync_P")
//GRDH C 0 A_ReFire("Altfire_H")
//GRDH B 3
//Goto Ready1
TankTime:
GRDH B 2 A_PlaySoundEX("GroundM/Transform","Body")//item/ItemUseMM9
GRDH B 1 A_JumpIf(1,1)//Awful way to resync online
GRDH B 1 A_JumpIf(1,1)//But its needed for the owner to sync up
GRDH B 1
GRDH C 3 A_GiveInventory("Groundman_StartTank_P")
GRDH C 0 A_JumpIfInventory("GroundIsATank",1,"AltTank_H")
goto AltTank_H

AltTank_H:
GRDH E 0 A_GiveInventory("Groundman_TankThrust_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_ReFire(1)
goto AltTank+3
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_JumpIfInventory("PlayerPropertyRage",1,4)
GRDH E 0 A_ReFire(1)
goto AltTank+7
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_ReFire(1)
goto AltTank+10
GRDH E 0 A_GiveInventory("VivifyDelay6")
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfNoAmmo("AltTankEnd")
GRDH F 0 A_GiveInventory("Groundman_TankThrust_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_ReFire(2)
GRDH F 0 A_TakeInventory("VivifyDelay6")//
goto AltTank+15
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_JumpIfInventory("PlayerPropertyRage",1,4)
GRDH F 0 A_ReFire(2)
GRDH F 0 A_TakeInventory("VivifyDelay6")//
goto AltTank+19
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_ReFire(2)
GRDH F 0 A_TakeInventory("VivifyDelay6")//
goto AltTank+22
GRDH F 0 A_TakeInventory("VivifyDelay6")//
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfNoAmmo("AltTankEnd")
GRDH F 0 A_ReFire("AltTank_H")
goto AltTank

AltTank:
GRDH E 0 A_GiveInventory("Groundman_TankThrust_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_ReFire("AltTankEnd")
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_JumpIfInventory("PlayerPropertyRage",1,4)
GRDH E 0 A_ReFire("AltTankEnd")
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH E 0 A_ReFire("AltTankEnd")
GRDH E 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH E 0 A_JumpIfNoAmmo("AltTankEnd")
GRDH F 0 A_GiveInventory("Groundman_TankThrust_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_ReFire("AltTankEnd")
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_JumpIfInventory("PlayerPropertyRage",1,4)
GRDH F 0 A_ReFire("AltTankEnd")
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfInventory("PressButton_Main_F",1,"AltDig")
GRDH F 0 A_ReFire("AltTankEnd")
GRDH F 1 A_GiveInventory("Groundman_TankDigCheck_P")
GRDH F 0 A_JumpIfNoAmmo("AltTankEnd")
loop

AltTankEnd:
GRDH D 0 A_GiveInventory("Groundman_EndTank_P")
GRDH D 0 A_ReFire(1)
GRDH D 2
GRDH C 2
GRDH B 2 A_JumpIfInventory("GroundInGround",1,"AltDigSync")
Goto Ready1

AltDig:
GRDH E 0 A_GiveInventory("Groundman_StartFloor_P")
GRDH E 2 Offset(0,36)
GRDH F 2 Offset(0,42)
AltDigSync:
GRDH E 2 Offset(0,48)
GRDH F 2 Offset(0,54)
GRDH E 2 Offset(0,60)
GRDH F 2 Offset(0,66)
GRDH E 2 Offset(0,72)
GRDH F 2 Offset(0,78)
GRDH E 0 A_GiveInventory("Groundman_StartFloor_P2")
goto AltDigging


AltDigging:
TNT1 A 3 A_GiveInventory("Groundman_FloorDigTake_P")
TNT1 A 0 A_JumpIfNoAmmo("DigRelease")
TNT1 A 3 A_GiveInventory("Groundman_FloorDigTake_P")
TNT1 A 0 A_JumpIfNoAmmo("DigRelease")
//TNT1 A 0 A_JumpIfInventory("GroundInCeiling",1,"CeilingDigStart")
AltDigging_L:
TNT1 A 0 A_GiveInventory("Groundman_FloorDigTake_P")
TNT1 A 0 A_JumpIfInventory("PressButton_Main_F",1,"CeilingDigStart")
TNT1 A 0 A_ReFire("DigRelease")
TNT1 A 1 A_GiveInventory("Groundman_FloorDigCheck_P")
TNT1 A 0 A_JumpIfInventory("PressButton_Main_F",1,"CeilingDigStart")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,4)
TNT1 A 0 A_ReFire("DigRelease")
TNT1 A 1 A_GiveInventory("Groundman_FloorDigCheck_P")
TNT1 A 0 A_JumpIfInventory("PressButton_Main_F",1,"CeilingDigStart")
TNT1 A 0 A_ReFire("DigRelease")
TNT1 A 1 A_GiveInventory("Groundman_FloorDigCheck_P")
TNT1 A 0 A_JumpIfNoAmmo("DigRelease")
TNT1 A 0 A_JumpIfInventory("EndlessAmmoCycle_F",6,"DigRelease")
loop
//TNT1 A 0 A_JumpIfInventory("SandAngerAmmo",1,"AltDigging_L")
//goto DigRelease

DigRelease:
TNT1 A 0 A_GiveInventory("Groundman_EndFloor_P")
TNT1 A 0 A_ReFire(1)
GRDH F 2 Offset(0,82)
GRDH E 2 Offset(0,76)
GRDH F 2 Offset(0,70)
GRDH E 2 Offset(0,64)
GRDH F 2 Offset(0,58)
GRDH E 2 Offset(0,52)
GRDH F 2 Offset(0,46)
GRDH E 2 Offset(0,40)
GRDH D 2 offset(0,38)
GRDH C 2 offset(0,36)
GRDH B 2 offset(0,34)
Goto Ready1

CeilingDigStart:
TNT1 A 0 A_GiveInventory("Groundman_StartRoof_P")
//TNT1 A 1
goto CeilingDigging


CeilingDigging:
TNT1 A 0 A_GiveInventory("Groundman_RoofDigTake_P")
TNT1 A 0 A_ReFire("CeilingDone")
TNT1 A 1 A_GiveInventory("Groundman_RoofDigCheck_P")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,3)
TNT1 A 0 A_ReFire("CeilingDone")
TNT1 A 1 A_GiveInventory("Groundman_RoofDigCheck_P")
TNT1 A 0 A_ReFire("CeilingDone")
TNT1 A 1 A_GiveInventory("Groundman_RoofDigCheck_P")
TNT1 A 0 A_JumpIfNoAmmo("CeilingDone")
TNT1 A 0 A_JumpIfInventory("EndlessAmmoCycle_F",6,"DigRelease")
loop
//TNT1 A 0 A_JumpIfInventory("SandAngerAmmo",1,"CeilingDigging")
//goto CeilingDone

CeilingDone:
GRDH F 0 A_GiveInventory("Groundman_EndRoof_P")
GRDH F 0 A_ReFire(1)
GRDH D 2 offset(0,52)
GRDH D 2 offset(0,50)
GRDH D 2 offset(0,48)
GRDH D 2 offset(0,46)
GRDH C 2 offset(0,44)
GRDH C 2 offset(0,42)
GRDH B 2 offset(0,40)
GRDH B 2 offset(0,38)
GRDH A 2 offset(0,36)
GRDH A 2 offset(0,34)
Goto Ready1
}
}

actor GroundFuryAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}

actor SandAngerAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 400
+INVENTORY.IGNORESKILL
}

//-1 Gravity
actor GroundmanCeilingGravPowerGiver : PowerApropGiver {}
actor GroundmanCeilingGravPower : Base_CBM_PropertyPower {}

actor GroundTankFlag : Inventory
{
inventory.amount 1
inventory.maxamount 2
}

actor GroundHoldFlag :Inventory{}

actor GroundCMainFlag : Inventory
{
inventory.amount 1
inventory.maxamount 30
}

actor Groundman_ReadyAmmo_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",1)
TNT1 A 0 A_GiveInventory("SandAngerAmmo",4)
stop
Ammo:
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0 A_GiveInventory("SandAngerAmmo",4+CallACS("core_checkrune",RUNE_RAGE)*4)
stop
}
}
actor Groundman_AltSync_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SandAngerAmmo",2+CallACS("core_checkrune",RUNE_RAGE)*2)
stop
}
}

actor Groundman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SandAngerAmmo",16)
TNT1 A 0 A_TakeInventory("GroundFuryAmmo",8,1)
TNT1 A 0 A_PlaySoundEx("weapon/spreaddrill1","Weapon")
TNT1 A 0 A_FireCustomMissile("SpreadDrillC",0,0,0,0)
stop
}
}

actor Groundman_StartTank_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("CBM_Ratio7JumpPowerGiver",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,true)
TNT1 A 0 A_GiveInventory("GroundIsATank",1)
TNT1 A 0 A_GiveInventory("GroundTankFlag",1)
TNT1 A 0 A_TakeInventory("SandAngerAmmo",8)
stop
}
}
actor Groundman_EndTank_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEX("GroundM/Transform","Body")
TNT1 A 0 A_TakeInventory("SandAngerAmmo",24)
TNT1 A 0 A_TakeInventory("CBM_Ratio7JumpPower")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,false)
TNT1 A 0 A_TakeInventory("GroundIsATank")
TNT1 A 0 A_TakeInventory("GroundTankFlag")
TNT1 A 0 A_TakeInventory("PressButton_Main_F")
stop
}
}


actor Groundman_TankDigCheck_P : CustomInventory
{
States
{
Pickup:
//TNT1 A 0 A_WeaponReady(WRF_NOPRIMARY)//4
TNT1 A 0 A_JumpIf(z-floorz==0 && CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,1)
stop
TNT1 A 0 A_GiveInventory("PressButton_Main_F",1)
stop
}
}

actor Groundman_FloorDigCheck_P : CustomInventory
{
States
{
Pickup:
//TNT1 A 0 A_WeaponReady(4)
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,1)
stop
TNT1 A 0 A_GiveInventory("PressButton_Main_F",1)
stop
}
}
actor Groundman_FloorDigTake_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("SandAngerAmmo",1,2)
TNT1 A 0 A_GiveInventory("EndlessAmmoCycle_F",1)
TNT1 A 0 ThrustThingZ(0,0,1,0)//Fix running over fans/bubbles
TNT1 A 0 A_TakeInventory("SandAngerAmmo",3,1)
TNT1 A 0 A_TakeInventory("SandAngerAmmo",3)
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",1)
TNT1 A 0 A_PlaySound("weapon/GroundDig",1,1.0)
stop
}
}

actor Groundman_RoofDigCheck_P : CustomInventory
{
States
{
Pickup:
//TNT1 A 0 A_WeaponReady(4)
TNT1 A 0 A_JumpIfInventory("PressButton_Main_F",1,"HoldingStart")
TNT1 A 0 A_JumpIfInventory("GroundHoldFlag",1,"HoldingDrill")
TNT1 A 0 A_JumpIfInventory("GroundCMainFlag",1,2)
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,2)
TNT1 A 0 A_TakeInventory("GroundCMainFlag",1)
stop
TNT1 A 0 //A_GiveInventory("PressButton_Main_F",1)
//Groundman_DigFire_P
TNT1 A 0 A_PlaySoundEx("weapon/GroundBigDrill","Body")
TNT1 A 0 A_SpawnItemEx("GiantCeilingDrill",0,0,0,0,0,0,0,1)
TNT1 A 0 A_GiveInventory("GroundHoldFlag",1)
TNT1 A 0 A_GiveInventory("GroundCMainFlag",30-CallACS("core_checkrune",RUNE_RAGE)*15)
TNT1 A 0 A_TakeInventory("SandAngerAmmo",15)
stop

HoldingStart:
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,2)
TNT1 A 0 A_TakeInventory("PressButton_Main_F",1)
TNT1 A 0
stop
HoldingDrill:
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,2)
TNT1 A 0 A_TakeInventory("GroundHoldFlag",1)
TNT1 A 0
stop
}
}
actor Groundman_RoofDigTake_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("SandAngerAmmo",1,2)
TNT1 A 0 A_GiveInventory("EndlessAmmoCycle_F",1)
TNT1 A 0 ThrustThingZ(0,20,0,1)//Keep Groundman on the ceiling
TNT1 A 0 A_JumpIfInventory("GroundCMainFlag",1,2)
TNT1 A 0 A_JumpIfInventory("GroundHoldFlag",1,3)
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",1)
TNT1 A 0 A_TakeInventory("SandAngerAmmo",2,1)
goto Take
TNT1 A 0 A_TakeInventory("SandAngerAmmo",3,1)
goto Take
Take:
TNT1 A 0 A_TakeInventory("SandAngerAmmo",4)
TNT1 A 0 A_PlaySound("weapon/GroundDig",1,1.0)
stop
}
}


actor Groundman_TankThrust_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("SandAngerAmmo",3,1)
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",1)
TNT1 A 0 A_FireCustomMissile("GroundTankMelee",0,0,0,0)
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchInputDir",0)>0,"Pickup_Forward")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchInputDir",0)<0,"Pickup_Back")
goto Pickup_None
Pickup_None:
TNT1 A 0
stop
Pickup_Forward:
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground_F")
TNT1 A 0 A_Recoil(-1.75)
stop
Ground_F:
TNT1 A 0 A_Recoil(-2.1)
stop
Pickup_Back:
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground_B")
TNT1 A 0 A_Recoil(0.4375)
stop
Ground_B:
TNT1 A 0 A_Recoil(0.525)
stop
}
}

actor Groundman_StartFloor_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("VivifyDelay6")
TNT1 A 0 A_TakeInventory("CBM_Ratio7JumpPower")
TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
TNT1 A 0 A_GiveInventory("GroundTankFlag",1)
TNT1 A 0 A_GiveInventory("GroundInGround",1)
TNT1 A 0 A_Stop
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
stop
}
}
actor Groundman_StartFloor_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("PressButton_Main_F")
TNT1 A 0 A_TakeInventory("GroundTankFlag")
TNT1 A 0 A_TakeInventory("EndlessAmmoCycle_F")
TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEON)
TNT1 A 0 A_GiveInventory("CBM_140_SpeedPowerGiver",1)
TNT1 A 0 A_GiveInventory("CBM_00_AlphaPowerGiver",1)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",1)
TNT1 A 0 A_Stop
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
stop
}
}

actor Groundman_StartRoof_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("GroundInCeiling",1)
TNT1 A 0 A_TakeInventory("GroundInGround")
TNT1 A 0 A_TakeInventory("ConcreteTime")//
TNT1 A 0 A_GiveInventory("CBM_175_SpeedPowerGiver",1)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",0)
TNT1 A 0 A_ChangeFlag("CEILINGHUGGER",1)
TNT1 A 0 A_GiveInventory("GroundmanCeilingGravPowerGiver",1)
TNT1 A 0 A_ChangeVelocity(0.001,0,0,1)//ThrustThing(angle*256/360,1)
TNT1 A 0 A_SpawnItemEx("GroundRocksCeilingBoostFX_H")//A_Stop
stop
}
}

actor Groundman_DigEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("VivifyDelay4",1)
TNT1 A 0 A_GiveInventory("GroundFuryAmmo",5)
TNT1 A 0 A_PlaySound("classes/drillout",1,1.0)
TNT1 A 0 A_TakeInventory("GroundIsATank")
TNT1 A 0 A_TakeInventory("GroundInGround")
TNT1 A 0 A_TakeInventory("GroundInCeiling")

TNT1 A 0 A_TakeInventory("PressButton_Main_F")
TNT1 A 0 A_TakeInventory("GroundCMainFlag")
TNT1 A 0 A_TakeInventory("GroundHoldFlag")

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,false)

TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_DAMAGE,CallACS("core_getmaxhealth")/10)

TNT1 A 0 A_TakeInventory("CBM_00_AlphaPower")
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
TNT1 A 0 A_TakeInventory("CBM_140_SpeedPower")
TNT1 A 0 A_TakeInventory("CBM_175_SpeedPower")
stop
}
}

actor Groundman_EndFloor_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("SandAngerAmmo",100,1)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",0)
TNT1 A 0 //A_Stop
TNT1 A 0 ThrustThingZ(0,1,0,1)
TNT1 A 0 A_SpawnItemEx("GroundDigUpDamage",0,0,32)
TNT1 A 0 A_GiveInventory("Groundman_DigEnd_P")
stop
}
}
actor Groundman_EndRoof_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("SandAngerAmmo",150,1)
TNT1 A 0 A_ChangeFlag("CEILINGHUGGER",0)
TNT1 A 0 A_TakeInventory("GroundmanCeilingGravPower")
TNT1 A 0 //A_Stop
TNT1 A 0 ThrustThingZ(0,75,1,0)
TNT1 AA 0 A_SpawnItemEx("GroundDigDownDamage",0,0,16)
TNT1 A 0 A_GiveInventory("Groundman_DigEnd_P")
stop
}
}

actor GroundBossSplitItem : BasicClassItem
{
inventory.icon "GrndIcon"
Inventory.Pickupmessage "I hate blue sand, it reminds me of a hedgehog."
Tag "Split Spread Drills"
states
{
Spawn:
GRDH I 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("GroundSplitFlag",1,"No")
TNT1 A 0 A_PlaySoundEx("weapon/BoobeamBeep","SoundSlot7")
TNT1 A 0 A_GiveInventory("GroundSplitFlag",1)
fail
}
}

actor GroundIsATank : Inventory{}
actor GroundInGround : Inventory{}
actor GroundInCeiling : Inventory{}

actor GroundSplitFlag : Powerup
{
Powerup.Duration 3
}

actor GroundWasTankX : Inventory{}
actor GroundWasDigX : Inventory{}
actor GroundWasCeilX : Inventory{}

actor GroundmanFullReset_P : CustomInventory//Bearer
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("GroundmanCeilingGravPower")
TNT1 A 0 A_TakeInventory("GroundTankFlag")
TNT1 A 0 A_TakeInventory("GroundHoldFlag")
TNT1 A 0 A_TakeInventory("GroundCMainFlag")
TNT1 A 0 A_TakeInventory("GroundIsATank")
TNT1 A 0 A_TakeInventory("GroundInGround")
TNT1 A 0 A_TakeInventory("GroundInCeiling")
TNT1 A 0 A_TakeInventory("GroundWasTankX")
TNT1 A 0 A_TakeInventory("GroundWasDigX")
TNT1 A 0 A_TakeInventory("GroundWasCeilX")
stop
}
}

actor GroundTankMelee
{
PROJECTILE
DamageType "GroundM_Stab"
Obituary "$OB_SPREADDIG"
+DONTBLAST
RenderStyle None
reactiontime 1
damage (40)
Radius 14
Height 16
speed 40
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_CountDown
goto Spawn+1
Death:
TNT1 A 0 A_Explode(40,94,0,0,32)
goto XDeath
XDeath:
TNT1 A 0 A_Stop
TNT1 A 1
stop
}
}

actor GroundTankDustFXL : BasicGraphicEffect
{
Scale 1.0
Args 1
States
{
SpawnFrame:
HSHH P 0
HSHH PQR 5 A_SpawnItemEx("GroundTankDustFX2",random(8,48),random(-8,-24)*Args[0],random(8,48),-1,frandom(0,Args[0]),0,0,1)
stop
}
}
actor GroundTankDustFXR : GroundTankDustFXL{Args -1}

actor GroundTankDustFX2 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
GRDH N 5
stop
GRDH O 5
stop
}
}


actor GroundDigUpDamage : BasicExplosion
{
Damagetype "GroundM_DigUp"
Obituary "$OB_SPREADDIG"
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GroundM_RockFX",0,0,-24,random(-8,8),random(-8,8),random(2,8),random(0,359),1)
Boom:
TNT1 AAAA 1 A_Explode(50+CallACS("core_checkrune",RUNE_SPREAD,2)*100,86,0,0,86)
stop
}
}
actor GroundDigDownDamage : GroundDigUpDamage
{
States
{
Spawn:
TNT1 A 0
TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("GroundM_RockFX",0,0,-8,random(-20,20),random(-20,20),random(-5,-30),random(0,359),1)
goto Boom
}
}

actor GroundM_DrillProtect : PowerProtection
{
Powerup.Duration 3
DamageFactor "GroundM_Shot1", 0.25
DamageFactor "GroundM_Shot2", 0.75
DamageFactor "GroundM_Shot3", 0.75
}

actor SpreadDrillC : ProjSpawnFuncActor
{
PROJECTILE
DamageType "GroundM_Shot1"
Obituary "$OB_SPREADDRILL"
+RIPPER
+SKYEXPLODE
+EXPLODEONWATER
damage (150)//250
radius 32
height 16
speed 20//13
scale 2.5
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("GroundIsATank",1)
GRDH PPQQ 1 A_JumpIfInTargetInventory("GroundSplitFlag",1,"Spread")
goto Spawn+2
Spread:
TNT1 A 0 A_SpawnItemEx("LargeDrillShellC",-8,0,0,5,0,0.25,0,1)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,0,0,20,13)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,0,0,20,-13)
stop
Death2:
TNT1 A 0
stop
Death:
TNT1 A 0 A_JumpIf(z-floorz<=2,"DeathF")
TNT1 A 0 A_JumpIf(ceilingz-z<=16,"DeathC")
TNT1 A 0 A_JumpIfInventory("GroundIsATank",1,"Death2")
goto Spread//Only split if Drill dies frame 0
DeathF:
TNT1 A 0
goto Spread
DeathC:
TNT1 A 0
goto Spread
}
}

actor MediumDrill1C : SpreadDrillC
{
DamageType "GroundM_Shot2"
damage (100)
radius 18
scale 2.5
states
{
Spawn:
GRDH R 0
GRDH SR 2
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("MediumDrill2C",0,0,0,28)
stop
}
}

actor MediumDrill2C : SpreadDrillC
{
DamageType "GroundM_Shot2"
damage (100)
radius 16
Speed 28//20
scale 2.5
states
{
Spawn:
GRDH SSRR 1 A_JumpIfInTargetInventory("GroundSplitFlag",1,"Spread")
loop
Spread:
TNT1 A 0 A_SpawnItemEx("MediumDrillShellC",-4,0,0,5,0,0.25,0,1)
TNT1 A 0 A_SpawnItemEx("SmallDrill1C",0,0,0,20,8)
TNT1 A 0 A_SpawnItemEx("SmallDrill1C",0,0,0,20,-8)
stop
Death:
TNT1 A 0 
stop
}
}

actor SmallDrill1C : MediumDrill1C
{
DamageType "GroundM_Shot3"
damage (80)
radius 10
height 8
states
{
Spawn:
GRDH T 0
GRDH UT 2
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("SmallDrill2C",0,0,0,28)
stop
}
}

actor SmallDrill2C : MediumDrill2C
{
DamageType "GroundM_Shot3"
damage (80)
radius 8
height 8
Speed 28
states
{
Spawn:
GRDH UT 2
loop
Death:
TNT1 A 0 
stop
}
}

actor LargeDrillShellC : BasicGraphicEffect
{
-NOGRAVITY
-NOINTERACTION
+THRUGHOST
+DONTREFLECT
+RIPPER
Gravity 0.3
Radius 8
Height 8
States
{
SpawnFrame:
TNT1 A 0
GRDH V 1 A_PlaySoundEx("weapon/spreaddrill2","Weapon")
TNT1 A 1 
Spawn2:
GRDH V 1
TNT1 A 1 A_CheckFloor("Death")
loop
Death:
TNT1 A 0
stop
}
}

actor MediumDrillShellC : LargeDrillShellC
{
States
{
SpawnFrame:
TNT1 A 0 
GRDH W 1 A_PlaySoundEx("weapon/spreaddrill3","Weapon")
TNT1 A 1 
Spawn2:
GRDH W 1
TNT1 A 1 A_CheckFloor("Death")
loop
}
}


actor LargeDrillShellCeiling : LargeDrillShellC
{
States
{
SpawnFrame:
TNT1 A 0
GRD6 Y 1 A_PlaySoundEx("weapon/spreaddrill2","Weapon")
TNT1 A 1 
Spawn2:
GRD6 Y 1
TNT1 A 1 A_CheckFloor("Death")
loop
}
}

actor CeilingDrillSpawner : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("CeilingSpreadDrillC",0,0,-32,0,0,-16)
stop
}
}

actor CeilingSpreadDrillC : ProjSpawnFuncActor
{
PROJECTILE
DamageType "GroundM_ShotCeil"
Obituary "$OB_SPREADDRILL"
-NOGRAVITY
+SKYEXPLODE
+EXPLODEONWATER
damage (250)
radius 28
height 28
speed 1
scale 2.5
states
{
Spawn:
GRD6 WX 2
Loop
Crash:
XDeath:
GRD6 X 0 A_SetGravity(0.0)
GRD6 X 0
GRD6 X 1
TNT1 A 1
GRD6 X 1
TNT1 A 1
GRD6 W 1
TNT1 A 1
GRD6 W 1
TNT1 A 1
GRD6 X 1
TNT1 A 1
GRD6 X 1
TNT1 A 1
GRD6 W 1
TNT1 A 1
GRD6 W 1
TNT1 A 1
stop
Death:
//TNT1 A 0 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,1)
TNT1 A 0 A_SpawnItemEx("LargeDrillShellCeiling",0,0,8,1,0,2,0,1)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,16,32,20,11,0,90)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,-16,32,20,-11,0,90)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,16,32,20,11,0,180)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,-16,32,20,-11,0,180)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,16,32,20,11,0,-90)
TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,-16,32,20,-11,0,-90)

TNT1 A 0 A_SpawnItemEx("MediumDrill1C",0,16,32,20,11)
TNT1 A 1 A_SpawnItemEx("MediumDrill1C",0,-16,32,20,-11)
stop

}
}

actor GiantCeilingDrill : ProjSpawnFuncActor
{
PROJECTILE
DamageType "GroundM_GigaDrill"
Obituary "$OB_SPREADBIGC"
+DONTBLAST
+RIPPER
+DONTREFLECT
+THRUGHOST
+SPAWNCEILING
+CEILINGHUGGER
Damage (50)
Radius 12
Height 18
Speed 0
scale 2.5
States
{
Spawn:
GRD6 A 0
GRD6 A 0
GRD6 A 1 A_SpawnItemEx("GCDExplode",0,0,-47)
GRD6 B 1
GRD6 C 1 A_SpawnItemEx("GCDExplode",0,0,-142)
GRD6 D 1
GRD6 E 1 A_SpawnItemEx("GCDExplode",0,0,-237)
GRD6 F 1
GRD6 G 1 A_SpawnItemEx("GCDExplode",0,0,-332)
GRD6 L 1
goto Spawn2
Spawn2:
GRD6 KLM 2 A_SpawnItemEx("GCDExplode",0,0,-380)
Spawn2a:
GRD6 LKLM 2 A_SpawnItemEx("GCDExplode",0,0,-380)
GRD6 L 0 A_JumpIfInTargetInventory("GroundHoldFlag",1,"Spawn2a")
goto Spawn3
Spawn3:
GRD6 L 1
GRD6 G 1 A_SpawnItemEx("GCDExplode",0,0,-332)
GRD6 F 1
GRD6 E 1 A_SpawnItemEx("GCDExplode",0,0,-237)
GRD6 D 1
GRD6 C 1 A_SpawnItemEx("GCDExplode",0,0,-142)
GRD6 B 1
GRD6 A 0 A_SpawnItemEx("GCDExplode",0,0,-47)
GRD6 A 0 A_PlaySoundEx("weapon/spreaddrill1","Weapon")
GRD6 A 1 A_SpawnItemEx("CeilingDrillSpawner",0,0,0,0,0,15)
stop
}
}

actor GCDExplode : BasicImplosion
{
DamageType "GroundM_GigaDrill"
Obituary "$OB_SPREADBIGC"
-NOINTERACTION
+THRUACTORS
+NOCLIP
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode(60*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1),48,0,0,48)
stop
}
}


actor GroundM_RockFX : BasicGraphicEffectM
{
-NOGRAVITY
+THRUACTORS
+FLOORCLIP
//+NOCLIP
Height 5
Radius 5
Speed 30
States
{
//GRD6 OPQRSTU 30
SpawnFrame:
TNT1 A 0
//TNT1 A 0 A_SetScale(ScaleX-frandom(0,0.5))
//TNT1 A 0 A_SetScale(ScaleX*(random(0,1)*2-1),ScaleY)
TNT1 A 0// A_ChangeFlag("NOCLIP",0)
TNT1 A 0 A_Jump(256,"P","Q","R","S","T","U")
P:
GRD6 P 10
goto END
Q:
GRD6 Q 10
goto END
R:
GRD6 R 10
goto END
S:
GRD6 S 10
goto END
T:
GRD6 T 10
goto END
U:
GRD6 U 10
goto END
END:
GRD6 O 10
stop
}
}

actor GroundRocksCeilingBoostFX_H : BasicExplosion
{
+FLOORHUGGER
States
{
Spawn:
TNT1 A 1
TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("GroundM_RockFX",0,0,16,random(-3,3),random(-3,3),random(6,18),random(0,359),1)
TNT1 A 1
stop
}
}



actor Groundman_W_NormalBar : NormalBar {Args 87,220}
actor Groundman_W_SecondBar : SecondBar {Args 71,76}