28 lines
1.6 KiB
Luau
28 lines
1.6 KiB
Luau
-- Puts small display copies of the crafted items on the empty shelves of the Craft House stall
|
|
-- (same shelf slots the shop uses for its toys: CraftHouse is the same stall mesh as ChristmasShop).
|
|
local craft = workspace.CraftHouse
|
|
local D = game.ReplicatedStorage.OrnamentMachine.Decor
|
|
local old = workspace:FindFirstChild("CraftShelfItems"); if old then old:Destroy() end
|
|
local folder = Instance.new("Model"); folder.Name = "CraftShelfItems"
|
|
local SLOTS = { -- {x, y(centre of a 1.32 tall toy), item}; z = 2.35 in stall space
|
|
{ -4.6, 7.96, "FrozenCastle" }, { -2.8, 7.96, "NutcrackerGuard" }, { 2.8, 7.96, "GiantSnowGlobe" }, { 4.6, 7.96, "SantaSleigh" },
|
|
{ -4.6, 6.40, "IceLanternPost" }, { -2.8, 6.40, "GiftPile" }, { 2.8, 6.40, "ReindeerStatue" }, { 4.6, 6.40, "GingerbreadHouse" },
|
|
{ -3.7, 4.84, "CandyCaneArch" }, { 3.7, 4.84, "FrostySnowman" },
|
|
}
|
|
for _, s in SLOTS do
|
|
local m = D[s[3]]:Clone()
|
|
if m.PrimaryPart then m.PrimaryPart:Destroy() end
|
|
for _, d in m:GetDescendants() do
|
|
if d:IsA("Light") then d:Destroy()
|
|
elseif d:IsA("BasePart") then d.Anchored, d.CanCollide, d.CanQuery, d.CastShadow = true, false, false, false end
|
|
end
|
|
local cf, size = m:GetBoundingBox()
|
|
m.WorldPivot = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2, cf.Position.Z)
|
|
m:ScaleTo(m:GetScale() * math.min(1.55 / math.max(size.X, size.Z), 1.4 / size.Y))
|
|
-- items face +Z in their own space; the stall's customers stand on its -Z side -> turn them round
|
|
m:PivotTo(craft:GetPivot() * CFrame.new(s[1], s[2] - 0.66 + 0.02, 2.35) * CFrame.Angles(0, math.pi, 0))
|
|
m.Parent = folder
|
|
end
|
|
folder.Parent = workspace
|
|
return "shelf items: " .. #folder:GetChildren()
|