addHook('PlayerSpawn', function(player)
	if (player.holdingspin == nil) then
		player.holdingspin = 0
	end
	if (player.holdingc1 == nil) then
		player.holdingc1 = 0
	end
	if (player.hammertime == nil) then
		player.hammertime = 0
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "oldnottakis" then
		if (player.cmd.buttons & BT_CUSTOM1) and player.holdingc1 == 0 and P_IsObjectOnGround(player.mo) and not (player.pflags & PF_SPINNING) and player.playerstate ~= PST_DEAD
			player.mo.state = S_PLAY_RUN
			P_Thrust(player.mo, player.mo.angle, 20*FRACUNIT)
			player.holdingc1 = 1
			player.powers[pw_strong] = STR_DASH|STR_ANIM|STR_PUNCH|STR_WALL
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "oldnottakis" then
		if not (player.cmd.buttons & BT_CUSTOM1) and player.holdingc1 == 1 then
			player.holdingc1 = 0
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "oldnottakis" then
		if not (player.cmd.buttons & BT_SPIN) and player.holdingspin == 1 then
			player.holdingspin = 0
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "oldnottakis" then
		if player.holdingspin == 0 then
			if (player.cmd.buttons & BT_SPIN) and (player.pflags & PF_JUMPED) and player.hammertime == 0 then
				S_StartSound(player.mo, sfx_s23c)
				player.holdingspin = 1
				player.hammertime = 1
				player.pflags = $|PF_THOKKED
				P_SetObjectMomZ(player.mo, 10 * FRACUNIT, false)
			end
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "oldnottakis" then
		if player.hammertime == 1 then
			P_SetObjectMomZ(player.mo, -2*FRACUNIT, true)
			player.mo.state = S_PLAY_FLY
			player.powers[pw_strong] = STR_ANIM|STR_STOMP|STR_WALL|STR_FLOOR|STR_SPRING
			player.pflags = $ & ~PF_SPINNING
		end
		if player.hammertime == 1 and P_IsObjectOnGround(player.mo) then
			player.hammertime = 0
			player.pflags = $ & ~PF_THOKKED
			if (player.cmd.buttons & BT_JUMP) then
				P_SetObjectMomZ(player.mo, 15*FRACUNIT, false)
				player.pflags = $1|PF_JUMPED|PF_THOKKED
				player.mo.state = S_PLAY_JUMP
				S_StartSound(player.mo, sfx_pstop)
			end
			if (player.cmd.buttons & BT_SPIN) and not (player.cmd.buttons & BT_JUMP) then
				P_Thrust(player.mo, player.mo.angle, 10*FRACUNIT)
				player.pflags = $1|PF_SPINNING
				player.mo.state = S_PLAY_ROLL
			end
		end
	end
end)