98 lines
2.9 KiB
Lua
98 lines
2.9 KiB
Lua
-- 미리보기용 장면 덤프: 맵과 가게 두 곳(1단계 중간, 2단계 전부 산 상태)을 짓고 모든 파트를 JSON으로 돌려줍니다.
|
|
-- python3 tools/cloud.py run tests/cloud/dump_scene.luau --version N --out .cache/scene.json
|
|
-- python3 tools/render.py .cache/scene.json
|
|
local HttpService = game:GetService("HttpService")
|
|
local Players = game:GetService("Players")
|
|
local ServerScriptService = game:GetService("ServerScriptService")
|
|
local Server = ServerScriptService.Server
|
|
|
|
local World = require(Server.World)
|
|
local Npc = require(Server.Npc)
|
|
local PlotController = require(Server.PlotController)
|
|
local PlotBuilder = require(Server.PlotBuilder)
|
|
local PlotLayout = require(Server.PlotLayout)
|
|
local Data = require(Server.Data)
|
|
|
|
local slots = World.build()
|
|
Npc.preload()
|
|
|
|
local function shop(slot, bought: number, withChar: boolean)
|
|
local data = table.clone(Data.TEMPLATE)
|
|
data.PurchaseIdCache = {}
|
|
data.Bought = bought
|
|
data.TutorialDone = true
|
|
local char: Model? = nil
|
|
if withChar then
|
|
char = Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R15)
|
|
local c = char :: Model
|
|
c.Parent = workspace
|
|
local root = c:FindFirstChild("HumanoidRootPart") :: BasePart
|
|
root.Anchored = true
|
|
local pos = PlotBuilder.world(slot.cf, PlotLayout.STOVE + Vector3.new(0, 0, 4.5))
|
|
c:PivotTo(CFrame.lookAt(pos + Vector3.new(0, 3, 0), pos + Vector3.new(0, 3, 10)))
|
|
end
|
|
local owner = Instance.new("Folder")
|
|
owner.Parent = ServerScriptService
|
|
local c = PlotController.new(slot, owner, {
|
|
userId = slot.index,
|
|
displayName = "Player" .. slot.index,
|
|
data = data,
|
|
now = 0,
|
|
getCharacter = function()
|
|
return char
|
|
end,
|
|
})
|
|
-- 손님을 채우고 몇 명은 먹는 중으로
|
|
local t = 0
|
|
for _ = 1, 400 do
|
|
t += 0.1
|
|
c:update(t)
|
|
end
|
|
local n = 0
|
|
for id, cust in c.shop.customers do
|
|
if cust.state == "waiting" and n < 2 then
|
|
c.shop.hand = { cust.menu }
|
|
c:serve(id)
|
|
n += 1
|
|
end
|
|
end
|
|
if withChar then
|
|
c:cook()
|
|
end
|
|
return c
|
|
end
|
|
|
|
shop(slots[2], #require(game:GetService("ReplicatedStorage").Shared.Economy).PURCHASES, true)
|
|
shop(slots[1], 6, false)
|
|
shop(slots[3], 0, false)
|
|
task.wait(0.5)
|
|
|
|
local parts = {}
|
|
for _, d in workspace:GetDescendants() do
|
|
if d:IsA("BasePart") and d.Transparency < 0.95 then
|
|
local shape = "Block"
|
|
if d:IsA("Part") then
|
|
shape = d.Shape.Name
|
|
elseif d:IsA("WedgePart") then
|
|
shape = "Wedge"
|
|
end
|
|
local cf = d.CFrame
|
|
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = cf:GetComponents()
|
|
local col = d.Color
|
|
table.insert(parts, {
|
|
s = shape,
|
|
c = { x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 },
|
|
z = { d.Size.X, d.Size.Y, d.Size.Z },
|
|
k = { math.floor(col.R * 255), math.floor(col.G * 255), math.floor(col.B * 255) },
|
|
t = d.Transparency,
|
|
m = d.Material.Name,
|
|
})
|
|
end
|
|
end
|
|
print("parts", #parts)
|
|
local json = HttpService:JSONEncode(parts)
|
|
return {
|
|
BinaryOutput = buffer.fromstring(json),
|
|
ReturnValues = { #parts },
|
|
}
|