517 lines
24 KiB
Lua
517 lines
24 KiB
Lua
-- Двухэтажная Гильдия рыбаков v2 (assets/props/lobby_guild_hall_v2.bbmodel) на севере лобби + порталы на диагоналях.
|
||
-- Собирается tools/build-guild-hall3.js, запускать в Edit. Повторный запуск пересобирает только FishingMap.GuildHall
|
||
-- (порталы поворачиваются один раз — атрибут PortalsDiagonal у FishingMap). Старое — в ServerStorage.Backup.
|
||
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
assert(map, "Нет Workspace.FishingMap")
|
||
local V = Vector3.new
|
||
local CENTER = V(0, 0, -60) -- середина участка; фасад (крыльцо) выходит к z ≈ −46.5
|
||
local TITLE_FONT = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy)
|
||
local GOLD_TEXT = Color3.fromRGB(255, 214, 120)
|
||
local WARM = Color3.fromRGB(255, 238, 220) -- тёплый, но не оранжевый
|
||
|
||
local backup = game.ServerStorage:FindFirstChild("Backup") or Instance.new("Folder")
|
||
backup.Name = "Backup"
|
||
backup.Parent = game.ServerStorage
|
||
|
||
---------------------------------------------------------------- 1) прежнее здание — в архив, место Ворона — забрать
|
||
|
||
local function findElder(root)
|
||
for _, d in ipairs(root:GetDescendants()) do
|
||
if d:IsA("BasePart") and d:GetAttribute("GuildElder") then
|
||
return d
|
||
end
|
||
end
|
||
end
|
||
local oldElder
|
||
local cur = map:FindFirstChild("GuildHall")
|
||
if cur and cur:GetAttribute("GuildHall3") then
|
||
local e = findElder(cur)
|
||
oldElder = e and e:Clone()
|
||
cur:Destroy() -- пересборка v2
|
||
elseif cur then
|
||
oldElder = findElder(cur)
|
||
oldElder = oldElder and oldElder:Clone()
|
||
cur.Name = "GuildHallV1_old"
|
||
cur.Parent = backup
|
||
end
|
||
for _, name in ipairs({ "GuildHallV1_old", "GuildYard_old" }) do
|
||
local src = not oldElder and backup:FindFirstChild(name)
|
||
local e = src and findElder(src)
|
||
oldElder = oldElder or (e and e:Clone())
|
||
end
|
||
assert(oldElder, "Не найдено место Старейшины Ворона (GuildElder)")
|
||
|
||
---------------------------------------------------------------- 2) порталы — на диагонали площади (один раз)
|
||
-- северный портал стоял точно между фонтаном и дверью гильдии. Все четыре поворачиваем на 45° вокруг центра
|
||
-- площади: порталы встают на диагонали (ближе к центру, чем скамейки на радиусе 34), стороны света свободны.
|
||
|
||
if not map:GetAttribute("PortalsDiagonal") then
|
||
local turn = CFrame.Angles(0, math.rad(45), 0)
|
||
for _, c in ipairs(map:GetChildren()) do
|
||
local isPortal = c.Name:match("^PortalModel_World%d$") or c.Name:match("^PortalArch_World%d$") or c.Name:match("^Portal_World%d$")
|
||
or c.Name == "GuidePortal"
|
||
if isPortal then
|
||
if c:IsA("Model") then
|
||
c:PivotTo(turn * c:GetPivot())
|
||
elseif c:IsA("BasePart") then
|
||
c.CFrame = turn * c.CFrame
|
||
end
|
||
end
|
||
end
|
||
map:SetAttribute("PortalsDiagonal", true)
|
||
end
|
||
|
||
---------------------------------------------------------------- 3) здание
|
||
|
||
local hall = Instance.new("Folder")
|
||
hall.Name = "GuildHall"
|
||
hall:SetAttribute("GuildHall3", true)
|
||
hall.Parent = map
|
||
local model = BUILD.hall(hall)
|
||
model.Name = "GuildHallBuilding"
|
||
|
||
local params = RaycastParams.new()
|
||
params.FilterType = Enum.RaycastFilterType.Exclude
|
||
params.FilterDescendantsInstances = { hall }
|
||
local hit = workspace:Raycast(CENTER + V(0, 60, 0), V(0, -120, 0), params)
|
||
local groundY = hit and hit.Position.Y or 1.02
|
||
model:PivotTo(CFrame.new(CENTER.X, groundY, CENTER.Z) * CFrame.Angles(0, math.pi, 0)) -- фасад (−Z модели) — к площади
|
||
|
||
---------------------------------------------------------------- 4) материалы, коллизии, тени
|
||
|
||
-- без столкновений: настенное, висящее и мелкое убранство
|
||
local NO_COLLIDE = {
|
||
Door = true, Banners = true, WallNets = true, Sign = true, Crest = true, Lantern_L = true, Lantern_R = true,
|
||
Chandelier = true, Fire = true, ElderSpot = true, Rugs = true, UpperRug = true, Trophies = true, RankWall = true,
|
||
LakeMap = true, InteriorDecor = true,
|
||
-- отделка стен (штукатурка, панели, балки): стены держат камень и брёвна, а пласт штукатурки
|
||
-- на передней стене в модели проходит поперёк двери — с ним персонаж бился головой о проём
|
||
InteriorWalls = true, UpperInterior = true,
|
||
}
|
||
-- всегда со столкновениями: по ним ходят или они не дают упасть
|
||
local SOLID = { Stairs = true, Gallery = true, Balcony = true, UpperSlab = true, Foundation = true, Porch = true }
|
||
local parts, collide, glow = 0, 0, 0
|
||
for _, p in ipairs(model:GetDescendants()) do
|
||
if p:IsA("BasePart") then
|
||
parts += 1
|
||
p.Anchored = true
|
||
local group = p.Parent and p.Parent.Name or ""
|
||
local s = { p.Size.X, p.Size.Y, p.Size.Z }
|
||
table.sort(s)
|
||
local solid
|
||
if SOLID[group] then
|
||
solid = s[3] >= 0.6
|
||
else
|
||
solid = s[2] >= 1 and not NO_COLLIDE[group]
|
||
end
|
||
if p.Name:find("Window_Glow") then
|
||
solid = true -- стекло: в окно не пролезть
|
||
end
|
||
p.CanCollide = solid
|
||
p.CanQuery = solid
|
||
p.CanTouch = false
|
||
p.CastShadow = s[3] >= 3
|
||
if solid then
|
||
collide += 1
|
||
end
|
||
if p.Name:find("_Glow") then
|
||
p.Material = Enum.Material.Neon
|
||
p.CastShadow = false
|
||
glow += 1
|
||
-- свет в помещении горит и днём (Ambience не гасит), фонари у двери — как остальные в лобби
|
||
if group ~= "Lantern_L" and group ~= "Lantern_R" and not p.Name:find("^Window") then
|
||
p:SetAttribute("AlwaysLit", true)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
---------------------------------------------------------------- проёмы: вход, лестница, балкон
|
||
-- Модель v2 местами перекрывает проходы: пласт штукатурки поперёк входной арки, перекрытие и балки над
|
||
-- первым маршем лестницы, низкая узкая дверь на балкон. Вырезаем проёмы «по-настоящему»: деталь, задетая
|
||
-- вырезом, делится на куски вокруг него (детали модели стоят ровно по осям), лишнее удаляется.
|
||
-- Координаты вырезов — в системе модели (как в Blockbench / 16, фасад в −Z), поэтому не зависят от места.
|
||
|
||
local function axisAligned(cf)
|
||
for _, v in ipairs({ cf.RightVector, cf.UpVector, cf.LookVector }) do
|
||
local a = math.max(math.abs(v.X), math.abs(v.Y), math.abs(v.Z))
|
||
if a < 0.999 then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
local function boundsOf(p)
|
||
local h = p.CFrame:VectorToWorldSpace(p.Size / 2)
|
||
h = V(math.abs(h.X), math.abs(h.Y), math.abs(h.Z))
|
||
return p.Position - h, p.Position + h
|
||
end
|
||
-- вырез в мировых координатах: bx = { mn, mx }; skip — группы (родители деталей), которые не трогать
|
||
local function carve(bx, skip, filter)
|
||
local mn, mx = bx[1], bx[2]
|
||
local cut, removed, kept = 0, 0, 0
|
||
for _, p in ipairs(model:GetDescendants()) do
|
||
if p:IsA("BasePart") and p ~= model.PrimaryPart and not (skip and skip[p.Parent.Name]) and (not filter or filter(p)) then
|
||
local a, b = boundsOf(p)
|
||
if a.X < mx.X - 1e-3 and b.X > mn.X + 1e-3 and a.Y < mx.Y - 1e-3 and b.Y > mn.Y + 1e-3 and a.Z < mx.Z - 1e-3 and b.Z > mn.Z + 1e-3 then
|
||
if axisAligned(p.CFrame) then
|
||
local rot = p.CFrame - p.Position
|
||
-- куски: по X слева/справа, затем в пределах X — по Y снизу/сверху, затем по Z спереди/сзади
|
||
local pieces = {}
|
||
local x0, x1 = math.max(a.X, mn.X), math.min(b.X, mx.X)
|
||
local y0, y1 = math.max(a.Y, mn.Y), math.min(b.Y, mx.Y)
|
||
if a.X < mn.X then table.insert(pieces, { V(a.X, a.Y, a.Z), V(mn.X, b.Y, b.Z) }) end
|
||
if b.X > mx.X then table.insert(pieces, { V(mx.X, a.Y, a.Z), V(b.X, b.Y, b.Z) }) end
|
||
if a.Y < mn.Y then table.insert(pieces, { V(x0, a.Y, a.Z), V(x1, mn.Y, b.Z) }) end
|
||
if b.Y > mx.Y then table.insert(pieces, { V(x0, mx.Y, a.Z), V(x1, b.Y, b.Z) }) end
|
||
if a.Z < mn.Z then table.insert(pieces, { V(x0, y0, a.Z), V(x1, y1, mn.Z) }) end
|
||
if b.Z > mx.Z then table.insert(pieces, { V(x0, y0, mx.Z), V(x1, y1, b.Z) }) end
|
||
for _, pc in ipairs(pieces) do
|
||
local size = pc[2] - pc[1]
|
||
if size.X > 0.02 and size.Y > 0.02 and size.Z > 0.02 then
|
||
local q = p:Clone()
|
||
local ls = rot:VectorToObjectSpace(size)
|
||
q.Size = V(math.abs(ls.X), math.abs(ls.Y), math.abs(ls.Z))
|
||
q.CFrame = CFrame.new((pc[1] + pc[2]) / 2) * rot
|
||
q.Parent = p.Parent
|
||
kept += 1
|
||
end
|
||
end
|
||
p:Destroy()
|
||
cut += 1
|
||
else
|
||
p:Destroy() -- повёрнутую мелочь в проёме просто убираем
|
||
removed += 1
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return cut, removed, kept
|
||
end
|
||
local PIV = model:GetPivot()
|
||
-- прямоугольник модели (x, y, z — пары) → мировые [mn, mx]
|
||
local function box(x0, x1, y0, y1, z0, z1)
|
||
local a, b = PIV * V(x0, y0, z0), PIV * V(x1, y1, z1)
|
||
return { V(math.min(a.X, b.X), math.min(a.Y, b.Y), math.min(a.Z, b.Z)), V(math.max(a.X, b.X), math.max(a.Y, b.Y), math.max(a.Z, b.Z)) }
|
||
end
|
||
local WOOD_DARK = Color3.fromRGB(74, 48, 32)
|
||
local function plank(name, cf, size, color, solid)
|
||
local p = Instance.new("Part")
|
||
p.Name = name
|
||
p.Anchored, p.CanTouch = true, false
|
||
p.CanCollide, p.CanQuery = solid ~= false, solid ~= false
|
||
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||
p.Material = Enum.Material.SmoothPlastic
|
||
p.Color = color or WOOD_DARK
|
||
p.Size = size
|
||
p.CFrame = cf
|
||
p.CastShadow = math.max(size.X, size.Y, size.Z) >= 3
|
||
p.Parent = model
|
||
return p
|
||
end
|
||
|
||
-- 1) вход: штукатурка и обшивка поперёк арки (дверь в модели — x ±2.6, до 8.2 над полом)
|
||
carve(box(-2.6, 2.6, 1.0, 8.2, -10.4, -8.9), { Door = true })
|
||
-- створки были распахнуты внутрь поперёк прохода — поворачиваем к стене зала по обе стороны от проёма
|
||
do
|
||
local door = model:FindFirstChild("Door", true)
|
||
local intoHall = PIV:VectorToWorldSpace(V(0, 0, 0.9)) -- в модели зал — в +Z
|
||
for _, p in ipairs(door and door:GetDescendants() or {}) do
|
||
if p:IsA("BasePart") then
|
||
local lx = PIV:PointToObjectSpace(p.Position).X
|
||
local hinge = PIV * V(lx > 0 and 2.45 or -2.45, 0, -10.7)
|
||
local s = (hinge.X > PIV.Position.X) and 1 or -1 -- сторона проёма в мире
|
||
local H = CFrame.new(hinge.X, 0, hinge.Z)
|
||
p.CFrame = H * CFrame.Angles(0, math.rad(-s * 90), 0) * H:Inverse() * p.CFrame + intoHall
|
||
p.CanCollide, p.CanQuery = false, false
|
||
end
|
||
end
|
||
end
|
||
|
||
-- 2) лестница: над лестничным колодцем (площадка и второй марш) и над верхом первого марша висели балки
|
||
-- и потолочный настил — голова поднимающегося их задевала. Убираем их; само перекрытие второго этажа
|
||
-- над первым маршем не трогаем (на нём стоит архив), до его низа голова не достаёт.
|
||
local STAIR_SKIP = { Stairs = true, Gallery = true, InteriorWalls = true, UpperInterior = true, StoneFloor = true, UpperFloor = true,
|
||
Timber = true, Windows = true, UpperSlab = true, Chandelier = true }
|
||
carve(box(-15.0, -4.4, 10.5, 13.95, 6.6, 10.0), STAIR_SKIP) -- колодец: x −15…−4.4, z 6.6…10 (модель)
|
||
carve(box(-15.0, -11.8, 10.5, 12.94, 0.5, 6.6), STAIR_SKIP) -- над первым маршем — до низа перекрытия
|
||
|
||
-- 3) балкон: дверь от пола второго этажа до балок потолка (свес крыши снаружи начинается сразу над ней),
|
||
-- шириной 3 стада; старая низкая створка и стекло — убрать, косяки, перемычка и створка — новые
|
||
for _, d in ipairs(model:GetDescendants()) do
|
||
if d:IsA("BasePart") and d.Name:find("^BalconyDoor") then
|
||
d:Destroy()
|
||
end
|
||
end
|
||
carve(box(-1.5, 1.5, 13.82, 20.3, -12.0, -9.6), { Balcony = true, Crest = true, Fish = true, UpperSlab = true, Jetty = true, Roof = true }, function(p)
|
||
return p.Name ~= "Sill" and p.Name ~= "UpperFloorPlank"
|
||
end)
|
||
for _, x in ipairs({ -1.65, 1.65 }) do
|
||
plank("BalconyJamb", PIV * CFrame.new(x, 17.06, -11.25), V(0.3, 6.5, 1.4))
|
||
end
|
||
plank("BalconyLintel", PIV * CFrame.new(0, 20.45, -11.25), V(3.6, 0.35, 1.4))
|
||
do
|
||
-- открытая створка: доски с поперечинами, распахнута в комнату у правого косяка
|
||
local hinge = PIV * CFrame.new(1.45, 17.1, -10.55)
|
||
local leaf = hinge * CFrame.Angles(0, math.rad(90), 0) * CFrame.new(-1.45, 0, 0)
|
||
plank("BalconyLeaf", leaf, V(2.9, 6.2, 0.2), Color3.fromRGB(120, 78, 46), false)
|
||
for _, y in ipairs({ -2.3, 0, 2.3 }) do
|
||
plank("BalconyLeafStrap", leaf * CFrame.new(0, y, 0.12), V(2.7, 0.2, 0.06), Color3.fromRGB(56, 56, 62), false)
|
||
plank("BalconyLeafStrap", leaf * CFrame.new(0, y, -0.12), V(2.7, 0.2, 0.06), Color3.fromRGB(56, 56, 62), false)
|
||
end
|
||
end
|
||
-- балкон в модели — 2.1 стада от стены до перил, на нём негде стоять: выдвигаем его вперёд на 1.6
|
||
-- (детали на всю глубину — удлиняем наружу, перила и всё у внешнего края — сдвигаем)
|
||
local BALC_EXTRA = 1.6
|
||
do
|
||
local g = model:FindFirstChild("Balcony", true)
|
||
local out = PIV:VectorToWorldSpace(V(0, 0, -BALC_EXTRA)) -- наружу = −Z модели
|
||
for _, p in ipairs(g and g:GetDescendants() or {}) do
|
||
if p:IsA("BasePart") then
|
||
local a, b = boundsOf(p)
|
||
local la, lb = PIV:PointToObjectSpace(a), PIV:PointToObjectSpace(b)
|
||
local zOut, zIn = math.min(la.Z, lb.Z), math.max(la.Z, lb.Z) -- внешний край — меньший z модели
|
||
if zOut < -13.9 and zIn > -12.1 and axisAligned(p.CFrame) then
|
||
-- на всю глубину (пол, боковые бортики): удлинить наружу
|
||
local ls = (p.CFrame - p.Position):VectorToObjectSpace(out)
|
||
p.Size = p.Size + V(math.abs(ls.X), math.abs(ls.Y), math.abs(ls.Z))
|
||
p.CFrame = p.CFrame + out / 2
|
||
elseif zOut < -13.9 then
|
||
p.CFrame = p.CFrame + out -- перила, балясины, бортик у края
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- герб висел над балконной дверью снаружи — перевешиваем его на перила балкона (уменьшен до 0.7)
|
||
do
|
||
local list = {}
|
||
local crest = model:FindFirstChild("Crest", true)
|
||
for _, d in ipairs(crest and crest:GetDescendants() or {}) do
|
||
if d:IsA("BasePart") then
|
||
table.insert(list, d)
|
||
end
|
||
end
|
||
if #list > 0 then
|
||
local mn, mx = V(math.huge, math.huge, math.huge), V(-math.huge, -math.huge, -math.huge)
|
||
for _, p in ipairs(list) do
|
||
local a, b = boundsOf(p)
|
||
mn, mx = mn:Min(a), mx:Max(b)
|
||
end
|
||
local c = (mn + mx) / 2
|
||
local k = 0.7
|
||
local h = (mx.Y - mn.Y) * k
|
||
local target = PIV * V(0, 15.6 - h / 2, -14.45 - BALC_EXTRA) -- верх — вровень с поручнем, перед перилами
|
||
for _, p in ipairs(list) do
|
||
p.Size = p.Size * k
|
||
p.CFrame = CFrame.new(target + (p.Position - c) * k) * (p.CFrame - p.Position)
|
||
end
|
||
end
|
||
end
|
||
-- ящики, бочки и сундуки — на землю / пол: в модели они стоят на высоте цоколя (у фасада висят над мостовой).
|
||
-- Детали одного предмета — общий префикс имени (BarrelA_S0 → BarrelA); каждый предмет опускаем на самую
|
||
-- высокую точку под ним (лучи вниз из центра и углов основания, только по твёрдым деталям)
|
||
do
|
||
local rp = RaycastParams.new()
|
||
rp.FilterType = Enum.RaycastFilterType.Exclude
|
||
rp.RespectCanCollide = true
|
||
for _, groupName in ipairs({ "Props", "Chests" }) do
|
||
local g = model:FindFirstChild(groupName, true)
|
||
local items = {}
|
||
for _, p in ipairs(g and g:GetDescendants() or {}) do
|
||
if p:IsA("BasePart") then
|
||
local key = p.Name:match("^([^_]+)") or p.Name
|
||
-- сундуки: один префикс у всех — различаем по положению (сетка 3 стада)
|
||
if groupName == "Chests" then
|
||
key = key .. math.floor(p.Position.X / 3) .. ":" .. math.floor(p.Position.Z / 3)
|
||
end
|
||
items[key] = items[key] or {}
|
||
table.insert(items[key], p)
|
||
end
|
||
end
|
||
for _, list in pairs(items) do
|
||
local mn, mx = V(math.huge, math.huge, math.huge), V(-math.huge, -math.huge, -math.huge)
|
||
for _, p in ipairs(list) do
|
||
local a, b = boundsOf(p)
|
||
mn, mx = mn:Min(a), mx:Max(b)
|
||
end
|
||
rp.FilterDescendantsInstances = { g, hall:FindFirstChild("NpcSpot"), model.PrimaryPart } -- основание модели невидимо, но пока твёрдое
|
||
local best
|
||
local c, h = (mn + mx) / 2, (mx - mn) * 0.35
|
||
-- луч из центра: края ящиков у фасада заходят на узкий выступ цоколя, по нему мерить нельзя
|
||
for _, o in ipairs({ V(0, 0, 0) }) do
|
||
local hit = workspace:Raycast(V(c.X + o.X, mn.Y + 1, c.Z + o.Z), V(0, -6, 0), rp)
|
||
if hit and (not best or hit.Position.Y > best) then
|
||
best = hit.Position.Y
|
||
end
|
||
end
|
||
local gap = best and (mn.Y - best)
|
||
if gap and math.abs(gap) > 0.03 and gap < 5 then
|
||
for _, p in ipairs(list) do
|
||
p.CFrame = p.CFrame - V(0, gap, 0)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
local base = model.PrimaryPart
|
||
if base then
|
||
base.CanCollide, base.CanQuery, base.Transparency = false, false, 1
|
||
end
|
||
|
||
local function group(name)
|
||
return model:FindFirstChild(name, true)
|
||
end
|
||
local function partsOf(groupName, pattern)
|
||
local list = {}
|
||
local g = group(groupName)
|
||
for _, d in ipairs(g and g:GetDescendants() or {}) do
|
||
if d:IsA("BasePart") and d.Name:find(pattern) then
|
||
table.insert(list, d)
|
||
end
|
||
end
|
||
return list
|
||
end
|
||
local function light(part, range, brightness, color, shadows)
|
||
local l = Instance.new("PointLight")
|
||
l.Range, l.Brightness, l.Color, l.Shadows = range, brightness, color, shadows or false
|
||
l.Parent = part
|
||
return l
|
||
end
|
||
-- центр группы деталей (для одного источника света на всю люстру)
|
||
local function centerOf(list)
|
||
local sum = V()
|
||
for _, p in ipairs(list) do
|
||
sum += p.Position
|
||
end
|
||
return #list > 0 and sum / #list or nil
|
||
end
|
||
local function lamp(pos, range, brightness, color, shadows)
|
||
if not pos then
|
||
return
|
||
end
|
||
local f = Instance.new("Part")
|
||
f.Name = "HallLight"
|
||
f.Size = V(0.4, 0.4, 0.4)
|
||
f.Transparency, f.Anchored, f.CanCollide, f.CanQuery, f.CanTouch, f.CastShadow = 1, true, false, false, false, false
|
||
f.Position = pos
|
||
f.Parent = model
|
||
light(f, range, brightness, color, shadows)
|
||
end
|
||
|
||
-- люстры: на первом этаже (ChCandle) и на втором (UChCandle) — по одному мягкому свету с большим радиусом
|
||
lamp(centerOf(partsOf("Chandelier", "^ChCandle_Glow")), 46, 0.5, WARM, true)
|
||
lamp(centerOf(partsOf("Chandelier", "^UChCandle_Glow")), 38, 0.42, WARM, true)
|
||
-- камин: огонь и неяркий тёплый свет
|
||
local fireCore = partsOf("Fire", "FireCore_Glow")[1] or partsOf("Fire", "Fire_Glow")[1]
|
||
if fireCore then
|
||
local f = Instance.new("Fire")
|
||
f.Size, f.Heat = 3, 5
|
||
f.Color, f.SecondaryColor = Color3.fromRGB(255, 150, 60), Color3.fromRGB(200, 60, 20)
|
||
f.Parent = fireCore
|
||
light(fireCore, 20, 0.7, Color3.fromRGB(255, 186, 130))
|
||
end
|
||
-- рассеянный свет, чтобы углы залов не тонули в темноте
|
||
local pivot = model:GetPivot()
|
||
for _, p in ipairs({ V(-9, 9, 3), V(9, 9, 3), V(-8, 19.5, 0), V(8, 19.5, 0) }) do
|
||
lamp(pivot * p, 30, 0.18, Color3.fromRGB(240, 240, 245))
|
||
end
|
||
-- фонари у двери
|
||
for _, g in ipairs({ "Lantern_L", "Lantern_R" }) do
|
||
for _, p in ipairs(partsOf(g, "_Glow")) do
|
||
light(p, 14, 0.9, Color3.fromRGB(255, 205, 150))
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- 5) вывеска, доски заказов, Ворон
|
||
|
||
local function surfaceGui(part, face)
|
||
local sg = Instance.new("SurfaceGui")
|
||
sg.Face = face
|
||
sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||
sg.PixelsPerStud = 50
|
||
sg.LightInfluence = 0
|
||
sg.Parent = part
|
||
return sg
|
||
end
|
||
local function label(parent, props)
|
||
local t = Instance.new("TextLabel")
|
||
t.BackgroundTransparency = 1
|
||
t.FontFace = TITLE_FONT
|
||
t.TextScaled = true
|
||
t.TextColor3 = GOLD_TEXT
|
||
t.TextStrokeTransparency = 0.35
|
||
t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20)
|
||
for k, v in pairs(props) do
|
||
t[k] = v
|
||
end
|
||
t.Parent = parent
|
||
return t
|
||
end
|
||
|
||
local signFace = partsOf("Sign", "^Sign_Face$")[1]
|
||
assert(signFace, "Нет Sign_Face в модели")
|
||
label(surfaceGui(signFace, Enum.NormalId.Front), { Size = UDim2.fromScale(0.8, 0.7), Position = UDim2.fromScale(0.1, 0.15), Text = "⚓ ГИЛЬДИЯ РЫБАКОВ" })
|
||
local bb = Instance.new("BillboardGui")
|
||
bb.Size = UDim2.fromOffset(320, 56)
|
||
bb.StudsOffsetWorldSpace = V(0, 22, 0)
|
||
bb.MaxDistance = 160
|
||
bb.LightInfluence = 0
|
||
bb.Parent = signFace
|
||
label(bb, { Size = UDim2.fromScale(1, 1), Text = "⚔ Гильдия рыбаков", TextStrokeTransparency = 0.15 })
|
||
|
||
-- доска заказов: заголовок и приколотые пергаменты; атрибут OrderBoard + подсказка «Заказы гильдии»
|
||
local rng = Random.new(7)
|
||
local function orderBoard(face)
|
||
face.CanCollide, face.CanQuery = true, true
|
||
face:SetAttribute("OrderBoard", true)
|
||
local sg = surfaceGui(face, Enum.NormalId.Front)
|
||
label(sg, { Size = UDim2.fromScale(0.9, 0.2), Position = UDim2.fromScale(0.05, 0.03), Text = "📜 ДОСКА ЗАКАЗОВ" })
|
||
for i = 1, 6 do
|
||
local note = Instance.new("Frame")
|
||
note.Size = UDim2.fromScale(0.26, 0.3)
|
||
note.Position = UDim2.fromScale(0.06 + ((i - 1) % 3) * 0.31, 0.27 + math.floor((i - 1) / 3) * 0.36)
|
||
note.Rotation = rng:NextNumber(-7, 7)
|
||
note.BackgroundColor3 = Color3.fromRGB(236, 220, 180):Lerp(Color3.fromRGB(200, 170, 120), rng:NextNumber(0, 0.4))
|
||
note.BorderSizePixel = 0
|
||
note.Parent = sg
|
||
local pin = Instance.new("Frame")
|
||
pin.Size = UDim2.fromScale(0.16, 0.12)
|
||
pin.Position = UDim2.fromScale(0.42, -0.04)
|
||
pin.BackgroundColor3 = (i % 2 == 0) and Color3.fromRGB(150, 40, 35) or Color3.fromRGB(214, 160, 70)
|
||
pin.BorderSizePixel = 0
|
||
pin.Parent = note
|
||
Instance.new("UICorner", pin).CornerRadius = UDim.new(1, 0)
|
||
for l = 1, 3 do
|
||
local line = Instance.new("Frame")
|
||
line.Size = UDim2.fromScale(0.7, 0.05)
|
||
line.Position = UDim2.fromScale(0.15, 0.25 + l * 0.17)
|
||
line.BackgroundColor3 = Color3.fromRGB(110, 80, 50)
|
||
line.BorderSizePixel = 0
|
||
line.Parent = note
|
||
end
|
||
end
|
||
local pp = Instance.new("ProximityPrompt")
|
||
pp.ActionText, pp.ObjectText = "Заказы гильдии", "Доска заказов"
|
||
pp.HoldDuration, pp.MaxActivationDistance, pp.RequiresLineOfSight = 0, 12, false
|
||
pp:SetAttribute("Action", "Orders")
|
||
pp.Parent = face
|
||
end
|
||
local outside = partsOf("OrderBoard", "^OrderBoard_Face$")[1]
|
||
local inside = partsOf("OrderBoardInside", "^OrderBoardInside_Face$")[1]
|
||
assert(outside and inside, "Нет граней досок заказов в модели")
|
||
orderBoard(outside)
|
||
orderBoard(inside)
|
||
|
||
-- Старейшина Ворон — за столом в глубине зала, лицом к двери (LookVector детали = «вперёд» модели)
|
||
local spot = partsOf("ElderSpot", "^ElderSpot$")[1]
|
||
assert(spot, "Нет ElderSpot в модели")
|
||
local top = spot.Position + V(0, spot.Size.Y / 2, 0)
|
||
local fwd = V(spot.CFrame.LookVector.X, 0, spot.CFrame.LookVector.Z).Unit
|
||
oldElder.CFrame = CFrame.lookAt(top + V(0, 2.9, 0), top + V(0, 2.9, 0) + fwd)
|
||
oldElder.Parent = hall
|
||
spot.Transparency = 1
|
||
|
||
return ("Гильдия v2: деталей %d, с коллизией %d, светящихся %d; земля Y=%.2f; Ворон %s"):format(parts, collide, glow, groundY, tostring(oldElder.Position))
|