scoreboard players set global moveCooldown 4
scoreboard players set @s moveCommit 3
scoreboard players operation @s moveCommitTime = global MOVECOMMITTIME

#count every move performed for end ranking
function bd:game/track_game_moves

#breakables?
execute positioned ~-2 ~ ~ if block ~ ~ ~ #bd:breakable run setblock ~ ~ ~ air destroy

#pushables?
execute positioned ~-2 ~ ~ if block ~ ~ ~ #bd:pushable run function bd:movement/object/block_move_3
execute positioned ~-2 ~ ~ if block ~ ~ ~ #bd:pushable_one_only run function bd:movement/object/block_move_3

#barrel under us?
execute positioned ~ ~-1 ~ if block ~ ~ ~ barrel[facing=north] run function bd:movement/object/try_move_3
execute positioned ~ ~-1 ~ if block ~ ~ ~ barrel[facing=south] run function bd:movement/object/try_move_3

#log under us?
execute positioned ~ ~-1 ~ if block ~ ~ ~ #bd:z_axis_linked run function bd:movement/object/try_move_3

execute as @e[type=armor_stand,tag=piston_activate,tag=!remember_piston] at @s run setblock ~ ~ ~ gray_concrete
execute as @e[type=armor_stand,tag=piston_activate,tag=remember_piston] at @s run setblock ~ ~ ~ piston[facing=up]
kill @e[type=armor_stand,tag=kill_on_next_move]

tag @s add moved

scoreboard players set global recordNextReset 1