feat(bunsik): 가게 꾸미기 3D 투명 미리보기·회전, 테이블·의자 따로 배치, 아래 [사기] 막대 → 튜토리얼, 손님 느리게, 2배 돈 "이미 보유" 수정

- 아래 추천 [사기] 막대를 없애고 튜토리얼 말풍선을 아래 가운데로. 튜토리얼 3단계는 [가게 꾸미기]에서 의자 놓기
- 상점에서 꾸미기 탭을 빼고 따로 [가게 꾸미기] 버튼·창. 카드를 고르면 캐릭터 앞에 투명 미리보기가 붙어 다니고
  [돌리기](R)·[놓기](F)로 그 자리에 놓음(놓을 때 돈). [옮기기]로 놓은 물건·조리대를 들어서 옮김
- 의자를 테이블에서 떼어 {x,z,f,r}로 저장(등받이로 방향 보임). 의자는 보는 쪽 앞에 테이블이 있어야 하고,
  테이블을 옮기거나 돌리면 그 테이블을 보는 의자도 같이. 예전 {t,s} 저장은 자동 변환. 새 요청 buyAt
- 테이블은 의자 없이 따로 판매(20 + 15×테이블 수²)
- 손님 간격 10초 → 20초(손님 속도 갈래도 2배), 대신 음식값 2배로 1분 매출 유지. 실내 11분·2층 50분(봇)
- 2배 돈: 게임 주인은 게임패스를 자동 보유하는데 [처음부터]·2배 끄기 뒤 버튼이 결제 창을 띄워 "이미 보유"가 나옴.
  누르면 먼저 보유를 확인해 바로 켜고, [처음부터]도 2배를 유지
- 검사 위치 0.5칸 자리 길 검사 오류 수정(touches가 막힌 칸 안쪽을 보던 문제)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 05:22:17 +09:00
parent e57e908b85
commit fdc5c05c2c
22 changed files with 1527 additions and 1107 deletions

View File

