// Time Freeze

ACTOR TimeFreezeSpawnActor : CustomInventory 10074
{
	Tag "Time Freeze (Insanity)"
	//$Category Powerups
	//$Sprite TIMEA0
	+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("TimeFreezeSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR TimefreezeSpawner : RandomSpawner
{
	DropItem "IDMTimeFreeze"
}

ACTOR PowerIDMFreezer : PowerTimeFreezer
{
	Inventory.Icon "TIMESP1"
}

ACTOR IDMTimeFreezeGiver : PowerupGiver
{
	Inventory.Maxamount 0
	Powerup.Duration -10
	Inventory.PickupMessage ""
	Inventory.PickupSound ""
	Powerup.ColorMap 1.0,1.0,1.0
	Powerup.Type IDMFreezer
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR TimeFreezeInvulnerable : PowerupGiver
{
	Inventory.MaxAmount 0
	Powerup.Duration -10
	Inventory.PickupMessage ""
	Inventory.PickupSound ""
	Powerup.Type "RageInvulnerable"
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}


ACTOR TimeFreezeGreyscale : PowerupGiver
{
	Inventory.MaxAmount 0
	Powerup.Duration -10
	Powerup.Type "Nothing"
	Powerup.ColorMap 1.0,1.0,1.0
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}

ACTOR IDMTimeFreeze : CustomInventory
{
    +FLOAT
	+FLOATBOB
	Inventory.Pickupmessage "TIME FREEZE!"
	Inventory.PickupSound "misc/p_pkup"
	Inventory.PickupAnnouncerEntry "timefreeze"
	Inventory.RespawnTics 4200
	+COUNTITEM
	+INVENTORY.BIGPOWERUP
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	Tag "Time Freeze Sphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
	  TIME ABCD 5 Bright
	  Loop
	NoGrav:
	  TNT1 A 0 A_ScaleVelocity(0)
	  TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	  Goto SpawnLoop
	Pickup:
	  TNT1 A 0 A_PrintBold("\n\n\n\n\n\cJTIME FREEZE!\n\n\n\n",10)
	  TNT1 A 0 A_Print("\n\n\n\n\nTIME FREEZE!\n\n\n\nTime is frozen for 10 seconds!")
	  TNT1 A 0 A_GiveInventory("IDMTimeFreezeGiver")
	  TNT1 A 0 A_GiveInventory("TimeFreezeInvulnerable")
	  TNT1 A 0 ACS_NamedExecuteAlways("TimeFreezeGreyscale",0)
	  TNT1 A 0 A_PlaySound("misc/timefreeze",CHAN_AUTO|CHAN_NOPAUSE,1,0,ATTN_NONE)
	  Stop
	}
}


ACTOR DemoTimeFreezeGiver : IDMTimeFreezeGiver
{
	Powerup.Duration -270
}

ACTOR DemoTimeFreezeInvulnerable : TimeFreezeInvulnerable
{
	Powerup.Duration -270
}

ACTOR DemoTimeFreeze : IDMTimeFreeze
{
	States
	{
	Pickup:
		TNT1 A 0 A_GiveInventory("DemoTimeFreezeGiver")
		TNT1 A 0 A_GiveInventory("DemoTimeFreezeInvulnerable")
		TNT1 A 0 A_PlaySound("misc/demotimefreeze",CHAN_AUTO|CHAN_NOPAUSE,1,0,ATTN_NONE)
		Stop
	}
}