// Spread

ACTOR SpreadSphereSpawnActor : CustomInventory 10082
{
	Tag "Spread Sphere"
	//$Category Powerups
	//$Sprite SPRDA0
	+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("SpreadSphereSpawner")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR SpreadSphereSpawner : RandomSpawner
{
	DropItem "SpreadSphere"
}

ACTOR SpreadSphere : CustomInventory
{
	+FLOAT
	+FLOATBOB
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+COUNTITEM
	-INVENTORY.INVBAR
	Inventory.PickupMessage "Spread!"
	Inventory.PickupSound "misc/p_pkup"
	Inventory.PickupAnnouncerEntry "spread"
	Inventory.RespawnTics 2100
	Inventory.MaxAmount 0
	Tag "Spread Sphere"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
      SPRD A 15 Bright
      SPRD BCDB 5 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_GiveInventory("PickupProtection")
	  TNT1 A 0 A_Print("\n\n\n\n\nSpread!\n\n\n\nYour shots are tripled!")
	  TNT1 A 0 A_GiveInventory("SpreadSphereSpread")
	  TNT1 A 0 A_GiveInventory("IDMPowerupTrail")
	  Stop
	}
}

ACTOR PowerIDMSpread : PowerSpread
{
	Inventory.Icon "SPRDSP1"
}
	
ACTOR SpreadSphereSpread : PowerupGiver
{
	Powerup.Duration -20
	Powerup.Type "IDMSpread"
	Powerup.Color "Orange", 0.2
	Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
}