//const int CBM_FetchMyHealth = 6142;
//const int CBM_HealMyThing = 6143;

actor SmallHealth : BaseMM8BDMItem 10001
{
Reactiontime 525
inventory.pickupmessage "$PU_SMALLHEALTH"
+COUNTITEM
Scale 2.0
States
{
SpawnLoop://Spawn
HBAL AAAAAABBBBBB 1 A_Countdown
loop
Death:
HBAL ABABA 1 A_Fadeout(0.2)
stop
Pickup:
//TNT1 A 0 A_JumpIfInventory("CanUseItems",1,"Success")
//TNT1 A 0 
//fail
//Success:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(6142,2),"HealMe")
fail
HealMe:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 HealThing(20)//ACS_ExecuteAlways(CBM_HealMyThing,0,1,20)
stop
}
}

actor BigHealth : BaseMM8BDMItem 10002
{
Reactiontime 525
inventory.pickupmessage "$PU_LARGEHEALTH"
+COUNTITEM
Scale 2.0
States
{
SpawnLoop://Spawn
HBAL CCCCCCDDDDDD 1 A_Countdown
loop
Death:
HBAL CDCDC 1 A_Fadeout(0.2)
stop
Pickup:
//TNT1 A 0 A_JumpIfInventory("CanUseItems",1,"Success")
//TNT1 A 0 
//fail
//Success:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(6142,2),"HealMe")
fail
HealMe:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 HealThing(50)//ACS_ExecuteAlways(CBM_HealMyThing,0,1,55)
stop
}
}

actor WeaponEnergy : BaseMM8BDMItem 10003
{
//$Category MM8BDM-Energy
//$Title Weapon Energy
//$Sprite EBALA0
//Inventory.RespawnTics 210
Reactiontime 525
inventory.pickupmessage "$PU_SMALLENERGY"
inventory.amount 1
inventory.pickupsound "item/energyup"
Scale 2.0
States
{
SpawnLoop:
EBAL A 0
EBAL A 0 A_JumpIf(tid!=0, 2)
EBAL A 0 Thing_ChangeTID(0,999)
EBAL AAAAABBBBB 1 A_Countdown
Goto SpawnLoop+3
Death:
EBAL ABABA 1 A_Fadeout(0.2)
stop
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(984,0),"Success")
fail
Success:
TNT1 A 0 ACS_ExecuteAlways(992,0,30)
stop
}
}

actor BigWeaponEnergy : BaseMM8BDMItem 10004
{
//$Category MM8BDM-Energy
//$Title Big Weapon Energy
//$Sprite EBALC0
//Inventory.RespawnTics 350
Reactiontime 525
inventory.pickupmessage "$PU_LARGEENERGY"
+COUNTITEM
inventory.pickupsound "item/energyup/large"
Scale 2.0
States
{
SpawnLoop:
EBAL C 0
EBAL C 0 A_JumpIf(tid!=0, 2)
EBAL C 0 Thing_ChangeTID(0,999)
EBAL CCCCCDDDDD 1
Goto SpawnLoop+3
Death:
EBAL CDCDC 1 A_Fadeout(0.2)
stop
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(984,0),"Success")
fail
Success:
TNT1 A 0 ACS_ExecuteAlways(992,0,72)
stop
}
}

actor MegaHealth : BaseMM8BDMHealth 10092
{
//$Category MM8BDM-Energy
//$Title Mega Health
//$Sprite HBALE0
//Inventory.RespawnTics 550
inventory.amount 100
inventory.maxamount 100
Scale 2.0
inventory.pickupmessage "Picked up a mega health capsule."
inventory.pickupsound "item/energyup/large"
+COUNTITEM
States
{
SpawnLoop:
HBAL E 0
EBAL F 0 A_JumpIf(tid!=0, 2)
HBAL E 0 Thing_ChangeTID(0, 999)
HBAL EF 6
Goto SpawnLoop+3
loop
}
}

actor MegaWeaponEnergy : BaseMM8BDMItem 10093
{
//$Category MM8BDM-Energy
//$Title Mega Weapon Energy
//$Sprite EBALI0
//Inventory.RespawnTics 350
inventory.pickupmessage "Picked up a mega energy capsule."
+COUNTITEM
inventory.pickupsound "item/energyup/large"
Scale 2.0
States
{
SpawnLoop:
EBAL I 0
EBAL I 0 A_JumpIf(tid!=0, 2)
EBAL I 0 Thing_ChangeTID(0,999)
EBAL IJ 6 
Goto SpawnLoop+3
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(984,0),"Success")
fail
Success:
//TNT1 A 0 ACS_ExecuteAlways(992, 0, 0, 1)
TNT1 A 0 ACS_Execute(992, 0, 255)
stop
}
}

actor SmallHealthDropper : RandomSpawner replaces Stimpack
{
	//$Category MM8BDM-Obsolete
	//$Obsolete
	//$Title Small Health (Stimpack)
	//$Sprite HBALA0
	//dropitem "SmallHealth"
}

actor BigHealthDropper : RandomSpawner replaces Medikit
{
	//$Category MM8BDM-Obsolete
	//$Obsolete
	//$Title Big Health (Medikit)
	//$Sprite HBALC0
	//dropItem "BigHealth"
}

actor WeaponEnergyDropper : RandomSpawner replaces Shell
{
	//$Category MM8BDM-Obsolete
	//$Obsolete
	//$Title Weapon Energy (Shell)
	//$Sprite EBALA0
	//dropitem "WeaponEnergy"
}

actor BigWeaponEnergyDropper : RandomSpawner replaces ShellBox
{
	//$Category MM8BDM-Obsolete
	//$Obsolete
	//$Title Big Weapon Energy (ShellBox)
	//$Sprite EBALC0
	//dropItem "BigWeaponEnergy"
}

//Misc Stuff
actor ForceLook : CustomInventory
{
	+INVENTORY.AUTOACTIVATE
	Inventory.Amount 1
	Inventory.MaxAmount 1
	States
	{
		Pickup:
			TNT1 A 0 A_ChangeFlag("LOOKALLAROUND",1)
			TNT1 A 1 A_ClearTarget
			TNT1 A 1 A_Look
			TNT1 A 1 A_FaceTarget
			stop
	}
}

actor PlayerRespawnPoint
{
+NOINTERACTION
+NOGRAVITY
Radius 1
Height 1
States
{
SpawnLoop:
TNT1 A 1
Loop
}
}

//Make Actor Shootable again - fixes possession exploit
actor MakeShootable : CustomInventory
{
states
{
Pickup:
TNT1 A 0
TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
TNT1 A 0 A_ChangeFlag("DONTRIP", 0)
TNT1 A 0 A_TakeInventory("SkullBarrierProtection", 1)
stop
}
}


//Flag given to bots
actor IsBot : Once {}


actor NoGravity : CustomInventory // Used for a boss fight or two
{
states
{
	Pickup:
	TNT1 A 0 A_ChangeFlag("NOGRAVITY",1)
	stop
}
}


