
# -> If lay figure doesn't have an ID yet then give it one
execute unless score @s OverlyRealistic.World.LayFigure_ID matches -2147483648..2147483647 \
    store result score @s OverlyRealistic.World.LayFigure_ID run \
        scoreboard players add #or.global_lay_figure_id OverlyRealistic.General.ArbitraryData 1

# -> Globalize lay figure ID
scoreboard players operation #or.lay_figure_id_globalized OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ID

# -> Reset interaction type
scoreboard players set #or.lay_figure_interaction_type OverlyRealistic.General.ArbitraryData 0

# -> Globalize if figure has any existing recipe being done
scoreboard players set #or.lay_figure_has_recipe_ongoing OverlyRealistic.General.ArbitraryData 0
execute if entity @s[tag=OverlyRealistic.Block.LayFigure_HasRecipeOngoing] run \
    scoreboard players set #or.lay_figure_has_recipe_ongoing OverlyRealistic.General.ArbitraryData 1

# -> Operate on player
execute on target at @s run \
    function overly_realistic:general/custom_blocks/lay_figure/player_interact_with_lay_figure

# --> Interaction types

# -> If no interaction types passed, then return
execute if score #or.lay_figure_interaction_type OverlyRealistic.General.ArbitraryData matches 0 run \
    return fail

# -> Drop items
execute if score #or.lay_figure_interaction_type OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:general/custom_blocks/wooden_rack/drop_current_item_filled_rack
