// Fists
actor Unarmed : AOWWeapon {
	+WIMPY_WEAPON
	+MELEEWEAPON
	Obituary "$OB_FIST"
	Inventory.PickupMessage "You got a fist."
	Dropitem "Nothing"
	Weapon.Kickback 165
	Weapon.SelectionOrder 20
	Weapon.PreferredSkin "MarineFist"
	Tag "Fists"
	states {
	Ready:
		PUNG A 1 A_WeaponReady
		loop
	Deselect:
		PUNG A 0 A_Lower
		PUNG A 1 A_Lower
		loop
	Select:
		PUNG A 0 A_JumpIfInventory ("PowerBerserk", 1, "Remove")
		PUNG A 0 A_JumpIfInventory ("FistReplaced", 1, "ReplaceCleanup")
		PUNG A 0 A_Raise
		PUNG A 1 A_Raise
		goto Select+2
	Fire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		PUNG B 2 A_JumpIfInventory("FistSwitch",1,6)
		PUNG C 2
		PUNG B 0 A_GiveInventory("FistSwitch",1)
		PUNG D 5 A_CustomPunch(35,1,1,"FistPuff",64)
		PUNG C 2
		PUNG B 5 A_ReFire
		goto Ready
		PUNG E 2
		PUNG F 2
		PUNG B 0 A_TakeInventory("FistSwitch",1)
		PUNG G 5 A_CustomPunch(35,1,1,"FistPuff",64)
		PUNG F 2
		PUNG E 5 A_ReFire
		goto Ready
	Remove:
		PUNG A 1 offset (1,32)
		PUNG A 0 A_GiveInventory ("BerserkFists", 1)
		PUNG A 0 A_SelectWeapon ("BerserkFists")
		PUNG A 0 A_GiveInventory ("FistReplaced", 1)
		goto Deselect
	ReplaceCleanup:
		BEAC B 0 A_TakeInventory ("BerserkFists", 1)
		BEAC B 0 A_TakeInventory ("FistReplaced", 1)
		goto Select
	Spawn:
		TNT1 A 0
		stop
	}
}

actor FistSwitch : Inventory {}
actor FistReplaced : Inventory {}

actor FistPuff : BulletPuff {
	+CLIENTSIDEONLY
	+NOBLOCKMAP
	+NOGRAVITY
	-ALLOWPARTICLES
	+PUFFONACTORS
	DamageType "Fist"
	states {
	Crash:
		PUFF A 0 bright
		PUFF A 4 bright A_SpawnItem ("FistWall")
		PUFF B 4 
		PUFF CD 4
		stop
	Melee:
		PUFF A 0 bright
		PUFF A 4 bright A_SpawnItem ("FistHit")
		stop
	Spawn:
		PUFF A 0 bright
		PUFF A 4 bright A_SpawnItem ("FistHit")
		stop
	}
}

actor FistHit {
	+CLIENTSIDEONLY
	+NOCLIP
	radius 1
	height 1
	states {
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_PlaySound("fist/hit")
		stop
	}
}

actor FistWall : FistHit {
	states {
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_PlaySound("fist/wall")
		stop
	}
}