actor GravityHoldBoss : BaseMM8BDMWep_CBM 
{
dropitem "GravitySphereWepCDropped"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Weapon.SlotNumber 1
Obituary "$OB_GRAVITYHOLD"
weapon.ammotype "GravityHoldClassAmmo"
States
{
Spawn:
C_05 A 1
loop
Ready:
GRAB B 0 ACS_ExecuteAlways(998,0,800)
GRAB B 0 A_JumpIfInventory("GravityHoldClassAmmo",28,"Ready2")
GRAB B 6 A_WeaponReady(WRF_NOSECONDARY)
GRAB B 0 A_GiveInventory("GravityHoldClassAmmo",1)
Goto ready+1
Ready2:
GRAB B 0 A_JumpIfInventory("GravitySwitch",1,"SwitchUpsideDown")
GRAB B 1 A_WeaponReady
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("IsBot",1,"BotFire")
GRAB B 0 A_JumpIfInventory("CeilingFlag",1,"UpSideDownFire")
GRAB B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
GRAB B 0 A_GiveInventory("GravitymanMain_CI",1)
GRAB CDC 3
GRAB B 6//18
GRAB B 0 A_GiveInventory("GravityHoldClassAmmo",1)
goto Ready+1
UpSideDownFire:
GRAB B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
GRAB B 0 A_GiveInventory("GravitymanMain2_CI",1)
GRAB FGF 3
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:
GRAH A 0 A_JumpIfInventory("CeilingFlag",1,"SwitchRightSideUp")
GRAH A 0 A_TakeInventory("GravitySwitch",99)
GRAH A 0 //A_TakeInventory("GravitySwitchItem",1)
GRAH A 0
GRAH A 0 A_PlaySoundEx("weapon/gravityhold","Weapon")
GRAH A 0 A_GiveInventory("GravitymanAlt_CI",1)
GRAH A 0 A_TakeInventory("GravityHoldClassAmmo",28)
GRAH A 0 A_TakeInventory("UnSolid",1)
GRAH A 0 A_ChangeFlag("SOLID",0)
GRAH A 0 ACS_ExecuteAlways(998,0,814,5)
GRAH ABC 1
GRAH D 2
GRAB B 0 ACS_ExecuteAlways(998,0,800,1)
TNT1 A 0 ACS_ExecuteAlways(191,0,0)
TNT1 A 0 ACS_ExecuteAlways(648,0,2)
TNT1 A 0 A_TakeInventory("OnCeilingFlag",99)
GRAH DC 4
GRAH B 0 A_SpawnItemEx("ReSolidifier")
GRAH BA 4

GRAB B 0 ACS_ExecuteAlways(191,0,0)
GRAB B 0 ACS_ExecuteAlways(998,0,800,1)
//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",99)
GRAB B 0 //A_TakeInventory("GravitySwitchItem",1)
GRAB B 0 A_TakeInventory("GroundFlag",99)
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","Body")
GRAB B 0 A_GunFlash
goto UpsideDownReady
SwitchRightSideUp:
GRAH E 0 A_GiveInventory("EnvironmentGravity",1)//A_SetGravity(0.8)
GRAH E 0 //A_ChangeFlag("NOGRAVITY",0)
GRAH E 0 A_TakeInventory("OnCeilingFlag",99)
GRAH E 0 A_TakeInventory("CeilingFlag",99)
GRAH E 0 A_GiveInventory("GroundFlag",1)
GRAH E 0 A_TakeInventory("JumpCancler",1)
TNT1 A 0 ACS_ExecuteAlways(648,0,2)
TNT1 A 0 ACS_ExecuteAlways(191,0,0)
GRAH E 0 A_TakeInventory("GravitySwitch",99)
GRAH E 0 A_PlaySoundEx("weapon/gravityhold","Weapon")
GRAH A 0 A_GiveInventory("GravitymanAlt_CI",1)
GRAH E 0 A_TakeInventory("GravityHoldClassAmmo",28)
GRAH E 0 A_TakeInventory("UnSolid",1)
GRAH E 0 A_ChangeFlag("SOLID",0)
GRAB E 0 ACS_ExecuteAlways(998,0,814,5)
GRAH EFG 1
GRAH H 2
GRAH H 0 ACS_ExecuteAlways(998,0,800,1)
GRAH H 0 A_TakeInventory("OnCeilingFlag",99)
GRAH HG 4
GRAH F 0 A_SpawnItemEx("ReSolidifier")
GRAH FE 4
GRAH E 0 ACS_ExecuteAlways(191,0,0)
GRAH E 0 ACS_ExecuteAlways(998,0,800,1)
goto Ready+1
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("IsDead",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",2)
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
+INVENTORY.IGNORESKILL
}

actor GravityShot
{
Translation "198:198=41:41"
PROJECTILE
+DONTBLAST
damagetype "Buster"
Obituary "$OB_GRAVITYBUSTER"
Damage (14)
radius 8
height 8
Speed 50
scale 2.5
States
{
Spawn:
TNT1 A 1
GRSH A 1
Goto Spawn+1
Death:
GRSH A 1
stop
}
}

actor GravityShotB : GravityShot{translation "198:198=74:74"}
actor GravityShotR : GravityShot{translation "198:198=41:41"}
actor GravityShotO : GravityShot{translation "198:198=128:128"}
actor GravityShotP : GravityShot{translation "198:198=232:232"}

actor GravityShotUp : GravityShot {Obituary "$OB_GRAVITYBUSTERUP"}
actor GravityShotUpB : GravityShotB {Obituary "$OB_GRAVITYBUSTERUP"}
actor GravityShotUpR : GravityShotR {Obituary "$OB_GRAVITYBUSTERUP"}
actor GravityShotUpO : GravityShotO {Obituary "$OB_GRAVITYBUSTERUP"}
actor GravityShotUpP : GravityShotP {Obituary "$OB_GRAVITYBUSTERUP"}

actor GravitySwitchItem : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "GravIcon"
scale 2.0
inventory.pickupmessage "Power up! Screw Gravity!"
+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 : OnceC{}
actor CeilingFlag : OnceC{}
actor GroundFlag : OnceC{}

actor ReverseGravityThrust : CustomInventory
{
States
{
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_ChangeVelocity(0,0,0.8)
TNT1 A 0 A_GiveInventory("CeilingCheck",1)
TNT1 A 1
stop
}
}

actor CeilingCheck : CustomInventory
{
States
{
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)
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",99)
stop
}
}

actor OnCeilingFlag : OnceC{}

actor ReverseJump : CustomInventory
{
States
{
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("ReverseJumped",1,"NoJump")
TNT1 A 0 A_JumpIfInventory("OnCeilingFlag",1,"Jump")
stop
Jump:
TNT1 A 0 //ThrustThingZ(0,70,1,0)
//TNT1 A 0 ThrustThingZ(0,75,1,0)
//TNT1 A 0 A_Print("A jump!")
TNT1 A 0 A_ChangeVelocity(0,0,-15.0)
TNT1 A 0 A_GiveInventory("ReverseJumped",1)
TNT1 A 0 A_GiveInventory("JumpCancler",1)
TNT1 A 0 A_TakeInventory("OnCeilingFlag",99)
TNT1 A 1
stop
NoJump:
TNT1 A 1
stop
}
}

actor ReverseJumped : PowerDamage
{
powerup.duration 7
damagefactor "normal", 1.0
}

actor GravityManHold : GravityHold
{
Translation "192:192=4:4", "198:198=41:41"
damagetype "GravityB1"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(8,550,0)
stop
}
}

