//Copy of v6b 'items.txt'
//
//Adds an additional check for snatching classes to take the pickup
//Along with disabling their pickupsound so the snatch sound plays

actor SmallHealth : BaseMM8BDMItem 10001
{
//$Category MM8BDM-Energy
//$Title Small Health
//$Sprite HBALA0
//Inventory.RespawnTics 210
//$Color 14
var int user_RemoveAsSmallHealth;
var int user_RemoveAsHealth;
inventory.pickupmessage "$PU_SMALLHEALTH"
+COUNTITEM
//inventory.pickupsound "item/energyup"//$CBM
Scale 2.0
mass 20
accuracy 8
States
{
SpawnLoop:
HBAL AB 6
loop
Pickup:
//TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",20)//$CBM
//stop

TNT1 A 0 A_JumpIf(CallACS("core_CanGainHealth"),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",20)
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P1A",1)
stop
}
}

actor SmallHealth_Respawn : 8BDMItemRespawnSmall
{
	translation "192:192=4:4", "198:198=215:215"
	mass 1050
}
actor SmallHealth_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		HBAL A 0
		goto Super::Spawn
	}
}

actor BigHealth : BaseMM8BDMItem 10002
{
//$Category MM8BDM-Energy
//$Title Big Health
//$Sprite HBALC0
//Inventory.RespawnTics 550
//$Color 14
Scale 2.0
var int user_RemoveAsHealth;
inventory.pickupmessage "$PU_LARGEHEALTH"
//inventory.pickupsound "item/energyup/large"//$CBM
+COUNTITEM
States
{
SpawnLoop:
HBAL CD 6
loop
Pickup:
//TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",55)//$CBM
//stop
TNT1 A 0 A_JumpIf(CallACS("core_CanGainHealth"),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",55)
TNT1 A 0 A_PlaySound("item/energyup/large",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P2",1)
stop
}
}

actor BigHealth_Respawn : 8BDMItemRespawn
{
	translation "192:192=4:4", "198:198=215:215"
	mass 1050
}
actor BigHealth_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		HBAL C 0
		goto Super::Spawn
	}
}

actor HealCent : Inventory
{
inventory.amount 1
inventory.maxamount 100
}

actor WeaponEnergy : BaseMM8BDMItem 10003
{
//$Category MM8BDM-Energy
//$Title Weapon Energy
//$Sprite EBALA0
//Inventory.RespawnTics 210
//$Color 9
var int user_RemoveAsSmallAmmo;
var int user_RemoveAsAmmo;
inventory.pickupmessage "$PU_SMALLENERGY"
inventory.amount 1
//inventory.pickupsound "item/energyup"//$CBM
Scale 2.0
mass 20
accuracy 8
States
{
SpawnLoop:
EBAL A 0
EBAL A 0 A_JumpIf(tid!=0, 2)
EBAL A 0 Thing_ChangeTID(0,999)
EBAL AB 6
Goto SpawnLoop+3
Pickup:
//TNT1 A 0 ACS_NamedExecuteWithResult("core_AmmoScript",30)//$CBM
TNT1 A 0 A_JumpIf(CallACS("core_AmmoScript",30),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P1A",1)
stop
}
}

actor WeaponEnergy_Respawn : 8BDMColoredItemRespawnSmall { mass 1050 }
actor WeaponEnergy_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL A 0
		goto Super::Spawn
	}
}

actor BigWeaponEnergy : BaseMM8BDMItem 10004
{
//$Category MM8BDM-Energy
//$Title Big Weapon Energy
//$Sprite EBALC0
//Inventory.RespawnTics 350
//$Color 9
var int user_RemoveAsAmmo;
inventory.pickupmessage "$PU_LARGEENERGY"
+COUNTITEM
//inventory.pickupsound "item/energyup/large"//$CBM
Scale 2.0
accuracy 12
States
{
SpawnLoop:
EBAL C 0
EBAL C 0 A_JumpIf(tid!=0, 2)
EBAL C 0 Thing_ChangeTID(0,999)
EBAL CD 6 
Goto SpawnLoop+3
Pickup:
//TNT1 A 0 ACS_NamedExecuteWithResult("core_AmmoScript",72)//$CBM
//stop
TNT1 A 0 A_JumpIf(CallACS("core_AmmoScript",72),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 A_PlaySound("item/energyup/large",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P2",1)
stop
}
}

actor BigWeaponEnergy_Respawn : 8BDMColoredItemRespawn { mass 1050 }
actor BigWeaponEnergy_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL C 0
		goto Super::Spawn
	}
}

actor MegaHealth : BaseMM8BDMItem 10092
{
//$Category MM8BDM-Energy
//$Title Mega Health
//$Sprite HBALE0
//Inventory.RespawnTics 550
//$Color 14
Scale 2.0
var int user_RemoveAsHealth;
inventory.pickupmessage "Picked up a mega health capsule."
//inventory.pickupsound "item/energyup/large"//$CBM
+COUNTITEM
accuracy 30
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
Pickup:
//TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",100)//$CBM
//stop
TNT1 A 0 A_JumpIf(CallACS("core_CanGainHealth"),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",100)
TNT1 A 0 A_PlaySound("item/energyup/large",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P3",1)
stop
}
}

actor MegaHealth_Respawn : 8BDMItemRespawn
{
	translation "192:192=4:4", "198:198=215:215"
	mass 1050
}
actor MegaHealth_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		HBAL E 0
		goto Super::Spawn
	}
}

actor MegaWeaponEnergy : BaseMM8BDMItem 10093
{
//$Category MM8BDM-Energy
//$Title Mega Weapon Energy
//$Sprite EBALI0
//Inventory.RespawnTics 350
//$Color 9
var int user_RemoveAsAmmo;
inventory.pickupmessage "Picked up a mega energy capsule."
+COUNTITEM
//inventory.pickupsound "item/energyup/large"//$CBM
Scale 2.0
accuracy 28
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 ACS_NamedExecuteWithResult("core_AmmoScript",255)
//stop
TNT1 A 0 A_JumpIf(CallACS("core_AmmoScript",255),"Success")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
fail
Success:
TNT1 A 0 A_PlaySound("item/energyup/large",3,1.0)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P3",1)
stop
}
}

actor MegaWeaponEnergy_Respawn : 8BDMColoredItemRespawn { mass 1050 }
actor MegaWeaponEnergy_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL I 0
		goto Super::Spawn
	}
}

//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
}
}

// We don't want GZDB/UDB to parse the stuff below - [Trill]
// It's unnecessary and causes a load error due to Zandronum actor replacements!
//$GZDB_SKIP
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"
}
