// ===========================
// ARMOR ITEMS

actor FireArmor : InventoryItem {
	+NOGRAVITY +NOCLIP
	tag "Fire Proof Armor"
	inventory.pickupmessage "Picked up fireproof armor!"
	inventory.pickupsound "misc/armor_pkup"
	inventory.icon "arm3icon"
	inventory.maxamount 1
	renderstyle Translucent
	alpha 0.0
	
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerFireProof", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 1)
		stop
	Spawn:
		ARM3 A 0
		goto Init
	Init:
		"----" AAAAAAAAAA 3 A_FadeIn (0.1)
		"----" A 0 A_ChangeFlag("NOCLIP",0)
		"----" A 0 A_SetTranslucent (1.0, 0)
		"----" A 0 A_Gravity
		goto Idle
	Idle:
		ARM3 A 6 BRIGHT
		ARM3 B 6
		loop
	}
}

actor ChemicalArmor : FireArmor {
	tag "Chemical Proof Armor"
	inventory.pickupmessage "Picked up chemproof armor!"
	inventory.icon "arm1icon"
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerChemicalProof", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 2)
		stop
	Spawn:
		ARM1 A 0
		goto Init
	Init:
		"----" AAAAAAAAAA 3 A_FadeIn (0.1)
		"----" A 0 A_ChangeFlag("NOCLIP",0)
		"----" A 0 A_SetTranslucent (1.0, 0)
		"----" A 0 A_Gravity
		goto Idle
	Idle:
		ARM1 A 6 BRIGHT
		ARM1 B 6
		loop
	}
}

actor EnergyArmor : FireArmor {
	tag "Energy-Resistant Armor"
	inventory.pickupmessage "Picked up energy-resistant armor!"
	inventory.icon "arm2icon"
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerEnergyResistance", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 3)
		stop
	Spawn:
		ARM2 A 0
		goto Init
	Idle:
		ARM2 A 6 BRIGHT
		ARM2 B 6
		loop
	}
}

// MY ARMOR IS EXPLOSIONS
// RUN
actor ExplosionArmor : FireArmor {
	tag "Explosive-Resistant Armor"
	inventory.pickupmessage "Picked up explosive-resistant armor!"
	inventory.icon "arm4icon"
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerExplosiveResistance", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 4)
		stop
	Spawn:
		ARM4 A 0
		goto Init
	Idle:
		ARM4 A 6 BRIGHT
		ARM4 B 6
		loop
	}
}

// [SG] restoring BulletProof as a separate item from Bullet resistant armor

actor BulletProofArmor : FireArmor {
	tag "Bulletproof Vest"
	inventory.pickupmessage "Picked up the bullet-proof vest! Oh, yes."
	inventory.icon "arm7icon"
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerBulletProof", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 5)
		stop
	Spawn:
		ARM7 A 0
		goto Init
	Idle:
		ARM7 A 6 bright
		ARM7 B 6
		loop
	}
}

actor CryoArmor : FireArmor {
	tag "Ice-Resistant Armor"
	inventory.pickupmessage "Picked up ice-resistant armor!."
	inventory.icon "arm6icon"
	states {
	Use:
		TNT1 A 0 A_JumpIfInventory ("IsMech", 1, "Use.Mech")
		TNT1 A 0 A_JumpIfInventory ("PowerBerserk", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("IsChangingArmor", 1, "Failure")
		TNT1 A 0 A_JumpIfInventory ("PowerCryoResistance", 1, "Failure")
		TNT1 A 0 ACS_ExecuteAlways (920, 0, 7)
		stop
	Spawn:
		ARM6 A 0
		goto Init
	Idle:
		ARM6 A 6 bright
		ARM6 B 6
		loop
	}
}

actor IsChangingArmor : Inventory {}
actor CancelChangingArmor : inventory {}
actor ArmorChangeProgress : Inventory {inventory.maxamount 175}