actor GravityManHold2 : GravityManHold
{
Obituary "$OB_GRAVITYHOLDB"
damagetype "GravityB2"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(8,550,0)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(440,550),0,random(275,550),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(330,440),0,random(275,550),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(220,330),0,random(275,550),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(110,220),0,random(275,550),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(0,110),0,random(275,550),0,0,-40,random(0,359),129)
TNT1 A 1
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(440,550),0,random(0,275),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(330,440),0,random(0,275),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(220,330),0,random(0,275),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(110,220),0,random(0,275),0,0,-40,random(0,359),129)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("GravityManHoldFX",random(0,110),0,random(0,275),0,0,-40,random(0,359),129)
TNT1 A 1
stop
}
}

actor GravityManHoldB : GravityManHold{translation "192:192=205:205", "198:198=74:74"}
actor GravityManHoldR : GravityManHold{translation "192:192=171:171", "198:198=41:41"}
actor GravityManHoldO : GravityManHold{translation "192:192=104:104", "198:198=128:128"}
actor GravityManHoldP : GravityManHold{translation "192:192=229:229", "198:198=232:232"}

actor GravityManHold2B : GravityManHold2{translation "192:192=205:205", "198:198=74:74"}
actor GravityManHold2R : GravityManHold2{translation "192:192=171:171", "198:198=41:41"}
actor GravityManHold2O : GravityManHold2{translation "192:192=104:104", "198:198=128:128"}
actor GravityManHold2P : GravityManHold2{translation "192:192=229:229", "198:198=232:232"}

actor GravityManHoldFX
{
-SOLID
+MISSILE
+DONTBLAST
+THRUACTORS
+CLIENTSIDEONLY
+DONTSPLASH
Damage (0)
radius 2
height 2
scale 2.5
States
{
Spawn:
GRSH B 12
stop
}
}

actor GravityCollide : BasicExplosion
{
Obituary "$OB_GRAVITYHOLDB"
damagetype "GravityB2"
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(3,15,0,0,15)
TNT1 A 1
stop
}
}

actor GravityCollideX : GravityCollide
{
Obituary "$OB_GRAVITYHOLDX"
}

/*
actor GravityManHold : GravityHold
{
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
}
}
*/


actor GravitymanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("GravityShot",0,0,-8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("GravityShotB",0,0,-8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("GravityShotR",0,0,-8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("GravityShotO",0,0,-8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("GravityShotP",0,0,-8,0)
goto Done
}
}


actor GravitymanMain2_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("GravityShotUp",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("GravityShotUpB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("GravityShotUpR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("GravityShotUpO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("GravityShotUpP",0,0,8,0)
goto Done
}
}

actor GravitymanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("GravityManHold",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("GravityManHold2",0,0,0,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("GravityManHoldB",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("GravityManHold2B",0,0,0,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("GravityManHoldR",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("GravityManHold2R",0,0,0,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("GravityManHoldO",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("GravityManHold2O",0,0,0,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("GravityManHoldP",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("GravityManHold2P",0,0,0,0)
goto Done
}
}