# #open menu when nearby
execute unless entity @e[type=text_display,tag=green_portal_text] as @a at @s positioned ~-2 ~ ~-2 as @e[type=armor_stand,tag=reward_portal,dx=3,dz=3,dy=3] at @s positioned ^ ^-1 ^ run function main:game/stage_end/green_portal

execute as @a at @s positioned ~-2 ~ ~-2 unless entity @e[type=armor_stand,tag=reward_portal,dx=3,dz=3,dy=3] run kill @e[type=#main:not_enemies,tag=green_portal_text]

# execute as @a[tag=choice] at @s positioned ~-1 ~ ~-1 if entity @e[type=armor_stand,tag=shop_portal,dx=1,dz=1,dy=1] run function main:game/stage_end/stage_reward_choice {"portal":"shop"}

#leave
execute as @e[type=interaction,tag=green_portal_yes,tag=button] on attacker at @s run function main:game/stage_end/stage_reward_choice {"portal":"reward"}

#misc
execute as @e[type=armor_stand,tag=reward_portal] at @s run particle dust{color:[0,1,0],scale:1} ~ ~ ~ 1 1 1 1 20 force
execute as @e[type=armor_stand,tag=shop_portal] at @s run particle dust{color:[1.0,0.5,0.0],scale:1} ~ ~ ~ 1 1 1 1 20 force