wip(bunsik): 서버 개편 — 갈래 업그레이드, 배치형 테이블·의자·조리대, 실내·2층 건물과 디자인 5종, 알바생 역할·시급, 홍보·쫓아내기·손님 러시, 가게 이름 필터·무지개, 세이브 버전 2 이전
로블록스 서버 통합 테스트 tests/cloud/server.luau 1003개 통과(저장 버전 25). 화면 UI는 다음 커밋. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,22 @@ local RunService = game:GetService("RunService")
|
||||
local ServerScriptService = game:GetService("ServerScriptService")
|
||||
|
||||
local ProfileStore = require(ServerScriptService.Vendor.ProfileStore)
|
||||
local Economy = require(game:GetService("ReplicatedStorage").Shared.Economy)
|
||||
local Floor = require(game:GetService("ReplicatedStorage").Shared.Floor)
|
||||
|
||||
local Data = {}
|
||||
|
||||
Data.TEMPLATE = {
|
||||
Money = 0,
|
||||
Bought = 0,
|
||||
Bought = 0, -- 예전(버전 1) 한 줄 업그레이드 수. 버전 2로 옮긴 뒤에는 쓰지 않음
|
||||
Levels = {} :: { [string]: number }, -- 업그레이드 갈래 레벨(Economy.TRACKS)
|
||||
Layout = {} :: any, -- 배치(Floor.Layout). 빈 표면 기본 배치
|
||||
Staff = {} :: { [string]: number }, -- 고용한 알바 수
|
||||
ShopName = "", -- 가게 이름 원문("" = 기본 이름)
|
||||
Rainbow = true, -- 무지개 이름 켜기(게임패스가 있을 때만 보임)
|
||||
Design = "Basic",
|
||||
RushLeft = 0, -- 손님 러시 남은 초
|
||||
KickCredits = 0, -- 산 "손님 쫓아내기" 남은 횟수
|
||||
PurchaseIdCache = {} :: { string },
|
||||
TutorialDone = false,
|
||||
Lang = "", -- "" = 계정 언어 자동
|
||||
@@ -19,7 +29,7 @@ Data.TEMPLATE = {
|
||||
Sfx = true, -- 효과음
|
||||
Served = 0,
|
||||
Earned = 0,
|
||||
Version = 1,
|
||||
Version = 2,
|
||||
}
|
||||
|
||||
export type SaveData = typeof(Data.TEMPLATE)
|
||||
@@ -48,7 +58,10 @@ function Data.load(player: Player): any
|
||||
return nil
|
||||
end
|
||||
profile:AddUserId(player.UserId)
|
||||
-- Reconcile 전에 버전을 봐야 합니다(빠진 Version은 템플릿 값 2로 채워지므로).
|
||||
local version = profile.Data.Version
|
||||
profile:Reconcile()
|
||||
Data.migrate(profile.Data, if typeof(version) == "number" then version else 1)
|
||||
profile.OnSessionEnd:Connect(function()
|
||||
profiles[player] = nil
|
||||
if player.Parent == Players then
|
||||
@@ -65,6 +78,26 @@ function Data.load(player: Player): any
|
||||
return profile
|
||||
end
|
||||
|
||||
-- 버전 1(한 줄 업그레이드 Bought) -> 버전 2(갈래 레벨, 배치, 알바생)
|
||||
function Data.migrate(data: any, version: number)
|
||||
if version >= 2 then
|
||||
return
|
||||
end
|
||||
local levels, seats, tables, cooks = Economy.migrate(data.Bought or 0)
|
||||
data.Levels = levels
|
||||
data.Staff = { Cook = cooks }
|
||||
local stage = Economy.stats(levels, seats).stage
|
||||
local layout = Floor.default()
|
||||
for _ = 2, tables do
|
||||
Floor.addTable(layout, stage)
|
||||
end
|
||||
for _ = #layout.chairs + 1, seats do
|
||||
Floor.addChair(layout, stage)
|
||||
end
|
||||
data.Layout = layout
|
||||
data.Version = 2
|
||||
end
|
||||
|
||||
function Data.get(player: Player): any
|
||||
return profiles[player]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user