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:
14
music_quiz/data/mq/function/answer/submit.mcfunction
Normal file
14
music_quiz/data/mq/function/answer/submit.mcfunction
Normal file
@@ -0,0 +1,14 @@
|
||||
# 정답 dialog 제출 핸들러 — 매크로 인자 {text:"..."} 받음
|
||||
# 퀴즈 진행 중(init=5) 이 아니면 제출 무시
|
||||
execute unless score init main matches 5 run return 0
|
||||
|
||||
# 제출 순번 부여 — seq 는 setanswer 에서 0 으로 초기화됨
|
||||
# 동일 tick 내 동시 제출도 명령 실행 순서대로 1씩 증가하여 고유한 seq 가 부여됨
|
||||
scoreboard players add seq func.temp 1
|
||||
scoreboard players operation @s submit_seq = seq func.temp
|
||||
|
||||
# 큐에 {text, seq} append — process 는 queue[0] (가장 먼저 제출된 것) 부터 처리
|
||||
data modify storage mq:tmp new_entry set value {text:"", seq:0}
|
||||
execute store result storage mq:tmp new_entry.seq int 1 run scoreboard players get @s submit_seq
|
||||
$data modify storage mq:tmp new_entry.text set value "$(text)"
|
||||
data modify storage mq:input queue append from storage mq:tmp new_entry
|
||||
Reference in New Issue
Block a user