actor GravityHoldBoss : MegaBuster 
{
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Weapon.SlotNumber 1
Obituary "%o was bombed by %k's Gravity Buster."
weapon.ammotype "GravityHoldClassAmmo"
inventory.pickupsound "weapon/weaponup"
+WEAPON.AMMO_OPTIONAL
Scale 2.0
States
{
Spawn:
TNT1 A 0
stop
Ready:
GRAB B 0 ACS_ExecuteAlways(998,0,77)
GRAB B 0 A_JumpIfInventory("GravityHoldClassAmmo",28,"Ready2")
GRAB B 12 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
GRAB B 0 A_GiveInventory("GravityHoldClassAmmo",1)
Goto ready+1
Ready2:
GRAB B 0 A_JumpIfInventory("GravitySwitch",1,"SwitchUpsideDown")
GRAB B 1 A_WeaponReady(WRF_NOSWITCH)
loop
UpSideDownReady:
GRAB E 1 A_WeaponReady(WRF_NOSWITCH)
GRAB E 0 A_JumpIfInventory("GravityHoldClassAmmo",1,"UpSideDownReady")
goto AltFire
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
GRAB B 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
GRAB B 1 A_Raise
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("IsBotFlag",1,"BotFire")
GRAB B 0 A_JumpIfInventory("CeilingFlag",1,"UpSideDownFire")
GRAB B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
GRAB B 0 A_FireCustomMissile("GravityShot",0,0,8,0)
GRAB CCD 4
GRAB B 6
GRAB B 0 A_GiveInventory("GravityHoldClassAmmo",1)
goto Ready+1
UpSideDownFire:
GRAB B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
GRAB B 0 A_FireCustomMissile("GravityShot",0,0,8,0)
GRAB FFG 4
GRAB E 6
GRAB E 0 A_JumpIfInventory("GravityHoldClassAmmo",1,"UpSideDownReady")
goto AltFire
Altfire:
GRAB B 0 A_JumpIfInventory("CeilingFlag",1,"HoldLaunch")
GRAB B 0 A_JumpIfInventory("GravityHoldClassAmmo",28,"HoldLaunch")
/*GRAB B 1
GRAB B 0 A_Refire*/
Goto Ready+1
HoldLaunch:
GRAB B 0 A_JumpIfInventory("CeilingFlag",1,"SwitchRightSideUp")
GRAB B 0 A_TakeInventory("GravitySwitch",1)
GRAB B 0 //A_TakeInventory("GravitySwitchItem",1)
GRAB B 0
GRAB B 0 A_PlaySoundEx("weapon/gravityhold","Weapon")
GRAB B 0 A_FireCustomMissile("GravityManHold",0,0,8,0)
GRAB B 0 A_FireCustomMissile("GravityManHold2",0,0,8,0)
GRAB B 0 A_TakeInventory("GravityHoldClassAmmo",28)
GRAB B 0 ACS_ExecuteAlways(991,0,32)
GRAH ABCDD 1
TNT1 A 0 ACS_ExecuteAlways(191,0,0)
TNT1 A 0 ACS_ExecuteAlways(648,0,2)
TNT1 A 0 A_TakeInventory("OnCeilingFlag",1)
GRAB B 0 ACS_ExecuteAlways(991,0,77)
GRAH DCBA 4
GRAB B 0
GRAB B 0 ACS_ExecuteAlways(991,0,77)
GRAB B 1 A_Refire
goto Ready+1
SwitchGive:
GRAB B 0 A_GiveInventory("GravitySwitchItem",1)
goto Ready+2
SwitchUpsideDown:
GRAB B 0 A_SetGravity(-0.8)
TNT1 A 0 //A_ChangeFlag("NOGRAVITY",1)
GRAB B 0 A_TakeInventory("GravitySwitch",1)
GRAB B 0 //A_TakeInventory("GravitySwitchItem",1)
GRAB B 0 A_TakeInventory("GroundFlag",1)
GRAB B 0 A_GiveInventory("CeilingFlag",1)
GRAB B 0 A_TakeInventory("JumpCancler",1)
TNT1 A 0 ACS_ExecuteAlways(648,0,1)
GRAB B 0 A_PlaySoundEx("weapon/upsidedown","Weapon")
GRAB B 0 A_GunFlash
goto UpsideDownReady
SwitchRightSideUp:
GRAB B 0 A_SetGravity(0.8)
TNT1 A 0 //A_ChangeFlag("NOGRAVITY",0)
TNT1 A 0 ACS_ExecuteAlways(191,0,0)
TNT1 A 0 ACS_ExecuteAlways(648,0,2)
GRAB B 0 A_TakeInventory("OnCeilingFlag",1)
GRAB B 0 A_TakeInventory("CeilingFlag",1)
GRAB B 0 A_GiveInventory("GroundFlag",1)
goto HoldLaunch
NoAmmo:
GRAB B 0
//GRAB B 1 ACS_Execute(979,0)
Goto Ready+1
Flash:
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 1 A_GiveInventory("ReverseGravityThrust",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "NoFlash")
TNT1 A 0 A_JumpIfInventory("CeilingFlag", 1, "TakeAmmo")
stop
TakeAmmo:
TNT1 A 0 A_TakeInventory("GravityHoldClassAmmo",1)
goto Flash
NoFlash:
TNT1 A 0
stop

BotFire:
TNT1 A 0 A_JumpIfInventory("CeilingFlag",1,"AltCheck")
TNT1 A 0 A_JumpIfInventory("GravityHoldClassAmmo",28,"AltCheck")
TNT1 A 0 A_JumpIfInventory("GravityHoldClassAmmo",14,"NormalFire")
FleeFire:
TNT1 A 0 A_GiveInventory("BotRetreatFlag",1)
GRAB B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
GRAB B 0 A_FireCustomMissile("GravityShot",0,0,8,0)
GRAB CCD 4
GRAB B 6
GRAB B 0 A_GiveInventory("GravityHoldClassAmmo",1)
TNT1 A 0 A_TakeInventory("BotRetreatFlag",999)
goto Ready+1
NormalFire:
TNT1 A 0
goto Fire+1
AltCheck:
TNT1 A 0 A_JumpIfCloser(750, "HoldLaunch")
TNT1 A 0 A_JumpIfInventory("CeilingFlag",1,2)
TNT1 A 0 A_Jump(64, "SwitchUpsideDown")
TNT1 A 0
goto Fire+1
}
}


