fix(bunsik): 새 손님 자리를 돌아가며 골라 2층·구석 자리도 쓰이게, 실내에서는 수레 네온 간판을 빼서 천장 관통 방지, 경제 수치표 개편
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,7 @@ export type Shop = {
|
||||
now: number,
|
||||
nextSpawn: number,
|
||||
menuIndex: number,
|
||||
lastSeat: number, -- 마지막으로 NPC 손님을 앉힌 자리
|
||||
lastId: number,
|
||||
served: number,
|
||||
earned: number,
|
||||
@@ -107,6 +108,7 @@ function Shop.new(opts: Options): Shop
|
||||
now = opts.now,
|
||||
nextSpawn = opts.now, -- 접속하자마자 첫 손님
|
||||
menuIndex = 0,
|
||||
lastSeat = 0,
|
||||
lastId = 0,
|
||||
served = 0,
|
||||
earned = 0,
|
||||
@@ -129,6 +131,19 @@ function Shop.freeSeat(self: Shop): number?
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 새 손님 자리: 마지막으로 앉힌 자리 다음부터 돌아가며 찾습니다(2층·구석 자리도 고르게 쓰이게).
|
||||
local function nextSpawnSeat(self: Shop): number?
|
||||
local n = self.stats.seats
|
||||
for k = 1, n do
|
||||
local seat = ((self.lastSeat + k - 1) % n) + 1
|
||||
if self.seatTaken[seat] == nil then
|
||||
self.lastSeat = seat
|
||||
return seat
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function Shop.freeSeatCount(self: Shop): number
|
||||
local n = 0
|
||||
for seat = 1, self.stats.seats do
|
||||
@@ -312,7 +327,7 @@ function Shop.tick(self: Shop, now: number): { Event }
|
||||
end
|
||||
|
||||
if now >= self.nextSpawn then
|
||||
local seat = Shop.freeSeat(self)
|
||||
local seat = nextSpawnSeat(self)
|
||||
if seat then
|
||||
local menu = nextOrder(self)
|
||||
local c = addCustomer(self, seat, menu, self.seatWalk[seat] or Economy.WALK_IN)
|
||||
|
||||
Reference in New Issue
Block a user