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:
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