Files
roblox-project/bunsik-tycoon/tools/simlib.luau
EJClaw 4d861b8fd3 feat(bunsik): 이웃 가게·손님 방문 멀티플레이, 4개 언어, 설정 창, 마우스 회전, 김밥 해금 효과
- 빈 부지에 NPC 사장님이 운영하는 이웃 가게(크기 제각각), 플레이어가 오면 그 자리를 넘겨줌
- 다른 가게 입구에서 손님으로 앉기: 주인은 2배 값, 손님은 시식 보너스(1분에 한 번)
- 한국어·영어·일본어·중국어(계정 언어 자동 선택), 이름판·메뉴판은 보는 사람 언어로
- 오른쪽 위 언어 버튼을 설정 창으로: 언어, 마우스로 화면 돌리기(PC 기본 켜짐), 효과음
- 메뉴 해금 시 진열대 모형이 생기고 다음 손님이 바로 새 메뉴를 주문
- 통합 테스트 600개 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 05:37:46 +09:00

62 lines
1.8 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, 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, cost = p.cost })
end
t += dt
end
return log
end
return Sim