// Turbosphere

ACTOR TurboSphereSpawnActor : CustomInventory 10084
{
	Tag "Turbosphere (Insanity)"
	//$Category Powerups
	//$Sprite TURBA0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 1 A_SpawnItemEx("TurboSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR TurboSphereSpawner : RandomSpawner
{
	DropItem "IDMTurboSphere"
}

ACTOR IDMTurboSphere : CustomInventory
{
	+FLOAT
	+FLOATBOB
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	Inventory.PickupMessage "Turbosphere!"
	Inventory.PickupSound "misc/p_pkup"
	Inventory.PickupAnnouncerEntry "turbosphere"
	Inventory.RespawnTics 2100
	Tag "Turbosphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
      TURB ABCD 6 Bright
      Loop
	NoGrav:
	  TNT1 A 0 A_ScaleVelocity(0)
	  TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	  Goto SpawnLoop
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("PowerRageInvulnerable",1,"NoProt")
	  TNT1 A 0 A_GiveInventory("PickupProtection")
    NoProt:
	  TNT1 A 0 A_Print("\n\n\n\n\n\n\nTurbosphere!\n\n\n\n200 Health!\n1.5x movement speed!\nYou leave a fire trail in your wake!")
	  TNT1 A 0 Healthing(200,200)
	  TNT1 A 0 A_GiveInventory("TurboSphereSpeed")
	  Stop
	}
}

ACTOR PowerIDMTurbo : PowerSpeed
{
	Inventory.Icon "TURBSP1"
	Speed 1.5
}

ACTOR TurboSphereSpeed : PowerupGiver
{
	Powerup.Duration -30
	Powerup.Type "IDMTurbo"
	//Powerup.ColorMap 1.5,0.5,0.0
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR TurboSphereFlameMissile
{
	+NOBLOCKMAP
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1 A_SpawnItemEx("TurboSphereFlame",-20,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
	  Stop
	}
}

ACTOR TurboSphereFlame
{
	Obituary "%o walked on the fire trail of %k's Turbosphere."
	//SelfObituary "%o did a donut too fast with %p own Turbosphere."
	+NOBLOCKMAP
	+MISSILE
	+NOEXPLODEFLOOR
	-NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0 A_StartFire
	  FIRP ABAB 2 Bright A_Explode(25,48,0,0,48)
	  TNT1 A 0 A_FireCrackle
	  FIRP CBCBCDCDCDEDED 2 Bright A_Explode(25,48,0,0,48)
	  TNT1 A 0 A_FireCrackle
	  FIRP EFEFEFGHGHGH 2 Bright A_Explode(25,48,0,0,48)
	  Stop
	}
}