feat(bunsik): 이웃 가게·손님 방문 멀티플레이, 4개 언어, 설정 창, 마우스 회전, 김밥 해금 효과

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 05:37:46 +09:00
parent c7af87c646
commit 4d861b8fd3
21 changed files with 1464 additions and 135 deletions

View File

@@ -18,13 +18,14 @@ export type Customer = {
seat: number,
menu: string,
state: CustomerState,
untilT: number, -- walking/eating이 끝나는 시각
untilT: number, -- walking/eating이 끝나는 시각. 플레이어 손님은 기다리다 일어나는 시각
guest: number?, -- 다른 플레이어가 손님으로 왔으면 그 UserId
}
export type Event =
{ kind: "spawn", id: number, seat: number, menu: string }
| { kind: "seated", id: number }
| { kind: "leave", id: number, seat: number }
| { kind: "leave", id: number, seat: number, guest: number?, served: boolean }
| { kind: "counter", menu: string }
export type Shop = {
@@ -76,6 +77,14 @@ local function freeSeat(self: Shop): number?
return nil
end
-- 다음 손님이 주문할 메뉴(해금된 메뉴를 돌아가며)
local function nextOrder(self: Shop): string
local menus = self.stats.menus
local menu = menus[(self.menuIndex % #menus) + 1]
self.menuIndex += 1
return menu
end
-- 아직 접시가 정해지지 않은 주문(먼저 온 손님부터). 걷는 중인 손님도 주문은 이미 정해져 있습니다.
function Shop.openOrders(self: Shop): { Customer }
local covered: { [string]: number } = {}
@@ -125,10 +134,14 @@ function Shop.tick(self: Shop, now: number): { Event }
if c.state == "walking" and now >= c.untilT then
c.state = "waiting"
table.insert(events, { kind = "seated", id = id } :: Event)
elseif c.state == "eating" and now >= c.untilT then
elseif c.state ~= "walking" and now >= c.untilT and (c.state == "eating" or c.guest ~= nil) then
-- 다 먹었거나, 플레이어 손님이 너무 오래 기다렸으면 나갑니다.
self.customers[id] = nil
self.seatTaken[c.seat] = nil
table.insert(events, { kind = "leave", id = id, seat = c.seat } :: Event)
table.insert(
events,
{ kind = "leave", id = id, seat = c.seat, guest = c.guest, served = c.state == "eating" } :: Event
)
end
end
@@ -136,9 +149,7 @@ function Shop.tick(self: Shop, now: number): { Event }
local seat = freeSeat(self)
if seat then
self.lastId += 1
local menus = self.stats.menus
local menu = menus[(self.menuIndex % #menus) + 1]
self.menuIndex += 1
local menu = nextOrder(self)
local c: Customer = {
id = self.lastId,
seat = seat,
@@ -201,6 +212,9 @@ function Shop.serve(self: Shop, id: number): number?
c.state = "eating"
c.untilT = self.now + Economy.EAT
local earn = Economy.dishPrice(c.menu, self.stats, self.moneyMult)
if c.guest then
earn *= Economy.GUEST_MULT
end
self.money += earn
self.earned += earn
self.served += 1
@@ -226,9 +240,50 @@ function Shop.buyNext(self: Shop): (Purchase?, string?)
if p.effect.spawn then
self.nextSpawn = math.min(self.nextSpawn, self.now + p.effect.spawn)
end
if p.effect.menu then
-- 새 메뉴를 사면 다음 손님이 바로 그 메뉴를 주문해서, 산 효과가 곧바로 보이게 합니다.
self.menuIndex = #self.stats.menus - 1
self.nextSpawn = math.min(self.nextSpawn, self.now + 1)
end
return p, nil
end
-- 다른 플레이어가 손님으로 와서 빈자리에 앉습니다(걷지 않고 바로 주문). 자리가 없거나 이미 앉아 있으면 nil.
function Shop.addGuest(self: Shop, userId: number): Customer?
for _, c in self.customers do
if c.guest == userId then
return nil
end
end
local seat = freeSeat(self)
if not seat then
return nil
end
self.lastId += 1
local c: Customer = {
id = self.lastId,
seat = seat,
menu = nextOrder(self),
state = "waiting",
untilT = self.now + Economy.GUEST_WAIT,
guest = userId,
}
self.customers[c.id] = c
self.seatTaken[seat] = c.id
return c
end
-- 플레이어 손님이 먼저 일어났을 때(점프, 퇴장). 이벤트 없이 자리만 비웁니다.
function Shop.removeGuest(self: Shop, id: number): Customer?
local c = self.customers[id]
if not c or not c.guest then
return nil
end
self.customers[id] = nil
self.seatTaken[c.seat] = nil
return c
end
function Shop.addMoney(self: Shop, amount: number)
self.money += amount
end