// Invisibility

ACTOR InvisSphereSpawnActor : CustomInventory 10103
{
	Tag "Invisibility (Insanity)"
	//$Category Powerups
	//$Sprite SINVA0
	+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("InvisSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR InvisSphereSpawner : RandomSpawner
{
	DropItem "IDMInvisSphere"
}

ACTOR IDMInvisSphere : CustomInventory
{
	+FLOAT
	+FLOATBOB
	+VISIBILITYPULSE
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+COUNTITEM
	-INVENTORY.INVBAR
	Inventory.PickupMessage "Invisibility!"
	Inventory.PickupSound "misc/invis_pkup"
	Inventory.PickupAnnouncerEntry "invisibility"
	Inventory.RespawnTics 2100
	Inventory.MaxAmount 0
	Renderstyle "Translucent"
	Tag "Invisibility"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  SINV 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\nInvisibility!\n\n\n\n200 Health!\nYou are blurry for 30 seconds!")
	  TNT1 A 0 Healthing(200,200)
	  TNT1 A 0 A_GiveInventory("InvisSphereInvisibility")
	  Stop
	}
}


ACTOR PowerIDMInvisibility : PowerInvisibility
{
	Inventory.Icon "INVISP1"
	Powerup.Mode "Fuzzy"
}

ACTOR InvisSphereInvisibility : PowerupGiver
{
	Powerup.Duration -30
	Powerup.Type "IDMInvisibility"
	Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}