This commit is contained in:
listik committed 2026-11-04 00:09:13 +03:00
1 parent b48d1f68f6
commit 1ff7ef7e83
5 files changed
+37777 -1628

No files matched your search

@@ -608,6 +608,99 @@ local function setBestiary(board, zoneId, title, titleHex)
writeBestiary(board)
end
-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков.
-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся
-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil.
local LOWPOLY_FLAT = {
[Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true,
[Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true,
}
local function lowPolyShade(c, lrng, spread)
local k = 1 + lrng:NextNumber(-spread, spread)
return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1))
end
local function lowPolyPlanks(p, lrng)
local s = p.Size
local dims = { s.X, s.Y, s.Z }
local thin = 1
for i = 2, 3 do
if dims[i] < dims[thin] then thin = i end
end
-- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные
local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3
local len = dims[axis]
local n = math.max(2, math.floor(len / 1.8 + 0.5))
local w = len / n
for i = 1, n do
local off = -len / 2 + w * (i - 0.5)
local depth = lrng:NextNumber(-0.06, 0.06)
local o = { 0, 0, 0 }
o[axis] = off
o[thin] = depth
local size = { s.X, s.Y, s.Z }
size[axis] = w
local plank = Instance.new("Part")
plank.Name = "Plank"
plank.Anchored = true
plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
plank.Material = Enum.Material.SmoothPlastic
plank.Size = V(size[1], size[2], size[3])
plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3])
plank.Color = lowPolyShade(p.Color, lrng, 0.09)
plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery
plank.Parent = p.Parent
end
p:Destroy()
end
function Builder.lowPolyParts(parts, frame, seed)
local lrng = Random.new(seed or 5)
for _, p in ipairs(parts) do
if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then
local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block
if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then
-- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям
local d = p.Size.X
local flag = Instance.new("Part")
flag.Name = "Pennant"
flag.Anchored = true
flag.CanCollide = false
flag.Material = Enum.Material.SmoothPlastic
flag.Size = V(d * 1.15, d * 1.15, 0.25)
flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45))
flag.Color = p.Color
flag.Parent = p.Parent
p:Destroy()
elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then
p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения
p.Color = Color3.fromRGB(214, 160, 70)
elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0
and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then
lowPolyPlanks(p, lrng)
elseif LOWPOLY_FLAT[p.Material] then
p.Material = Enum.Material.SmoothPlastic
p.Color = lowPolyShade(p.Color, lrng, 0.06)
end
end
end
end
-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent
function Builder.stallParts(cf, parent)
local list = {}
for _, p in ipairs(parent:GetChildren()) do
if p:IsA("BasePart") then
local l = cf:PointToObjectSpace(p.Position)
if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then
table.insert(list, p)
end
end
end
return list
end
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
local function stall(cf, opt)
local function at(x, y, z)
@@ -664,6 +757,7 @@ local function stall(cf, opt)
if opt.decor then
opt.decor(at)
end
Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z))
return counter
end
@@ -1098,6 +1192,10 @@ function Builder.build()
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel)
w1map.Parent = map
local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true)
if baitShop then
Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11)
end
-- NPC встают на маркеры — их можно двигать в Studio
local seller = w1map:FindFirstChild("World1NpcSeller", true)
if seller and not seller:GetAttribute("NpcName") then