@@ -21,7 +21,7 @@ end
local lv0 = Economy.emptyLevels()
local s0 = Economy.stats(lv0, 1)
T.eq(s0.seats, 1, "처음 자리 1")
T.eq(s0.spawn, 10, "처음 손님 간격 10초(예전 6초보다 느림)")
T.eq(s0.spawn, 20, "처음 손님 간격 20초(6초 → 10초 → 20초로 느리게)")
T.eq(s0.cook, 2.5, "처음 조리 2.5")
T.eq(#s0.menus, 1, "처음 메뉴 1개")
T.eq(s0.carry, 1, "처음 접시 1개")
@@ -44,20 +44,22 @@ T.eq(Economy.cleanLevels({ Menu = 99 }).Menu, 4, "레벨은 최대값으로 자
Economy.stats(all, 1)
T.eq(#Economy.START_MENUS, 1, "START_MENUS 불변")
T.eq(Economy.dishPrice("Tteokbokki", s0, 1), 15, "떡볶이 15")
T.eq(Economy.dishPrice("Tteokbokki", s0, 1), 30, "떡볶이 30")
local p2 = Economy.stats(Economy.cleanLevels({ Price = 2 }), 1)
T.eq(Economy.dishPrice("Gimbap", p2, 1), 37, "김밥 25 x 1.5 = 37(내림)")
T.eq(Economy.dishPrice("Tteokbokki", s0, 2), 30, "2배 수익")
T.eq(Economy.dishPrice("Gimbap", p2, 1), 75, "김밥 50 x 1.5 = 75")
T.eq(Economy.dishPrice("Tteokbokki", s0, 2), 60, "2배 수익")
-- 자리 값
T.eq(Economy.seatCost(1), 0, "첫 자리 공짜")
T.eq(Economy.seatCost(2), 10, "두 번째 자리 10원(첫 구매 10초 안)")
T.eq(Economy.seatCost(2), 10, "두 번째 자리 10원(첫 손님 한 명 값으로 삼)")
local prev = 0
for s = 2, 24 do
T.check(Economy.seatCost(s) > prev, `자리 {s} 값이 오름`)
prev = Economy.seatCost(s)
end
T.check(Economy.tableCost(1, 1) > Economy.seatCost(2), "테이블은 의자보다 비쌈")
T.check(Economy.tableCost(1) > Economy.seatCost(2), "테이블은 의자보다 비쌈")
T.eq(Economy.tableCost(1), 35, "두 번째 테이블 35원(의자는 따로)")
T.check(Economy.tableCost(2) > Economy.tableCost(1), "테이블이 많을수록 비쌈")
-- 살 수 있는 것: 건물 단계 조건
local offers = Economy.offers(lv0, 1, 1)
@@ -67,7 +69,12 @@ for _, o in offers do
end
T.check(ids.Menu and ids.Price and ids.Speed and ids.Stage and ids.Staff, "처음 살 수 있는 갈래")
T.check(not ids.Tray, "쟁반은 실내 분식집부터")
T.check(ids.Seat and ids.Table, "의자·테이블")
T.check(ids.Seat and not ids.Table, "테이블에 빈 의자 자리가 많으면 의자만 추천")
local near = {}
for _, o in Economy.offers(lv0, 1, 3) do
near[o.id] = true
end
T.check(near.Seat and near.Table, "테이블이 거의 차면(의자 3개) 테이블도 추천")
T.check(offers[1].cost <= offers[#offers].cost, "싼 순서")
local capped = Economy.offers(lv0, 3, 6)
for _, o in capped do
@@ -78,8 +85,8 @@ end
T.eq(Economy.wage("Cook", s0), 12, "요리 알바 시급 12")
T.eq(Economy.wage("Cook", p2), 18, "판매 금액 1.5배면 시급도 1.5배")
T.eq(Economy.totalWage({ Cook = 2, Server = 1 }, s0), 39, "시급 합")
T.eq(Economy.spawnInterval(s0, 1, false), 7.5, "홍보 알바 x0.75")
T.eq(Economy.spawnInterval(s0, 0, true), 5, "손님 러시 x0.5")
T.eq(Economy.spawnInterval(s0, 1, false), 15, "홍보 알바 x0.75")
T.eq(Economy.spawnInterval(s0, 0, true), 10, "손님 러시 x0.5")
-- 예전 세이브 옮기기
local lv8, seats8, tables8, cooks8 = Economy.migrate(8)
@@ -95,7 +102,7 @@ T.eq(seats20, 8, "자리 8")
T.eq(tables20, 6, "테이블은 2단계 최대 6")
T.eq(Economy.migrate(0).Menu, 0, "예전 0개")
T.check(Economy.incomePerMinute(s0) >= 20 and Economy.incomePerMinute(s0) <= 60, "처음 1분 매출 20~60원")
T.check(Economy.incomePerMinute(s0) >= 40 and Economy.incomePerMinute(s0) <= 100, "처음 1분 매출 40~100원")
T.check(Economy.boostAmount(Economy.stats(all, 24)) > Economy.boostAmount(s0), "후반일수록 부스트가 큼")
T.eq(Economy.shopLevel(lv0, 1), 0, "처음 가게 레벨 0")

View File

@@ -8,6 +8,8 @@ T.eq(#base.chairs, 1, "처음 의자 1개")
local p1 = Floor.chairPos(base, 1)
T.eq(p1 and p1.x, -9, "첫 의자 x")
T.eq(p1 and p1.z, -6.5, "첫 의자는 테이블 앞(+Z) 3.5")
T.eq(base.chairs[1].r, 2, "첫 의자는 테이블(-Z)을 봄")
T.eq(Floor.chairTable(base, 1), 1, "첫 의자는 테이블 1을 봄")
-- 밖, 겹침, 문 앞
T.eq(select(2, Floor.move(base, 1, { kind = "table", i = 1, x = 40, z = 0 })), "bounds", "부지 밖")
@@ -19,12 +21,68 @@ T.eq(why, nil, "빈 곳으로 옮기기")
T.eq(moved and Floor.chairPos(moved, 1).x, 20, "의자도 같이 옮겨짐")
T.eq(base.tables[1].x, -9, "원래 배치는 그대로(복사본)")
-- 의자 쪽 바꾸기, 같은 쪽 두 개 금지
-- 테이블을 돌리면 의자가 테이블 둘레로 돌아감
local turned = Floor.move(base, 1, { kind = "table", i = 1, x = -9, z = -10, r = 1 })
T.check(turned ~= nil, "테이블 돌리기")
if turned then
T.eq(turned.chairs[1].x, -5.5, "의자가 +X 쪽으로")
T.eq(turned.chairs[1].z, -10, "의자 z")
T.eq(turned.chairs[1].r, 3, "의자는 계속 테이블을 봄")
T.eq(Floor.chairTable(turned, 1), 1, "돌린 뒤에도 테이블 1을 봄")
end
-- 의자는 따로 옮기고 돌림. 앞에 테이블이 있어야 하고, 겹치면 안 됨
local two = Floor.clone(base)
T.check(Floor.addChair(two, 1, 1) ~= nil, "의자 추가")
T.eq(#two.chairs, 2, "의자 2")
T.check(two.chairs[2].s ~= two.chairs[1].s, "다른 쪽에 붙음")
T.eq(select(2, Floor.move(two, 1, { kind = "chair", i = 2, x = 1, z = 0 })), "chair", "같은 쪽 금지")
T.check(two.chairs[2].x ~= two.chairs[1].x or two.chairs[2].z ~= two.chairs[1].z, "다른 자리에 붙음")
T.eq(Floor.chairTable(two, 2), 1, "새 의자도 테이블 1을 봄")
T.eq(
select(2, Floor.move(two, 1, { kind = "chair", i = 2, x = -9, z = -6.5, r = 2 })),
"overlap",
"다른 의자와 겹치면 안 됨"
)
T.eq(
select(2, Floor.move(two, 1, { kind = "chair", i = 2, x = 10, z = 0, r = 0 })),
"chair",
"앞에 테이블이 없으면 안 됨"
)
T.eq(
select(2, Floor.move(two, 1, { kind = "chair", i = 2, x = -12.5, z = -10, r = 3 })),
"chair",
"테이블 반대쪽을 보면 안 됨"
)
local side, sideWhy = Floor.move(two, 1, { kind = "chair", i = 2, x = -12.5, z = -10, r = 1 })
T.eq(sideWhy, nil, "테이블 왼쪽에서 테이블을 보게 놓기")
T.eq(side and side.chairs[2].r, 1, "의자 방향 저장")
local corner = Floor.move(two, 1, { kind = "chair", i = 2, x = -10.5, z = -13.5, r = 0 })
T.check(corner ~= nil, "테이블 가장자리 쪽에 비스듬히 놓아도 됨")
-- 새 물건을 정한 자리에 놓기
local added, addWhy, ai = Floor.add(base, 1, { kind = "table", x = 12, z = 0 })
T.eq(addWhy, nil, "테이블 놓기")
T.eq(ai, 2, "테이블 번호 2")
if added then
local withChair, cw, ci = Floor.add(added, 1, { kind = "chair", x = 12, z = 3.5, r = 2 })
T.eq(cw, nil, "새 테이블 앞에 의자 놓기")
T.eq(ci, 2, "의자 번호 2")
T.eq(withChair and Floor.chairTable(withChair, 2), 2, "새 의자는 테이블 2를 봄")
end
T.eq(
select(2, Floor.add(base, 1, { kind = "chair", x = 20, z = 0, r = 0 })),
"chair",
"테이블 없는 곳에 의자 안 됨"
)
T.eq(
select(2, Floor.add(base, 1, { kind = "decor", k = "Plant", x = 0, z = 17 })),
"reserved",
"문 앞 소품 안 됨"
)
T.eq(
select(2, Floor.add(base, 1, { kind = "decor", k = "Stove", x = 20, z = 0 })),
"none",
"조리대는 새로 못 놓음"
)
-- 테이블 자동 배치: 단계별 최대까지 놓을 수 있어야 함
local full = Floor.clone(base)
@@ -32,8 +90,9 @@ for _ = 2, 6 do
T.check(Floor.addTable(full, 2) ~= nil, "테이블 자동 배치")
end
T.eq(#full.tables, 6, "테이블 6")
T.eq(#full.chairs, 1, "테이블만 늘고 의자는 그대로")
T.eq(Floor.validate(full, 2), nil, "자동 배치 결과가 검사 통과")
for _ = 1, 8 do
for _ = 1, 13 do
T.check(Floor.addChair(full, 2) ~= nil, "의자 자동 배치")
end
T.eq(#full.chairs, 14, "의자 14(2단계 최대)")
@@ -51,14 +110,16 @@ end
-- 길을 막으면 거절: 조리대 앞을 테이블로 막기
local block = Floor.clone(base)
block.tables = { { x = -5, z = -21, f = 1 }, { x = 5, z = -21, f = 1 }, { x = 0, z = -17, f = 1 } }
block.chairs = { { t = 1, s = 1 }, { t = 2, s = 1 }, { t = 3, s = 1 } }
block.chairs = {}
for i = 1, 3 do
block.chairs[i] = Floor.chairAt(block.tables[i], 1)
end
T.eq(Floor.validate(block, 1), "blocked", "조리대 앞을 테이블로 둘러싸면 거절")
block.tables[3] = { x = 0, z = -10, f = 1 }
T.eq(Floor.validate(block, 1), nil, "한쪽을 열면 통과")
local opened = Floor.move(block, 1, { kind = "table", i = 3, x = 0, z = -10 })
T.check(opened ~= nil, "한쪽을 열면 통과(의자도 같이 옮겨짐)")
-- 2층(3단계): 계단 자리 정리 후 2층에도 배치
local stair = Floor.clone(base)
stair.tables[1] = { x = -28, z = -2, f = 1 }
local stair = Floor.move(base, 2, { kind = "table", i = 1, x = -28, z = -2 }) :: Floor.Layout
T.eq(Floor.validate(stair, 2), nil, "2단계에서는 계단 자리에 놓아도 됨")
T.check(Floor.validate(stair, 3) ~= nil, "3단계에서는 계단 자리와 겹침")
local fixed = Floor.repair(stair, 3)
@@ -75,22 +136,36 @@ for _, t in up.tables do
end
T.check(on2 > 0, "3단계에서는 2층에도 테이블이 놓임")
T.eq(Floor.validate(up, 3), nil, "2층 배치 통과")
for i, t in up.tables do
if t.f == 2 then
for ci, c in up.chairs do
if c.t == i then
local path = Floor.pathToChair(up, 3, ci)
local sawStair = false
for _, pt in path do
if pt.f == 2 then
sawStair = true
end
end
T.check(sawStair, "2층 의자 길은 계단을 지남")
for _ = 1, 10 do
Floor.addChair(up, 3)
end
local chairs2 = 0
for ci, c in up.chairs do
if c.f == 2 then
chairs2 += 1
local path = Floor.pathToChair(up, 3, ci)
local sawStair = false
for _, pt in path do
if pt.f == 2 then
sawStair = true
end
end
T.check(sawStair, "2층 의자 길은 계단을 지남")
end
end
T.check(chairs2 > 0, "2층에도 의자가 놓임")
T.eq(Floor.validate(up, 3), nil, "2층 의자 배치 통과")
-- 2층으로 올릴 때 계단 자리 테이블은 의자와 같이 옮겨지고 자리 수는 그대로
local crowded = Floor.clone(base)
crowded.tables[2] = { x = -28, z = -2, f = 1 }
table.insert(crowded.chairs, Floor.chairAt(crowded.tables[2], 1))
table.insert(crowded.chairs, Floor.chairAt(crowded.tables[2], 2))
T.eq(Floor.validate(crowded, 2), nil, "2단계 배치")
local moved3 = Floor.repair(crowded, 3)
T.eq(Floor.validate(moved3, 3), nil, "3단계 repair 통과")
T.eq(#moved3.chairs, 3, "자리 수 그대로")
T.eq(#moved3.tables, 2, "테이블 수 그대로")
-- 조리대 회전·이동
local s2, sw = Floor.move(base, 1, { kind = "stove", i = 1, x = 20, z = -28, r = 2 })
@@ -113,6 +188,15 @@ local cleaned =
T.eq(cleaned.stove.x, 0, "이상한 값은 기본값")
T.eq(cleaned.tables[1].f, 1, "층은 1 또는 2")
T.eq(#cleaned.chairs, 1, "없는 테이블 의자는 빼고 기본 의자")
local old = Floor.clean({ tables = { { x = 0, z = 0, f = 1 } }, chairs = { { t = 1, s = 2 }, { t = 1, s = 4 } } })
T.eq(#old.chairs, 2, "예전 모양 의자 2개")
T.eq(old.chairs[1].x, 3.5, "예전 쪽 2(+X) -> x 3.5")
T.eq(old.chairs[1].r, 3, "예전 쪽 2 의자는 -X(테이블)를 봄")
T.eq(old.chairs[2].r, 1, "예전 쪽 4 의자는 +X를 봄")
T.eq(Floor.validate(old, 1), nil, "예전 모양을 바꾼 배치 통과")
local new = Floor.clean({ chairs = { { x = 2, z = 3, f = 2, r = 7 } } })
T.eq(new.chairs[1].r, 3, "방향은 0~3")
T.eq(new.chairs[1].f, 2, "층 저장")
T.eq(#Floor.clean(nil).tables, 1, "nil이면 기본 배치")
T.done("Floor.spec")

View File

@@ -48,9 +48,9 @@ for _, d in DEVICES do
carry = L.carry,
hint = L.hint,
toasts = L.toasts,
card = L.card,
settings = L.settings,
list = L.list,
decorate = L.decorate,
double = L.double,
boost = L.boost,
promote = L.promote,
@@ -59,7 +59,6 @@ for _, d in DEVICES do
for name, r in hud do
T.check(inside(r, L.width, L.height), `{tag}: {name} 화면 안`)
end
T.check(inside(L.buy, L.width, L.height), `{tag}: 사기 버튼 화면 안`)
local names = {}
for name in hud do
table.insert(names, name)
@@ -79,9 +78,9 @@ for _, d in DEVICES do
T.check(inside(L.kitchen, L.width, L.height), `{tag}: 요리 창 화면 안`)
T.check(inside(L.confirm, L.width, L.height), `{tag}: 홍보 확인 창 화면 안`)
-- 상점 창 안: 탭 4개와 내용 자리가 창 안에, 서로 안 겹침
-- 상점 창 안: 탭 3개와 내용 자리가 창 안에, 서로 안 겹침
local panelBox = { x = 0, y = 0, w = L.panel.w, h = L.panel.h }
T.eq(#L.tabs, 4, `{tag}: 탭 4개`)
T.eq(#L.tabs, 3, `{tag}: 탭 3개`)
for i, t in L.tabs do
T.check(inside(t, panelBox.w, panelBox.h), `{tag}: 탭 {i} 창 안`)
T.check(not overlap(t, L.content), `{tag}: 탭 {i}와 내용 안 겹침`)
@@ -92,11 +91,14 @@ for _, d in DEVICES do
end
end
T.check(inside(L.content, panelBox.w, panelBox.h), `{tag}: 탭 내용 창 안`)
-- 카드 칸(업그레이드 4x2, 꾸미기 5x2, 알바생 3x1): 손가락으로 누를 만큼 큼
for _, grid in { { 4, 2 }, { 5, 2 }, { 3, 1 } } do
T.check(inside(L.decorContent, panelBox.w, panelBox.h), `{tag}: 가게 꾸미기 내용 창 안`)
T.check(L.decorContent.y >= Layout.HEADER_H, `{tag}: 가게 꾸미기 내용은 제목 띠 아래`)
-- 카드 칸(업그레이드 4x2, 알바생 3x1, 가게 꾸미기 5x2): 손가락으로 누를 만큼 큼
for _, grid in { { 4, 2, L.content }, { 3, 1, L.content }, { 5, 2, L.decorContent } } do
-- ShopWindow의 칸: 내용 자리를 똑같이 나누고 칸마다 8씩 띄움
local cw = L.content.w / grid[1] - 8
local chh = L.content.h / grid[2] - 8
local box = grid[3] :: Rect
local cw = box.w / grid[1] - 8
local chh = box.h / grid[2] - 8
T.check(
cw * L.scale >= 90 and chh * L.scale >= 90,
`{tag}: {grid[1]}x{grid[2]} 카드가 손가락으로 누를 만큼 큼({math.floor(cw * L.scale)}x{math.floor(
@@ -106,7 +108,8 @@ for _, d in DEVICES do
end
-- 꾸미기 화면 버튼: 화면 안, 서로 안 겹침, 누르기 쉬움
local deco: { [string]: Rect } = { exit = L.deco.exit, floor = L.deco.floor, info = L.deco.info }
T.eq(#L.deco.tools, 3, `{tag}: 꾸미기 버튼 3개`)
local deco: { [string]: Rect } = { exit = L.deco.exit, info = L.deco.info }
for i, r in L.deco.tools do
deco["tool" .. i] = r
end
@@ -128,9 +131,9 @@ for _, d in DEVICES do
if d.touch then
local zones = Layout.touchZones(d.w, d.h)
local buttons: { [string]: Rect } = {
buy = L.buy,
settings = L.settings,
list = L.list,
decorate = L.decorate,
double = L.double,
boost = L.boost,
promote = L.promote,
@@ -142,9 +145,11 @@ for _, d in DEVICES do
T.check(not overlap(p, zones.jump), `{tag}: {name} 버튼이 점프 버튼 자리 피함`)
T.check(p.h >= 44, `{tag}: {name} 버튼 높이 {math.floor(p.h)}px ≥ 44(어린이 손가락)`)
end
-- 꾸미기 화면에서는 걸어 다니므로 조이스틱 자리도 피함
for name, r in deco do
local p = px(r, L.scale)
T.check(not overlap(p, zones.jump), `{tag}: 꾸미기 {name}이 점프 버튼 자리 피함`)
T.check(not overlap(p, zones.stick), `{tag}: 꾸미기 {name}이 조이스틱 자리 피함`)
if name ~= "info" then
T.check(p.h >= 44, `{tag}: 꾸미기 {name} 버튼 높이 {math.floor(p.h)}px ≥ 44`)
end

View File

@@ -23,17 +23,17 @@ T.eq(Shop.nextCookMenu(s), "Tteokbokki", "걷는 중인 손님 주문도 미리
T.eq(Shop.serve(s, 1), nil, "앉기 전에는 서빙 불가")
-- 자리가 1개면 두 번째 손님은 못 들어옴
T.eq(#kinds(Shop.tick(s, 110), "spawn"), 0, "빈자리 없으면 손님이 지나감")
T.eq(#kinds(Shop.tick(s, 120), "spawn"), 0, "빈자리 없으면 손님이 지나감")
T.eq(s.customers[1].state, "waiting", "자리에 앉음")
-- 조리 -> 서빙 -> 돈
T.eq(Shop.cook(s), "Tteokbokki", "조리하면 떡볶이")
T.eq(Shop.cook(s), nil, "손이 꽉 차면 더 못 만듦")
T.eq(Shop.serve(s, 1), 15, "떡볶이 15원")
T.eq(s.money, 15, "돈 15")
T.eq(Shop.serve(s, 1), 30, "떡볶이 30원")
T.eq(s.money, 30, "돈 30")
T.eq(#s.hand, 0, "접시를 내려놓음")
T.eq(Shop.serve(s, 1), nil, "같은 손님에게 두 번 못 줌")
T.check(#kinds(Shop.tick(s, 110 + Economy.EAT + 0.1), "leave") == 1, "다 먹으면 나감")
T.check(#kinds(Shop.tick(s, 120 + Economy.EAT + 0.1), "leave") == 1, "다 먹으면 나감")
T.eq(s.customers[1], nil, "손님 목록에서 빠짐")
-- 갈래 업그레이드
@@ -62,16 +62,16 @@ T.eq(select(2, Shop.buyLevel(b, "Nope")), "max", "없는 갈래")
local sp = Shop.new({ money = 60, now = 0 })
Shop.tick(sp, 0)
Shop.buyLevel(sp, "Speed")
T.eq(sp.stats.spawn, 8.5, "간격 8.5초")
T.check(sp.nextSpawn <= 8.5, "산 직후 다음 손님 시각이 당겨짐")
T.eq(sp.stats.spawn, 17, "간격 17초")
T.check(sp.nextSpawn <= 17, "산 직후 다음 손님 시각이 당겨짐")
-- 자리
local seats = Shop.new({ money = 0, now = 0, seats = 2 })
Shop.tick(seats, 0)
T.eq(#kinds(Shop.tick(seats, 10), "spawn"), 1, "자리 2개면 두 번째 손님")
T.eq(#kinds(Shop.tick(seats, 20), "spawn"), 1, "자리 2개면 두 번째 손님")
Shop.setSeats(seats, 3)
T.eq(seats.stats.seats, 3, "자리 3")
T.check(seats.nextSpawn <= 11, "자리가 생기면 곧 손님")
T.check(seats.nextSpawn <= 21, "자리가 생기면 곧 손님")
-- 2배 수익
local d = Shop.new({ money = 0, now = 0 })
@@ -79,12 +79,12 @@ d.moneyMult = 2
Shop.tick(d, 0)
Shop.tick(d, 3)
Shop.cook(d)
T.eq(Shop.serve(d, 1), 30, "2배 수익이면 30원")
T.eq(Shop.serve(d, 1), 60, "2배 수익이면 60원")
-- 요리 화면에서 메뉴 고르기: 주문이 있는 메뉴만 만들 수 있음
local pick = Shop.new({ money = 0, now = 0, seats = 2, levels = { Menu = 1 } })
Shop.tick(pick, 0)
Shop.tick(pick, 10)
Shop.tick(pick, 20)
local counts = Shop.openCounts(pick)
T.eq(counts.Tteokbokki, 1, "떡볶이 주문 1")
T.eq(counts.Gimbap, 1, "김밥 주문 1")
@@ -137,22 +137,22 @@ T.eq(#sv.counter, 0, "카운터에서 빠짐")
T.eq(Shop.serve(sv, 1), nil, "알바가 가져가는 손님은 플레이어가 못 줌")
local e3 = Shop.tick(sv, Economy.WALK_IN + 0.1 + Economy.SERVER_TRIP + 0.1)
local delivered = kinds(e3, "delivered")
T.eq(delivered[1] and delivered[1].earn, 15, "서빙 알바가 놓으면 돈")
T.eq(delivered[1] and delivered[1].earn, 30, "서빙 알바가 놓으면 돈")
T.eq(sv.customers[1].state, "eating", "먹는 중")
-- 홍보 알바·손님 러시
local pr = Shop.new({ money = 0, now = 0, levels = { Staff = 1 }, staff = { Promoter = 1 } })
T.eq(Shop.spawnInterval(pr), 7.5, "홍보 알바 간격 x0.75")
T.eq(Shop.spawnInterval(pr), 15, "홍보 알바 간격 x0.75")
Shop.addRush(pr, 30)
T.eq(Shop.spawnInterval(pr), 3.75, "러시 x0.5")
T.eq(Shop.spawnInterval(pr), 7.5, "러시 x0.5")
Shop.tick(pr, 31)
T.eq(pr.rushLeft, 0, "러시 끝")
-- 옆 가게로 손님 데려가기: 먹는 중이 아닌 NPC 손님만, 늦게 온 손님부터
local victim = Shop.new({ money = 0, now = 0, seats = 3, levels = { Menu = 1 } })
Shop.tick(victim, 0)
Shop.tick(victim, 10)
Shop.tick(victim, 20)
Shop.tick(victim, 40)
Shop.cook(victim) -- 1번 손님 떡볶이를 들고 있음
local taken = Shop.takeCustomers(victim, 5)
T.eq(#taken, 3, "3명 모두 데려감(아직 못 먹음)")
@@ -160,7 +160,7 @@ T.eq(taken[1].id, 3, "늦게 온 손님부터")
T.eq(next(victim.customers), nil, "손님 없음")
-- 남은 떡볶이 접시: 다음 손님이 떡볶이를 주문
victim.menuIndex = 1 -- 원래라면 다음은 김밥
local nextEv = kinds(Shop.tick(victim, 30), "spawn")
local nextEv = kinds(Shop.tick(victim, 60), "spawn")
T.eq(nextEv[1] and nextEv[1].menu, "Tteokbokki", "주인 없는 접시 메뉴를 다음 손님이 주문")
local thief = Shop.new({ money = 0, now = 0, seats = 2 })
@@ -193,15 +193,15 @@ T.eq(guest and guest.seat, 2, "빈 2번 자리")
T.eq(guest and guest.state, "waiting", "걷지 않고 바로 주문")
T.eq(Shop.addGuest(g, 777), nil, "같은 플레이어는 한 번만")
T.eq(Shop.addGuest(g, 888), nil, "빈자리가 없으면 못 앉음")
T.eq(#kinds(Shop.tick(g, 10.5), "spawn"), 0, "플레이어 손님 자리에는 NPC가 안 옴")
T.eq(#kinds(Shop.tick(g, 20.5), "spawn"), 0, "플레이어 손님 자리에는 NPC가 안 옴")
Shop.cook(g)
T.eq(Shop.serve(g, 1), 15, "NPC 손님은 1배")
T.eq(Shop.serve(g, 1), 30, "NPC 손님은 1배")
local gid = (guest :: any).id
T.eq(Shop.nextCookMenu(g), (guest :: any).menu, "플레이어 손님 주문도 조리대에 뜸")
Shop.cook(g)
T.eq(Shop.serve(g, gid), 30, "플레이어 손님은 2배")
T.eq(Shop.serve(g, gid), 60, "플레이어 손님은 2배")
local guestLeave = nil
for _, e in Shop.tick(g, 10.5 + Economy.EAT + 0.1) do
for _, e in Shop.tick(g, 20.5 + Economy.EAT + 0.1) do
if e.kind == "leave" and e.guest then
guestLeave = e
end

View File

@@ -176,12 +176,9 @@ local SHOTS = {
),
shot("phone_tut", PHONE, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot("phone_shop", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "shop" }),
shot(
"phone_shop_decor",
PHONE,
shopState(MID, 3, 2, { Money = 400, Layout = LAYOUT }),
{ open = "shop", tab = "decor" }
),
shot("phone_decor", PHONE, shopState(MID, 3, 2, { Money = 400, Layout = LAYOUT }), { open = "decor" }),
shot("pc_decor", PC, shopState(MID, 3, 2, { Money = 60, Layout = LAYOUT }), { open = "decor" }),
shot("pc_tut", PC, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot(
"phone_shop_staff",
PHONE,

View File

@@ -105,23 +105,23 @@ local function label(o: Instance?): string?
end
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text", true) :: TextLabel
eq(moneyText.Text, "5", "돈 표시")
local nextCard = root:FindFirstChild("Next") :: Frame
local nextTitle = nextCard:FindFirstChild("Title", true) :: TextLabel
check(nextTitle.Text ~= "" and not string.find(nextTitle.Text, "_"), `추천 구매 이름 ({nextTitle.Text})`)
eq((nextCard:FindFirstChild("Cost", true) :: TextLabel).Text, "5 / 10", "추천 구매(의자 10원) 진행 막대")
check((root:FindFirstChild("Hint") :: Frame).Visible, "튜토리얼 말풍선 보임")
check((nextCard:FindFirstChild("Pointer") :: ImageLabel).Visible, "튜토리얼 3: [사기] 가리키는 손")
local buyBtn = nextCard:FindFirstChild("Buy") :: TextButton
eq(label(buyBtn), "사기", "사기 버튼 글자")
eq(
(buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3,
Theme.darken(Theme.GRAY, 0.3),
"돈이 모자라면 회색"
check(root:FindFirstChild("Next") == nil, "아래 [사기] 막대 없음")
local hintFrame = root:FindFirstChild("Hint") :: Frame
check(hintFrame.Visible, "튜토리얼 말풍선 보임")
local hintText = hintFrame:FindFirstChild("Text", true) :: TextLabel
check(
string.find(hintText.Text, "가게 꾸미기") ~= nil,
`튜토리얼 3은 가게 꾸미기 안내 ({hintText.Text})`
)
check((root:FindFirstChild("Pointer") :: ImageLabel).Visible, "튜토리얼 3: [가게 꾸미기] 가리키는 손")
local lay0 = hud.layout()
check(hintFrame.Position.Y.Offset > lay0.height / 2, "튜토리얼 말풍선은 화면 아래쪽")
local listButton = root:FindFirstChild("ListButton") :: TextButton
eq(label(listButton), "상점", "상점 버튼 글자")
local decoButton = root:FindFirstChild("Decorate") :: TextButton
eq(label(decoButton), "가게 꾸미기", "가게 꾸미기 버튼 글자")
check(not (listButton:FindFirstChild("Badge") :: Frame).Visible, "살 것이 없으면 배지 없음")
state:SetAttribute("Money", 15)
eq((buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3, Theme.darken(Theme.MINT, 0.3), "살 수 있으면 초록")
check((listButton:FindFirstChild("Badge") :: Frame).Visible, "살 수 있으면 상점 버튼에 ! 배지")
eq(
(root:FindFirstChild("Gain") :: TextLabel?) and (root:FindFirstChild("Gain") :: TextLabel).Text,
@@ -132,20 +132,26 @@ for _, name in { "Promote", "Rush", "Double", "Boost", "Settings" } do
check(root:FindFirstChild(name) ~= nil, `버튼 {name}`)
end
state:SetAttribute("Lang", "en")
check(nextTitle.Text ~= "" and not string.find(nextTitle.Text, "의자"), `영어 추천 구매 ({nextTitle.Text})`)
eq(label(decoButton), "Decorate", "영어 가게 꾸미기 버튼")
state:SetAttribute("Lang", "ko")
state:SetAttribute("Tut", 0)
check(
not hintFrame.Visible and not (root:FindFirstChild("Pointer") :: ImageLabel).Visible,
"튜토리얼 끝나면 아래 말풍선 없음"
)
section("상점 창(탭 4개)")
section("상점 창(탭 3개)")
hud.open("shop")
local panel = root:FindFirstChild("Panel") :: Frame
check(hud.menuOpen() and panel.Visible, "상점 창 열기")
local function page(id: string): Frame
return panel:FindFirstChild("Page_" .. id, true) :: Frame
end
for _, id in { "upgrade", "decor", "staff", "mine" } do
for _, id in { "upgrade", "staff", "mine" } do
check(page(id) ~= nil, `탭 {id}`)
check(panel:FindFirstChild("Tab_" .. id, true) ~= nil, `탭 버튼 {id}`)
end
check(panel:FindFirstChild("Tab_decor", true) == nil, "상점에는 꾸미기 탭 없음")
check(page("upgrade").Visible, "처음엔 업그레이드 탭")
for _, id in Economy.TRACK_ORDER do
local card = page("upgrade"):FindFirstChild("Track_" .. id, true)
@@ -155,13 +161,22 @@ for _, id in Economy.TRACK_ORDER do
end
local tray = page("upgrade"):FindFirstChild("Track_Tray", true) :: Frame
check((tray:FindFirstChild("Lock", true) :: ImageLabel).Visible, "쟁반은 포장마차에서 잠김")
hud.open("shop", "decor")
check(page("decor").Visible and not page("upgrade").Visible, "꾸미기 탭")
check(page("decor"):FindFirstChild("Place", true) ~= nil, "배치하기 버튼")
check(page("decor"):FindFirstChild("Decor_Table", true) ~= nil, "테이블 카드")
for _, d in Economy.DECOR do
check(page("decor"):FindFirstChild("Decor_" .. d.id, true) ~= nil, `소품 카드 {d.id}`)
hud.open("decor")
local decorPanel = root:FindFirstChild("DecorPanel") :: Frame
check(decorPanel.Visible and not panel.Visible and hud.menuOpen(), "가게 꾸미기 창(상점과 따로)")
local decorPage = decorPanel:FindFirstChild("Page_decor", true) :: Frame
check(decorPage ~= nil, "가게 꾸미기 카드 자리")
eq(label(decorPage:FindFirstChild("Place", true)), "옮기기", "옮기기 버튼")
for _, id in { "Table", "Seat" } do
check(decorPage:FindFirstChild("Decor_" .. id, true) ~= nil, `{id} 카드`)
end
for _, d in Economy.DECOR do
check(decorPage:FindFirstChild("Decor_" .. d.id, true) ~= nil, `소품 카드 {d.id}`)
end
local tableCost = (decorPage:FindFirstChild("Decor_Table", true) :: Frame):FindFirstChild("Buy", true)
eq(label(tableCost), Locale.number(Economy.tableCost(1)), "테이블 값(의자 없이)")
hud.open("shop", "upgrade")
check(not decorPanel.Visible and panel.Visible, "창은 하나만 열림(꾸미기 → 상점)")
hud.open("shop", "staff")
check((page("staff"):FindFirstChild("Locked", true) :: Frame).Visible, "알바생 기능 전에는 잠김")
state:SetAttribute("Levels", "Staff=1")
@@ -219,6 +234,7 @@ local SAMPLES = {
kickOwn = {},
rushOn = { min = 10 },
notEnough = { need = "100" },
doubleOwned = {},
}
for _, lang in { "ko", "en", "ja", "zh" } do
for key, args in SAMPLES do
@@ -260,6 +276,23 @@ hud.destroy()
section("꾸미기 화면(클라이언트 모듈)")
local Decorate = require(StarterPlayer.StarterPlayerScripts.Client.Decorate)
check(typeof(Decorate.build) == "function", "꾸미기 모듈")
local dstate = Instance.new("Folder")
dstate:SetAttribute("Lang", "ko")
dstate:SetAttribute("Stage", 1)
dstate:SetAttribute("Money", 100)
local dplot = Instance.new("Model")
dplot:SetAttribute("Origin", CFrame.new())
local dholder = Instance.new("Folder")
local deco = Decorate.build(dholder, dstate, dplot, function() end)
local Layout = require(StarterPlayer.StarterPlayerScripts.Client.Layout)
deco.setLayout(Layout.compute(750, 332, true, false))
local droot = deco.gui:FindFirstChild("Root") :: Frame
for _, name in { "Exit", "Info", "Rotate", "Cancel", "Place" } do
check(droot:FindFirstChild(name) ~= nil, `꾸미기 {name}`)
end
check(droot:FindFirstChild("Floor") == nil and droot:FindFirstChild("Side1") == nil, "예전 층·쪽 버튼 없음")
check(not deco.isOpen() and not deco.holding(), "처음엔 닫힘")
deco.destroy()
section("요리 창(메뉴 고르기 → 조리 과정 → 완성)")
local kstate = Instance.new("Folder")

View File

@@ -175,7 +175,7 @@ eq(owner:GetAttribute("Tut"), 2, "튜토리얼 2단계")
-- 접시가 똑바로 놓이는지(예전에 세로로 서던 문제)
local held = dyn:FindFirstChild("Dish_Tteokbokki") :: Model
check(held ~= nil, "접시 모형")
eq(c:serve(1), 15, "서빙 15원")
eq(c:serve(1), 30, "서빙 30원")
local onTable = dyn:FindFirstChild("Dish_Tteokbokki") :: Model
local up = onTable and onTable:GetPivot().UpVector
check(up and up.Y > 0.99, `테이블 위 접시가 똑바로 놓임 (UpVector.Y {up and up.Y})`)
@@ -218,11 +218,60 @@ for _ = 1, 4 do
check(c:buyTable(), "테이블 구매")
end
eq(#c.layout.tables, 5, "테이블 5")
for _ = 1, 5 do
eq(owner:GetAttribute("Seats"), 2, "테이블만 사면 의자는 그대로")
for _ = 1, 9 do
check(c:buySeat(nil), "의자 구매")
end
eq(owner:GetAttribute("Seats"), 11, "의자 11")
eq(Floor.validate(c.layout, 2), nil, "배치 검사 통과")
-- 꾸미기 화면처럼 정한 자리에 새 물건 놓기(투명 미리보기 → 놓기)
local tableAt = nil
for _, spotXZ in { { 22, -20 }, { -22, -20 }, { 22, 0 }, { -22, 0 } } do
if not tableAt and c:buyItem("table", nil, { kind = "table", x = spotXZ[1], z = spotXZ[2], f = 1 }) then
tableAt = spotXZ
end
end
check(tableAt ~= nil, "정한 자리에 테이블 놓기")
if tableAt then
local tn = #c.layout.tables
eq(c.layout.tables[tn].x, tableAt[1], "테이블 x 그대로")
check(
c:buyItem("chair", nil, { kind = "chair", x = tableAt[1], z = tableAt[2] - 3.5, f = 1, r = 0 }),
"테이블 뒤에 의자 놓기"
)
local cn = #c.layout.chairs
eq(c.layout.chairs[cn].r, 0, "의자 방향 저장")
eq(Floor.chairTable(c.layout, cn), tn, "새 의자는 새 테이블을 봄")
check(furniture:FindFirstChild("Chair" .. cn) ~= nil, "새 의자 모형")
local seatCf = PlotBuilder.seatCFrame(slots[1].cf, c.layout, cn)
local tablePos = PlotBuilder.floorCFrame(slots[1].cf, tableAt[1], tableAt[2], 1).Position
local toTable = (Vector3.new(tablePos.X, seatCf.Position.Y, tablePos.Z) - seatCf.Position).Unit
check(seatCf.LookVector:Dot(toTable) > 0.9, "앉은 손님은 테이블을 봄")
local dish = PlotBuilder.dishCFrame(slots[1].cf, c.layout, cn)
local local_ = slots[1].cf:PointToObjectSpace(dish.Position)
check(math.abs(local_.X - tableAt[1]) <= 2.5 and math.abs(local_.Z - tableAt[2]) <= 2.5, "접시는 테이블 위")
end
local seatsBefore = #c.layout.chairs
local moneyBefore = c.shop.money
check(
not c:buyItem("chair", nil, { kind = "chair", x = 0, z = 5, f = 1, r = 0 }),
"테이블 없는 곳에 의자 못 놓음"
)
eq(#c.layout.chairs, seatsBefore, "실패하면 의자 그대로")
eq(c.shop.money, moneyBefore, "실패하면 돈 안 나감")
check(noted("placeFail"), "못 놓는 이유 알림")
local teddy = false
for _, spotXZ in { { 0, 8 }, { 16, 12 }, { -16, 12 }, { 30, -20 }, { -30, -20 } } do
teddy = teddy
or c:buyItem("decor", "Teddy", { kind = "decor", k = "Teddy", x = spotXZ[1], z = spotXZ[2], f = 1, r = 2 })
end
check(teddy, "정한 자리에 곰인형")
eq(c.layout.decor[#c.layout.decor].r, 2, "소품 방향 저장")
local templates = PlotBuilder.buildTemplates()
for _, name in { "Table", "Chair", "Decor_Plant", "Decor_Fridge" } do
local tm = templates:FindFirstChild(name) :: Model?
check(tm ~= nil and tm:GetPivot().Position.Magnitude < 1e-3, `미리보기 모형 {name}(기준점 원점)`)
end
check(c:buyDecor("Plant"), "화분 구매")
check(c:buyDecor("Balloons"), "풍선 구매")
check(furniture:FindFirstChild("Decor1") ~= nil, "소품 모형")
@@ -239,18 +288,33 @@ local stallBefore = slots[1].refs.stall:GetPivot().Position
check(c:move({ kind = "stove", i = 1, x = 4, z = -28, r = 0 }), "조리대 옮기기")
check((slots[1].refs.stall:GetPivot().Position - stallBefore).Magnitude > 3, "수레 모형이 옮겨짐")
check(slots[1].refs.stove:IsDescendantOf(slots[1].refs.stall), "조리대 인스턴스는 그대로(버튼 유지)")
-- 의자 1을 빈 쪽이 있는 다른 테이블로 옮기기(테이블 1은 네 쪽이 다 찼을 수 있음)
-- 의자 1을 다른 테이블의 빈 쪽으로 옮기기
local sideMoved = false
for ti in c.layout.tables do
local from = Floor.chairTable(c.layout, 1)
for ti, tb in c.layout.tables do
for side = 1, 4 do
if not sideMoved and ti ~= c.layout.chairs[1].t then
sideMoved = c:move({ kind = "chair", i = 1, x = side, z = ti })
if not sideMoved and ti ~= from then
local at = Floor.chairAt(tb, side)
sideMoved = c:move({ kind = "chair", i = 1, x = at.x, z = at.z, f = at.f, r = at.r })
end
end
end
check(sideMoved, "의자를 다른 테이블·다른 쪽으로 옮기기")
-- 테이블을 옮기면 그 테이블을 보는 의자도 같이
local tIndex = Floor.chairTable(c.layout, 1) :: number
local tb0 = c.layout.tables[tIndex]
local ch0 = c.layout.chairs[1]
local movedWith = false
for _, d in { { 0, -4 }, { 0, 4 }, { 4, 0 }, { -4, 0 }, { 6, 6 }, { -6, -6 } } do
if not movedWith and c:move({ kind = "table", i = tIndex, x = tb0.x + d[1], z = tb0.z + d[2], f = tb0.f }) then
movedWith = true
eq(c.layout.chairs[1].x, ch0.x + d[1], "의자도 같이 옮겨짐")
end
end
check(movedWith, "의자 붙은 테이블 옮기기")
c.shop.money = 0
check(not c:buyTable(), "돈 모자라면 테이블 못 삼")
check(not c:buyItem("chair", nil, { kind = "chair", x = 0, z = 0, f = 1, r = 0 }), "돈 모자라면 의자 못 놓음")
check(noted("notEnough"), "모자란 돈 알림")
c:addMoney(1_000_000)
@@ -301,9 +365,10 @@ end
check(#c.layout.tables > before2, "테이블 늘어남")
check(on2 ~= nil, "2층에 테이블")
if on2 then
check(c:buySeat(on2), "2층 테이블에 의자")
local chair2 = nil
for ci, ch in c.layout.chairs do
if ch.t == on2 then
for ci in c.layout.chairs do
if Floor.chairTable(c.layout, ci) == on2 then
chair2 = ci
end
end
@@ -349,7 +414,7 @@ end
local served = c.shop.served - served0
print(`5분 영업(알바만): 서빙 {served}회, 돈 {c.shop.money - money0}`)
check(delivered, "서빙 알바가 접시를 들고 감")
check(served > 20, "알바만으로 5분 동안 20회 넘게 서빙")
check(served > 12, "알바만으로 5분 동안 12회 넘게 서빙(손님 간격 20초 기준)")
check(c.shop.money > money0, "시급을 내고도 돈이 늘어남")
task.wait(Economy.WALK_IN + 2)
check(count_(dyn, "Customer") <= Economy.seatCap(3) + 6, "손님 NPC가 쌓이지 않음")