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

@@ -26,6 +26,7 @@ local function section(name: string)
end
local Economy = require(ReplicatedStorage.Shared.Economy)
local Locale = require(ReplicatedStorage.Shared.Locale)
section("맵")
local World = require(Server.World)
@@ -80,14 +81,17 @@ local c = PlotController.new(slots[1], owner, {
displayName = "Tester",
data = data,
now = 0,
lang = "ko",
notify = function(k)
table.insert(notes, k)
end,
})
local Plots = require(StarterPlayer.StarterPlayerScripts.Client.Plots)
eq(owner:GetAttribute("Tut"), 1, "튜토리얼 1단계")
eq(owner:GetAttribute("Money"), 0, "돈 0")
eq(slots[1].refs.nameLabel.Text, "Tester의 분식집", "이름판")
eq(slots[1].model:GetAttribute("OwnerId"), 111, "부지 주인 속성")
eq(Plots.nameText(slots[1].model, "ko"), "Tester의 분식집", "이름판(한국어)")
eq(Plots.nameText(slots[1].model, "ja"), "Testerのブンシク店", "이름판(일본어)")
eq(Plots.nameText(slots[4].model, "en"), "Empty lot", "빈 자리 이름판")
c:update(0)
local dyn = slots[1].refs.dynamic
local customers = 0
@@ -119,12 +123,36 @@ eq(owner:GetAttribute("Tut"), 0, "튜토리얼 끝")
eq(data.TutorialDone, true, "튜토리얼 저장")
eq(data.Bought, 1, "세이브 데이터 구매 1")
check(table.find(notes, "tutDone") and table.find(notes, "purchased"), "알림")
section("가게 1: 김밥 해금이 바로 보임")
c:addMoney(40)
check(c:buy(), "김밥 해금 구매")
check(slots[1].refs.upgrades:FindFirstChild("UnlockGimbap") ~= nil, "김밥 진열대 모형")
check(
slots[1].refs.upgrades:FindFirstChild("UnlockGimbap"):FindFirstChild("Display") ~= nil,
"진열대에 김밥 접시"
)
check(table.find(notes, "newMenu") ~= nil, "새 메뉴 알림")
check(string.find(Plots.menuText(slots[1].model, "ko"), "김밥") ~= nil, "메뉴판에 김밥")
local gimbapOrder = false
for k = 1, 30 do
c:update(3 + Economy.EAT + 0.5 + k * 0.1)
for _, cust in c.shop.customers do
if cust.menu == "Gimbap" then
gimbapOrder = true
end
end
if gimbapOrder then
break
end
end
check(gimbapOrder, "산 직후 3초 안에 김밥 주문 손님")
c:update(3 + Economy.EAT + 0.5)
eq(dyn:FindFirstChild("Dish_Tteokbokki"), nil, "다 먹은 접시 치움")
section("가게 1: 전부 구매")
c:addMoney(10_000_000)
for i = 2, #Economy.PURCHASES do
for i = 3, #Economy.PURCHASES do
local okBuy, err = c:buy()
check(okBuy, `#{i} 구매 ({err})`)
end
@@ -137,7 +165,9 @@ check(dyn:FindFirstChild("Helper") ~= nil, "알바생 NPC")
check(table.find(notes, "expanded") ~= nil, "확장 알림")
local okMax, errMax = c:buy()
check(not okMax and errMax == "max", "더 살 것 없음")
check(string.find(slots[1].refs.menuLabel.Text, "튀김") ~= nil, "메뉴판에 튀김")
check(string.find(Plots.menuText(slots[1].model, "ko"), "튀김") ~= nil, "메뉴판에 튀김")
check(string.find(Plots.menuText(slots[1].model, "zh"), "炸物") ~= nil, "중국어 메뉴판")
check(slots[1].refs.upgrades:FindFirstChild("UnlockTwigim") ~= nil, "튀김 진열대 모형")
section("가게 1: 가상 5분 영업(봇)")
local t = 20
@@ -221,6 +251,107 @@ eq(#slots[2].refs.dynamic:GetChildren(), 0, "나가면 가게 비움")
eq(slots[2].refs.stove:GetAttribute("OwnerId"), nil, "조리대 주인 해제")
charModel:Destroy()
section("다른 플레이어가 손님으로 방문")
local guestChar =
Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R15)
guestChar.Name = "GuestCharacter"
guestChar.Parent = workspace
local hostOwner = Instance.new("Folder")
hostOwner.Parent = ServerScriptService
local hostData = newData()
hostData.Bought = 5 -- 자리 3개
hostData.TutorialDone = true
local guestEvents = {}
local host = PlotController.new(slots[2], hostOwner, {
userId = 333,
displayName = "Host",
data = hostData,
now = 0,
guestEvent = function(kind, userId, info)
table.insert(guestEvents, { kind, userId, info })
end,
})
local gc = host:addGuest(444, guestChar)
check(gc ~= nil, "빈자리에 손님으로 앉음")
eq(host:addGuest(444, guestChar), nil, "같은 손님은 한 번만")
local guestSeat = slots[2].refs.dynamic:FindFirstChild("GuestSeat") :: Seat?
check(guestSeat ~= nil, "손님 의자")
print("손님 의자 Occupant", guestSeat and guestSeat.Occupant)
eq(slots[2].refs.stove:GetAttribute("CookMenu"), gc and gc.menu, "손님 주문이 조리대에 뜸")
host.shop.now = 0.5
eq(host:cook(), gc and gc.menu, "손님 메뉴 조리")
local hostBefore = host.shop.money
local guestEarn = host:serve(gc.id)
eq(guestEarn, Economy.dishPrice(gc.menu, host.shop.stats, 1) * Economy.GUEST_MULT, "손님 접시는 2배 값")
eq(host.shop.money - hostBefore, guestEarn, "주인 돈 증가")
eq(guestEvents[1] and guestEvents[1][1], "served", "손님에게 서빙 소식")
eq(guestEvents[1] and guestEvents[1][3].price, Economy.dishPrice(gc.menu, host.shop.stats, 1), "시식 보너스 값")
host:update(0.6 + Economy.EAT + 0.5)
eq(guestEvents[2] and guestEvents[2][1], "left", "다 먹고 일어남")
eq(guestEvents[2] and guestEvents[2][3].reason, "ate", "일어난 이유: 다 먹음")
eq(slots[2].refs.dynamic:FindFirstChild("GuestSeat"), nil, "손님 의자 치움")
-- 오래 기다리면 일어남
local gc2 = host:addGuest(444, guestChar)
check(gc2 ~= nil, "다시 손님으로 앉음")
host:update(0.6 + Economy.EAT + 1 + Economy.GUEST_WAIT + 0.5)
eq(guestEvents[#guestEvents][3].reason, "hungry", "너무 기다리면 일어남")
-- 주인이 나가면 손님도 일어남
check(host:addGuest(444, guestChar) ~= nil, "세 번째 앉음")
host:destroy()
eq(guestEvents[#guestEvents][3].reason, "closed", "가게가 닫히면 일어남")
guestChar:Destroy()
section("이웃 가게(NPC 가게)")
local Neighbor = require(Server.Neighbor)
local nb = Neighbor.open(slots[5], 0)
eq(slots[5].model:GetAttribute("Npc"), 5, "이웃 가게 속성")
eq(slots[5].model:GetAttribute("OwnerId"), nil, "이웃 가게엔 주인 없음")
eq(slots[5].model:GetAttribute("Level"), Neighbor.LEVELS[5], "이웃 가게 크기")
eq(slots[5].refs.stove:GetAttribute("OwnerId"), nil, "이웃 가게 조리대엔 버튼 없음")
check(slots[5].refs.dynamic:FindFirstChild("Keeper") ~= nil, "사장님 NPC")
eq(
Plots.nameText(slots[5].model, "ko"),
Locale.t("ko", "npcShop5") .. ` ⭐Lv.{Neighbor.LEVELS[5]}`,
"이웃 가게 이름판"
)
local nt = 0
while nt < 90 do
nt += 0.1
Neighbor.update(nb, nt)
end
print(`이웃 가게 90초: 서빙 {nb.controller.shop.served}회`)
check(nb.controller.shop.served >= 5, "이웃 가게가 스스로 서빙")
Neighbor.close(nb)
eq(slots[5].model:GetAttribute("Npc"), nil, "닫으면 속성 해제")
eq(#slots[5].refs.dynamic:GetChildren(), 0, "닫으면 가게 비움")
section("부지 글자·손님 버튼(클라이언트 모듈)")
local viewer = Instance.new("Folder")
viewer:SetAttribute("Lang", "en")
local nb2 = Neighbor.open(slots[6], 0)
local detach = Plots.attach(slots[6].model, viewer, 999, function() end)
local visitPrompt = slots[6].model.Base.VisitPoint:FindFirstChild("VisitPrompt") :: ProximityPrompt
check(visitPrompt ~= nil and visitPrompt.Enabled, "이웃 가게 입구에 손님 버튼")
eq(visitPrompt.ActionText, "Eat here as a customer", "손님 버튼 글자(영어)")
local boardLabel = slots[6].model.Base.NameBoard:FindFirstChildOfClass("SurfaceGui"):FindFirstChildOfClass("TextLabel")
check(string.find(boardLabel.Text, "Twigim King") ~= nil, `이름판 영어 ({boardLabel.Text})`)
viewer:SetAttribute("Lang", "ja")
check(string.find(boardLabel.Text, "天ぷら") ~= nil, `언어 바꾸면 이름판도 바뀜 ({boardLabel.Text})`)
Neighbor.close(nb2)
check(not visitPrompt.Enabled, "닫힌 가게엔 손님 버튼 없음")
slots[6].model:SetAttribute("OwnerId", 999)
check(not visitPrompt.Enabled, "내 가게엔 손님 버튼 없음")
slots[6].model:SetAttribute("OwnerId", nil)
detach()
section("마우스 회전 판단")
local MouseLook = require(StarterPlayer.StarterPlayerScripts.Client.MouseLook)
check(MouseLook.shouldLock(true, true, false, false), "켜짐 + 마우스 = 고정")
check(not MouseLook.shouldLock(false, true, false, false), "설정 끄면 안 고정")
check(not MouseLook.shouldLock(true, false, false, false), "마우스 없으면(모바일) 안 고정")
check(not MouseLook.shouldLock(true, true, true, false), "Ctrl 누르면 커서 풀림")
check(not MouseLook.shouldLock(true, true, false, true), "창 열리면 커서 풀림")
section("결제(ProfileStore Mock + Receipts)")
local ProfileStore = require(ServerScriptService.Vendor.ProfileStore)
local Receipts = require(Server.Receipts)
@@ -286,13 +417,32 @@ check((root:FindFirstChild("Hint") :: Frame).Visible, "튜토리얼 안내 보
state:SetAttribute("Lang", "en")
eq(moneyText.Text, "💰 ₩25", "영어 돈 표시")
eq(nextTitle.Text, "Next: Unlock Gimbap", "영어 다음 업그레이드")
state:SetAttribute("Lang", "zh")
eq(nextTitle.Text, "下一个: 解锁紫菜包饭", "중국어 다음 업그레이드")
state:SetAttribute("Lang", "en")
check(root:FindFirstChild("Lang") == nil, "언어 버튼 대신")
local settingsBtn = root:FindFirstChild("Settings") :: TextButton
check(settingsBtn ~= nil, "오른쪽 위 설정 버튼")
eq(settingsBtn and settingsBtn.Text, "⚙️ Settings", "설정 버튼 글자")
local settingsPanel = root:FindFirstChild("SettingsPanel") :: Frame
check(settingsPanel ~= nil and not settingsPanel.Visible, "설정 창은 처음엔 닫힘")
for _, l in { "auto", "ko", "en", "ja", "zh" } do
check(settingsPanel:FindFirstChild("Lang_" .. l) ~= nil, `설정 창 언어 버튼 {l}`)
end
eq((settingsPanel:FindFirstChild("Lang_ja") :: TextButton).Text, "日本語", "언어 이름은 그 나라 말")
eq((settingsPanel:FindFirstChild("MouseLook") :: TextButton).Text, "On", "마우스 회전 기본 켜짐")
state:SetAttribute("Sfx", false)
eq((settingsPanel:FindFirstChild("Sfx") :: TextButton).Text, "Off", "효과음 끔 표시")
check(not hud.menuOpen(), "창 닫힘")
state:SetAttribute("Bought", #Economy.PURCHASES)
check(not (root:FindFirstChild("Next"):FindFirstChild("Buy") :: TextButton).Visible, "다 사면 사기 버튼 숨김")
check(not (root:FindFirstChild("Dev") :: Frame).Visible, "개발자 버튼은 기본으로 숨김")
state:SetAttribute("Dev", true)
check((root:FindFirstChild("Dev") :: Frame).Visible, "게임 주인에게 개발자 버튼")
check((root:FindFirstChild("Double") :: TextButton).Visible, "2배 수익 버튼(상품 ID 설정됨)")
hud.notify("purchased", { name = "X" })
hud.notify("purchased", { item = "Table2" })
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
hud.setScale(Hud.scaleFor(Vector2.new(844, 390)))
hud.destroy()
@@ -345,6 +495,18 @@ local okStart, errStart = pcall(Game.start)
check(okStart, `Game.start 오류 없음 ({errStart})`)
task.wait(1)
eq(#workspace.BunsikWorld.Plots:GetChildren(), 6, "시작 후 부지 6칸")
for _, plot in workspace.BunsikWorld.Plots:GetChildren() do
check(plot:GetAttribute("Npc") ~= nil, `{plot.Name}: 빈 부지에 이웃 가게`)
end
task.wait(3)
local npcCustomers = 0
for _, d in workspace.BunsikWorld.Plots:GetDescendants() do
if d.Name == "Customer" then
npcCustomers += 1
end
end
print("이웃 가게 손님 수", npcCustomers)
check(npcCustomers > 0, "이웃 가게에 손님이 옴(실제 Heartbeat)")
print(`통합 테스트: {count - #failures}/{count} 통과`)
if #failures > 0 then