// Fists
actor Unarmed : AOWWeapon {
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
	+WIMPY_WEAPON
	+MELEEWEAPON
	Obituary "$OB_FIST"
	Inventory.PickupMessage "You got a fist."
	Dropitem "Nothing"
	Weapon.Kickback 165
	Weapon.SelectionOrder 20
	Weapon.PreferredSkin "MarineFist"
	weapon.upsound "weapons/up/fists"
	Tag "Fists"
	States {
	Select:
		PUNG A 1 offset (0,100)
		PUNG A 1 offset (0,89)
		PUNG A 1 offset (0,79)
		PUNG A 1 offset (0,70)
		PUNG A 1 offset (0,62)
		PUNG A 1 offset (0,55)
		PUNG A 1 offset (0,49)
		PUNG A 1 offset (0,44)
		PUNG A 1 offset (0,40)
		PUNG A 1 offset (0,37)
		PUNG A 1 offset (0,34)
		PUNG A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)	
		goto ready
	Deselect:
	    TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)	
	    PUNG A 1 offset (0,34)
		PUNG A 1 offset (0,40)
		PUNG A 1 offset (0,49)
		PUNG A 1 offset (0,62)
		PUNG A 1 offset (0,79)
		PUNG A 1 offset (0,100)
		TNT1 A 0 offset (0,33)
		TNT1 A 0 A_Lower
		wait
	Ready:
	    TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
	    TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
	    PUNG A 1 A_WeaponReady
		loop
	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
	+NOINTERACTION
	-ALLOWPARTICLES
	+PUFFONACTORS
	+FORCEXYBILLBOARD
	RenderStyle Add
	Alpha 0.6
	DamageType "Fist"
	Obituary "$OB_FIST"
	states {
	Spawn:
		TNT1 A 0 bright
		TNT1 A 1 bright A_SpawnItem ("FistHit")
		stop
	Melee:
		TNT1 A 0 bright
		TNT1 A 1 bright A_SpawnItem ("FistHit")
		stop
	Crash:
		TNT1 A 0 bright
		FPUF A 3 bright A_SpawnItem ("FistWall")
		FPUF BCD 3
		stop
	}
}

actor FistHit {
	+CLIENTSIDEONLY
	+NOINTERACTION
	+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
	}
}
