diff --git a/README.md b/README.md index 3385286..a908b1d 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,11 @@ music_quiz/ │ ├── load.mcfunction # 스코어보드·storage 초기화, init/* 호출 │ ├── tick.mcfunction # 매 틱 서브함수 디스패치 (init 게이팅) │ ├── tellraw.mcfunction # 매크로 prefix 메시지 헬퍼 - │ ├── init/ # 정적 데이터를 storage 로 적재 - │ │ ├── songs.mcfunction # mq:main songs 리스트 - │ │ ├── buttons.mcfunction # mq:main button_defs 리스트 - │ │ └── triggers.mcfunction # mq:main trigger_defs 리스트 + │ ├── init/ # 사용자 설정·정적 데이터 (수정 포인트) + │ │ ├── config.mcfunction # 주제·곡 개수·스폰·명령 블록 좌표 + │ │ ├── songs.mcfunction # 곡 목록 + │ │ ├── buttons.mcfunction # 버튼 좌표·실행 명령 + │ │ └── triggers.mcfunction # 다수결 트리거 정의 │ ├── check/server.mcfunction # YP / TS 설치 확인 │ ├── commands/ # start·stop·skip·hint·replay·test │ ├── quiz/ # 게임 진행 로직 @@ -138,18 +139,26 @@ music_quiz/ - `mq:tmp` — setanswer 룩업용 임시 인덱스 - `func:temp` — `func:` 헬퍼 함수용 임시 NBT -### 곡 목록 수정 +### 설정 (한 곳에서 수정) -곡은 `data/mq/function/init/songs.mcfunction` 한 파일에 정의된다. -한 줄에 한 곡씩, 리스트로 append 한다: +세계마다 다른 값은 모두 `data/mq/function/init/` 폴더에서 편집한다. +`/reload` 후 반영된다. -``` -data modify storage mq:main songs append value {title:"...", author:"...", alias:["...","..."]} -``` +- **`init/config.mcfunction`** — 주제, 곡 개수, 스폰 위치, 음원 명령 블록 + 좌표, 정답 이미지 표시 영역. `title` 은 `[ … ]` 채팅 접두사로도 사용된다. +- **`init/songs.mcfunction`** — 곡 목록 (한 줄에 한 곡씩 append). + `alias` 배열의 문자열은 정답 판정 시 동의어로 인정된다. 곡 수를 바꾸면 + `init/config.mcfunction` 의 `max_index` 도 함께 맞춰야 한다. +- **`init/buttons.mcfunction`** — 6개 물리 버튼의 좌표·표면 방향·실행 명령. +- **`init/triggers.mcfunction`** — 다수결 트리거(`stop`/`skip`/`hint`/`replay`) + 표시 이름·실행 명령. -곡 순서가 게임 내 순서이며, `alias` 배열에 적은 문자열은 정답 판정에서 -동의어로 인식된다. 곡 수를 늘리거나 줄이면 `mq:function/load.mcfunction`의 -`max_index` 기본값(50)도 함께 맞추는 것이 좋다. +`load.mcfunction` 은 위 4개를 호출해 `mq:main` 스토리지를 적재한다. +스코어보드·보스바 같은 런타임 인프라는 `load.mcfunction` 본문에 남아 있다. + +다이얼로그 페이지(`data/mq/dialog/page{1,2,3}.json`) 의 타이틀과 설명문구는 +JSON 텍스트 컴포넌트가 storage 참조를 일관되게 지원하지 않으므로 직접 +편집해야 한다. ### 설치 diff --git a/music_quiz/data/mq/function/init/config.mcfunction b/music_quiz/data/mq/function/init/config.mcfunction new file mode 100644 index 0000000..6e30a24 --- /dev/null +++ b/music_quiz/data/mq/function/init/config.mcfunction @@ -0,0 +1,26 @@ +# 음악퀴즈 주제 — tellraw 접두사([ 이름 ])와 사이드바 표시에 사용 +data modify storage mq:main title set value "음악퀴즈" + +# 곡 개수 — init/songs.mcfunction 의 곡 수와 일치시킬 것 +data modify storage mq:main max_index set value 50 + +# 플레이어 접속 시 텔레포트 위치 (x y z, r=yaw, f=pitch) +data modify storage mq:main spawn set value {x: 144, y: 61, z: -219, r: 180, f: 0} + +# 음원 재생용 명령 블록 위치 + 정답 이미지 표시 영역 +# x,y,z — 명령 블록 좌표 +# r — 명령 블록 정면 방향 (EAST | WEST | SOUTH | NORTH) +# volume — yp playall 명령에 넘기는 음량 +# x1,y1,z1 — 이미지 표시 영역 한쪽 모서리 +# x2,y2,z2 — 이미지 표시 영역 반대 모서리 +data modify storage mq:main command_block set value { \ + name: "", \ + image: "", \ + alias: [], \ + index: 1, \ + volume: 30, \ + x: 144, y: 59, z: -219, \ + r: "SOUTH", \ + x1: 131, y1: 77, z1: -262, \ + x2: 157, y2: 91, z2: -262 \ +} diff --git a/music_quiz/data/mq/function/load.mcfunction b/music_quiz/data/mq/function/load.mcfunction index 41b3888..196ac18 100644 --- a/music_quiz/data/mq/function/load.mcfunction +++ b/music_quiz/data/mq/function/load.mcfunction @@ -1,41 +1,14 @@ -function mq:tellraw {"text":"서버 리로드 성공!","color":"white","msg":'""'} - -data merge storage mq:main { \ - title: "음악퀴즈이름", \ - max_index: 50, \ - answer: { author: "", title: "", alias: [] }, \ - command_block: { \ - name: "", \ - image: "", \ - alias: [], \ - index: 1, \ - volume: 30, \ - x: 144, \ - y: 59, \ - z: -219, \ - r: "SOUTH", \ - x1: 131, \ - y1: 77, \ - z1: -262, \ - x2: 157, \ - y2: 91, \ - z2: -262 \ - }, \ - spawn: { \ - x: 144, \ - y: 61, \ - z: -219, \ - r: 180, \ - f: 0 \ - } \ -} +data modify storage mq:main answer set value {author: "", title: "", alias: []} data merge storage func:temp {} data merge storage mq:tmp {} +function mq:init/config function mq:init/songs function mq:init/buttons function mq:init/triggers +function mq:tellraw {"text":"서버 리로드 성공!","color":"white","msg":'""'} + scoreboard objectives remove func.temp scoreboard objectives remove status scoreboard objectives remove main diff --git a/music_quiz/data/mq/function/tellraw.mcfunction b/music_quiz/data/mq/function/tellraw.mcfunction index a0b413d..e8a04f7 100644 --- a/music_quiz/data/mq/function/tellraw.mcfunction +++ b/music_quiz/data/mq/function/tellraw.mcfunction @@ -1 +1 @@ -$tellraw @a ["",{"text":"[ ","bold":true,"color":"gray"},{"text":"음악퀴즈","bold":true,"color":"dark_green"},{"text":" ]","bold":true,"color":"gray"},{"text":" "},{"text":"$(text)","color":"$(color)"},$(msg)] +$tellraw @a ["",{"text":"[ ","bold":true,"color":"gray"},{"storage":"mq:main","nbt":"title","bold":true,"color":"dark_green"},{"text":" ]","bold":true,"color":"gray"},{"text":" "},{"text":"$(text)","color":"$(color)"},$(msg)]