Actor Jetpack : CustomInventory
{
//Creator: Fluffy
//Origin: Nexus Infinity
//Sprite: JETP
//Title: "Jetpack"
+DONTGIB
-INVENTORY.INVBAR
+INVENTORY.UNDROPPABLE
+Inventory.PickupFlash
+Inventory.FancyPickupSound
+INVENTORY.HUBPOWER
+INVENTORY.PERSISTENTPOWER
+INVENTORY.BIGPOWERUP
Inventory.Amount 1
Inventory.MaxAmount 1
Inventory.Icon "JETTB0"
ActiveSound ""
Inventory.PickupSound "Jetpack/Pick"
Inventory.PickupMessage "\c[x1]Jet\c[w3]pack\c-: You are able to fly (Gas required)"
States
	{
	Spawn:
	    TNT1 A 0 A_CustomMissile("JetpackSparkleSpawner",0,0,random(0,-360),2,random(0,360))
		JETP A 1 Bright A_SpawnItem("BlueSphereFlare",0,10)
		Loop
	Use:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("JetpackActive",1,"Disable")
		TNT1 A 1 A_JumpIfInventory("AmpGogglesCooldown",1,"Nope")
		TNT1 A 0 A_GiveInventory("JetpackActive",1)
		TNT1 A 0 A_GiveInventory("JetpackActivated",1)
		TNT1 A 0 A_GiveInventory("AmpGogglesCooldown",1)
		TNT1 A 0 A_PlaySound("Jetpack/Activate",7)
		TNT1 A 1 ACS_NamedExecuteAlways("JetpackActiveScript",0,6)
		Fail
	Disable:
	    TNT1 A 0 A_TakeInventory("JetpackActive",1)
		TNT1 A 0 A_TakeInventory("JetpackActivated",1)
	    TNT1 A 0 A_GiveInventory("AmpGogglesCooldown",1)
	    TNT1 A 1 A_PlaySound("Jetpack/Out",7)
		Fail
	Nope:
	    TNT1 A 0 A_CustomMissile("JetpackSparkleSpawner",0,0,random(0,-360),2,random(0,360))
		JETP A 1 Bright A_SpawnItem("BlueSphereFlare",0,10)
	    Fail
	}
}

ACTOR JetpackSparkleSpawner : WhiteSparkleSpawner
{
States
{
  Spawn:
	TNT1 A 0 NoDelay A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 AA 2 A_SpawnItemEx("BlueStar", random(-15, 15), random(-15, 15), random(0, 28), 0, 0, 0, 0, 128)
    Stop
    }
}

Actor JetpackActive : PowerDamage
{
+INVENTORY.HUBPOWER
+INVENTORY.PERSISTENTPOWER
+NOTIMEFREEZE
DamageFactor "nothing", 1.0
Powerup.duration 0x7FFFFFFF
}

Actor JetpackCooldown : PowerDamage
{
+INVENTORY.ADDITIVETIME
DamageFactor "nothing", 1.0
Powerup.duration -5
}

ACTOR JetpackShake : Crusaderbuff
{
	States 
	{
		Pickup:
		    TNT1 A 1
			TNT1 A 5 A_quake(3,5,0,20,"")
			stop
	}
}

ACTOR JetpackActivated : LegendaryRuneItem { }
ACTOR JetpackOffIcon : LegendaryRuneItem { }
ACTOR JetpackOnIcon : LegendaryRuneItem { }
ACTOR JetpackWTFIcon : LegendaryRuneItem { }