# --------------- Fill 2_rooms ------------
# Room variation
function rng:percentage

# Type
execute if entity @s[tag=spawn] run function rooms_py:spawn/floor_sort
execute if entity @s[tag=enemy] run function rooms_py:enemy/floor_sort
execute if entity @s[tag=trapped] run function rooms_py:trapped/floor_sort
execute if entity @s[tag=challenge,tag=no_hit] run function rooms_py:enemy/floor_sort
execute if entity @s[tag=challenge,tag=!no_hit] run function rooms_py:challenge/floor_sort
execute if entity @s[tag=armory] run function rooms_py:armory/floor_sort
execute if entity @s[tag=shop] run function rooms_py:shop/floor_sort
execute if entity @s[tag=boss] run function rooms_py:boss/floor_sort
data merge block ~ ~ ~ {rotation:"NONE",posX:-23,posZ:-23}

# Room rotation
# scoreboard players set max rng 4
# scoreboard players set min rng 1
# function rng:interval
#
# # Rotation
# execute if score out rng matches 1 run data merge block ~ ~ ~ {rotation:"NONE",posX:-23,posZ:-23}
# execute if score out rng matches 2 run data merge block ~ ~ ~ {rotation:"CLOCKWISE_90",posX:23,posZ:-23}
# execute if score out rng matches 3 run data merge block ~ ~ ~ {rotation:"CLOCKWISE_180",posX:23,posZ:23}
# execute if score out rng matches 4 run data merge block ~ ~ ~ {rotation:"COUNTERCLOCKWISE_90",posX:-23,posZ:23}

# Activate structure blocks
setblock ~ ~1 ~ air replace
setblock ~ ~1 ~ redstone_block replace

tag @s add structure
