Files
roblox-project/bunsik-tycoon/tools/simlib.luau
EJClaw 802ba10e1a feat(bunsik): MVP 전체 구현 — 맵, 요리·서빙, 손님 NPC, 업그레이드 20개, 세이브, 결제, 한/영 UI
- Shop.luau: 손님·주문·조리·서빙·구매 순수 로직(lune 단위 테스트, 시뮬레이터 공용)
- 서버: World(부지 6칸), PlotBuilder(파트 모형), PlotController, Npc(트윈 이동), Data(ProfileStore), Receipts(결제 1회 = 지급 1회), Game
- 클라이언트: Hud(돈·다음 업그레이드·목록·결제·언어·튜토리얼), 내 조리대 전용 버튼, 튜토리얼 화살표, 주인 전용 테스트 버튼
- 2단계 업그레이드 10개 추가, 파이썬 시뮬레이터를 실제 로직 기반 tools/sim.luau로 교체
- tools/cloud.py: 업로드, 원격 Luau 실행, 게임패스·개발자 상품 생성, 서버 인원 설정
- tests/cloud/integration.luau: 로블록스 서버 통합 테스트 514개 통과
- check.sh에 luau-lsp 타입 검사 추가, ProfileStore 고정 버전 포함

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:34:06 +09:00

62 lines
1.9 KiB
Lua

-- 경제 시뮬레이터 본체: 실제 게임 로직(src/shared/Shop)을 봇이 쉬지 않고 최적으로 플레이합니다.
-- 실행은 tools/sim.luau, 검사는 tests/Sim.spec.luau
-- 봇 가정: 조리대 <-> 테이블 편도 WALK/2초, 알바생이 있으면 직접 조리하지 않고 나르기만 합니다.
local Economy = require("../src/shared/Economy")
local Shop = require("../src/shared/Shop")
local Sim = {}
function Sim.run(mult: number, limit: number): { { t: number, id: string, name: string, cost: number } }
local shop = Shop.new(0, 0, 0)
shop.moneyMult = mult
local dt = 0.1
local t = 0
local at = "stove"
local busyUntil = 0
local pending: string? = nil -- 끝나면 할 일: "cook" | "arrive_tables" | "arrive_stove"
local log = {}
while t < limit and Shop.nextPurchase(shop) do
Shop.tick(shop, t)
if t >= busyUntil then
if pending == "cook" then
Shop.cook(shop)
elseif pending == "arrive_tables" then
at = "tables"
elseif pending == "arrive_stove" then
at = "stove"
end
pending = nil
if at == "stove" then
Shop.pickup(shop)
local canCook = not shop.stats.helper and not Shop.handFull(shop) and Shop.nextCookMenu(shop) ~= nil
if canCook then
pending = "cook"
busyUntil = t + shop.stats.cook
elseif #shop.hand > 0 and (Shop.handFull(shop) or #shop.counter == 0) then
pending = "arrive_tables"
busyUntil = t + Economy.WALK / 2
end
else
for id, c in shop.customers do
if c.state == "waiting" then
Shop.serve(shop, id)
end
end
if #shop.hand == 0 then
pending = "arrive_stove"
busyUntil = t + Economy.WALK / 2
end
end
end
local p = Shop.nextPurchase(shop)
if p and shop.money >= p.cost then
Shop.buyNext(shop)
table.insert(log, { t = t, id = p.id, name = p.name, cost = p.cost })
end
t += dt
end
return log
end
return Sim