actor GravityHoldClassAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
}

actor GravityShot : FastProjectile
{
PROJECTILE
+LOOKALLAROUND
+SKYEXPLODE
+DONTBLAST
damagetype "Buster"
//seesound "weapon/mbuster"
Speed 50
Damage (20)
radius 5
height 5
scale 2.5
States
{
Spawn:
TNT1 A 1
GRSH A 1
Goto Spawn+1
Death:
GRSH A 1
stop
}
}

actor GravitySwitchItem : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "GravIcon"
scale 2.0
+COUNTITEM
+INVBAR
states
{
Spawn:
GRAI A 1
loop
Use:
TNT1 A 0 A_JumpIfInventory("GravityHoldClassAmmo",28,"Success")
fail
Success:
TNT1 A 0 A_GiveInventory("GravitySwitch",1)
fail
}
}

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

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

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

actor ReverseGravityThrust : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
States
{
Spawn:
TNT1 A 0
stop
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, 3)
GRAB B 0 A_SetGravity(-0.8)
TNT1 A 0 ThrustThingZ(0,momz*4+4/*4*/,0,0/*1*/)
TNT1 A 0 A_GiveInventory("CeilingCheck",1)
TNT1 A 1
stop
}
}

actor CeilingCheck : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
States
{
Spawn:
TNT1 A 0
stop
Pickup:
TNT1 A 0
TNT1 A 0 A_TakeInventory("JumpCancler",1)
TNT1 A 0 A_JumpIfInventory("GroundFlag", 1, "SpeedDown")
CRAS A 0 A_JumpIf(z-ceilingz==0-56, "Contact")
goto SpeedDown
Contact:
TNT1 A 0 A_JumpIf(z-floorz<=0, "SpeedDown")
TNT1 A 0 //A_JumpIfInventory("OnCeilingFlag", 1, "SpeedUp")
TNT1 A 0 //A_PlaySoundEx("weapon/land","Voice")
TNT1 A 0 A_GiveInventory("OnCeilingFlag",1)
goto SpeedUp
SpeedUp:
TNT1 A 0 ACS_ExecuteAlways(191,0,4)
stop
SpeedDown:
TNT1 A 0 ACS_ExecuteAlways(191,0,0)
TNT1 A 0 A_TakeInventory("OnCeilingFlag",1)
stop
}
}

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

actor ReverseJump : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
States
{
Spawn:
TNT1 A 0
stop
Pickup:
TNT1 A 0
TNT1 A 0 //ThrustThingZ(0,70,1,0)
TNT1 A 0 ThrustThingZ(0,75,1,0)
TNT1 A 0 //A_GiveInventory("JumpCancler",1)
TNT1 A 0 A_TakeInventory("OnCeilingFlag",1)
TNT1 A 1
stop
}
}

actor GravityManHold : GravityHold
{
damagetype "GravityB1"
Obituary "%o was held up by %k's Gravity Hold."
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(5, 750,0)
stop
}
}

actor GravityManHold2 : GravityManHold
{
damagetype "GravityB2"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(10, 750,0)
stop
}
}

/*
actor GravityManHold : GravityHold
{
Obituary "%o was held up by %k's Gravity Hold."
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(5, 1000,0)
TNT1 A 1 A_Explode(5, 1000,0)
TNT1 A 1 A_Explode(5, 1000,0)
TNT1 A 1 A_Explode(5, 1000,0)
stop
}
}
*/