diff --git a/music_quiz/data/mq/function/repeat/buttons/btn.mcfunction b/music_quiz/data/mq/function/repeat/buttons/btn.mcfunction index 2e6d666..055894d 100644 --- a/music_quiz/data/mq/function/repeat/buttons/btn.mcfunction +++ b/music_quiz/data/mq/function/repeat/buttons/btn.mcfunction @@ -104,6 +104,7 @@ $execute if score $(n) buttons matches -1 run scoreboard players set $(n) button # ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ---- # init main = 0 (퀴즈 시작 전 설정 단계) : 명령 직접 실행 +# init main >= 10 (종료 상태) + 정지 버튼 : 명령 직접 실행 (재시작용, 투표 없음) # 그 외 : trigger 투표 경로 # 한 버튼에 interaction 3개지만 `on target` 은 클릭된 1개만 통과 # (나머지는 target 부재로 체인 중단). limit=1 을 두면 MC 가 임의로 1개를 @@ -111,6 +112,11 @@ $execute if score $(n) buttons matches -1 run scoreboard players set $(n) button $execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target as @s positioned $(x).0 $(y).0 $(z).0 run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1 $execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target if data storage mq:tmp btn{n:"test"} run $(c) $execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target unless data storage mq:tmp btn{n:"test"} as @s positioned $(x).0 $(y).0 $(z).0 if score init main matches 0 run $(c) +# 종료 상태(init 10/11)에서 정지 버튼 단일 클릭 → 즉시 commands/stop 으로 재시작 대기(init 0). +# 투표 집계는 repeat/triggers/trigger 가 init==5 에서만 하므로, 이 분기 없이는 종료 안내문 +# ("종료를 눌러주세요")대로 눌러도 종료가 안 된다. commands/stop 이 init 을 0 으로 만들어 +# 아래 투표 줄(unless init==0)은 같은 tick 에 자동으로 건너뛰어진다(중복 실행 없음). +$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target if data storage mq:tmp btn{n:"stop"} as @s positioned $(x).0 $(y).0 $(z).0 if score init main matches 10.. run $(c) $execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target unless data storage mq:tmp btn{n:"test"} as @s positioned $(x).0 $(y).0 $(z).0 unless score init main matches 0 run trigger $(n) # ---- 처리 후 attack/interaction NBT 클리어 (다음 tick 중복 발화 방지) ----