- 요리: 조리대 버튼 → 요리 창. 주문 있는 메뉴만 고름(서버도 검사), 메뉴마다 다른 단계 (톡톡/꾹/문지르기, 실패 없음), 화구 업그레이드로 누르는 양 감소. Recipes(순수 로직)+Kitchen(화면) - 서버: cook에 메뉴 인자, 조리대 거리 검사, Orders/Hand 속성, 주문 말풍선을 그림으로(받으면 하트) - 경제: 한 접시에 손이 더 가므로 떡볶이·김밥·순대 15·25·40원, 시뮬레이터가 요리 창 시간 반영(확장 9:47) - UI: 사탕색 테마(흰 바탕·같은 계열 테두리·숫자는 Fredoka), 버튼 묶음 정리, 상점 5x2 카드, 마스코트 떡이 튜토리얼 말풍선, 손에 든 음식 표시, 알림 3개 제한, 움직임은 살 수 있는 것에만 - 그림: 요리 재료·도구 33칸 추가(ui_icons v2), 조리 도구·마스코트 큰 그림(kitchen.png), 톡톡 효과음 - 검사: 단위 테스트(Recipes 71, Layout 1642 등) + 로블록스 서버 통합 테스트 801/801 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.1 KiB
Lua
65 lines
2.1 KiB
Lua
-- 경제 시뮬레이터 본체: 실제 게임 로직(src/shared/Shop)을 봇이 쉬지 않고 최적으로 플레이합니다.
|
|
-- 실행은 tools/sim.luau, 검사는 tests/Sim.spec.luau
|
|
-- 봇 가정: 조리대 <-> 테이블 편도 WALK/2초, 알바생이 있으면 직접 조리하지 않고 나르기만 합니다.
|
|
-- 조리 시간은 요리 화면을 쉬지 않고 했을 때의 시간(Recipes.expectedTime: 메뉴 고르기 + 단계 + 완성 연출)입니다.
|
|
local Economy = require("../src/shared/Economy")
|
|
local Recipes = require("../src/shared/Recipes")
|
|
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"
|
|
local menu = Shop.nextCookMenu(shop) :: string
|
|
busyUntil = t + Recipes.expectedTime(menu, 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
|