feat(bunsik): Rojo 골격, 도구 버전 고정(rokit), 경제 수치 모듈과 단위 테스트

- rokit.toml: rojo 7.7.1, selene 0.32.0, stylua 2.6.0, lune 0.11.0
- default.project.json: Shared/Server/Client 매핑, 바닥판과 스폰
- src/shared/Economy.luau: ECONOMY.md 수치
- tests/Economy.spec.luau: lune 단위 테스트
- tools/check.sh: stylua·selene·lune·rojo build 일괄 실행

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 00:44:44 +09:00
parent 1958a2dd99
commit 61b3f7730d
10 changed files with 162 additions and 0 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,5 @@
__pycache__/
*.pyc
build/
*.rbxl
*.rbxlx

View File

@@ -0,0 +1,40 @@
{
"name": "BunsikTycoon",
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"Shared": { "$path": "src/shared" }
},
"ServerScriptService": {
"Server": { "$path": "src/server" }
},
"StarterPlayer": {
"StarterPlayerScripts": {
"Client": { "$path": "src/client" }
}
},
"Workspace": {
"$properties": { "FilteringEnabled": true },
"Baseplate": {
"$className": "Part",
"$properties": {
"Anchored": true,
"Locked": true,
"Size": [512, 20, 512],
"Position": [0, -10, 0],
"Material": "Grass",
"Color": [0.42, 0.62, 0.32]
}
},
"SpawnLocation": {
"$className": "SpawnLocation",
"$properties": {
"Anchored": true,
"Size": [12, 1, 12],
"Position": [0, 0.5, 0],
"Duration": 0
}
}
}
}
}

View File

@@ -0,0 +1 @@
std = "roblox"

View File

@@ -0,0 +1,3 @@
local Players = game:GetService("Players")
print(`[Bunsik] client ready for {Players.LocalPlayer.Name}`)

View File

@@ -0,0 +1,5 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Economy = require(ReplicatedStorage.Shared.Economy)
print(`[Bunsik] server ready, {#Economy.PURCHASES} purchases loaded`)

View File

@@ -0,0 +1,54 @@
--!strict
-- 분식집 첫 10분 경제 수치. ECONOMY.md 표, tools/economy_sim.py 와 같은 숫자여야 합니다.
export type Effect = {
seats: number?, -- 테이블 수
spawn: number?, -- 손님 간격(초)
cook: number?, -- 조리 시간(초)
price: number?, -- 가격 배율
helper: boolean?, -- 알바생(조리 자동)
menu: string?, -- 해금할 메뉴
}
export type Purchase = {
id: string,
name: string,
cost: number,
effect: Effect,
}
local Economy = {}
Economy.WALK = 5 -- 조리대 -> 테이블 -> 조리대 왕복(초)
Economy.EAT = 6 -- 식사 시간(초)
Economy.START = {
money = 0,
seats = 1,
spawn = 6,
cook = 2.5,
price = 1,
helper = false,
menus = { "Tteokbokki" },
}
Economy.MENUS = {
Tteokbokki = { name = "떡볶이", price = 10 },
Gimbap = { name = "김밥", price = 20 },
Sundae = { name = "순대", price = 35 },
}
Economy.PURCHASES = {
{ id = "Table2", name = "테이블 2", cost = 10, effect = { seats = 2 } },
{ id = "UnlockGimbap", name = "김밥 해금", cost = 40, effect = { menu = "Gimbap" } },
{ id = "Sign1", name = "간판 Lv1", cost = 70, effect = { spawn = 5 } },
{ id = "Stove1", name = "화구 Lv1", cost = 90, effect = { cook = 1.5 } },
{ id = "Table3", name = "테이블 3", cost = 120, effect = { seats = 3 } },
{ id = "UnlockSundae", name = "순대 해금", cost = 160, effect = { menu = "Sundae" } },
{ id = "Sauce1", name = "양념 비법 Lv1", cost = 240, effect = { price = 1.5 } },
{ id = "Helper", name = "알바생 고용", cost = 360, effect = { helper = true } },
{ id = "Table4", name = "테이블 4", cost = 480, effect = { seats = 4, spawn = 4 } },
{ id = "Expand", name = "실내 분식집 확장", cost = 600, effect = {} },
} :: { Purchase }
return Economy

View File

@@ -0,0 +1,34 @@
-- 로블록스 없이 서버에서 돌리는 단위 테스트: lune run tests/Economy.spec.luau
local Economy = require("../src/shared/Economy")
local failures = 0
local function check(cond: boolean, msg: string)
if not cond then
failures += 1
print("FAIL " .. msg)
end
end
check(#Economy.PURCHASES == 10, "구매 항목은 10개")
local seen = {}
local prev = 0
for i, p in Economy.PURCHASES do
check(p.cost > prev, `#{i} {p.id} 비용이 앞 단계보다 커야 함`)
prev = p.cost
check(seen[p.id] == nil, `#{i} {p.id} id 중복`)
seen[p.id] = true
if p.effect.menu then
check(Economy.MENUS[p.effect.menu] ~= nil, `#{i} 없는 메뉴 {p.effect.menu}`)
end
end
check(Economy.PURCHASES[#Economy.PURCHASES].id == "Expand", "마지막 구매는 확장")
for _, m in Economy.START.menus do
check(Economy.MENUS[m] ~= nil, `시작 메뉴 {m} 없음`)
end
if failures > 0 then
error(`{failures} test(s) failed`)
end
print("Economy.spec: all passed")

11
bunsik-tycoon/tools/check.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# 코드 스타일·린트·단위 테스트·빌드를 한 번에 돌립니다. 실패하면 0이 아닌 값으로 끝납니다.
set -euo pipefail
cd "$(dirname "$0")/.."
export PATH="$HOME/.rokit/bin:$PATH"
stylua --check src tests
selene src
for t in tests/*.spec.luau; do lune run "$t"; done
mkdir -p build
rojo build default.project.json -o build/BunsikTycoon.rbxl

8
rokit.toml Normal file
View File

@@ -0,0 +1,8 @@
# 이 리포에서 쓰는 Roblox 개발 도구 버전 고정 (https://github.com/rojo-rbx/rokit)
# 설치: rokit install
[tools]
rojo = "rojo-rbx/rojo@7.7.1"
selene = "Kampfkarren/selene@0.32.0"
stylua = "JohnnyMorganz/StyLua@2.6.0"
lune = "lune-org/lune@0.11.0"

3
stylua.toml Normal file
View File

@@ -0,0 +1,3 @@
column_width = 120
indent_type = "Tabs"
quote_style = "AutoPreferDouble"