# Gate open
execute positioned ~-22.5 ~ ~-22.5 as @e[dx=44,dy=31,dz=44,tag=gate] at @s run function game:room/5_room_end/open_gate
execute positioned ~-22.5 ~ ~-22.5 as @a[dx=44,dy=31,dz=44] at @s run playsound custom.gate.open ambient @s ~ ~ ~

# Drops
execute if entity @s[tag=enemy] positioned ~-22.5 ~ ~-22.5 at @e[dx=44,dy=31,dz=44,tag=drop_mark,limit=1] positioned ~ ~.2 ~ run function game:room/5_room_end/drops/0_main

# Boss end
execute if entity @s[tag=boss] run function game:room/5_room_end/boss/end

# Passive end
execute as @a run function items:passive/room_trigger/end

# Clear glow countdown
scoreboard players reset @s room_clock

# Next state
scoreboard players set @s room_state 6
