feat(bunsik): 손님 외형 다양화 — 로블록스 공식 머리·모자·옷·얼굴 조합(사람 75%), 공식 동물 번들 11종(펭귄·곰·북극곰·고양이·강아지·판다·여우·쥐 등, 25%)
- NpcLooks: 확인된 아이템 표(assets/npc_assets.md), 서버 시작 때 외형 템플릿을 만들어 두고 복제 - 화면 UI 통합 테스트를 새 화면에 맞게 다시 씀(서버 로직은 tests/cloud/server.luau) - GUI 미리보기를 장면 6개씩 나눠 뽑기(5분 제한·4MB 출력 제한) - 서버 통합 테스트 1416개, 화면 통합 테스트 379개 통과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BIN
bunsik-tycoon/assets/npc_animals.rbxm
Normal file
BIN
bunsik-tycoon/assets/npc_animals.rbxm
Normal file
Binary file not shown.
253
bunsik-tycoon/assets/npc_assets.md
Normal file
253
bunsik-tycoon/assets/npc_assets.md
Normal file
@@ -0,0 +1,253 @@
|
||||
# 손님 NPC 외형 에셋 (2026-10-14 확인)
|
||||
|
||||
결론: **Option A(HumanoidDescription)로 충분합니다.** 사람·동물 모두 R15 그대로라 기존 걷기·대기·앉기 애니메이션을 같이 씁니다.
|
||||
Option B(Creator Store 동물 모델)는 Luau Execution에서 남의 모델을 불러올 권한이 없어 막혔습니다(아래 참고). 직접 Part로 동물을 만들 필요는 없습니다.
|
||||
|
||||
## 확인 방법
|
||||
|
||||
- 확인 스크립트: `python3 tools/cloud.py run tools/npc_verify_avatars.luau --out assets/npc_animals.rbxm`
|
||||
(로블록스 서버, 최근 저장 버전에서 `Players:CreateHumanoidModelFromDescription(desc, Enum.HumanoidRigType.R15)`)
|
||||
- 아래 표의 아이템 73개를 하나씩 기본 몸에 붙여 봄: **73개 모두 적용**(장신구·Shirt·Pants 생성, Head 메시 교체 확인)
|
||||
- 사람 무작위 조합 6개 + 동물 프리셋 11개 = **17개 모두 생성 성공**. 각 모델: R15 관절 15개 이름 모두 있음, 스크립트 0개(Animate 제거 뒤), 높이 4.8~6.3, HipHeight 1.92~2.19
|
||||
- 애니메이션 3개(walk 507777826 / idle 507766388 / sit 2506281703)가 모든 모델의 Animator에서 로드됨(Length 0.67 / 3.77 / 0.92, IsPlaying true)
|
||||
- 관절은 새 아바타 관절(`AnimationConstraint`, `IsKinematic=true`)입니다. Luau Execution은 시뮬레이션을 돌리지 않아(`RunService:IsRunning()=false`, 떨어지는 블록도 그대로) **관절이 실제로 움직이는지는 서버 실행으로 확인 못 함** → Studio 플레이 테스트에서 한 번 눈으로 확인하세요. 몸 모양만 바꾼 R15라 일반 아바타와 같은 조건입니다.
|
||||
- 아이템 소유는 필요 없음: 유료 아이템(예: Pink Pigtails, Unicorn Beanie)도 서버에서 그대로 붙습니다.
|
||||
- 모든 ID는 로블록스 제작(Creator Id 1)입니다. `MarketplaceService:GetProductInfo`와 카탈로그 검색(`CreatorTargetId=1`)으로 확인했습니다.
|
||||
|
||||
## 중요 발견
|
||||
|
||||
1. **클래식 얼굴(`Face` 속성)은 이제 안 보입니다.** 기본 머리가 얼굴이 그려진 다이내믹 헤드라서, `Face = 144075659`(Smile)를 넣어도 머리 텍스처가 그대로이고 Decal도 생기지 않습니다. 얼굴을 바꾸려면 `Head`에 다이내믹 헤드 ID를 넣으세요(`FACE_HEADS`). 피부색은 `HeadColor` 등 description 색으로 줍니다.
|
||||
2. 장신구는 `Handle.AccessoryRigidConstraint`로 붙습니다(Weld 아님). 위치는 모델을 Workspace에 넣고 한 프레임(Heartbeat) 지나야 맞춰집니다.
|
||||
3. 동물 머리 모자 중 Beary Cute(28998435)·Cute Fox(61773267)는 머리 **위에** 얹히는 모양입니다(아랫면이 머리 아래보다 0.93 위). `HatAttachment.Position`을 그만큼 올리고 `Humanoid:AddAccessory`로 다시 붙이면 목 위치로 내려갑니다(확인: 차이 0.93 → 0). 다른 동물 머리는 처음부터 머리 전체를 덮습니다(차이 −0.09~0.15).
|
||||
4. 모델 안에 플레이어용 `Animate` LocalScript가 들어 있습니다. 서버 NPC에서는 돌지 않으니 지우면 됩니다.
|
||||
5. 지금 `Npc.luau`의 `colorize`는 부위 이름으로 색을 덮어씁니다. 동물 몸(텍스처가 있는 메시)과 옷 입은 사람에게는 쓰지 말고, 색은 description의 `*Color`로만 주세요.
|
||||
6. 생성 시간: 처음 1개 약 1초, 그다음은 0.02~0.35초. 서버 시작 때 종류별 템플릿을 만들어 두고 `Clone`하는 지금 방식이 맞습니다.
|
||||
|
||||
## Luau 데이터 표
|
||||
|
||||
```luau
|
||||
-- 사람: 로블록스 제작 머리카락(HairAccessory, 문자열로 넣음). 7193…/9244…는 레이어드 머리카락(자동으로 머리에 맞춰짐)
|
||||
local HAIR = {
|
||||
63690008, -- Pal Hair
|
||||
451221329, -- True Blue Hair
|
||||
376526888, -- Straight Blonde Hair
|
||||
376524487, -- Blonde Spiked Hair
|
||||
376548738, -- Brown Charmer Hair
|
||||
376527350, -- Black Ponytail
|
||||
451220849, -- Lavender Updo
|
||||
62234425, -- Brown Hair
|
||||
2956239660, -- Belle Of Belfast Long Red Hair
|
||||
3814476174, -- Colorful Braids
|
||||
24910539, -- Pink Pigtails
|
||||
7193442167, -- Pony Tail - Black
|
||||
9244095135, -- Pony Tail - Blonde
|
||||
6993754725, -- Straight Bangs - Black
|
||||
7193448258, -- Wavy Middle Part - Brown
|
||||
9243987340, -- Short and Sleek - Blonde
|
||||
7193450455, -- Curly Afro - Black
|
||||
7193452166, -- Short Curls - Black
|
||||
9244148336, -- Braided Hair - Blonde
|
||||
430063008, -- Strawberry Ice Cream Hair
|
||||
727320877, -- Long Pastel Hair
|
||||
}
|
||||
-- 어린이용 귀여운 모자(HatAccessory, 35% 정도만 씌우기 추천)
|
||||
local HATS = {
|
||||
1028606, -- Red Baseball Cap
|
||||
607702162, -- Roblox Baseball Cap
|
||||
321570512, -- Chill Cap
|
||||
10911990, -- Propeller Beanie
|
||||
67291394, -- Unicorn Beanie
|
||||
3756496643, -- Pizza Time Cap
|
||||
100932329, -- Pink Flower Crown
|
||||
150337770, -- Spring Crown of Flowers
|
||||
118280079, -- Narwhal Beanie
|
||||
215724779, -- Robot Beanie
|
||||
116778296, -- Wide-brimmed Straw Cap
|
||||
833771553, -- Starbling Beanie
|
||||
3756447657, -- Lil' Kitty Cap
|
||||
439943629, -- Sleepy Mouse Cap
|
||||
1536057124, -- Spring Bunny Headband
|
||||
}
|
||||
-- 클래식 옷(Shirt / Pants), 모두 무료
|
||||
local SHIRTS = {
|
||||
144076358, -- Blue and Black Motorcycle Shirt
|
||||
607785314, -- ROBLOX Jacket
|
||||
398633584, -- Denim Jacket with White Hoodie
|
||||
144076436, -- Grey Striped Shirt with Denim Jacket
|
||||
398634295, -- Pastel Starburst Top with Gray Jacket
|
||||
3670737444, -- Roblox Shirt - Simple Pattern
|
||||
382538059, -- Green Jersey
|
||||
398635081, -- Blue Plaid Shirt
|
||||
382537702, -- Teal Shirt
|
||||
382537085, -- I <3 Pizza Shirt
|
||||
382538295, -- Guitar Tee with Black Jacket
|
||||
4047884939, -- My Favorite Pizza Shirt
|
||||
4047884046, -- Guitar Tee with Black Jacket
|
||||
4047886060, -- Purple and Teal Top
|
||||
}
|
||||
local PANTS = {
|
||||
144076760, -- Dark Green Jeans
|
||||
398634487, -- Beautiful You Jeans
|
||||
398633812, -- Black Jeans with White Shoes
|
||||
398635338, -- Ripped Skater Pants
|
||||
382537806, -- Jean Shorts
|
||||
382538503, -- Black Jeans with Sneakers
|
||||
382537569, -- Black Jeans
|
||||
382537950, -- Jean Shorts with White Shoes
|
||||
}
|
||||
-- 얼굴 = 다이내믹 헤드(Head). 앞 7개 무료, 뒤 8개 유료(소유 불필요)
|
||||
local FACE_HEADS = {
|
||||
10725626210, -- Woman Face
|
||||
10725826963, -- Man Face
|
||||
11308945948, -- Check It
|
||||
15938951781, -- Silly Fun
|
||||
10687288296, -- Dylan Default
|
||||
10638267973, -- Stevie Standard
|
||||
10723855306, -- Devon Default
|
||||
13692975981, -- Friendly Smile
|
||||
11163789916, -- The Winning Smile
|
||||
12954264879, -- Joyful Smile
|
||||
13682064263, -- Happy :D
|
||||
130433936882245, -- Super Super Happy Face
|
||||
11159990982, -- Classic Female Face
|
||||
11180212350, -- Classic Male Face
|
||||
16042049101, -- Happy Wink
|
||||
}
|
||||
|
||||
-- 동물: body = {Torso, LeftArm, RightArm, LeftLeg, RightLeg}, colors = {Head, Torso, LeftArm, RightArm, LeftLeg, RightLeg}
|
||||
-- hideHead: 동물 머리 모자가 사람 머리를 다 덮으므로 Head를 투명하게. lowerHat: 모자를 목까지 내림(위 3번)
|
||||
local function rgb(r, g, b) return Color3.fromRGB(r, g, b) end
|
||||
local W, G = rgb(245, 245, 245), rgb(163, 162, 165)
|
||||
local ANIMALS = {
|
||||
-- 공식 번들 몸(Penguin 284) + Tokyokhaos Penguin 머리
|
||||
{ name = "Penguin", body = { 46358991, 46359095, 46359040, 46359181, 46359241 }, hat = "15967866", colors = { W, W, W, W, W, W }, hideHead = true },
|
||||
-- 공식 번들 몸(Bear Suit 309) + Beary Cute 머리
|
||||
{ name = "Bear", body = { 27132957, 27133013, 27132990, 27133040, 27133055 }, hat = "28998435", lowerHat = true, hideHead = true,
|
||||
colors = { rgb(160, 110, 80), rgb(160, 110, 80), rgb(110, 75, 55), rgb(110, 75, 55), rgb(110, 75, 55), rgb(110, 75, 55) } },
|
||||
-- 공식 번들 그대로(Polar Bear 195)
|
||||
{ name = "PolarBear", body = { 137715759, 137715036, 137715073, 137715120, 137715151 }, hat = "137714793", hideHead = true,
|
||||
colors = { rgb(248, 248, 248), rgb(248, 248, 248), rgb(248, 248, 248), rgb(248, 248, 248), rgb(248, 248, 248), rgb(248, 248, 248) } },
|
||||
-- 공식 번들 그대로(Blue Collar Cat 182)
|
||||
{ name = "Cat", body = { 146176562, 146176342, 146176447, 146176406, 146176511 }, hat = "146176716", colors = { G, G, G, G, G, G }, hideHead = true },
|
||||
-- 공식 번들 그대로(White Collar Dog 11)
|
||||
{ name = "Dog", body = { 1796148633, 1796137813, 1796141971, 1796143895, 1796146180 }, hat = "1796135151", colors = { G, G, G, G, G, G }, hideHead = true },
|
||||
-- Bear Suit 몸을 흑백으로 + Panda 머리(27369187)
|
||||
{ name = "Panda", body = { 27132957, 27133013, 27132990, 27133040, 27133055 }, hat = "27369187", hideHead = true,
|
||||
colors = { rgb(242, 242, 242), rgb(242, 242, 242), rgb(30, 30, 30), rgb(30, 30, 30), rgb(30, 30, 30), rgb(30, 30, 30) } },
|
||||
-- 기본 몸 + Cute Fox 머리 + 주황 꼬리 + 옷
|
||||
{ name = "Fox", hat = "61773267", lowerHat = true, tail = "187846604", shirt = 382537702, pants = 382537806, hideHead = true,
|
||||
colors = { rgb(235, 120, 40), rgb(235, 120, 40), rgb(235, 120, 40), rgb(235, 120, 40), rgb(250, 240, 230), rgb(250, 240, 230) } },
|
||||
-- 기본 몸 + Sleepy Mouse Cap(머리 전체) + 옷
|
||||
{ name = "Mouse", hat = "439943629", shirt = 398635081, pants = 144076760, hideHead = true,
|
||||
colors = { rgb(170, 185, 215), rgb(170, 185, 215), rgb(170, 185, 215), rgb(170, 185, 215), rgb(170, 185, 215), rgb(170, 185, 215) } },
|
||||
-- "동물 분장 사람" 가벼운 버전: 동물 얼굴 다이내믹 헤드 + 귀 + 꼬리 + 옷(사람 얼굴 모양이라 동물 느낌은 약함)
|
||||
{ name = "Bunny", head = 119665103921086, ears = "1080949", tail = "738679517", shirt = 4047886060, pants = 382537950, colors = { W, W, W, W, W, W } },
|
||||
{ name = "Kitty", head = 82082995456115, ears = "1374269", tail = "187846604", shirt = 382537085, pants = 398634487,
|
||||
colors = { rgb(250, 200, 140), rgb(250, 200, 140), rgb(250, 200, 140), rgb(250, 200, 140), rgb(250, 200, 140), rgb(250, 200, 140) } },
|
||||
{ name = "Puppy", head = 138526270057654, ears = "11142487", shirt = 144076436, pants = 382538503,
|
||||
colors = { rgb(220, 180, 130), rgb(220, 180, 130), rgb(220, 180, 130), rgb(220, 180, 130), rgb(220, 180, 130), rgb(220, 180, 130) } },
|
||||
}
|
||||
local SKIN = { rgb(255, 220, 190), rgb(240, 200, 160), rgb(205, 160, 120), rgb(150, 105, 75) }
|
||||
```
|
||||
|
||||
추천 비율: 사람 75%, 동물 25%(Penguin·Bear·PolarBear·Cat·Dog·Panda·Fox·Mouse를 주로, Bunny·Kitty·Puppy는 가끔).
|
||||
|
||||
빼 둔 후보(이유): Panda Monk 371·Grizzly Warrior 370·Guardian Lion 599(전사·무서운 얼굴), Fancy Mr. Fox 404(Rthro라 키가 큼, HipHeight 2.81~3.29), Cute Kitty·Spring Bunny·Puppy·Raccoon·Lion 다이내믹 헤드는 회색 사람 머리에 수염만 그린 모양이라 단독 동물로는 약함, 남이 만든 UGC 미니 번들(내려갈 수 있고 SurfaceAppearance 포함).
|
||||
|
||||
## 불러오는 코드 (서버에서 확인한 순서 그대로)
|
||||
|
||||
```luau
|
||||
local Players = game:GetService("Players")
|
||||
local RunService = game:GetService("RunService")
|
||||
|
||||
local function setColors(d: HumanoidDescription, c: { Color3 })
|
||||
d.HeadColor, d.TorsoColor, d.LeftArmColor, d.RightArmColor, d.LeftLegColor, d.RightLegColor = c[1], c[2], c[3], c[4], c[5], c[6]
|
||||
end
|
||||
|
||||
local function humanDesc(rng: Random): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
d.HairAccessory = tostring(HAIR[rng:NextInteger(1, #HAIR)])
|
||||
if rng:NextNumber() < 0.35 then
|
||||
d.HatAccessory = tostring(HATS[rng:NextInteger(1, #HATS)])
|
||||
end
|
||||
d.Shirt = SHIRTS[rng:NextInteger(1, #SHIRTS)]
|
||||
d.Pants = PANTS[rng:NextInteger(1, #PANTS)]
|
||||
d.Head = FACE_HEADS[rng:NextInteger(1, #FACE_HEADS)]
|
||||
local s = SKIN[rng:NextInteger(1, #SKIN)]
|
||||
setColors(d, { s, s, s, s, s, s })
|
||||
local h = 0.85 + rng:NextNumber() * 0.15 -- 어린이~어른 키
|
||||
d.HeightScale, d.WidthScale, d.DepthScale, d.HeadScale = h, 0.9, 0.9, 1
|
||||
return d
|
||||
end
|
||||
|
||||
local function animalDesc(a): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
if a.body then
|
||||
d.Torso, d.LeftArm, d.RightArm, d.LeftLeg, d.RightLeg = a.body[1], a.body[2], a.body[3], a.body[4], a.body[5]
|
||||
end
|
||||
if a.head then
|
||||
d.Head = a.head
|
||||
end
|
||||
d.HatAccessory = a.hat or a.ears or ""
|
||||
d.WaistAccessory = a.tail or ""
|
||||
d.Shirt = a.shirt or 0
|
||||
d.Pants = a.pants or 0
|
||||
setColors(d, a.colors)
|
||||
return d
|
||||
end
|
||||
|
||||
-- 템플릿 하나 만들기(서버 시작 때 종류마다 1번). 실패하면 nil → 기존 블록 NPC로 대신.
|
||||
local function buildTemplate(d: HumanoidDescription, a): Model?
|
||||
local ok, m = pcall(Players.CreateHumanoidModelFromDescription, Players, d, Enum.HumanoidRigType.R15)
|
||||
if not ok then
|
||||
warn("[Bunsik] NPC 외형 생성 실패", m)
|
||||
return nil
|
||||
end
|
||||
local animate = m:FindFirstChild("Animate")
|
||||
if animate then
|
||||
animate:Destroy()
|
||||
end
|
||||
m:PivotTo(CFrame.new(0, 500, 0)) -- 맵 밖 높은 곳(아래쪽은 FallenPartsDestroyHeight에 걸릴 수 있음)
|
||||
local root = m:FindFirstChild("HumanoidRootPart") :: BasePart
|
||||
root.Anchored = true
|
||||
m.Parent = workspace -- 장신구 위치가 맞춰지려면 Workspace 안에서 한 프레임 필요
|
||||
RunService.Heartbeat:Wait()
|
||||
if a then
|
||||
local head = m:FindFirstChild("Head") :: BasePart
|
||||
local hum = m:FindFirstChildOfClass("Humanoid") :: Humanoid
|
||||
if a.lowerHat then
|
||||
for _, acc in m:GetChildren() do
|
||||
if acc:IsA("Accessory") and acc.AccessoryType == Enum.AccessoryType.Hat then
|
||||
local h = acc:FindFirstChild("Handle") :: BasePart
|
||||
local att = h:FindFirstChild("HatAttachment") :: Attachment?
|
||||
local drop = (h.Position.Y - h.Size.Y / 2) - (head.Position.Y - head.Size.Y / 2)
|
||||
if att and drop > 0.1 then
|
||||
att.Position += Vector3.new(0, drop, 0)
|
||||
acc.Parent = nil
|
||||
hum:AddAccessory(acc) -- 다시 붙여야 바로 반영됨
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if a.hideHead then
|
||||
head.Transparency = 1
|
||||
end
|
||||
end
|
||||
m.Parent = nil
|
||||
return m
|
||||
end
|
||||
-- 이후: template:Clone() → (colorize 하지 말 것) → 지금 Npc.spawn 의 고정·트윈·Animator 처리 그대로
|
||||
```
|
||||
|
||||
## Option B (Creator Store 동물 모델) 결과
|
||||
|
||||
- `AssetService:LoadAssetAsync`, `InsertService:LoadAsset` 둘 다 남이 만든 무료 모델 12개(Low Poly Dog/Panda, Cute Penguin, Animal Pack 등)에서 `User is not authorized to access Asset.` 로블록스가 만든 에셋(1374269 Kitty Ears)은 둘 다 성공.
|
||||
- DECISIONS.md 0-1에 적힌 `AllowInsertFreeAssets`는 스크립트에서 `Workspace`의 멤버가 아닙니다(읽기·쓰기 모두 오류). 그래서 Luau Execution으로 남의 무료 모델을 가져오는 길은 지금 막혀 있습니다. 게임 주인 계정이 Toolbox에서 그 모델을 먼저 받아 두면 될 수도 있지만 확인하지 않았습니다.
|
||||
- 대신 **.rbxm 내보내기는 됩니다.** `SerializationService:SerializeInstancesAsync({ ... })`로 buffer를 만들고 스크립트가 `return { BinaryOutput = buf, ReturnValues = { ... } }`를 돌려주면 `cloud.py run … --out 파일`로 받습니다(다른 값을 함께 return하면 "Script must return exactly one table" 오류).
|
||||
- `assets/npc_animals.rbxm`(199 KB, `<roblox!` 바이너리): 위 동물 프리셋 11개 + 사람 예시 1개, 모두 Anchored 해제·Animate 제거 상태. 같은 실행 안에서 `DeserializeInstancesAsync`로 다시 읽어 12개를 확인했습니다. 게임은 실행 중에 HumanoidDescription으로 만들면 되니 필수는 아니고, 아바타 서비스가 실패할 때 쓸 예비본이나 Studio 미리보기용입니다.
|
||||
|
||||
## 도구
|
||||
|
||||
- `tools/npc_search.py` — Creator Store 검색, 카탈로그(로블록스 제작) 검색, 번들 구성품 보기(공개 API)
|
||||
- `tools/npc_verify_avatars.luau` — 위 표 전체 확인 + `npc_animals.rbxm` 내보내기
|
||||
- `tools/npc_inspect_models.luau` — Option B 모델 조사(지금은 권한 오류로 막힘)
|
||||
@@ -682,7 +682,10 @@ end
|
||||
|
||||
function Game.start()
|
||||
slots = World.build()
|
||||
task.spawn(Npc.preload)
|
||||
task.spawn(function()
|
||||
Npc.preload()
|
||||
Npc.preloadCustomers()
|
||||
end)
|
||||
for _, slot in slots do
|
||||
openNeighbor(slot)
|
||||
end
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
-- 물리로 걷게 하면 테이블에 걸리거나 늦게 도착하므로, 몸을 고정(Anchored)하고 트윈으로 옮깁니다.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local RunService = game:GetService("RunService")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
local NpcLooks = require(script.Parent.NpcLooks)
|
||||
|
||||
local Npc = {}
|
||||
|
||||
local ANIM: { [string]: string } = {
|
||||
@@ -132,13 +135,8 @@ export type Handle = {
|
||||
tween: Tween?,
|
||||
}
|
||||
|
||||
function Npc.spawn(parent: Instance, cf: CFrame, rng: Random, shirt: Color3?): Handle
|
||||
if not template then
|
||||
Npc.preload()
|
||||
end
|
||||
local m = (template :: Model):Clone()
|
||||
m.Name = "Customer"
|
||||
colorize(m, rng, shirt)
|
||||
-- 복제한 모형을 NPC로 준비합니다(충돌 끄기, 고정, 애니메이션).
|
||||
local function setup(m: Model, parent: Instance, cf: CFrame): Handle
|
||||
local root = m:FindFirstChild("HumanoidRootPart") :: BasePart
|
||||
for _, p in m:GetDescendants() do
|
||||
if p:IsA("BasePart") then
|
||||
@@ -174,9 +172,125 @@ function Npc.spawn(parent: Instance, cf: CFrame, rng: Random, shirt: Color3?): H
|
||||
return h
|
||||
end
|
||||
|
||||
-- 손님 NPC(외형을 여러 가지로). 지금은 색만 바꾼 기본 아바타.
|
||||
-- 알바생·사장님: 기본 몸에 색 옷
|
||||
function Npc.spawn(parent: Instance, cf: CFrame, rng: Random, shirt: Color3?): Handle
|
||||
if not template then
|
||||
Npc.preload()
|
||||
end
|
||||
local m = (template :: Model):Clone()
|
||||
m.Name = "Customer"
|
||||
colorize(m, rng, shirt)
|
||||
return setup(m, parent, cf)
|
||||
end
|
||||
|
||||
-- 손님 외형 템플릿(서버 시작 때 만들어 두고 복제). 사람은 무작위 조합 여러 벌, 동물은 프리셋마다 한 벌.
|
||||
local humanTemplates: { Model } = {}
|
||||
local animalTemplates: { { model: Model, rare: boolean } } = {}
|
||||
local looksLoading = false
|
||||
local HUMAN_VARIANTS = 12
|
||||
|
||||
local function buildLook(desc: HumanoidDescription, a: NpcLooks.Animal?): Model?
|
||||
local ok, m = pcall(function()
|
||||
return Players:CreateHumanoidModelFromDescription(desc, Enum.HumanoidRigType.R15)
|
||||
end)
|
||||
if not ok or not m then
|
||||
warn("[Bunsik] 손님 외형 생성 실패:", m)
|
||||
return nil
|
||||
end
|
||||
local model = m :: Model
|
||||
local animate = model:FindFirstChild("Animate")
|
||||
if animate then
|
||||
animate:Destroy()
|
||||
end
|
||||
local root = model:FindFirstChild("HumanoidRootPart") :: BasePart?
|
||||
if not root then
|
||||
return nil
|
||||
end
|
||||
root.Anchored = true
|
||||
model:PivotTo(CFrame.new(0, 500, 0)) -- 맵 밖 높은 곳
|
||||
model.Parent = workspace -- 장신구 위치가 맞춰지려면 Workspace 안에서 한 프레임 필요
|
||||
RunService.Heartbeat:Wait()
|
||||
if a then
|
||||
local head = model:FindFirstChild("Head") :: BasePart?
|
||||
local hum = model:FindFirstChildOfClass("Humanoid")
|
||||
if a.lowerHat and head and hum then
|
||||
-- 머리 위에 얹히는 동물 머리 모자를 목까지 내립니다.
|
||||
for _, acc in model:GetChildren() do
|
||||
if acc:IsA("Accessory") and acc.AccessoryType == Enum.AccessoryType.Hat then
|
||||
local h = acc:FindFirstChild("Handle") :: BasePart?
|
||||
local att = h and h:FindFirstChild("HatAttachment") :: Attachment?
|
||||
if h and att then
|
||||
local drop = (h.Position.Y - h.Size.Y / 2) - (head.Position.Y - head.Size.Y / 2)
|
||||
if drop > 0.1 then
|
||||
att.Position += Vector3.new(0, drop, 0)
|
||||
acc.Parent = nil
|
||||
hum:AddAccessory(acc)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if a.hideHead and head then
|
||||
head.Transparency = 1
|
||||
local face = head:FindFirstChildOfClass("Decal")
|
||||
if face then
|
||||
face:Destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
model.Parent = nil
|
||||
model.Name = "Customer"
|
||||
return model
|
||||
end
|
||||
|
||||
-- 서버 시작 때 한 번(백그라운드). 만드는 동안 온 손님은 기본 몸으로 옵니다.
|
||||
function Npc.preloadCustomers()
|
||||
if looksLoading or #humanTemplates > 0 then
|
||||
return
|
||||
end
|
||||
looksLoading = true
|
||||
local rng = Random.new(20261014)
|
||||
for _ = 1, HUMAN_VARIANTS do
|
||||
local m = buildLook(NpcLooks.human(rng), nil)
|
||||
if m then
|
||||
table.insert(humanTemplates, m)
|
||||
end
|
||||
end
|
||||
for _, a in NpcLooks.ANIMALS do
|
||||
local m = buildLook(NpcLooks.animal(a), a)
|
||||
if m then
|
||||
m:SetAttribute("Animal", a.name)
|
||||
table.insert(animalTemplates, { model = m, rare = a.rare == true })
|
||||
end
|
||||
end
|
||||
looksLoading = false
|
||||
end
|
||||
|
||||
function Npc.lookCount(): (number, number)
|
||||
return #humanTemplates, #animalTemplates
|
||||
end
|
||||
|
||||
-- 손님 NPC: 사람이 가장 많이(75%), 가끔 동물(동물 분장 사람은 더 드물게)
|
||||
function Npc.spawnCustomer(parent: Instance, cf: CFrame, rng: Random): Handle
|
||||
return Npc.spawn(parent, cf, rng)
|
||||
local chosen: Model? = nil
|
||||
if #animalTemplates > 0 and rng:NextNumber() < NpcLooks.ANIMAL_CHANCE then
|
||||
local list = {}
|
||||
for _, t in animalTemplates do
|
||||
if not t.rare or rng:NextNumber() < 0.4 then
|
||||
table.insert(list, t.model)
|
||||
end
|
||||
end
|
||||
if #list > 0 then
|
||||
chosen = list[rng:NextInteger(1, #list)]
|
||||
end
|
||||
end
|
||||
if not chosen and #humanTemplates > 0 then
|
||||
chosen = humanTemplates[rng:NextInteger(1, #humanTemplates)]
|
||||
end
|
||||
if not chosen then
|
||||
return Npc.spawn(parent, cf, rng)
|
||||
end
|
||||
return setup((chosen :: Model):Clone(), parent, cf)
|
||||
end
|
||||
|
||||
function Npc.play(h: Handle, name: string)
|
||||
|
||||
332
bunsik-tycoon/src/server/NpcLooks.luau
Normal file
332
bunsik-tycoon/src/server/NpcLooks.luau
Normal file
@@ -0,0 +1,332 @@
|
||||
--!strict
|
||||
-- 손님 외형: 로블록스가 만든 옷·머리·얼굴 아이템과 동물 번들(모두 Creator Id 1, 2026-10-14 서버에서 확인).
|
||||
-- 사람은 무작위 조합, 동물은 정해 둔 프리셋입니다. 모두 R15라 걷기·앉기 애니메이션을 그대로 씁니다.
|
||||
-- 조사 기록: assets/npc_assets.md (도구: tools/npc_verify_avatars.luau)
|
||||
|
||||
local NpcLooks = {}
|
||||
|
||||
NpcLooks.ANIMAL_CHANCE = 0.25 -- 사람이 가장 많이(75%), 동물 손님은 가끔
|
||||
|
||||
-- 사람: 로블록스 제작 머리카락(HairAccessory, 문자열로 넣음). 7193…/9244…는 레이어드 머리카락(자동으로 머리에 맞춰짐)
|
||||
NpcLooks.HAIR = {
|
||||
63690008, -- Pal Hair
|
||||
451221329, -- True Blue Hair
|
||||
376526888, -- Straight Blonde Hair
|
||||
376524487, -- Blonde Spiked Hair
|
||||
376548738, -- Brown Charmer Hair
|
||||
376527350, -- Black Ponytail
|
||||
451220849, -- Lavender Updo
|
||||
62234425, -- Brown Hair
|
||||
2956239660, -- Belle Of Belfast Long Red Hair
|
||||
3814476174, -- Colorful Braids
|
||||
24910539, -- Pink Pigtails
|
||||
7193442167, -- Pony Tail - Black
|
||||
9244095135, -- Pony Tail - Blonde
|
||||
6993754725, -- Straight Bangs - Black
|
||||
7193448258, -- Wavy Middle Part - Brown
|
||||
9243987340, -- Short and Sleek - Blonde
|
||||
7193450455, -- Curly Afro - Black
|
||||
7193452166, -- Short Curls - Black
|
||||
9244148336, -- Braided Hair - Blonde
|
||||
430063008, -- Strawberry Ice Cream Hair
|
||||
727320877, -- Long Pastel Hair
|
||||
}
|
||||
-- 어린이용 귀여운 모자(HatAccessory, 35% 정도만 씌우기 추천)
|
||||
NpcLooks.HATS = {
|
||||
1028606, -- Red Baseball Cap
|
||||
607702162, -- Roblox Baseball Cap
|
||||
321570512, -- Chill Cap
|
||||
10911990, -- Propeller Beanie
|
||||
67291394, -- Unicorn Beanie
|
||||
3756496643, -- Pizza Time Cap
|
||||
100932329, -- Pink Flower Crown
|
||||
150337770, -- Spring Crown of Flowers
|
||||
118280079, -- Narwhal Beanie
|
||||
215724779, -- Robot Beanie
|
||||
116778296, -- Wide-brimmed Straw Cap
|
||||
833771553, -- Starbling Beanie
|
||||
3756447657, -- Lil' Kitty Cap
|
||||
439943629, -- Sleepy Mouse Cap
|
||||
1536057124, -- Spring Bunny Headband
|
||||
}
|
||||
-- 클래식 옷(Shirt / Pants), 모두 무료
|
||||
NpcLooks.SHIRTS = {
|
||||
144076358, -- Blue and Black Motorcycle Shirt
|
||||
607785314, -- ROBLOX Jacket
|
||||
398633584, -- Denim Jacket with White Hoodie
|
||||
144076436, -- Grey Striped Shirt with Denim Jacket
|
||||
398634295, -- Pastel Starburst Top with Gray Jacket
|
||||
3670737444, -- Roblox Shirt - Simple Pattern
|
||||
382538059, -- Green Jersey
|
||||
398635081, -- Blue Plaid Shirt
|
||||
382537702, -- Teal Shirt
|
||||
382537085, -- I <3 Pizza Shirt
|
||||
382538295, -- Guitar Tee with Black Jacket
|
||||
4047884939, -- My Favorite Pizza Shirt
|
||||
4047884046, -- Guitar Tee with Black Jacket
|
||||
4047886060, -- Purple and Teal Top
|
||||
}
|
||||
NpcLooks.PANTS = {
|
||||
144076760, -- Dark Green Jeans
|
||||
398634487, -- Beautiful You Jeans
|
||||
398633812, -- Black Jeans with White Shoes
|
||||
398635338, -- Ripped Skater Pants
|
||||
382537806, -- Jean Shorts
|
||||
382538503, -- Black Jeans with Sneakers
|
||||
382537569, -- Black Jeans
|
||||
382537950, -- Jean Shorts with White Shoes
|
||||
}
|
||||
-- 얼굴 = 다이내믹 헤드(Head). 앞 7개 무료, 뒤 8개 유료(소유 불필요)
|
||||
NpcLooks.FACE_HEADS = {
|
||||
10725626210, -- Woman Face
|
||||
10725826963, -- Man Face
|
||||
11308945948, -- Check It
|
||||
15938951781, -- Silly Fun
|
||||
10687288296, -- Dylan Default
|
||||
10638267973, -- Stevie Standard
|
||||
10723855306, -- Devon Default
|
||||
13692975981, -- Friendly Smile
|
||||
11163789916, -- The Winning Smile
|
||||
12954264879, -- Joyful Smile
|
||||
13682064263, -- Happy :D
|
||||
130433936882245, -- Super Super Happy Face
|
||||
11159990982, -- Classic Female Face
|
||||
11180212350, -- Classic Male Face
|
||||
16042049101, -- Happy Wink
|
||||
}
|
||||
|
||||
-- 동물: body = {Torso, LeftArm, RightArm, LeftLeg, RightLeg}, colors = {Head, Torso, LeftArm, RightArm, LeftLeg, RightLeg}
|
||||
-- hideHead: 동물 머리 모자가 사람 머리를 다 덮으므로 Head를 투명하게. lowerHat: 모자를 목까지 내림(위 3번)
|
||||
local function rgb(r: number, g: number, b: number): Color3
|
||||
return Color3.fromRGB(r, g, b)
|
||||
end
|
||||
local W, G = rgb(245, 245, 245), rgb(163, 162, 165)
|
||||
-- 항목마다 필드가 달라서(luau-lsp가 한 모양으로 묶으려 함) animal()로 하나씩 Animal로 바꿉니다.
|
||||
local function animal(a: any): Animal
|
||||
return a
|
||||
end
|
||||
local ANIMALS: { Animal } = {
|
||||
-- 공식 번들 몸(Penguin 284) + Tokyokhaos Penguin 머리
|
||||
animal({
|
||||
name = "Penguin",
|
||||
body = { 46358991, 46359095, 46359040, 46359181, 46359241 },
|
||||
hat = "15967866",
|
||||
colors = { W, W, W, W, W, W },
|
||||
hideHead = true,
|
||||
}),
|
||||
-- 공식 번들 몸(Bear Suit 309) + Beary Cute 머리
|
||||
animal({
|
||||
name = "Bear",
|
||||
body = { 27132957, 27133013, 27132990, 27133040, 27133055 },
|
||||
hat = "28998435",
|
||||
lowerHat = true,
|
||||
hideHead = true,
|
||||
colors = {
|
||||
rgb(160, 110, 80),
|
||||
rgb(160, 110, 80),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
},
|
||||
}),
|
||||
-- 공식 번들 그대로(Polar Bear 195)
|
||||
animal({
|
||||
name = "PolarBear",
|
||||
body = { 137715759, 137715036, 137715073, 137715120, 137715151 },
|
||||
hat = "137714793",
|
||||
hideHead = true,
|
||||
colors = {
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
},
|
||||
}),
|
||||
-- 공식 번들 그대로(Blue Collar Cat 182)
|
||||
animal({
|
||||
name = "Cat",
|
||||
body = { 146176562, 146176342, 146176447, 146176406, 146176511 },
|
||||
hat = "146176716",
|
||||
colors = { G, G, G, G, G, G },
|
||||
hideHead = true,
|
||||
}),
|
||||
-- 공식 번들 그대로(White Collar Dog 11)
|
||||
animal({
|
||||
name = "Dog",
|
||||
body = { 1796148633, 1796137813, 1796141971, 1796143895, 1796146180 },
|
||||
hat = "1796135151",
|
||||
colors = { G, G, G, G, G, G },
|
||||
hideHead = true,
|
||||
}),
|
||||
-- Bear Suit 몸을 흑백으로 + Panda 머리(27369187)
|
||||
animal({
|
||||
name = "Panda",
|
||||
body = { 27132957, 27133013, 27132990, 27133040, 27133055 },
|
||||
hat = "27369187",
|
||||
hideHead = true,
|
||||
colors = {
|
||||
rgb(242, 242, 242),
|
||||
rgb(242, 242, 242),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
},
|
||||
}),
|
||||
-- 기본 몸 + Cute Fox 머리 + 주황 꼬리 + 옷
|
||||
animal({
|
||||
name = "Fox",
|
||||
hat = "61773267",
|
||||
lowerHat = true,
|
||||
tail = "187846604",
|
||||
shirt = 382537702,
|
||||
pants = 382537806,
|
||||
hideHead = true,
|
||||
colors = {
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(250, 240, 230),
|
||||
rgb(250, 240, 230),
|
||||
},
|
||||
}),
|
||||
-- 기본 몸 + Sleepy Mouse Cap(머리 전체) + 옷
|
||||
animal({
|
||||
name = "Mouse",
|
||||
hat = "439943629",
|
||||
shirt = 398635081,
|
||||
pants = 144076760,
|
||||
hideHead = true,
|
||||
colors = {
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
},
|
||||
}),
|
||||
-- "동물 분장 사람" 가벼운 버전: 동물 얼굴 다이내믹 헤드 + 귀 + 꼬리 + 옷(사람 얼굴 모양이라 동물 느낌은 약함)
|
||||
animal({
|
||||
name = "Bunny",
|
||||
head = 119665103921086,
|
||||
ears = "1080949",
|
||||
tail = "738679517",
|
||||
shirt = 4047886060,
|
||||
pants = 382537950,
|
||||
colors = { W, W, W, W, W, W },
|
||||
}),
|
||||
animal({
|
||||
name = "Kitty",
|
||||
head = 82082995456115,
|
||||
ears = "1374269",
|
||||
tail = "187846604",
|
||||
shirt = 382537085,
|
||||
pants = 398634487,
|
||||
colors = {
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
},
|
||||
}),
|
||||
animal({
|
||||
name = "Puppy",
|
||||
head = 138526270057654,
|
||||
ears = "11142487",
|
||||
shirt = 144076436,
|
||||
pants = 382538503,
|
||||
colors = {
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
},
|
||||
}),
|
||||
}
|
||||
NpcLooks.ANIMALS = ANIMALS
|
||||
NpcLooks.SKIN = { rgb(255, 220, 190), rgb(240, 200, 160), rgb(205, 160, 120), rgb(150, 105, 75) }
|
||||
|
||||
export type Animal = {
|
||||
name: string,
|
||||
body: { number }?,
|
||||
head: number?,
|
||||
hat: string?,
|
||||
ears: string?,
|
||||
tail: string?,
|
||||
shirt: number?,
|
||||
pants: number?,
|
||||
colors: { Color3 },
|
||||
hideHead: boolean?,
|
||||
lowerHat: boolean?,
|
||||
rare: boolean?,
|
||||
}
|
||||
|
||||
-- 동물 분장 사람(Bunny·Kitty·Puppy)은 동물 느낌이 약해서 가끔만
|
||||
for _, a in NpcLooks.ANIMALS do
|
||||
if a.name == "Bunny" or a.name == "Kitty" or a.name == "Puppy" then
|
||||
a.rare = true
|
||||
end
|
||||
end
|
||||
|
||||
local function setColors(d: HumanoidDescription, c: { Color3 })
|
||||
d.HeadColor = c[1]
|
||||
d.TorsoColor = c[2]
|
||||
d.LeftArmColor = c[3]
|
||||
d.RightArmColor = c[4]
|
||||
d.LeftLegColor = c[5]
|
||||
d.RightLegColor = c[6]
|
||||
end
|
||||
|
||||
local function pick<T>(list: { T }, rng: Random): T
|
||||
return list[rng:NextInteger(1, #list)]
|
||||
end
|
||||
|
||||
function NpcLooks.human(rng: Random): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
d.HairAccessory = tostring(pick(NpcLooks.HAIR, rng))
|
||||
if rng:NextNumber() < 0.35 then
|
||||
d.HatAccessory = tostring(pick(NpcLooks.HATS, rng))
|
||||
end
|
||||
d.Shirt = pick(NpcLooks.SHIRTS, rng)
|
||||
d.Pants = pick(NpcLooks.PANTS, rng)
|
||||
d.Head = pick(NpcLooks.FACE_HEADS, rng)
|
||||
local s = pick(NpcLooks.SKIN, rng)
|
||||
setColors(d, { s, s, s, s, s, s })
|
||||
local h = 0.85 + rng:NextNumber() * 0.15 -- 어린이~어른 키
|
||||
d.HeightScale = h
|
||||
d.WidthScale = 0.9
|
||||
d.DepthScale = 0.9
|
||||
d.HeadScale = 1
|
||||
return d
|
||||
end
|
||||
|
||||
function NpcLooks.animal(a: Animal): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
if a.body then
|
||||
d.Torso = a.body[1]
|
||||
d.LeftArm = a.body[2]
|
||||
d.RightArm = a.body[3]
|
||||
d.LeftLeg = a.body[4]
|
||||
d.RightLeg = a.body[5]
|
||||
end
|
||||
if a.head then
|
||||
d.Head = a.head
|
||||
end
|
||||
d.HatAccessory = a.hat or a.ears or ""
|
||||
d.WaistAccessory = a.tail or ""
|
||||
d.Shirt = a.shirt or 0
|
||||
d.Pants = a.pants or 0
|
||||
setColors(d, a.colors)
|
||||
return d
|
||||
end
|
||||
|
||||
return NpcLooks
|
||||
@@ -159,7 +159,7 @@ local STRINGS: { [string]: { [string]: string } } = {
|
||||
btnPromote = "홍보",
|
||||
btnRush = "러시",
|
||||
promoteTitle = "홍보하기",
|
||||
promoteAdText = "광고를 보면 옆 가게 손님이 우리 가게로 와요",
|
||||
promoteAdText = "광고를 보면\n옆 가게 손님이 와요",
|
||||
watchAd = "광고 보기",
|
||||
promoteFree = "그냥 홍보",
|
||||
kickAction = "손님 쫓아내기",
|
||||
|
||||
@@ -274,7 +274,12 @@ local SHOTS = {
|
||||
}
|
||||
|
||||
local shots = {}
|
||||
-- 한 번에 다 그리면 5분 제한을 넘을 수 있어서, ONLY에 이름을 넣으면 그 장면만 그립니다(tools/preview.sh가 나눠서 부름).
|
||||
local ONLY: { string }? = nil
|
||||
for _, s in SHOTS do
|
||||
if ONLY and not table.find(ONLY, s.name) then
|
||||
continue
|
||||
end
|
||||
local state = Instance.new("Folder")
|
||||
state:SetAttribute("Lang", "ko")
|
||||
state:SetAttribute("Ready", true)
|
||||
@@ -329,4 +334,6 @@ end
|
||||
local images = {}
|
||||
images[Icons.ASSET:match("%d+")] = "art/ui_icons.png"
|
||||
images[Icons.KITCHEN_ASSET:match("%d+")] = "art/kitchen.png"
|
||||
return HttpService:JSONEncode({ shots = shots, images = images })
|
||||
-- 결과가 커서(4MB 넘음) 바이너리 출력으로 돌려줍니다(tools/preview.sh가 --out 파일로 받음).
|
||||
local json = HttpService:JSONEncode({ shots = shots, images = images })
|
||||
return { BinaryOutput = buffer.fromstring(json), ReturnValues = { #shots } }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- 로블록스 서버(Open Cloud Luau Execution)에서 돌리는 통합 테스트.
|
||||
-- 로블록스 서버(Open Cloud Luau Execution)에서 돌리는 화면 UI·클라이언트 모듈 통합 테스트(서버 로직은 server.luau).
|
||||
-- python3 tools/cloud.py run tests/cloud/integration.luau --version <저장 버전>
|
||||
-- 이 환경에서는 플레이어가 없고 물리가 돌지 않으며 Script가 자동 실행되지 않으므로,
|
||||
-- 모듈을 직접 불러 가짜 플레이어(Folder)와 가상 시계로 가게를 돌립니다.
|
||||
@@ -30,344 +30,46 @@ local Icons = require(ReplicatedStorage.Shared.Icons)
|
||||
local Locale = require(ReplicatedStorage.Shared.Locale)
|
||||
local Recipes = require(ReplicatedStorage.Shared.Recipes)
|
||||
|
||||
section("맵")
|
||||
section("맵·부지 글자·손님 버튼(클라이언트 모듈)")
|
||||
local World = require(Server.World)
|
||||
local slots = World.build()
|
||||
eq(#slots, 6, "부지 6칸")
|
||||
for i, s in slots do
|
||||
check(s.refs.stove and s.refs.stove:IsDescendantOf(workspace), `부지 {i} 조리대`)
|
||||
for j, o in slots do
|
||||
if i < j then
|
||||
local d = (s.cf.Position - o.cf.Position).Magnitude
|
||||
check(d >= 76, `부지 {i},{j} 겹치지 않음 (거리 {d})`)
|
||||
end
|
||||
end
|
||||
-- 입구(+Z)가 길(z=0) 쪽을 봐야 함
|
||||
local front = s.cf:PointToWorldSpace(Vector3.new(0, 0, 40))
|
||||
check(math.abs(front.Z) < math.abs(s.cf.Position.Z), `부지 {i} 입구가 길 쪽`)
|
||||
end
|
||||
check(workspace.BunsikWorld:FindFirstChild("Spawn") ~= nil, "스폰 지점")
|
||||
local partCount = 0
|
||||
for _, d in workspace.BunsikWorld:GetDescendants() do
|
||||
if d:IsA("BasePart") then
|
||||
partCount += 1
|
||||
check(not d:IsA("PartOperation"), "Union 없음(업로드 제한)")
|
||||
end
|
||||
end
|
||||
print("맵 파트 수", partCount)
|
||||
check(partCount < 6000, "맵 파트 6000개 미만")
|
||||
|
||||
section("NPC")
|
||||
local Npc = require(Server.Npc)
|
||||
Npc.preload()
|
||||
local npc = Npc.spawn(workspace, CFrame.new(0, 5, 0), Random.new(1))
|
||||
check(npc.model:FindFirstChild("HumanoidRootPart") ~= nil, "NPC 몸")
|
||||
check(npc.tracks.walk ~= nil and npc.tracks.sit ~= nil and npc.tracks.idle ~= nil, "NPC 애니메이션 3종 로드")
|
||||
npc.model:Destroy()
|
||||
|
||||
section("가게 1: 튜토리얼 흐름")
|
||||
local PlotController = require(Server.PlotController)
|
||||
local Data = require(Server.Data)
|
||||
local function newData()
|
||||
local d = table.clone(Data.TEMPLATE)
|
||||
d.PurchaseIdCache = {}
|
||||
return d
|
||||
end
|
||||
local owner = Instance.new("Folder")
|
||||
owner.Name = "FakePlayer"
|
||||
owner.Parent = ServerScriptService
|
||||
local notes = {}
|
||||
local data = newData()
|
||||
local c = PlotController.new(slots[1], owner, {
|
||||
userId = 111,
|
||||
displayName = "Tester",
|
||||
data = data,
|
||||
now = 0,
|
||||
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].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
|
||||
for _, ch in dyn:GetChildren() do
|
||||
if ch.Name == "Customer" then
|
||||
customers += 1
|
||||
local bubble = ch:FindFirstChild("Order", true)
|
||||
check(bubble ~= nil, "손님 주문 말풍선")
|
||||
local icon = bubble and bubble:FindFirstChild("Icon", true) :: ImageLabel?
|
||||
eq(icon and icon.ImageRectOffset, Icons.OFFSET.Tteokbokki, "말풍선에 떡볶이 그림")
|
||||
end
|
||||
end
|
||||
eq(customers, 1, "첫 손님 NPC 1명")
|
||||
eq(slots[1].refs.stove:GetAttribute("CookMenu"), "Tteokbokki", "조리대에 떡볶이 주문 표시")
|
||||
eq(slots[1].refs.stove:GetAttribute("OwnerId"), 111, "조리대 주인")
|
||||
check((owner:FindFirstChild("Guide") :: ObjectValue).Value ~= nil, "튜토리얼 화살표 목표(조리대)")
|
||||
c:update(3)
|
||||
eq(c.shop.customers[1].state, "waiting", "손님이 앉음")
|
||||
eq(owner:GetAttribute("Orders"), "Tteokbokki=1", "요리 창에 보여 줄 주문 수")
|
||||
eq(c:cook("Gimbap"), nil, "주문 없는 메뉴(김밥)는 못 만듦")
|
||||
-- 요리 창 세션: 원격 이벤트만 보내 조리 과정을 건너뛰지 못함
|
||||
eq(c:finishCook("Tteokbokki", 10), nil, "메뉴를 고르지 않고 완성만 보내면 거절")
|
||||
eq(c:startCook("Gimbap", 10), false, "주문 없는 메뉴로는 시작 못 함")
|
||||
check(c:startCook("Tteokbokki", 10), "주문 있는 메뉴로 시작")
|
||||
eq(c:finishCook("Gimbap", 20), nil, "고른 메뉴와 다른 메뉴로 완성하면 거절")
|
||||
check(c:startCook("Tteokbokki", 10), "다시 시작")
|
||||
local minT = Recipes.minTime("Tteokbokki", c.shop.stats.cook)
|
||||
eq(c:finishCook("Tteokbokki", 10 + minT * 0.5), nil, `조리 과정 최소 시간({minT}초)보다 빠르면 거절`)
|
||||
eq(c:finishCook("Tteokbokki", 10 + minT), nil, "거절된 세션은 다시 못 씀")
|
||||
eq(owner:GetAttribute("Carry"), 0, "거절되면 접시 없음")
|
||||
-- (가상 시계를 3초에 맞춰 끝냅니다. 뒤의 식사 시간 검사가 3초 기준)
|
||||
check(c:startCook("Tteokbokki", 3 - Recipes.expectedTime("Tteokbokki", c.shop.stats.cook)), "다시 시작")
|
||||
eq(c:finishCook("Tteokbokki", 3), "Tteokbokki", "정상 시간이면 조리")
|
||||
eq(owner:GetAttribute("Hand"), "Tteokbokki", "손에 든 접시 종류")
|
||||
eq(owner:GetAttribute("Orders"), "", "주문이 다 채워짐")
|
||||
eq(owner:GetAttribute("Tut"), 2, "튜토리얼 2단계")
|
||||
eq(owner:GetAttribute("Carry"), 1, "접시 1개 듦")
|
||||
eq(slots[1].refs.stove:GetAttribute("CookMenu"), "", "더 만들 것 없음")
|
||||
eq(c:serve(1), 15, "서빙 15원")
|
||||
eq(owner:GetAttribute("Money"), 15, "돈 15")
|
||||
eq(data.Money, 15, "세이브 데이터 돈 15")
|
||||
local served1 = dyn:FindFirstChild("Customer"):FindFirstChild("Order", true)
|
||||
eq(
|
||||
served1 and (served1:FindFirstChild("Icon", true) :: ImageLabel).ImageRectOffset,
|
||||
Icons.OFFSET.heart,
|
||||
"받은 손님 말풍선은 하트"
|
||||
)
|
||||
eq(owner:GetAttribute("Tut"), 3, "튜토리얼 3단계")
|
||||
check(dyn:FindFirstChild("Dish_Tteokbokki") ~= nil, "테이블에 접시")
|
||||
local ok = c:buy()
|
||||
check(ok, "테이블 2 구매")
|
||||
check(slots[1].refs.upgrades:FindFirstChild("Table2") ~= nil, "테이블 2 모형")
|
||||
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 = 3, #Economy.PURCHASES do
|
||||
local okBuy, err = c:buy()
|
||||
check(okBuy, `#{i} 구매 ({err})`)
|
||||
end
|
||||
eq(owner:GetAttribute("Bought"), #Economy.PURCHASES, "20개 구매")
|
||||
eq(owner:GetAttribute("Stage"), 2, "2단계")
|
||||
for _, id in { "Expand", "Sign1", "Sign2", "Stove1", "Stove2", "Sauce1", "Sauce2", "Tray1", "Tray2", "Table8" } do
|
||||
check(slots[1].refs.upgrades:FindFirstChild(id) ~= nil, `업그레이드 모형 {id}`)
|
||||
end
|
||||
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(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
|
||||
local servedBefore = c.shop.served
|
||||
local t0 = os.clock()
|
||||
while t < 320 do
|
||||
t += 0.1
|
||||
c:update(t)
|
||||
c:pickup()
|
||||
if not c.shop.stats.helper then
|
||||
c:cook()
|
||||
end
|
||||
for id, cust in c.shop.customers do
|
||||
if cust.state == "waiting" then
|
||||
c:serve(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
local elapsed = os.clock() - t0
|
||||
local served = c.shop.served - servedBefore
|
||||
print(`5분 영업: 서빙 {served}회, 계산 시간 {math.floor(elapsed * 1000)}ms`)
|
||||
check(served > 60, "5분 동안 60회 넘게 서빙")
|
||||
-- 나가는 손님은 실제 시간으로 몇 초 뒤 지워지므로 잠깐 기다립니다.
|
||||
task.wait(Economy.WALK_IN + 1.5)
|
||||
local alive = 0
|
||||
for _, ch in dyn:GetChildren() do
|
||||
if ch.Name == "Customer" then
|
||||
alive += 1
|
||||
end
|
||||
end
|
||||
check(alive <= Economy.MAX_SEATS + 6, `손님 NPC가 쌓이지 않음 ({alive})`)
|
||||
|
||||
section("가게 2: 캐릭터 가까이 가면 자동 서빙·집기")
|
||||
local charModel =
|
||||
Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R15)
|
||||
charModel.Name = "FakeCharacter"
|
||||
charModel.Parent = workspace
|
||||
local hrp = charModel:FindFirstChild("HumanoidRootPart") :: BasePart
|
||||
hrp.Anchored = true
|
||||
local owner2 = Instance.new("Folder")
|
||||
owner2.Parent = ServerScriptService
|
||||
local data2 = newData()
|
||||
data2.Bought = 8 -- 알바생까지 산 상태
|
||||
data2.Money = 5
|
||||
local c2 = PlotController.new(slots[2], owner2, {
|
||||
userId = 222,
|
||||
displayName = "Tester2",
|
||||
data = data2,
|
||||
now = 0,
|
||||
getCharacter = function()
|
||||
return charModel
|
||||
end,
|
||||
})
|
||||
eq(owner2:GetAttribute("Money"), 5, "저장된 돈 불러옴")
|
||||
eq(owner2:GetAttribute("Tut"), 1, "튜토리얼 안 끝났으면 1")
|
||||
c2:update(0)
|
||||
eq(#c2.shop.counter, 1, "알바생이 카운터에 접시")
|
||||
hrp.CFrame = slots[2].refs.counter.CFrame + Vector3.new(0, 3, 4)
|
||||
c2:update(0.2)
|
||||
eq(#c2.shop.hand, 1, "카운터 근처에서 자동으로 집음")
|
||||
local held = 0
|
||||
for _, ch in charModel:GetChildren() do
|
||||
if string.sub(ch.Name, 1, 5) == "Dish_" then
|
||||
held += 1
|
||||
end
|
||||
end
|
||||
eq(held, 1, "손에 접시 모형")
|
||||
c2:update(3)
|
||||
local seat = c2.shop.customers[1].seat
|
||||
local PlotBuilder = require(Server.PlotBuilder)
|
||||
hrp.CFrame = PlotBuilder.seatCFrame(slots[2].cf, seat) + Vector3.new(0, 2, 2)
|
||||
local before = c2.shop.money
|
||||
c2:update(3.2)
|
||||
check(c2.shop.money > before, "손님 근처에서 자동 서빙")
|
||||
-- 리스폰: 손에 든 접시 모형 다시 만들기
|
||||
c2:update(4)
|
||||
c2:update(4.1)
|
||||
c2:rebuildHand()
|
||||
c2:destroy()
|
||||
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 Plots = require(StarterPlayer.StarterPlayerScripts.Client.Plots)
|
||||
local viewer = Instance.new("Folder")
|
||||
viewer:SetAttribute("Lang", "en")
|
||||
viewer:SetAttribute("KickCredits", 0)
|
||||
local nb2 = Neighbor.open(slots[6], 0)
|
||||
eq(Plots.nameText(slots[4].model, "en"), "Empty lot", "빈 자리 이름판")
|
||||
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 kickPrompt = slots[6].model.Base.VisitPoint:FindFirstChild("KickPrompt") :: ProximityPrompt
|
||||
check(kickPrompt ~= nil and kickPrompt.Enabled, "이웃 가게 입구에 쫓아내기 버튼")
|
||||
check(kickPrompt.KeyboardKeyCode ~= visitPrompt.KeyboardKeyCode, "두 버튼은 다른 키")
|
||||
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})`)
|
||||
check(string.find(Plots.menuText(slots[6].model, "ko"), "떡볶이") ~= nil, "메뉴판(부지 속성 Menus)")
|
||||
-- 가게 이름·무지개: 이름판과 지붕·천막 간판(ShopNameLabel)에 보임
|
||||
slots[6].model:SetAttribute("ShopName", "Yummy Land")
|
||||
check(string.find(boardLabel.Text, "Yummy Land") ~= nil, `가게 이름이 이름판에 ({boardLabel.Text})`)
|
||||
local valance = slots[6].model.Base.Stall.Valance:FindFirstChild("ShopNameLabel", true) :: TextLabel
|
||||
eq(valance and valance.Text, "Yummy Land", "천막 간판에 가게 이름")
|
||||
slots[6].model:SetAttribute("Rainbow", true)
|
||||
task.wait(0.2)
|
||||
check(boardLabel:FindFirstChild("RainbowGradient") ~= nil, "무지개 이름(그러데이션)")
|
||||
slots[6].model:SetAttribute("Rainbow", false)
|
||||
task.wait(0.2)
|
||||
eq(boardLabel:FindFirstChild("RainbowGradient"), nil, "무지개 끄면 사라짐")
|
||||
slots[6].model:SetAttribute("ShieldUntil", workspace:GetServerTimeNow() + 60)
|
||||
task.wait(0.2)
|
||||
check(not kickPrompt.Enabled, "보호 중인 가게엔 쫓아내기 버튼 꺼짐")
|
||||
Neighbor.close(nb2)
|
||||
check(not visitPrompt.Enabled, "닫힌 가게엔 손님 버튼 없음")
|
||||
slots[6].model:SetAttribute("OwnerId", 999)
|
||||
check(not visitPrompt.Enabled, "내 가게엔 손님 버튼 없음")
|
||||
check(not visitPrompt.Enabled and not kickPrompt.Enabled, "내 가게엔 버튼 없음")
|
||||
slots[6].model:SetAttribute("OwnerId", nil)
|
||||
detach()
|
||||
|
||||
@@ -379,56 +81,17 @@ 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)
|
||||
local store = ProfileStore.New("CloudTest", Data.TEMPLATE)
|
||||
local prof = store.Mock:StartSessionAsync("Player_1")
|
||||
check(prof ~= nil, "Mock 세션")
|
||||
local grants = 0
|
||||
local decision = Receipts.process(prof, "purchase-1", function()
|
||||
grants += 1
|
||||
prof.Data.Money += 100
|
||||
return true
|
||||
end)
|
||||
eq(decision, "Granted", "첫 결제 지급")
|
||||
local decision2 = Receipts.process(prof, "purchase-1", function()
|
||||
grants += 1
|
||||
return true
|
||||
end)
|
||||
eq(decision2, "Granted", "재시도 완료 응답")
|
||||
eq(grants, 1, "한 번만 지급")
|
||||
eq(prof.Data.Money, 100, "Mock 돈")
|
||||
prof:EndSession()
|
||||
|
||||
section("실제 DataStore 세션")
|
||||
local live = ProfileStore.New("CloudTest_v1", Data.TEMPLATE)
|
||||
local lp = live:StartSessionAsync("Player_test", {
|
||||
Cancel = function()
|
||||
return false
|
||||
end,
|
||||
})
|
||||
check(lp ~= nil, "실제 저장소 세션 시작")
|
||||
if lp then
|
||||
lp.Data.Money += 1
|
||||
lp:Save()
|
||||
lp:EndSession()
|
||||
end
|
||||
|
||||
section("Game.processReceipt(플레이어 없음)")
|
||||
local Game = require(Server.Game)
|
||||
eq(
|
||||
Game.processReceipt({ PlayerId = 1, PurchaseId = "x", ProductId = 1 }),
|
||||
Enum.ProductPurchaseDecision.NotProcessedYet,
|
||||
"플레이어가 없으면 나중에"
|
||||
)
|
||||
|
||||
section("화면 UI(서버에서 생성)")
|
||||
local Hud = require(StarterPlayer.StarterPlayerScripts.Client.Hud)
|
||||
local Theme = require(StarterPlayer.StarterPlayerScripts.Client.Theme)
|
||||
local state = Instance.new("Folder")
|
||||
state:SetAttribute("Lang", "ko")
|
||||
state:SetAttribute("Money", 25)
|
||||
state:SetAttribute("Bought", 1)
|
||||
state:SetAttribute("Money", 5)
|
||||
state:SetAttribute("Levels", "")
|
||||
state:SetAttribute("Stage", 1)
|
||||
state:SetAttribute("Seats", 1)
|
||||
state:SetAttribute("Tables", 1)
|
||||
state:SetAttribute("Staff", "")
|
||||
state:SetAttribute("Tut", 3)
|
||||
local sent = {}
|
||||
local holder = Instance.new("Folder")
|
||||
@@ -441,113 +104,134 @@ local function label(o: Instance?): string?
|
||||
return t and t.Text
|
||||
end
|
||||
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text", true) :: TextLabel
|
||||
eq(moneyText.Text, "25", "돈 표시(숫자만, 동전 그림 옆)")
|
||||
eq(moneyText.Text, "5", "돈 표시")
|
||||
local nextCard = root:FindFirstChild("Next") :: Frame
|
||||
local nextTitle = nextCard:FindFirstChild("Title", true) :: TextLabel
|
||||
eq(nextTitle.Text, "김밥 해금", "다음 업그레이드")
|
||||
local nextIcon = nextCard:FindFirstChild("IconBox", true):FindFirstChild("Icon") :: ImageLabel
|
||||
eq(nextIcon.Image, Icons.ASSET, "다음 업그레이드 아이콘 그림")
|
||||
eq(nextIcon.ImageRectOffset, Icons.OFFSET.Gimbap, "김밥 해금 아이콘")
|
||||
eq((nextCard:FindFirstChild("Cost", true) :: TextLabel).Text, "25 / 40", "진행 막대 글자")
|
||||
local hintFrame = root:FindFirstChild("Hint") :: Frame
|
||||
check(hintFrame.Visible, "튜토리얼 말풍선 보임")
|
||||
check(hintFrame:FindFirstChild("Mascot") ~= nil, "말풍선에 마스코트")
|
||||
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), "사기", "사기 버튼 글자")
|
||||
local Theme = require(StarterPlayer.StarterPlayerScripts.Client.Theme)
|
||||
eq(
|
||||
(buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3,
|
||||
Theme.darken(Theme.GRAY, 0.3),
|
||||
"돈이 모자라면 회색"
|
||||
)
|
||||
local listButton = root:FindFirstChild("ListButton") :: TextButton
|
||||
eq(label(listButton), "상점", "상점 버튼 글자(짧게)")
|
||||
check(not (listButton:FindFirstChild("Badge") :: Frame).Visible, "돈이 모자라면 상점 배지 없음")
|
||||
state:SetAttribute("Money", 60)
|
||||
eq(label(listButton), "상점", "상점 버튼 글자")
|
||||
state:SetAttribute("Money", 15)
|
||||
eq((buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3, Theme.darken(Theme.MINT, 0.3), "살 수 있으면 초록")
|
||||
check((listButton:FindFirstChild("Badge") :: Frame).Visible, "살 수 있으면 상점 버튼에 ! 배지")
|
||||
check(root:FindFirstChild("Gain") ~= nil, "돈이 늘면 +돈 글자가 떠오름")
|
||||
eq((root:FindFirstChild("Gain") :: TextLabel).Text, "+35", "늘어난 돈")
|
||||
for _, d in Icons.OFFSET do
|
||||
check(d.X % 128 == 0 and d.Y % 128 == 0 and d.X < 1024 and d.Y < 1024, "아이콘 칸 위치")
|
||||
eq(
|
||||
(root:FindFirstChild("Gain") :: TextLabel?) and (root:FindFirstChild("Gain") :: TextLabel).Text,
|
||||
"+10",
|
||||
"늘어난 돈"
|
||||
)
|
||||
for _, name in { "Promote", "Rush", "Double", "Boost", "Settings" } do
|
||||
check(root:FindFirstChild(name) ~= nil, `버튼 {name}`)
|
||||
end
|
||||
for _, d in Icons.KITCHEN do
|
||||
check(d.X % 256 == 0 and d.Y % 256 == 0 and d.X < 1024 and d.Y < 1024, "요리 그림 칸 위치")
|
||||
end
|
||||
-- 손에 든 접시
|
||||
local carryFrame = root:FindFirstChild("Carry") :: Frame
|
||||
check(not carryFrame.Visible, "빈손이면 접시 표시 숨김")
|
||||
state:SetAttribute("Carry", 1)
|
||||
state:SetAttribute("Hand", "Tteokbokki")
|
||||
check(carryFrame.Visible, "접시를 들면 표시")
|
||||
eq((carryFrame:FindFirstChild("Slot1") :: ImageLabel).ImageRectOffset, Icons.OFFSET.Tteokbokki, "든 음식 그림")
|
||||
state:SetAttribute("Carry", 0)
|
||||
state:SetAttribute("Hand", "")
|
||||
state:SetAttribute("Lang", "en")
|
||||
eq(moneyText.Text, "60", "영어 돈 표시")
|
||||
eq(nextTitle.Text, "Unlock Gimbap", "영어 다음 업그레이드")
|
||||
state:SetAttribute("Lang", "zh")
|
||||
eq(nextTitle.Text, "解锁紫菜包饭", "중국어 다음 업그레이드")
|
||||
state:SetAttribute("Lang", "en")
|
||||
local settingsBtn = root:FindFirstChild("Settings") :: TextButton
|
||||
check(settingsBtn ~= nil, "오른쪽 위 설정 버튼")
|
||||
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(label(settingsPanel:FindFirstChild("Lang_ja")), "日本語", "언어 이름은 그 나라 말")
|
||||
eq(label(settingsPanel:FindFirstChild("MouseLook")), "On", "마우스 회전 기본 켜짐")
|
||||
state:SetAttribute("Sfx", false)
|
||||
eq(label(settingsPanel:FindFirstChild("Sfx")), "Off", "효과음 끔 표시")
|
||||
check(not hud.menuOpen(), "창 닫힘")
|
||||
check(nextTitle.Text ~= "" and not string.find(nextTitle.Text, "의자"), `영어 추천 구매 ({nextTitle.Text})`)
|
||||
state:SetAttribute("Lang", "ko")
|
||||
|
||||
section("상점 창(탭 4개)")
|
||||
hud.open("shop")
|
||||
check(hud.menuOpen() and (root:FindFirstChild("Panel") :: Frame).Visible, "상점 창 열기")
|
||||
check((root:FindFirstChild("Dim") :: TextButton).Visible, "창 뒤 어둡게")
|
||||
local cardsFrame = root:FindFirstChild("Panel"):FindFirstChild("Cards", true) :: Frame
|
||||
local n1 = 0
|
||||
for _, ch in cardsFrame:GetChildren() do
|
||||
if ch.Name:sub(1, 3) == "Row" then
|
||||
n1 += 1
|
||||
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
|
||||
check(page(id) ~= nil, `탭 {id}`)
|
||||
check(panel:FindFirstChild("Tab_" .. id, true) ~= nil, `탭 버튼 {id}`)
|
||||
end
|
||||
check(page("upgrade").Visible, "처음엔 업그레이드 탭")
|
||||
for _, id in Economy.TRACK_ORDER do
|
||||
local card = page("upgrade"):FindFirstChild("Track_" .. id, true)
|
||||
check(card ~= nil, `갈래 카드 {id}`)
|
||||
local nm = card and card:FindFirstChild("Name", true) :: TextLabel?
|
||||
check(nm and nm.Text ~= "" and not string.find(nm.Text, "track_"), `갈래 이름 {id} ({nm and nm.Text})`)
|
||||
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}`)
|
||||
end
|
||||
hud.open("shop", "staff")
|
||||
check((page("staff"):FindFirstChild("Locked", true) :: Frame).Visible, "알바생 기능 전에는 잠김")
|
||||
state:SetAttribute("Levels", "Staff=1")
|
||||
state:SetAttribute("Staff", "Cook=1,Server=0,Promoter=0")
|
||||
state:SetAttribute("Strike", true)
|
||||
check(not (page("staff"):FindFirstChild("Locked", true) :: Frame).Visible, "알바생 기능을 사면 열림")
|
||||
for _, r in Economy.ROLES do
|
||||
check(page("staff"):FindFirstChild("Role_" .. r.id, true) ~= nil, `알바 카드 {r.id}`)
|
||||
end
|
||||
hud.open("shop", "mine")
|
||||
check(page("mine"):FindFirstChild("NameBox", true) ~= nil, "가게 이름 입력칸")
|
||||
for _, d in Economy.DESIGNS do
|
||||
check(page("mine"):FindFirstChild("Design_" .. d.id, true) ~= nil, `디자인 {d.id}`)
|
||||
end
|
||||
hud.open("settings")
|
||||
local settingsPanel = root:FindFirstChild("SettingsPanel") :: Frame
|
||||
check(settingsPanel.Visible and not panel.Visible, "창은 하나만 열림")
|
||||
hud.open(nil)
|
||||
check(not hud.menuOpen(), "창 닫기")
|
||||
|
||||
section("알림 글자(모든 알림 키, 4개 언어)")
|
||||
local Info = require(StarterPlayer.StarterPlayerScripts.Client.Info)
|
||||
local SAMPLES = {
|
||||
upgraded = { track = "Speed", level = 2 },
|
||||
newMenu = { menu = "Gimbap" },
|
||||
expanded = {},
|
||||
floor2 = {},
|
||||
seatAdded = {},
|
||||
tableAdded = {},
|
||||
decorAdded = { kind = "Teddy" },
|
||||
noSpace = {},
|
||||
seatMax = {},
|
||||
tableMax = {},
|
||||
tableFull = {},
|
||||
needStage = {},
|
||||
placeFail = { why = "blocked" },
|
||||
hired = { role = "Cook" },
|
||||
fired = { role = "Server" },
|
||||
staffLocked = {},
|
||||
staffMax = {},
|
||||
strike = {},
|
||||
strikeOver = {},
|
||||
renamed = {},
|
||||
nameRejected = {},
|
||||
designSet = { design = "Hanok" },
|
||||
designLocked = {},
|
||||
promoted = { n = 2 },
|
||||
promoteNone = {},
|
||||
promoteFull = {},
|
||||
promoteWait = { sec = 30 },
|
||||
adUnavailable = {},
|
||||
kicked = { n = 3 },
|
||||
kickedBy = { name = "Mina" },
|
||||
shielded = {},
|
||||
kickOwn = {},
|
||||
rushOn = { min = 10 },
|
||||
notEnough = { need = "100" },
|
||||
}
|
||||
for _, lang in { "ko", "en", "ja", "zh" } do
|
||||
for key, args in SAMPLES do
|
||||
local text = Info.toast(lang, key, args)
|
||||
check(text ~= key and not string.find(text, "{") and text ~= "", `{lang} 알림 {key}: {text}`)
|
||||
end
|
||||
end
|
||||
eq(n1, 10, "상점: 지금 단계 10개가 한 화면에(넘기지 않음)")
|
||||
check(
|
||||
cardsFrame:FindFirstChild("Row2"):FindFirstChild("BuyRow") ~= nil,
|
||||
"상점의 다음 업그레이드에 사기 버튼"
|
||||
)
|
||||
check(cardsFrame:FindFirstChild("Row1"):FindFirstChild("Done", true) ~= nil, "산 업그레이드는 체크 표시")
|
||||
check(cardsFrame:FindFirstChild("Row5"):FindFirstChild("Lock", true) ~= nil, "잠긴 업그레이드 자물쇠")
|
||||
hud.open("settings")
|
||||
check(settingsPanel.Visible and not (root:FindFirstChild("Panel") :: Frame).Visible, "창은 하나만 열림")
|
||||
hud.open(nil)
|
||||
check(not hud.menuOpen() and not (root:FindFirstChild("Dim") :: TextButton).Visible, "창 닫기")
|
||||
state:SetAttribute("Bought", #Economy.PURCHASES)
|
||||
check(not buyBtn.Visible, "다 사면 사기 버튼 숨김")
|
||||
check(not (root:FindFirstChild("Boost") :: TextButton).Visible, "다 사면 돈 부스트 숨김")
|
||||
local devMoneyBtn = settingsPanel:FindFirstChild("devMoney") :: TextButton
|
||||
check(not devMoneyBtn.Visible, "개발자 버튼은 기본으로 숨김")
|
||||
local setH = settingsPanel.Size.Y.Offset
|
||||
state:SetAttribute("Dev", true)
|
||||
check(devMoneyBtn.Visible, "게임 주인에게 개발자 버튼(설정 창)")
|
||||
check(settingsPanel.Size.Y.Offset > setH, "개발자 줄만큼 설정 창이 길어짐")
|
||||
local doubleBtn = root:FindFirstChild("Double") :: TextButton
|
||||
check(doubleBtn.Visible, "2배 수익 버튼(상품 ID 설정됨)")
|
||||
eq(label(doubleBtn), "2x Cash", "2배 수익 버튼 글자")
|
||||
state:SetAttribute("Double", true)
|
||||
eq(label(doubleBtn), "Active", "2배 수익 산 뒤")
|
||||
check((doubleBtn:FindFirstChild("Owned") :: ImageLabel).Visible, "2배 수익 산 뒤 체크")
|
||||
hud.notify("purchased", { item = "Table2" })
|
||||
state:SetAttribute("Lang", "en")
|
||||
hud.notify("upgraded", { track = "Speed", level = 2 })
|
||||
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
|
||||
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
|
||||
eq(
|
||||
(root.Toasts:FindFirstChild("Toast"):FindFirstChild("Icon") :: ImageLabel).ImageRectOffset,
|
||||
Icons.OFFSET.check,
|
||||
"구매 알림 아이콘"
|
||||
)
|
||||
check(string.find(toastText.Text, "Customer Speed") ~= nil, `알림에 갈래 이름(내 언어) ({toastText.Text})`)
|
||||
for _ = 1, 5 do
|
||||
hud.notify("purchased", { item = "Table2" })
|
||||
hud.notify("seatAdded")
|
||||
end
|
||||
local toastCount = 0
|
||||
for _, ch in root.Toasts:GetChildren() do
|
||||
@@ -556,7 +240,9 @@ for _, ch in root.Toasts:GetChildren() do
|
||||
end
|
||||
end
|
||||
check(toastCount <= 3, `알림은 3개까지만 쌓임 ({toastCount})`)
|
||||
-- 휴대폰 배치(아이폰 15 가로, 상단 바·노치 뺀 영역): 루트가 화면을 채우고, 버튼 묶음은 왼쪽 위, 마우스 줄 숨김
|
||||
|
||||
section("휴대폰·PC 배치")
|
||||
local doubleBtn = root:FindFirstChild("Double") :: TextButton
|
||||
hud.setLayout(Vector2.new(750, 332), true)
|
||||
local lay = hud.layout()
|
||||
local scaleObj = root:FindFirstChildOfClass("UIScale") :: UIScale
|
||||
@@ -564,29 +250,22 @@ check(
|
||||
root.Size.X.Offset * scaleObj.Scale - 750 >= -1e-3 and root.Size.X.Offset * scaleObj.Scale - 750 < scaleObj.Scale,
|
||||
"휴대폰: 루트 너비 = 화면"
|
||||
)
|
||||
check(
|
||||
root.Size.Y.Offset * scaleObj.Scale - 332 >= -1e-3 and root.Size.Y.Offset * scaleObj.Scale - 332 < scaleObj.Scale,
|
||||
"휴대폰: 루트 높이 = 화면"
|
||||
)
|
||||
eq(
|
||||
doubleBtn.Position.Y.Offset,
|
||||
lay.double.y + lay.double.h / 2,
|
||||
"휴대폰: 2배 수익 버튼 위치(가운데 기준)"
|
||||
)
|
||||
eq(doubleBtn.Size.Y.Offset, lay.double.h, "휴대폰: 2배 수익 버튼 크기")
|
||||
check(lay.double.y + lay.double.h < lay.height / 3, "휴대폰: 결제 버튼은 조이스틱 자리 위")
|
||||
check(not (settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "휴대폰: 마우스 회전 줄 숨김")
|
||||
check(scaleObj.Scale > 0.8, `휴대폰: 글자 배율 {scaleObj.Scale}`)
|
||||
eq(doubleBtn.Size.Y.Offset, lay.double.h, "휴대폰: 2배 수익 버튼 크기")
|
||||
hud.setLayout(Vector2.new(1366, 710), false)
|
||||
check((settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "PC: 마우스 회전 줄 보임")
|
||||
check(math.abs(scaleObj.Scale - math.min(1366 / 1100, 710 / 620)) < 1e-6, "PC: 배율(상단 바 뺀 높이 기준)")
|
||||
hud.destroy()
|
||||
|
||||
section("꾸미기 화면(클라이언트 모듈)")
|
||||
local Decorate = require(StarterPlayer.StarterPlayerScripts.Client.Decorate)
|
||||
check(typeof(Decorate.build) == "function", "꾸미기 모듈")
|
||||
|
||||
section("요리 창(메뉴 고르기 → 조리 과정 → 완성)")
|
||||
local kstate = Instance.new("Folder")
|
||||
kstate:SetAttribute("Lang", "ko")
|
||||
kstate:SetAttribute("Money", 0)
|
||||
kstate:SetAttribute("Bought", 6) -- 떡볶이·김밥·순대 해금
|
||||
kstate:SetAttribute("Levels", "Menu=2") -- 떡볶이·김밥·순대 해금
|
||||
kstate:SetAttribute("Tut", 1)
|
||||
kstate:SetAttribute("Orders", "Gimbap=2")
|
||||
local ksent = {}
|
||||
@@ -676,7 +355,7 @@ check(not kitchen.isOpen() and not kframe.Visible, "더 만들 것이 없으면
|
||||
check(not (kroot:FindFirstChild("Dim") :: TextButton).Visible, "닫히면 어둡게도 꺼짐")
|
||||
-- 메뉴마다 과정이 다르고 끝까지 갈 수 있음
|
||||
for _, m in Economy.MENU_ORDER do
|
||||
kstate:SetAttribute("Bought", 20)
|
||||
kstate:SetAttribute("Levels", "Stage=1,Menu=4")
|
||||
kstate:SetAttribute("Carry", 0)
|
||||
kstate:SetAttribute("Orders", `{m}=1`)
|
||||
khud.open("kitchen")
|
||||
@@ -749,23 +428,27 @@ for _, asset in { Icons.ASSET, Icons.KITCHEN_ASSET } do
|
||||
end
|
||||
end
|
||||
|
||||
section("Products")
|
||||
section("Products(게임패스·개발자 상품)")
|
||||
local Products = require(ReplicatedStorage.Shared.Products)
|
||||
local MarketplaceService = game:GetService("MarketplaceService")
|
||||
if Products.DOUBLE_MONEY_PASS ~= 0 then
|
||||
local info = MarketplaceService:GetProductInfoAsync(Products.DOUBLE_MONEY_PASS, Enum.InfoType.GamePass)
|
||||
print("게임패스", info.Name, info.PriceInRobux, info.IsForSale)
|
||||
check(info.IsForSale, "2배 수익 판매 중")
|
||||
for key, id in Products do
|
||||
check(id ~= 0, `{key} ID 있음`)
|
||||
local isPass = string.find(key, "_PASS$") ~= nil
|
||||
local okInfo, info = pcall(function()
|
||||
return MarketplaceService:GetProductInfoAsync(
|
||||
id,
|
||||
if isPass then Enum.InfoType.GamePass else Enum.InfoType.Product
|
||||
)
|
||||
end)
|
||||
check(okInfo, `{key} 정보 조회`)
|
||||
if okInfo then
|
||||
print(key, info.Name, info.PriceInRobux, info.IsForSale)
|
||||
check(info.PriceInRobux ~= nil and info.PriceInRobux > 0, `{key} 가격`)
|
||||
end
|
||||
end
|
||||
if Products.MONEY_BOOST_PRODUCT ~= 0 then
|
||||
local info = MarketplaceService:GetProductInfoAsync(Products.MONEY_BOOST_PRODUCT, Enum.InfoType.Product)
|
||||
print("개발자 상품", info.Name, info.PriceInRobux)
|
||||
check(info.PriceInRobux ~= nil, "돈 부스트 가격")
|
||||
end
|
||||
|
||||
c:destroy()
|
||||
|
||||
section("Game.start(실제 서버 시작 순서)")
|
||||
local Game = require(Server.Game)
|
||||
local okStart, errStart = pcall(Game.start)
|
||||
check(okStart, `Game.start 오류 없음 ({errStart})`)
|
||||
task.wait(1)
|
||||
|
||||
@@ -54,6 +54,42 @@ local npc = Npc.spawnCustomer(workspace, CFrame.new(0, 5, 0), Random.new(1))
|
||||
check(npc.model:FindFirstChild("HumanoidRootPart") ~= nil, "손님 NPC 몸")
|
||||
check(npc.tracks.walk ~= nil and npc.tracks.sit ~= nil and npc.tracks.idle ~= nil, "NPC 애니메이션 3종 로드")
|
||||
npc.model:Destroy()
|
||||
local tLooks = os.clock()
|
||||
Npc.preloadCustomers()
|
||||
local nHuman, nAnimal = Npc.lookCount()
|
||||
print(`손님 외형: 사람 {nHuman}벌, 동물 {nAnimal}종, {math.floor((os.clock() - tLooks) * 1000)}ms`)
|
||||
check(nHuman >= 10, `사람 외형 10벌 이상 ({nHuman})`)
|
||||
check(nAnimal >= 8, `동물 외형 8종 이상 ({nAnimal})`)
|
||||
local rngLook = Random.new(5)
|
||||
local animals, humans, accessories = 0, 0, 0
|
||||
local shown = {}
|
||||
for _ = 1, 200 do
|
||||
local h = Npc.spawnCustomer(workspace, CFrame.new(0, 300, 0), rngLook)
|
||||
local kind = h.model:GetAttribute("Animal")
|
||||
if kind then
|
||||
animals += 1
|
||||
shown[kind] = true
|
||||
else
|
||||
humans += 1
|
||||
end
|
||||
for _, d in h.model:GetChildren() do
|
||||
if d:IsA("Accessory") then
|
||||
accessories += 1
|
||||
end
|
||||
end
|
||||
check(h.tracks.walk ~= nil and h.tracks.sit ~= nil, "손님 애니메이션")
|
||||
check(h.model:FindFirstChildWhichIsA("Script", true) == nil, "손님 모형에 스크립트 없음")
|
||||
h.model:Destroy()
|
||||
end
|
||||
print(`손님 200명: 사람 {humans}, 동물 {animals}, 장신구 {accessories}`)
|
||||
check(humans > animals * 2, "사람 손님이 가장 많음")
|
||||
check(animals >= 25 and animals <= 75, `동물 손님은 가끔(약 25%) ({animals})`)
|
||||
check(accessories > 200, "머리·모자 장신구가 붙음")
|
||||
local kinds = 0
|
||||
for _ in shown do
|
||||
kinds += 1
|
||||
end
|
||||
check(kinds >= 6, `동물 종류 여러 가지 ({kinds})`)
|
||||
|
||||
local PlotController = require(Server.PlotController)
|
||||
local PlotBuilder = require(Server.PlotBuilder)
|
||||
|
||||
84
bunsik-tycoon/tools/npc_inspect_models.luau
Normal file
84
bunsik-tycoon/tools/npc_inspect_models.luau
Normal file
@@ -0,0 +1,84 @@
|
||||
-- Creator Store 동물 모델 후보를 로블록스 서버에서 불러와 내용을 살펴봅니다(저장은 안 함).
|
||||
-- python3 tools/cloud.py run tools/npc_inspect_models.luau
|
||||
-- 불러오기: AssetService:LoadAssetAsync 먼저, 실패하면 InsertService:LoadAsset.
|
||||
-- 결과(2026-10-14): 남이 만든 무료 모델은 12개 모두 두 방법 다 "User is not authorized to access Asset."
|
||||
-- 로블록스가 만든 에셋(예: 1374269)은 둘 다 성공. 그래서 손님은 HumanoidDescription 방식(assets/npc_assets.md)을 씁니다.
|
||||
local AssetService = game:GetService("AssetService")
|
||||
local InsertService = game:GetService("InsertService")
|
||||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
local IDS = {
|
||||
95757394637739, -- Poly Block Cute Animals Pack - 20 Assets (asasinatra)
|
||||
97050466582003, -- Stud-Themed Animal Pack [LITE] (DropKit)
|
||||
7902208283, -- Animal Pack (MRNOOB_504)
|
||||
8780565023, -- Cute Penguin (Calestelle)
|
||||
3676024481, -- House Cat (OscarAlhinho)
|
||||
2374016425, -- Dog (Low Poly) (PeppiIy)
|
||||
2374002814, -- Panda (Low Poly) (PeppiIy)
|
||||
12502111157, -- Fluffy Bunny Toy (Astrra)
|
||||
12549463718, -- Penguin Plushie (Astrra)
|
||||
12009487310, -- Cat with Animations - Rigged (KashTheKing)
|
||||
9415314422, -- Staring cat plush
|
||||
159064405, -- Sheep (SmilingGalactic)
|
||||
}
|
||||
|
||||
local function load(id: number): (Instance?, string)
|
||||
local ok, res = pcall(function()
|
||||
return AssetService:LoadAssetAsync(id)
|
||||
end)
|
||||
if ok and res then
|
||||
return res, "AssetService:LoadAssetAsync"
|
||||
end
|
||||
local ok2, res2 = pcall(function()
|
||||
return InsertService:LoadAsset(id)
|
||||
end)
|
||||
if ok2 and res2 then
|
||||
return res2, "InsertService:LoadAsset (AssetService err: " .. tostring(res) .. ")"
|
||||
end
|
||||
return nil, "both failed: " .. tostring(res) .. " | " .. tostring(res2)
|
||||
end
|
||||
|
||||
local out = {}
|
||||
for _, id in IDS do
|
||||
local inst, how = load(id)
|
||||
local r: { [string]: any } = { id = id, how = how }
|
||||
if inst then
|
||||
local counts: { [string]: number } = {}
|
||||
local maxPart = 0
|
||||
for _, d in inst:GetDescendants() do
|
||||
counts[d.ClassName] = (counts[d.ClassName] or 0) + 1
|
||||
if d:IsA("BasePart") then
|
||||
maxPart = math.max(maxPart, d.Size.Magnitude)
|
||||
end
|
||||
end
|
||||
local top = {}
|
||||
for _, c in inst:GetChildren() do
|
||||
local s = c.ClassName .. ":" .. c.Name
|
||||
if c:IsA("Model") or c:IsA("Folder") then
|
||||
local n = 0
|
||||
for _, d in c:GetDescendants() do
|
||||
if d:IsA("BasePart") then
|
||||
n += 1
|
||||
end
|
||||
end
|
||||
local sz = c:IsA("Model") and (c :: Model):GetExtentsSize() or Vector3.zero
|
||||
s ..= string.format("(%d parts, %.1fx%.1fx%.1f)", n, sz.X, sz.Y, sz.Z)
|
||||
local sub = {}
|
||||
for _, g in c:GetChildren() do
|
||||
if #sub < 25 then
|
||||
table.insert(sub, g.ClassName .. ":" .. g.Name)
|
||||
end
|
||||
end
|
||||
s ..= " [" .. table.concat(sub, ", ") .. "]"
|
||||
end
|
||||
table.insert(top, s)
|
||||
end
|
||||
r.counts = counts
|
||||
r.top = top
|
||||
r.maxPartDiag = math.floor(maxPart * 10) / 10
|
||||
inst:Destroy()
|
||||
end
|
||||
print(HttpService:JSONEncode(r))
|
||||
table.insert(out, r)
|
||||
end
|
||||
return #out
|
||||
100
bunsik-tycoon/tools/npc_search.py
Normal file
100
bunsik-tycoon/tools/npc_search.py
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env python3
|
||||
"""손님 NPC 에셋 찾기(인증 없이 공개 API만 씀).
|
||||
|
||||
python3 tools/npc_search.py store "low poly cat" [more queries...] # Creator Store 모델 검색
|
||||
python3 tools/npc_search.py catalog "hair" [--free] [--bundles] # 아바타 상점(Roblox 제작) 검색
|
||||
python3 tools/npc_search.py bundle 284 [...] # 번들 구성품 ID 보기
|
||||
|
||||
store: 무료·스크립트 없음만 보여 줍니다. 열: id, 투표(찬성/전체), 메시파트 수, 삼각형 수, 크리에이터, 이름.
|
||||
catalog/bundle 은 요청이 많으면 429/빈 오류가 나서 요청마다 몇 초씩 쉽니다.
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
|
||||
def get(url, tries=4):
|
||||
for attempt in range(tries):
|
||||
try:
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "bunsik-tycoon-tools"})
|
||||
with urllib.request.urlopen(req, timeout=60) as r:
|
||||
return json.loads(r.read())
|
||||
except Exception as e: # 429 등은 잠깐 쉬고 다시
|
||||
if attempt == tries - 1:
|
||||
return {"errors": [str(e)]}
|
||||
time.sleep(8 * (attempt + 1))
|
||||
|
||||
|
||||
def store(query, pages=2):
|
||||
rows = []
|
||||
token = ""
|
||||
for _ in range(pages):
|
||||
url = ("https://apis.roblox.com/toolbox-service/v2/assets:search?searchCategoryType=Model&maxPageSize=100&query="
|
||||
+ urllib.parse.quote(query) + (f"&pageToken={urllib.parse.quote(token)}" if token else ""))
|
||||
d = get(url)
|
||||
for it in d.get("creatorStoreAssets", []):
|
||||
a = it["asset"]
|
||||
price = it.get("creatorStoreProduct", {}).get("purchasePrice", {}).get("quantity", {}).get("significand", 0)
|
||||
if a.get("hasScripts") or price:
|
||||
continue
|
||||
v = it.get("voting", {})
|
||||
rows.append((a["id"], v.get("upVotes", 0), v.get("voteCount", 0),
|
||||
a.get("instanceCounts", {}).get("meshPart", 0),
|
||||
a.get("objectMeshSummary", {}).get("triangles", 0),
|
||||
it["creator"].get("name"), a["name"]))
|
||||
token = d.get("nextPageToken")
|
||||
if not token:
|
||||
break
|
||||
return rows
|
||||
|
||||
|
||||
def catalog(keyword, free=False, bundles=False):
|
||||
q = {"keyword": keyword, "creatorName": "Roblox", "limit": 120}
|
||||
if free:
|
||||
q["maxPrice"] = 0
|
||||
d = get("https://catalog.roblox.com/v2/search/items/details?" + urllib.parse.urlencode(q))
|
||||
out = []
|
||||
for x in d.get("data", []):
|
||||
if bundles and x["itemType"] != "Bundle":
|
||||
continue
|
||||
out.append((x["itemType"], x.get("assetType", x.get("bundleType")), x["id"], x["name"], x.get("price"),
|
||||
x.get("favoriteCount")))
|
||||
return out, d.get("errors")
|
||||
|
||||
|
||||
def bundle(bid):
|
||||
d = get(f"https://catalog.roblox.com/v1/bundles/{bid}/details")
|
||||
return d.get("name"), [(i["type"], i["id"], i["name"]) for i in d.get("items", [])]
|
||||
|
||||
|
||||
def main(argv):
|
||||
if not argv:
|
||||
print(__doc__)
|
||||
return 2
|
||||
cmd, args = argv[0], [a for a in argv[1:] if not a.startswith("--")]
|
||||
if cmd == "store":
|
||||
for q in args:
|
||||
print(f"== {q}")
|
||||
for r in sorted(store(q), key=lambda r: -r[2])[:40]:
|
||||
print(f"{r[0]}\t{r[1]}/{r[2]}\tmp={r[3]}\ttri={r[4]}\t{r[5]}\t{r[6]}")
|
||||
elif cmd == "catalog":
|
||||
for q in args:
|
||||
rows, err = catalog(q, "--free" in argv, "--bundles" in argv)
|
||||
print(f"== {q} {err or ''}")
|
||||
for r in rows:
|
||||
print("\t".join(str(c) for c in r))
|
||||
time.sleep(6)
|
||||
elif cmd == "bundle":
|
||||
for b in args:
|
||||
name, items = bundle(b)
|
||||
print(f"== {b} {name}")
|
||||
for t in items:
|
||||
print("\t".join(str(c) for c in t))
|
||||
time.sleep(3)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
509
bunsik-tycoon/tools/npc_verify_avatars.luau
Normal file
509
bunsik-tycoon/tools/npc_verify_avatars.luau
Normal file
@@ -0,0 +1,509 @@
|
||||
-- 손님 외형(사람·동물) 최종 확인. 로블록스 서버에서 HumanoidDescription으로 실제 모델을 만들어 봅니다.
|
||||
-- python3 tools/cloud.py run tools/npc_verify_avatars.luau --out assets/npc_animals.rbxm
|
||||
-- 확인 항목: 생성 성공, 장신구·옷 개수, 크기·HipHeight, 동물 머리 모자가 사람 머리를 덮는 정도,
|
||||
-- R15 관절 15개 이름, 걷기·대기·앉기 애니메이션 로드(Length>0).
|
||||
-- 주의: Luau Execution은 시뮬레이션을 돌리지 않아(RunService:IsRunning()=false) 관절이 실제로 움직이는지는 못 봅니다.
|
||||
-- 마지막에 동물 프리셋 모델을 .rbxm(BinaryOutput)으로 내보내고, 다시 읽어 개수를 확인합니다.
|
||||
local Players = game:GetService("Players")
|
||||
local HttpService = game:GetService("HttpService")
|
||||
local SerializationService = game:GetService("SerializationService")
|
||||
local RunService = game:GetService("RunService")
|
||||
|
||||
local function rgb(r, g, b)
|
||||
return Color3.fromRGB(r, g, b)
|
||||
end
|
||||
|
||||
-- ===== 데이터(npc_assets.md 와 같음) =====
|
||||
local HAIR = {
|
||||
63690008,
|
||||
451221329,
|
||||
376526888,
|
||||
376524487,
|
||||
376548738,
|
||||
376527350,
|
||||
451220849,
|
||||
62234425,
|
||||
2956239660,
|
||||
3814476174,
|
||||
24910539,
|
||||
7193442167,
|
||||
9244095135,
|
||||
6993754725,
|
||||
7193448258,
|
||||
9243987340,
|
||||
7193450455,
|
||||
7193452166,
|
||||
9244148336,
|
||||
430063008,
|
||||
727320877,
|
||||
}
|
||||
local HATS = {
|
||||
1028606,
|
||||
607702162,
|
||||
321570512,
|
||||
10911990,
|
||||
67291394,
|
||||
3756496643,
|
||||
100932329,
|
||||
150337770,
|
||||
118280079,
|
||||
215724779,
|
||||
116778296,
|
||||
833771553,
|
||||
3756447657,
|
||||
439943629,
|
||||
1536057124,
|
||||
}
|
||||
local SHIRTS = {
|
||||
144076358,
|
||||
607785314,
|
||||
398633584,
|
||||
144076436,
|
||||
398634295,
|
||||
3670737444,
|
||||
382538059,
|
||||
398635081,
|
||||
382537702,
|
||||
382537085,
|
||||
382538295,
|
||||
4047884939,
|
||||
4047884046,
|
||||
4047886060,
|
||||
}
|
||||
local PANTS = { 144076760, 398634487, 398633812, 398635338, 382537806, 382538503, 382537569, 382537950 }
|
||||
local FACE_HEADS = {
|
||||
10725626210,
|
||||
10725826963,
|
||||
11308945948,
|
||||
15938951781,
|
||||
10687288296,
|
||||
10638267973,
|
||||
10723855306,
|
||||
13692975981,
|
||||
11163789916,
|
||||
12954264879,
|
||||
13682064263,
|
||||
130433936882245,
|
||||
11159990982,
|
||||
11180212350,
|
||||
16042049101,
|
||||
}
|
||||
local SKIN = { rgb(255, 220, 190), rgb(240, 200, 160), rgb(205, 160, 120), rgb(150, 105, 75) }
|
||||
|
||||
type Animal = {
|
||||
name: string,
|
||||
body: { number }?, -- Torso, LeftArm, RightArm, LeftLeg, RightLeg
|
||||
head: number?, -- Head(다이내믹 헤드)
|
||||
hat: string?, -- HatAccessory(동물 머리 모양 모자)
|
||||
ears: string?,
|
||||
tail: string?,
|
||||
colors: { Color3 }, -- Head, Torso, LeftArm, RightArm, LeftLeg, RightLeg
|
||||
shirt: number?,
|
||||
pants: number?,
|
||||
hideHead: boolean?, -- 모자가 머리를 통째로 덮으면 사람 얼굴이 비치지 않게 Head 투명
|
||||
lowerHat: boolean?, -- 머리 "위에" 얹히는 모자(아랫면이 머리 꼭대기 근처)를 목까지 내림
|
||||
}
|
||||
local W, G = rgb(245, 245, 245), rgb(163, 162, 165)
|
||||
local ANIMALS: { Animal } = {
|
||||
{
|
||||
name = "Penguin",
|
||||
body = { 46358991, 46359095, 46359040, 46359181, 46359241 },
|
||||
hat = "15967866",
|
||||
colors = { W, W, W, W, W, W },
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Bear",
|
||||
body = { 27132957, 27133013, 27132990, 27133040, 27133055 },
|
||||
hat = "28998435",
|
||||
lowerHat = true,
|
||||
colors = {
|
||||
rgb(160, 110, 80),
|
||||
rgb(160, 110, 80),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
rgb(110, 75, 55),
|
||||
},
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "PolarBear",
|
||||
body = { 137715759, 137715036, 137715073, 137715120, 137715151 },
|
||||
hat = "137714793",
|
||||
colors = {
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
rgb(248, 248, 248),
|
||||
},
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Cat",
|
||||
body = { 146176562, 146176342, 146176447, 146176406, 146176511 },
|
||||
hat = "146176716",
|
||||
colors = { G, G, G, G, G, G },
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Dog",
|
||||
body = { 1796148633, 1796137813, 1796141971, 1796143895, 1796146180 },
|
||||
hat = "1796135151",
|
||||
colors = { G, G, G, G, G, G },
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Panda",
|
||||
body = { 27132957, 27133013, 27132990, 27133040, 27133055 },
|
||||
hat = "27369187",
|
||||
colors = {
|
||||
rgb(242, 242, 242),
|
||||
rgb(242, 242, 242),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
rgb(30, 30, 30),
|
||||
},
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Fox",
|
||||
hat = "61773267",
|
||||
lowerHat = true,
|
||||
tail = "187846604",
|
||||
colors = {
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(235, 120, 40),
|
||||
rgb(250, 240, 230),
|
||||
rgb(250, 240, 230),
|
||||
},
|
||||
shirt = 382537702,
|
||||
pants = 382537806,
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Mouse",
|
||||
hat = "439943629",
|
||||
colors = {
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
rgb(170, 185, 215),
|
||||
},
|
||||
shirt = 398635081,
|
||||
pants = 144076760,
|
||||
hideHead = true,
|
||||
},
|
||||
{
|
||||
name = "Bunny",
|
||||
head = 119665103921086,
|
||||
ears = "1080949",
|
||||
tail = "738679517",
|
||||
colors = { W, W, W, W, W, W },
|
||||
shirt = 4047886060,
|
||||
pants = 382537950,
|
||||
},
|
||||
{
|
||||
name = "Kitty",
|
||||
head = 82082995456115,
|
||||
ears = "1374269",
|
||||
tail = "187846604",
|
||||
colors = {
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
rgb(250, 200, 140),
|
||||
},
|
||||
shirt = 382537085,
|
||||
pants = 398634487,
|
||||
},
|
||||
{
|
||||
name = "Puppy",
|
||||
head = 138526270057654,
|
||||
ears = "11142487",
|
||||
colors = {
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
rgb(220, 180, 130),
|
||||
},
|
||||
shirt = 144076436,
|
||||
pants = 382538503,
|
||||
},
|
||||
}
|
||||
|
||||
-- ===== 만드는 함수(게임 코드에 그대로 옮길 수 있는 모양) =====
|
||||
local function setColors(d: HumanoidDescription, c: { Color3 })
|
||||
d.HeadColor, d.TorsoColor, d.LeftArmColor, d.RightArmColor, d.LeftLegColor, d.RightLegColor =
|
||||
c[1], c[2], c[3], c[4], c[5], c[6]
|
||||
end
|
||||
|
||||
local function humanDesc(rng: Random): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
d.HairAccessory = tostring(HAIR[rng:NextInteger(1, #HAIR)])
|
||||
if rng:NextNumber() < 0.35 then
|
||||
d.HatAccessory = tostring(HATS[rng:NextInteger(1, #HATS)])
|
||||
end
|
||||
d.Shirt = SHIRTS[rng:NextInteger(1, #SHIRTS)]
|
||||
d.Pants = PANTS[rng:NextInteger(1, #PANTS)]
|
||||
d.Head = FACE_HEADS[rng:NextInteger(1, #FACE_HEADS)]
|
||||
local s = SKIN[rng:NextInteger(1, #SKIN)]
|
||||
setColors(d, { s, s, s, s, s, s })
|
||||
local h = 0.85 + rng:NextNumber() * 0.15 -- 어린이~어른 키 섞기
|
||||
d.HeightScale, d.WidthScale, d.DepthScale, d.HeadScale = h, 0.9, 0.9, 1
|
||||
return d
|
||||
end
|
||||
|
||||
local function animalDesc(a: Animal): HumanoidDescription
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
if a.body then
|
||||
d.Torso, d.LeftArm, d.RightArm, d.LeftLeg, d.RightLeg = a.body[1], a.body[2], a.body[3], a.body[4], a.body[5]
|
||||
end
|
||||
if a.head then
|
||||
d.Head = a.head
|
||||
end
|
||||
d.HatAccessory = a.hat or a.ears or ""
|
||||
d.WaistAccessory = a.tail or ""
|
||||
d.Shirt = a.shirt or 0
|
||||
d.Pants = a.pants or 0
|
||||
setColors(d, a.colors)
|
||||
return d
|
||||
end
|
||||
|
||||
-- 모델을 Workspace에 넣고 한 프레임 지난 뒤(장신구 용접이 자리 잡은 뒤) 호출합니다.
|
||||
local function finishAnimal(m: Model, a: Animal)
|
||||
local head = m:FindFirstChild("Head") :: BasePart
|
||||
local hum = m:FindFirstChildOfClass("Humanoid") :: Humanoid
|
||||
if a.lowerHat then
|
||||
for _, acc in m:GetChildren() do
|
||||
if acc:IsA("Accessory") and acc.AccessoryType == Enum.AccessoryType.Hat then
|
||||
local h = acc:FindFirstChild("Handle") :: BasePart
|
||||
local drop = (h.Position.Y - h.Size.Y / 2) - (head.Position.Y - head.Size.Y / 2)
|
||||
local att = h:FindFirstChild("HatAttachment") :: Attachment?
|
||||
if drop > 0.1 and att then
|
||||
-- 손잡이 쪽 Attachment를 올리고 다시 붙이면 모자가 그만큼 내려갑니다.
|
||||
-- (붙이는 관절은 Handle.AccessoryRigidConstraint. Attachment만 옮기면 물리가 돌 때까지 반영이 안 됨)
|
||||
att.Position += Vector3.new(0, drop, 0)
|
||||
acc.Parent = nil
|
||||
hum:AddAccessory(acc)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if a.hideHead then
|
||||
head.Transparency = 1
|
||||
for _, x in head:GetChildren() do
|
||||
if x:IsA("Decal") then
|
||||
x.Transparency = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ===== 확인 =====
|
||||
local R15_JOINTS = {
|
||||
"Root",
|
||||
"Waist",
|
||||
"Neck",
|
||||
"LeftShoulder",
|
||||
"LeftElbow",
|
||||
"LeftWrist",
|
||||
"RightShoulder",
|
||||
"RightElbow",
|
||||
"RightWrist",
|
||||
"LeftHip",
|
||||
"LeftKnee",
|
||||
"LeftAnkle",
|
||||
"RightHip",
|
||||
"RightKnee",
|
||||
"RightAnkle",
|
||||
}
|
||||
local ANIM = { walk = "rbxassetid://507777826", idle = "rbxassetid://507766388", sit = "rbxassetid://2506281703" }
|
||||
|
||||
local function hatFit(m: Model): { number }?
|
||||
-- {모자 아랫면 - 머리 아랫면, 모자 윗면 - 머리 윗면} (스터드). 아랫면 차이가 0 근처면 머리를 다 덮음
|
||||
local head = m:FindFirstChild("Head") :: BasePart
|
||||
for _, acc in m:GetChildren() do
|
||||
if acc:IsA("Accessory") and acc.AccessoryType == Enum.AccessoryType.Hat then
|
||||
local h = acc:FindFirstChild("Handle") :: BasePart
|
||||
if h then
|
||||
local hb, ht = h.Position.Y - h.Size.Y / 2, h.Position.Y + h.Size.Y / 2
|
||||
local b, t = head.Position.Y - head.Size.Y / 2, head.Position.Y + head.Size.Y / 2
|
||||
return { math.round((hb - b) * 100) / 100, math.round((ht - t) * 100) / 100 }
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local built: { Model } = {}
|
||||
local summary = { ok = 0, fail = 0 }
|
||||
local function check(label: string, d: HumanoidDescription, after: ((Model) -> ())?, keep: boolean?)
|
||||
local t0 = os.clock()
|
||||
local ok, model = pcall(Players.CreateHumanoidModelFromDescription, Players, d, Enum.HumanoidRigType.R15)
|
||||
if not ok then
|
||||
summary.fail += 1
|
||||
print(HttpService:JSONEncode({ n = label, ok = false, err = tostring(model) }))
|
||||
return
|
||||
end
|
||||
local m = model :: Model
|
||||
m.Name = label
|
||||
local anim = m:FindFirstChild("Animate", true)
|
||||
if anim then
|
||||
anim:Destroy() -- 플레이어용 LocalScript(서버 NPC에선 안 돌아감)
|
||||
end
|
||||
m:PivotTo(CFrame.new(#built * 8, 20, 0))
|
||||
m.Parent = workspace;
|
||||
(m:FindFirstChild("HumanoidRootPart") :: BasePart).Anchored = true
|
||||
RunService.Heartbeat:Wait()
|
||||
if after then
|
||||
after(m)
|
||||
RunService.Heartbeat:Wait()
|
||||
end
|
||||
local hum = m:FindFirstChildOfClass("Humanoid") :: Humanoid
|
||||
local acc, parts, scripts, sa = {}, 0, 0, 0
|
||||
for _, x in m:GetDescendants() do
|
||||
if x:IsA("Accessory") then
|
||||
table.insert(acc, x.Name)
|
||||
elseif x:IsA("BasePart") then
|
||||
parts += 1
|
||||
elseif x:IsA("LuaSourceContainer") then
|
||||
scripts += 1
|
||||
elseif x:IsA("SurfaceAppearance") then
|
||||
sa += 1
|
||||
end
|
||||
end
|
||||
local missing = {}
|
||||
for _, j in R15_JOINTS do
|
||||
if not m:FindFirstChild(j, true) then
|
||||
table.insert(missing, j)
|
||||
end
|
||||
end
|
||||
local animator = hum:FindFirstChildOfClass("Animator") or Instance.new("Animator", hum)
|
||||
local lens = {}
|
||||
for k, id in ANIM do
|
||||
local a = Instance.new("Animation")
|
||||
a.AnimationId = id
|
||||
local tr = animator:LoadAnimation(a)
|
||||
local w0 = os.clock()
|
||||
while tr.Length == 0 and os.clock() - w0 < 3 do
|
||||
task.wait(0.05)
|
||||
end
|
||||
lens[k] = math.round(tr.Length * 100) / 100
|
||||
tr:Destroy()
|
||||
end
|
||||
local _, size = m:GetBoundingBox()
|
||||
summary.ok += 1
|
||||
print(HttpService:JSONEncode({
|
||||
n = label,
|
||||
ok = true,
|
||||
acc = acc,
|
||||
shirt = m:FindFirstChildOfClass("Shirt") ~= nil,
|
||||
pants = m:FindFirstChildOfClass("Pants") ~= nil,
|
||||
parts = parts,
|
||||
scripts = scripts,
|
||||
surfaceAppearance = sa,
|
||||
missingJoints = missing,
|
||||
anim = lens,
|
||||
size = string.format("%.1fx%.1fx%.1f", size.X, size.Y, size.Z),
|
||||
hip = math.round(hum.HipHeight * 100) / 100,
|
||||
rootY = (m:FindFirstChild("HumanoidRootPart") :: BasePart).Size.Y,
|
||||
hatFit = hatFit(m),
|
||||
sec = math.round((os.clock() - t0) * 100) / 100,
|
||||
}))
|
||||
if keep then
|
||||
table.insert(built, m)
|
||||
else
|
||||
m:Destroy()
|
||||
end
|
||||
end
|
||||
|
||||
-- 1) 아이템마다 한 번씩(모두 실제로 붙는지): 사람 기본 몸에 하나씩 넣어 봄
|
||||
local itemFails = {}
|
||||
local function itemCheck(kind: string, id: number, apply: (HumanoidDescription) -> ())
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
apply(d)
|
||||
local ok, m = pcall(Players.CreateHumanoidModelFromDescription, Players, d, Enum.HumanoidRigType.R15)
|
||||
if not ok then
|
||||
table.insert(itemFails, kind .. " " .. id .. " " .. tostring(m))
|
||||
return
|
||||
end
|
||||
local good
|
||||
if kind == "hair" or kind == "hat" then
|
||||
good = m:FindFirstChildOfClass("Accessory") ~= nil
|
||||
elseif kind == "shirt" then
|
||||
good = m:FindFirstChildOfClass("Shirt") ~= nil
|
||||
elseif kind == "pants" then
|
||||
good = m:FindFirstChildOfClass("Pants") ~= nil
|
||||
else
|
||||
local head = m:FindFirstChild("Head") :: MeshPart
|
||||
good = head:IsA("MeshPart") and head.MeshId ~= "" and not string.find(head.MeshId, "123480233606534")
|
||||
end
|
||||
if not good then
|
||||
table.insert(itemFails, kind .. " " .. id .. " not applied")
|
||||
end
|
||||
m:Destroy()
|
||||
end
|
||||
for _, id in HAIR do
|
||||
itemCheck("hair", id, function(d)
|
||||
d.HairAccessory = tostring(id)
|
||||
end)
|
||||
end
|
||||
for _, id in HATS do
|
||||
itemCheck("hat", id, function(d)
|
||||
d.HatAccessory = tostring(id)
|
||||
end)
|
||||
end
|
||||
for _, id in SHIRTS do
|
||||
itemCheck("shirt", id, function(d)
|
||||
d.Shirt = id
|
||||
end)
|
||||
end
|
||||
for _, id in PANTS do
|
||||
itemCheck("pants", id, function(d)
|
||||
d.Pants = id
|
||||
end)
|
||||
end
|
||||
for _, id in FACE_HEADS do
|
||||
itemCheck("faceHead", id, function(d)
|
||||
d.Head = id
|
||||
end)
|
||||
end
|
||||
print(HttpService:JSONEncode({
|
||||
items = #HAIR + #HATS + #SHIRTS + #PANTS + #FACE_HEADS,
|
||||
itemFails = itemFails,
|
||||
}))
|
||||
|
||||
-- 2) 사람 무작위 조합 6개
|
||||
local rng = Random.new(7)
|
||||
for i = 1, 6 do
|
||||
check("Human" .. i, humanDesc(rng), nil, i == 1)
|
||||
end
|
||||
|
||||
-- 3) 동물 프리셋
|
||||
for _, a in ANIMALS do
|
||||
check(a.name, animalDesc(a), function(m)
|
||||
finishAnimal(m, a)
|
||||
end, true)
|
||||
end
|
||||
|
||||
-- 4) .rbxm 으로 내보내고 다시 읽어 보기
|
||||
for _, m in built do
|
||||
m.Parent = nil
|
||||
(m:FindFirstChild("HumanoidRootPart") :: BasePart).Anchored = false
|
||||
end
|
||||
local buf = SerializationService:SerializeInstancesAsync(built)
|
||||
local back = SerializationService:DeserializeInstancesAsync(buf)
|
||||
print(HttpService:JSONEncode({ rbxmBytes = buffer.len(buf), models = #built, roundTrip = #back }))
|
||||
return { BinaryOutput = buf, ReturnValues = { summary.ok, summary.fail, #itemFails } }
|
||||
@@ -1,20 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# 화면 UI 미리보기: 빌드 → 저장 버전 업로드 → 로블록스 서버에서 UI 덤프 → 그림(PNG)으로.
|
||||
# tools/preview.sh 출력폴더
|
||||
# 화면 UI 미리보기: 빌드 → 저장 버전 업로드 → 로블록스 서버에서 UI 덤프(장면 6개씩 나눠서) → 그림(PNG)으로.
|
||||
# tools/preview.sh 출력폴더 [장면이름...]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
export PATH="$HOME/.rokit/bin:$PATH"
|
||||
out=${1:-.cache/preview}
|
||||
shift || true
|
||||
mkdir -p .cache "$out"
|
||||
rojo build default.project.json -o build/BunsikTycoon.rbxl >/dev/null
|
||||
ver=$(python3 tools/cloud.py publish build/BunsikTycoon.rbxl | awk '{print $2}')
|
||||
python3 tools/cloud.py run tests/cloud/dump_gui.luau --version "$ver" >.cache/dump_raw.txt || { tail -20 .cache/dump_raw.txt; exit 1; }
|
||||
if [ $# -gt 0 ]; then
|
||||
names="$*"
|
||||
else
|
||||
names=$(grep -o 'shot(\s*"[a-z_0-9]*"\|^\s*"[a-z_0-9]*",$' tests/cloud/dump_gui.luau | grep -o '"[a-z_0-9]*"' | tr -d '"' | tr '\n' ' ')
|
||||
fi
|
||||
rm -f .cache/gui_part_*.json
|
||||
i=0
|
||||
batch=()
|
||||
run_batch() {
|
||||
local list
|
||||
list=$(printf '"%s",' "${batch[@]}")
|
||||
sed "s/^local ONLY: { string }? = nil/local ONLY: { string }? = { ${list%,} }/" tests/cloud/dump_gui.luau >.cache/dump_gui_batch.luau
|
||||
python3 tools/cloud.py run .cache/dump_gui_batch.luau --version "$ver" --out ".cache/gui_part_$i.json" >.cache/dump_raw.txt ||
|
||||
{ tail -20 .cache/dump_raw.txt; exit 1; }
|
||||
i=$((i + 1))
|
||||
batch=()
|
||||
}
|
||||
for n in $names; do
|
||||
batch+=("$n")
|
||||
if [ ${#batch[@]} -ge 6 ]; then run_batch; fi
|
||||
done
|
||||
if [ ${#batch[@]} -gt 0 ]; then run_batch; fi
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
raw = open(".cache/dump_raw.txt").read()
|
||||
line = [l for l in raw.splitlines() if l.startswith("output: ")][-1]
|
||||
out = json.loads(line[len("output: "):])
|
||||
data = out["results"][0]
|
||||
open(".cache/gui_dump.json", "w").write(data)
|
||||
import glob, json
|
||||
shots, images = [], {}
|
||||
for f in sorted(glob.glob(".cache/gui_part_*.json")):
|
||||
d = json.load(open(f))
|
||||
shots += d["shots"]
|
||||
images.update(d["images"])
|
||||
json.dump({"shots": shots, "images": images}, open(".cache/gui_dump.json", "w"))
|
||||
PY
|
||||
python3 tools/gui_render.py .cache/gui_dump.json "$out"
|
||||
|
||||
Reference in New Issue
Block a user