
# --> (@EVENT: clicked on a build-armor menu button - build leggings, leather, confirmation button /// ID: 100,047)

# -> Message
execute if score #or.setting.output_messages OverlyRealistic.Settings.ArbitrarySetting matches 1 \
    if score #or.setting.overlay_messages OverlyRealistic.Settings.ArbitrarySetting matches 1 run \
        tellraw @s [\
        {\
            text:"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"\
        },\
        {\
            text:"[Lay Figure] \n",\
            color:"#929292",\
            bold:true\
        },\
        {\
            text:"→ Legging selections ",\
            color:"#929292"\
        },\
        {\
            text:"\n\n"\
        }\
    ]

# -> Sound
playsound ui.button.click block @s ~ ~ ~ 0.5 1
playsound entity.experience_orb.pickup block @s ~ ~ ~ 0.5 2

# -> Globalize button data
scoreboard players operation #or.lay_figure_data_button_0 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_0
scoreboard players operation #or.lay_figure_data_button_1 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_1
scoreboard players operation #or.lay_figure_data_button_2 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_2
scoreboard players operation #or.lay_figure_data_button_3 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_3
scoreboard players operation #or.lay_figure_data_button_4 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_4
scoreboard players operation #or.lay_figure_data_button_5 OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.LayFigure_ButtonProgress_5

# -> Reset costs
function overly_realistic:general/custom_blocks/lay_figure/menu_interactions/reset_resource_requirements_player

# -> Set base cost
scoreboard players set @s OverlyRealistic.World.LayFigure_ResourceRequirement_Leather 7


# --> Get player items

# -> Leather
execute store result score #or.player_resource_requirement_leather OverlyRealistic.General.ArbitraryData run \
    clear @s leather 0


# --> Check if player has the items necessary

# -> Leather (failure condition)
execute if score #or.player_resource_requirement_leather OverlyRealistic.General.ArbitraryData < @s OverlyRealistic.World.LayFigure_ResourceRequirement_Leather run \
    return run \
        function overly_realistic:players/non_setting_triggers/events/event_100047/build_fail


# -> Success screen
function overly_realistic:players/non_setting_triggers/events/event_100047/build_succeed
