feat(bunsik): MVP 전체 구현 — 맵, 요리·서빙, 손님 NPC, 업그레이드 20개, 세이브, 결제, 한/영 UI

- Shop.luau: 손님·주문·조리·서빙·구매 순수 로직(lune 단위 테스트, 시뮬레이터 공용)
- 서버: World(부지 6칸), PlotBuilder(파트 모형), PlotController, Npc(트윈 이동), Data(ProfileStore), Receipts(결제 1회 = 지급 1회), Game
- 클라이언트: Hud(돈·다음 업그레이드·목록·결제·언어·튜토리얼), 내 조리대 전용 버튼, 튜토리얼 화살표, 주인 전용 테스트 버튼
- 2단계 업그레이드 10개 추가, 파이썬 시뮬레이터를 실제 로직 기반 tools/sim.luau로 교체
- tools/cloud.py: 업로드, 원격 Luau 실행, 게임패스·개발자 상품 생성, 서버 인원 설정
- tests/cloud/integration.luau: 로블록스 서버 통합 테스트 514개 통과
- check.sh에 luau-lsp 타입 검사 추가, ProfileStore 고정 버전 포함

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 01:34:06 +09:00
parent 060974e277
commit 802ba10e1a
45 changed files with 6997 additions and 202 deletions

View File

@@ -0,0 +1,64 @@
--!strict
-- 개발자 상품 결제 처리: 결제 한 번에 정확히 한 번만 지급합니다(DECISIONS.md 2절).
-- 로블록스 API에 직접 기대지 않게 프로필과 지급 함수를 받아서, lune 단위 테스트로도 검증합니다.
local Receipts = {}
Receipts.CACHE_SIZE = 100
-- Enum.ProductPurchaseDecision 대신 문자열을 돌려주고, 호출하는 쪽에서 Enum으로 바꿉니다.
export type Decision = "Granted" | "NotProcessedYet"
export type ProfileLike = {
Data: { PurchaseIdCache: { string }? },
LastSavedData: { PurchaseIdCache: { string }? },
IsActive: (self: any) -> boolean,
Save: (self: any) -> (),
OnAfterSave: { Wait: (self: any) -> () },
}
local function isSaved(profile: ProfileLike, purchaseId: string): boolean
local saved = profile.LastSavedData and profile.LastSavedData.PurchaseIdCache
return saved ~= nil and table.find(saved, purchaseId) ~= nil
end
-- profile이 nil이면(아직 로드 안 됨, 이미 나감) 나중에 다시 시도하게 합니다.
function Receipts.process(profile: ProfileLike?, purchaseId: string, grant: () -> boolean): Decision
if profile == nil or not profile:IsActive() then
return "NotProcessedYet"
end
local cache = profile.Data.PurchaseIdCache
if cache == nil then
return "NotProcessedYet"
end
if table.find(cache, purchaseId) == nil then
local ok, granted = pcall(grant)
if not ok or granted ~= true then
if not ok then
warn("[Bunsik] 상품 지급 오류:", granted)
end
return "NotProcessedYet"
end
while #cache >= Receipts.CACHE_SIZE do
table.remove(cache, 1)
end
table.insert(cache, purchaseId)
end
-- 지급과 PurchaseId가 같이 저장된 것을 확인한 뒤에만 완료로 알립니다.
if isSaved(profile, purchaseId) then
return "Granted"
end
while profile:IsActive() do
local last = profile.LastSavedData
profile:Save()
if profile.LastSavedData == last then
profile.OnAfterSave:Wait()
end
if isSaved(profile, purchaseId) then
return "Granted"
end
end
return "NotProcessedYet"
end
return Receipts