music_quiz: dialog 기반 정답 입력 + 큐 기반 first-submit-wins 추가
정답 입력 UI 를 dialog 로 제공 (mq:dialog/answer), #minecraft:quick_actions 태그 등록으로 빠른행동키에서 바로 열 수 있게 함. 동시 제출 시 먼저 제출한 사람이 정답으로 인정되도록 mq:answer/ 에 submit_seq 기반 FIFO 큐 + 매크로 기반 제출자 lookup 으로 처리. tick/stop/setanswer 도 새 큐 흐름에 맞춰 업데이트.
This commit is contained in:
17
music_quiz/data/mq/function/answer/process.mcfunction
Normal file
17
music_quiz/data/mq/function/answer/process.mcfunction
Normal file
@@ -0,0 +1,17 @@
|
||||
# tick 에서 매 tick 호출됨 — 큐의 가장 먼저 제출된 항목 1개를 처리
|
||||
# 1 tick 당 1건 처리 — 동시 다발 제출은 FIFO 순서로 자동 직렬화됨
|
||||
execute store result score qlen func.temp run data get storage mq:input queue
|
||||
execute if score qlen func.temp matches 0 run return 0
|
||||
|
||||
# 첫번째 항목 = 가장 먼저 제출된 것
|
||||
data modify storage mq:tmp judge set value {input:"", answer:""}
|
||||
data modify storage mq:tmp judge.input set from storage mq:input queue[0].text
|
||||
|
||||
# 매크로로 해당 seq 를 가진 플레이어 찾아서 judge 실행
|
||||
data modify storage mq:tmp _find set value {seq:0}
|
||||
data modify storage mq:tmp _find.seq set from storage mq:input queue[0].seq
|
||||
|
||||
# 항목 제거 (한 번 비교했으면 큐에서 빼기)
|
||||
data remove storage mq:input queue[0]
|
||||
|
||||
function mq:answer/macro/find_submitter with storage mq:tmp _find
|
||||
Reference in New Issue
Block a user