Lobby
This commit is contained in:
1 parent
73a2db8bb8
commit
44cf31ce6b
231 files changed
+3396887
-1109081
No files matched your search
@@ -40,6 +40,8 @@ end
|
||||
local Config = load(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
local Models = load(ReplicatedStorage:WaitForChild("GameModels"))
|
||||
local World1Builder = load(ServerScriptService:WaitForChild("World1Builder"))
|
||||
-- образы NPC (если модуля нет — NPC собираются по-старому)
|
||||
local NpcLooks = ServerScriptService:FindFirstChild("NpcLooks") and load(ServerScriptService.NpcLooks) or { get = function() return nil end }
|
||||
|
||||
local V = Vector3.new
|
||||
local terrain = Workspace.Terrain
|
||||
@@ -700,6 +702,125 @@ function Builder.stallParts(cf, parent)
|
||||
return list
|
||||
end
|
||||
|
||||
-- Доска лидеров (low poly): два столба, двускатная крыша, табличка с названием, фонарики и экран на rows строк.
|
||||
-- cf стоит на полу и смотрит LookVector на зрителей. Строки Row1…RowN заполняет Leaderboards.server.lua.
|
||||
function Builder.leaderboard(cf, board, rows, parent)
|
||||
local model = Instance.new("Model")
|
||||
model.Name = "Leaderboard_" .. board.id
|
||||
model:SetAttribute("Leaderboard", board.id)
|
||||
local function part(props)
|
||||
local p = Instance.new(props.Class or "Part")
|
||||
p.Anchored = true
|
||||
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||
p.Material = Enum.Material.SmoothPlastic
|
||||
for k, v in pairs(props) do
|
||||
if k ~= "Class" and k ~= "At" then
|
||||
p[k] = v
|
||||
end
|
||||
end
|
||||
p.CFrame = cf * props.At
|
||||
p.Parent = model
|
||||
return p
|
||||
end
|
||||
local WOOD, DARK, TRIM = Color3.fromRGB(122, 82, 50), Color3.fromRGB(58, 38, 26), Color3.fromRGB(176, 122, 66)
|
||||
for _, s in ipairs({ -1, 1 }) do
|
||||
part({ Name = "Foot", Size = V(2.2, 1, 2.2), At = CFrame.new(s * 6.6, 0.5, 0), Color = Color3.fromRGB(128, 118, 122) })
|
||||
part({ Name = "Post", Size = V(1.3, 16.5, 1.3), At = CFrame.new(s * 6.6, 8.25, 0), Color = WOOD })
|
||||
-- фонарик на столбе
|
||||
local lamp = part({ Name = "Lantern", Size = V(0.9, 1.2, 0.9), At = CFrame.new(s * 6.6, 14.2, -0.95),
|
||||
Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 196, 110), CanCollide = false })
|
||||
part({ Name = "LanternCap", Size = V(1.2, 0.3, 1.2), At = CFrame.new(s * 6.6, 14.95, -0.95), Color = DARK, CanCollide = false })
|
||||
local light = Instance.new("PointLight")
|
||||
light.Range, light.Brightness, light.Color = 12, 0.9, Color3.fromRGB(255, 190, 110)
|
||||
light.Parent = lamp
|
||||
end
|
||||
local screen = part({ Name = "Screen", Size = V(12, 9.6, 0.5), At = CFrame.new(0, 9.4, 0), Color = DARK })
|
||||
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 14.5, 0), Color = TRIM })
|
||||
part({ Name = "Trim", Size = V(13.4, 0.6, 0.8), At = CFrame.new(0, 4.3, 0), Color = TRIM })
|
||||
local plaque = part({ Name = "Plaque", Size = V(11, 2.3, 0.7), At = CFrame.new(0, 16.2, -0.1), Color = WOOD })
|
||||
part({ Name = "PlaqueTrim", Size = V(11.6, 2.8, 0.5), At = CFrame.new(0, 16.2, 0.15), Color = TRIM })
|
||||
-- двускатная крыша
|
||||
for _, s in ipairs({ -1, 1 }) do
|
||||
part({ Name = "Roof", Size = V(8, 0.5, 2.6), At = CFrame.new(s * 3.55, 18.35, 0) * CFrame.Angles(0, 0, math.rad(-s * 17)),
|
||||
Color = Color3.fromRGB(150, 70, 52) })
|
||||
end
|
||||
|
||||
-- заголовок
|
||||
local titleGui = Instance.new("SurfaceGui")
|
||||
titleGui.Face = Enum.NormalId.Front
|
||||
titleGui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||
titleGui.PixelsPerStud = 40
|
||||
titleGui.LightInfluence = 0
|
||||
titleGui.Parent = plaque
|
||||
local title = Instance.new("TextLabel")
|
||||
title.Size = UDim2.new(1, -16, 1, -8)
|
||||
title.Position = UDim2.fromOffset(8, 4)
|
||||
title.BackgroundTransparency = 1
|
||||
title.Font = Enum.Font.FredokaOne
|
||||
title.TextScaled = true
|
||||
title.Text = board.title
|
||||
title.TextColor3 = board.color
|
||||
title.Parent = titleGui
|
||||
local ts = Instance.new("UIStroke")
|
||||
ts.Color, ts.Thickness = Color3.fromRGB(40, 22, 10), 3
|
||||
ts.Parent = title
|
||||
|
||||
-- строки топа
|
||||
local gui = Instance.new("SurfaceGui")
|
||||
gui.Name = "Rows"
|
||||
gui.Face = Enum.NormalId.Front
|
||||
gui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||
gui.PixelsPerStud = 40
|
||||
gui.LightInfluence = 0.2
|
||||
gui.Parent = screen
|
||||
local list = Instance.new("Frame")
|
||||
list.Size = UDim2.new(1, -24, 1, -20)
|
||||
list.Position = UDim2.fromOffset(12, 10)
|
||||
list.BackgroundTransparency = 1
|
||||
list.Parent = gui
|
||||
local layout = Instance.new("UIListLayout")
|
||||
layout.Padding = UDim.new(0, 3)
|
||||
layout.SortOrder = Enum.SortOrder.LayoutOrder
|
||||
layout.Parent = list
|
||||
local RANK_COLOR = { Color3.fromRGB(255, 210, 80), Color3.fromRGB(215, 225, 235), Color3.fromRGB(230, 150, 90) }
|
||||
for i = 1, rows do
|
||||
local row = Instance.new("Frame")
|
||||
row.Name = "Row" .. i
|
||||
row.LayoutOrder = i
|
||||
row.Size = UDim2.new(1, 0, 1 / rows, -3)
|
||||
row.BackgroundColor3 = Color3.fromRGB(255, 240, 210)
|
||||
row.BackgroundTransparency = (i % 2 == 0) and 0.94 or 0.88
|
||||
row.BorderSizePixel = 0
|
||||
row.Parent = list
|
||||
local corner = Instance.new("UICorner")
|
||||
corner.CornerRadius = UDim.new(0, 6)
|
||||
corner.Parent = row
|
||||
local color = RANK_COLOR[i] or Color3.fromRGB(245, 232, 205)
|
||||
local function label(name, pos, size, align, text)
|
||||
local t = Instance.new("TextLabel")
|
||||
t.Name = name
|
||||
t.Position, t.Size = pos, size
|
||||
t.BackgroundTransparency = 1
|
||||
t.Font = Enum.Font.FredokaOne
|
||||
t.TextScaled = true
|
||||
t.TextXAlignment = align
|
||||
t.TextColor3 = color
|
||||
t.Text = text
|
||||
t.Parent = row
|
||||
return t
|
||||
end
|
||||
label("Rank", UDim2.new(0, 6, 0.1, 0), UDim2.new(0, 46, 0.8, 0), Enum.TextXAlignment.Center, ({ "🥇", "🥈", "🥉" })[i] or (i .. "."))
|
||||
label("PlayerName", UDim2.new(0, 58, 0.12, 0), UDim2.new(0.58, -58, 0.76, 0), Enum.TextXAlignment.Left, "—")
|
||||
label("Value", UDim2.new(0.58, 0, 0.12, 0), UDim2.new(0.42, -8, 0.76, 0), Enum.TextXAlignment.Right, "")
|
||||
end
|
||||
-- опора модели — экран, точка опоры на земле под центром доски и без наклона:
|
||||
-- иначе Studio берёт поворот случайной детали (ската крыши) и стрелки инструментов встают наискосок
|
||||
model.PrimaryPart = screen
|
||||
screen.PivotOffset = CFrame.new(0, -9.4, 0)
|
||||
model.Parent = parent
|
||||
return model
|
||||
end
|
||||
|
||||
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
||||
local function stall(cf, opt)
|
||||
local function at(x, y, z)
|
||||
@@ -1016,6 +1137,12 @@ function Builder.build()
|
||||
lobbyTrees()
|
||||
lobbyRockPlants()
|
||||
lobbyHills()
|
||||
-- доски лидеров у подножия скал напротив точки появления
|
||||
for i, b in ipairs(Config.Leaderboards.boards) do
|
||||
local a = math.rad(({ 220, 270, 320 })[i] or 270)
|
||||
local p = V(math.cos(a) * 71, FLOOR, math.sin(a) * 71)
|
||||
Builder.leaderboard(CFrame.lookAt(p, V(0, FLOOR, 0)), b, Config.Leaderboards.size, map)
|
||||
end
|
||||
|
||||
-- магазин (запад) и скупка (восток)
|
||||
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||||
@@ -1152,12 +1279,31 @@ function Builder.build()
|
||||
-- сундук с ежедневной наградой
|
||||
do
|
||||
local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50))
|
||||
local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) })
|
||||
P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) })
|
||||
for _, x in ipairs({ -1.8, 1.8 }) do
|
||||
P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||||
local template = ServerStorage:FindFirstChild("DailyChestTemplate")
|
||||
local base
|
||||
if template and template:IsA("Model") then
|
||||
-- low poly сундук (Base, Lid, Coins, Lock; замок по +Z модели, опора — низ по центру);
|
||||
-- его анимирует ChestAnimation.client.lua, подсказка и подпись — на невидимой детали
|
||||
local chest = template:Clone()
|
||||
chest.Name = "DailyChest"
|
||||
chest:SetAttribute("DailyChest", true)
|
||||
chest:PivotTo(cf * CFrame.Angles(0, math.pi, 0))
|
||||
for _, p in ipairs(chest:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
p.Anchored = true
|
||||
p.CanCollide = p.Name == "Base"
|
||||
end
|
||||
end
|
||||
chest.Parent = map
|
||||
base = P({ Name = "DailyChestPrompt", Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Transparency = 1, CanCollide = false })
|
||||
else
|
||||
base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) })
|
||||
P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) })
|
||||
for _, x in ipairs({ -1.8, 1.8 }) do
|
||||
P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||||
end
|
||||
P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) })
|
||||
end
|
||||
P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) })
|
||||
local sp = Instance.new("ParticleEmitter")
|
||||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||
sp.Rate = 8
|
||||
@@ -1779,14 +1925,28 @@ local function spawnNpc(spot, parent)
|
||||
pants = color("PantsColor", Color3.fromRGB(60, 70, 100)),
|
||||
hat = color("HatColor", Color3.fromRGB(90, 110, 60)),
|
||||
}
|
||||
-- колоритный образ из NpcLooks (если есть): свои цвета и пропорции тела
|
||||
local look = NpcLooks.get(name)
|
||||
if look and look.colors then
|
||||
for k, v in pairs(look.colors) do
|
||||
colors[k] = v
|
||||
end
|
||||
end
|
||||
local ok, rig = pcall(function()
|
||||
local d = Instance.new("HumanoidDescription")
|
||||
d.HeadColor = colors.skin
|
||||
d.LeftArmColor = colors.skin
|
||||
d.RightArmColor = colors.skin
|
||||
d.LeftArmColor = colors.arms or colors.skin
|
||||
d.RightArmColor = colors.arms or colors.skin
|
||||
d.TorsoColor = colors.shirt
|
||||
d.LeftLegColor = colors.pants
|
||||
d.RightLegColor = colors.pants
|
||||
local s = look and look.scale
|
||||
if s then
|
||||
d.HeightScale = s.height or 1
|
||||
d.WidthScale = s.width or 1
|
||||
d.DepthScale = s.depth or 1
|
||||
d.HeadScale = s.head or 1
|
||||
end
|
||||
return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15)
|
||||
end)
|
||||
if not ok or not rig then
|
||||
@@ -1794,6 +1954,7 @@ local function spawnNpc(spot, parent)
|
||||
return nil
|
||||
end
|
||||
rig.Name = name
|
||||
rig:SetAttribute("Npc", true) -- по нему клиент находит NPC (взгляд на игрока, приветствие), сервер — включает idle
|
||||
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||
hum.DisplayName = name
|
||||
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
||||
@@ -1801,6 +1962,10 @@ local function spawnNpc(spot, parent)
|
||||
local root = rig:FindFirstChild("HumanoidRootPart")
|
||||
root.Anchored = true
|
||||
rig:PivotTo(spot.CFrame)
|
||||
-- место NPC — на 3 studs выше пола; у рослых и низких образов ставим ноги ровно на пол
|
||||
if look and look.scale then
|
||||
rig:PivotTo(spot.CFrame + Vector3.new(0, hum.HipHeight + root.Size.Y / 2 - 3, 0))
|
||||
end
|
||||
rig.Parent = parent
|
||||
|
||||
local head = rig:FindFirstChild("Head")
|
||||
@@ -1827,10 +1992,11 @@ local function spawnNpc(spot, parent)
|
||||
w.C0 = head.CFrame:Inverse() * p.CFrame
|
||||
w.Parent = p
|
||||
p.Parent = rig
|
||||
<<<<<<< HEAD
|
||||
return p
|
||||
end
|
||||
if spot:GetAttribute("Look") == "Elder" then
|
||||
if look then
|
||||
NpcLooks.dress(rig, look)
|
||||
elseif spot:GetAttribute("Look") == "Elder" then
|
||||
-- Старейшина Ворон: седые волосы и борода (цвет HatColor), чёрная повязка на глазу
|
||||
local function elderPart(size, offset, color, shape)
|
||||
local p = hatPart(size, offset, shape or Enum.PartType.Block)
|
||||
@@ -1841,15 +2007,16 @@ local function spawnNpc(spot, parent)
|
||||
elderPart(V(1.0, 0.75, 0.35), CFrame.new(0, -0.55, -0.5), colors.hat)
|
||||
elderPart(V(0.32, 0.3, 0.08), CFrame.new(0.22, 0.12, -0.6), Color3.fromRGB(20, 20, 22))
|
||||
elderPart(V(1.24, 0.08, 1.24), CFrame.new(0, 0.18, 0) * CFrame.Angles(0, 0, math.rad(-12)), Color3.fromRGB(20, 20, 22))
|
||||
elseif spot:GetAttribute("Look") == "Scarf" then
|
||||
-- платок (цвет HatColor): макушка и узелок сзади
|
||||
local s = hatPart(V(1.3, 0.5, 1.3), CFrame.new(0, 0.42, 0.05), Enum.PartType.Block)
|
||||
s.Material = Enum.Material.SmoothPlastic
|
||||
local k = hatPart(V(0.4, 0.4, 0.3), CFrame.new(0, 0.05, 0.62), Enum.PartType.Block)
|
||||
k.Material = Enum.Material.SmoothPlastic
|
||||
else
|
||||
hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||||
hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||||
end
|
||||
=======
|
||||
end
|
||||
hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||||
hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
end
|
||||
local action = spot:GetAttribute("NpcAction")
|
||||
if action then
|
||||
@@ -1857,6 +2024,7 @@ local function spawnNpc(spot, parent)
|
||||
end
|
||||
return rig
|
||||
end
|
||||
Builder.spawnNpc = spawnNpc -- жители лобби (LobbyLife.server.lua) создаются так же
|
||||
|
||||
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
||||
function Builder.prepareRuntime(root)
|
||||
@@ -1874,6 +2042,23 @@ function Builder.prepareRuntime(root)
|
||||
spot.Transparency = 1
|
||||
spawnNpc(spot, root)
|
||||
end
|
||||
-- порталы лобби двигают в Studio за модель (PortalModel_WorldN); невидимый якорь с подсказкой и подписью
|
||||
-- (Portal_WorldN) и маркер стрелки обучения (GuidePortal, перед порталом в мир 1) встают к модели
|
||||
for _, model in ipairs(root:GetChildren()) do
|
||||
local id = model.Name:match("^PortalModel_(World%d)$")
|
||||
local anchor = id and root:FindFirstChild("Portal_" .. id)
|
||||
if model:IsA("Model") and anchor then
|
||||
local cf, size = model:GetBoundingBox()
|
||||
anchor.CFrame = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2 + 10, cf.Position.Z) * (anchor.CFrame - anchor.Position)
|
||||
local marker = id == "World1" and root:FindFirstChild("GuidePortal", true)
|
||||
if marker then
|
||||
local flat = V(cf.Position.X, 0, cf.Position.Z)
|
||||
local outward = flat.Magnitude > 0.1 and flat.Unit or V(0, 0, 1)
|
||||
local p = flat + outward * 5.7
|
||||
marker.CFrame = CFrame.new(p.X, marker.Position.Y, p.Z) * (marker.CFrame - marker.Position)
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, board in ipairs(boards) do
|
||||
writeBestiary(board)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user