diff --git a/.gitignore b/.gitignore index 7a60b85..a7b2c46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ __pycache__/ *.pyc +build/ +*.rbxl +*.rbxlx diff --git a/bunsik-tycoon/default.project.json b/bunsik-tycoon/default.project.json new file mode 100644 index 0000000..aa084bb --- /dev/null +++ b/bunsik-tycoon/default.project.json @@ -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 + } + } + } + } +} diff --git a/bunsik-tycoon/selene.toml b/bunsik-tycoon/selene.toml new file mode 100644 index 0000000..c4ddb46 --- /dev/null +++ b/bunsik-tycoon/selene.toml @@ -0,0 +1 @@ +std = "roblox" diff --git a/bunsik-tycoon/src/client/Main.client.luau b/bunsik-tycoon/src/client/Main.client.luau new file mode 100644 index 0000000..a80c12b --- /dev/null +++ b/bunsik-tycoon/src/client/Main.client.luau @@ -0,0 +1,3 @@ +local Players = game:GetService("Players") + +print(`[Bunsik] client ready for {Players.LocalPlayer.Name}`) diff --git a/bunsik-tycoon/src/server/Main.server.luau b/bunsik-tycoon/src/server/Main.server.luau new file mode 100644 index 0000000..d144ba3 --- /dev/null +++ b/bunsik-tycoon/src/server/Main.server.luau @@ -0,0 +1,5 @@ +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Economy = require(ReplicatedStorage.Shared.Economy) + +print(`[Bunsik] server ready, {#Economy.PURCHASES} purchases loaded`) diff --git a/bunsik-tycoon/src/shared/Economy.luau b/bunsik-tycoon/src/shared/Economy.luau new file mode 100644 index 0000000..36cb290 --- /dev/null +++ b/bunsik-tycoon/src/shared/Economy.luau @@ -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 diff --git a/bunsik-tycoon/tests/Economy.spec.luau b/bunsik-tycoon/tests/Economy.spec.luau new file mode 100644 index 0000000..c573865 --- /dev/null +++ b/bunsik-tycoon/tests/Economy.spec.luau @@ -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") diff --git a/bunsik-tycoon/tools/check.sh b/bunsik-tycoon/tools/check.sh new file mode 100755 index 0000000..1bedbe8 --- /dev/null +++ b/bunsik-tycoon/tools/check.sh @@ -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 diff --git a/rokit.toml b/rokit.toml new file mode 100644 index 0000000..2aa3742 --- /dev/null +++ b/rokit.toml @@ -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" diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..2b2790d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +column_width = 120 +indent_type = "Tabs" +quote_style = "AutoPreferDouble"