ACTOR HEALBACKPACK : INVENTORY {INVENTORY.MAXAMOUNT 1}

ACTOR HealthBackpackAdd : Health
{
	Inventory.Amount 1
}
ACTOR DidHeal : Inventory {}
ACTOR HealthBackpack : CustomInventory 30041
{
	+INVBAR
	  +CANNOTPUSH
	  +UNDROPPABLE
+canpass
	scale 0.3
	Inventory.Amount 100
	Inventory.MaxAmount 200
	Inventory.InterHubAmount 200
	Inventory.PickupMessage "$GOTHEALTHBACKPACK"
	Inventory.PickUpSound "MBAKPK"
	Tag "Health Pack"
	Inventory.Icon "PKMKB0"
	 tag"Medical Backpack"
	States
	{
		Spawn:
		MBPK A 0
		PKMK A -1
		Stop
		
		Failheal:
		TNT1 A 0 
		Fail
		
		Use:
		TNT1 A 0 a_jumpifinventory("choosingreward",1, "Failheal")
		TNT1 A 0 a_jumpifinventory("readingammo",1, "Failheal")
		TNT1 A 0 a_giveinventory("BANDAGETOKEN",1)
		TNT1 A 0 a_giveinventory("BANDAGEdrugTOKEN",1)
		GiveCheck:
		TNT1 A 0 A_JumpIfInventory("HealthBackpack", 1, "GiveCheck2")
		TNT1 A 0 A_JumpIfInventory("DidHeal", 1, "PlaySound")
		Fail
		GiveCheck2:
		TNT1 A 0 A_JumpIf(CallACS("Check max health") == TRUE, "Give")
		TNT1 A 0 A_JumpIfInventory("DidHeal", 1, "PlaySound")
		Fail
		PlaySound:
		TNT1 A 0 A_TakeInventory("Didheal", 1)
		TNT1 A 0 A_playsound("BANDAGE1",3,10.0)
		Fail	
		Give:
		TNT1 A 0 A_GiveInventory("DidHeal", 1)
		GiveHealth:
		TNT1 A 0 ACS_Namedexecutealways("Medications")
		TNT1 A 0 ACS_Namedterminate("Rupture")
		TNT1 A 0 ACS_NAMEDEXECUTE("POISONCURE",0)
		TNT1 A 0 A_TakeInventory("HealthBackpack", 1)
		TNT1 A 0 A_GiveInventory("HealthBackpackAdd", 1)
		TNT1 A 0 A_GIVEINVENTORY("HEALBACKPACK",1)
		Goto GiveCheck
	}
}

ACTOR Bandages : Custominventory 30042
{
	+CANNOTPUSH
	+INVBAR
+canpass
	Inventory.MaxAmount 10
	Inventory.InterHubAmount 10
	Scale 0.3
	Inventory.PickupMessage "$GOTBANDAGES"
	Inventory.PickUpSound "BANDAGE4"
	Tag "Bandages"
	Inventory.Icon "BNDGC0"
	States
	{
		Spawn:
		BNDG B 0
		BNDG A 0 A_checkproximity("clean","recombinerstatic",50)
		BNDG A 0 A_checkproximity("clean","recombinerstart",50)
		BNDG A 0 a_jump(150,"Dirty")
		goto Clean
		
		Clean:
		CBPK A 0 A_SETSCALE(0.28,0.27)
		TNT1 A 0 A_Changeflag("SPRITEFLIP", random(0,1))
		BNDG B -1
		Stop
		
		Dirty:
		TNT1 A 0 A_Changeflag("SPRITEFLIP",random(0,1))
		BNDG A -1
		STOP
	
		Failheal:
		TNT1 A 0 
		Fail
		
		Use:
		TNT1 A 0 a_jumpifinventory("choosingreward",1, "Failheal")
		TNT1 A 0 a_jumpifinventory("readingammo",1, "Failheal")
		TNT1 A 0 A_TAKEinventory("BANDAGEDRUGTOKEN",1)
		TNT1 A 1
		TNT1 A 0 ACS_Namedterminate("Rupture")
		TNT1 A 0 ACS_Namedexecutealways("Medications")
		TNT1 A 0 A_giveinventory("usedbandages",1)
		TNT1 A 0 a_giveinventory("BANDAGETOKEN",1)
		stop
	}
}	

ACTOR HealthPack2 : Custominventory
{
	+CANNOTPUSH
	+INVBAR
+canpass
	+noblood
	Inventory.MaxAmount 2
	Inventory.InterHubAmount 2
	Scale 0.3
	Inventory.PickupMessage "$GOTHEALTHPACK"
	Inventory.PickUpSound "MPAKPK"
	Inventory.Icon "MBPKB0"
	 tag"Portable First Aid Kit"
	States
	{
		Spawn:
		MBPK A 1
		MBPK A -1
		Stop
		
		Failheal:
		TNT1 A 0 
		Fail
		
		Use:
		TNT1 A 0 a_jumpifinventory("choosingreward",1, "Failheal")
		TNT1 A 0 a_jumpifinventory("readingammo",1, "Failheal")
		TNT1 A 0 A_giveinventory("usedhealthpack",1)
		TNT1 A 0 ACS_Namedterminate("Rupture")
		TNT1 A 0 ACS_Namedexecutealways("Medications")
		TNT1 A 0 a_giveinventory("BANDAGETOKEN",1)
		TNT1 A 0 a_giveinventory("BANDAGEdrugTOKEN",1)
		stop
		
		pain.removehealthpack:
		death.removehealthpack:
		TNT1 A 1
		stop
	}
}	

ACTOR CraftedHealthPack2 : Custominventory
{
+canpass
	+noblood
	health 20
	Scale 0.3
	Inventory.PickupMessage "$GOTHEALTHPACK"
	Inventory.PickUpSound "MPAKPK"
	Inventory.Icon "MBPKB0"
	 tag"Portable First Aid Kit"
	States
	{
		Spawn:
		TNT1 A 0
		
		Stay:
		MBPK A -1
		Stop
		
		Pickup:
		TNT1 A 0 A_JumpIfInventory("healthpack2", 2, 1)
		goto realpickup
		PKMK A 1 
		fail
		Realpickup:
		TNT1 A 0 A_GiveInventory("Healthpack2", 1)
		Stop	
		
	}
}	