Lobby
This commit is contained in:
1 parent
73a2db8bb8
commit
44cf31ce6b
231 files changed
+3396887
-1109081
No files matched your search
@@ -0,0 +1,145 @@
|
||||
-- Лавка «Удочки и снаряжение» Михалыча из Blockbench (assets/props/lobby_rod_shop.bbmodel) вместо старой.
|
||||
-- Запуск: node tools/build-rod-shop.js <out.lua>, затем выполнить <out.lua> в Studio (режим редактирования), Ctrl+S.
|
||||
-- Повторный запуск пересобирает новую лавку на том же месте (место запоминается в ServerStorage.Backup.RodShop).
|
||||
-- * старая лавка (все детали в её габаритах прямо в FishingMap, с витриной удочек) → ServerStorage.Backup.RodShop;
|
||||
-- * новая — на её месте, фасадом к центру площади; надпись «🎣 УДОЧКИ И СНАРЯЖЕНИЕ» (Merriweather);
|
||||
-- * подсказка магазина (Action = Shop) — на стойке; место Михалыча — за стойкой.
|
||||
-- Внимание: build-lobby-shops.lua после widen-lobby.lua заново не запускать — он поставит лавки на старые места.
|
||||
|
||||
local ServerStorage = game:GetService("ServerStorage")
|
||||
local map = workspace.FishingMap
|
||||
local SCALE = 1.4
|
||||
local FLOOR = 1
|
||||
local TITLE_FONT = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy)
|
||||
local backup = ServerStorage:FindFirstChild("Backup") or Instance.new("Folder")
|
||||
backup.Name = "Backup"
|
||||
backup.Parent = ServerStorage
|
||||
|
||||
local function flat(v)
|
||||
return Vector3.new(v.X, 0, v.Z)
|
||||
end
|
||||
local spot
|
||||
for _, c in ipairs(map:GetChildren()) do
|
||||
if c:IsA("BasePart") and c:GetAttribute("NpcName") == "Продавец Михалыч" then
|
||||
spot = c
|
||||
end
|
||||
end
|
||||
assert(spot, "Нет места Продавца Михалыча")
|
||||
|
||||
local folder = backup:FindFirstChild("RodShop")
|
||||
if not folder then
|
||||
-- кадр старой лавки WorldBuilder.stall: NPC стоял в (0, 4, 1.5) от неё, фасад к центру (−Z)
|
||||
local away = flat(spot.Position).Unit
|
||||
local base = Vector3.new(spot.Position.X, FLOOR, spot.Position.Z) - away * 1.5
|
||||
local cf = CFrame.lookAt(base, base - away)
|
||||
folder = Instance.new("Folder")
|
||||
folder.Name = "RodShop"
|
||||
folder:SetAttribute("StallCF", cf)
|
||||
for _, c in ipairs(map:GetChildren()) do
|
||||
if c ~= spot and (c:IsA("BasePart") or c:IsA("Model")) and not c:GetAttribute("NpcName") and not c:GetAttribute("Leaderboard")
|
||||
and not c.Name:find("^LobbyShop_") and not c.Name:find("^Portal") then
|
||||
local p = c:IsA("Model") and c:GetPivot().Position or c.Position
|
||||
local l = cf:PointToObjectSpace(p)
|
||||
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
|
||||
c.Parent = folder
|
||||
end
|
||||
end
|
||||
end
|
||||
folder.Parent = backup
|
||||
end
|
||||
local cf = folder:GetAttribute("StallCF")
|
||||
local oldPrompt
|
||||
for _, d in ipairs(folder:GetDescendants()) do
|
||||
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Shop" then
|
||||
oldPrompt = d
|
||||
end
|
||||
end
|
||||
|
||||
local prev = map:FindFirstChild("LobbyShop_Rods")
|
||||
if prev then
|
||||
prev:Destroy()
|
||||
end
|
||||
local model = BUILD.rod_shop(map)
|
||||
model.Name = "LobbyShop_Rods"
|
||||
model:ScaleTo(SCALE)
|
||||
local params = RaycastParams.new()
|
||||
params.FilterType = Enum.RaycastFilterType.Exclude
|
||||
params.FilterDescendantsInstances = { model, folder }
|
||||
local hit = workspace:Raycast(cf.Position + Vector3.new(0, 30, 0), Vector3.new(0, -60, 0), params)
|
||||
local at = Vector3.new(cf.Position.X, hit and hit.Position.Y or FLOOR, cf.Position.Z)
|
||||
model:PivotTo(CFrame.lookAt(at, at + flat(cf.LookVector)))
|
||||
local base = model:GetPivot()
|
||||
for _, p in ipairs(model:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
p.Anchored = true
|
||||
end
|
||||
end
|
||||
|
||||
local function find(name)
|
||||
local p = model:FindFirstChild(name, true)
|
||||
return p and p:IsA("BasePart") and p or nil
|
||||
end
|
||||
-- тёплый свет в фонарях
|
||||
for _, n in ipairs({ "LanternL_Glow", "LanternR_Glow" }) do
|
||||
local g = find(n)
|
||||
if g then
|
||||
local l = Instance.new("PointLight")
|
||||
l.Color, l.Range, l.Brightness, l.Shadows = Color3.fromRGB(255, 186, 110), 16, 1.4, true
|
||||
l.Parent = g
|
||||
g.Material = Enum.Material.Neon
|
||||
end
|
||||
end
|
||||
-- вывеска
|
||||
local face = find("Sign_Face")
|
||||
if face then
|
||||
local sg = Instance.new("SurfaceGui")
|
||||
sg.Name = "ShopSign"
|
||||
sg.Face = Enum.NormalId.Front
|
||||
sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||||
sg.PixelsPerStud = 40
|
||||
sg.LightInfluence = 0
|
||||
sg.Parent = face
|
||||
local t = Instance.new("TextLabel")
|
||||
t.Size = UDim2.fromScale(1, 1)
|
||||
t.BackgroundTransparency = 1
|
||||
t.FontFace = TITLE_FONT
|
||||
t.TextScaled = true
|
||||
t.TextColor3 = Color3.fromRGB(255, 214, 120)
|
||||
t.TextStrokeTransparency = 0.3
|
||||
t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20)
|
||||
t.Text = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ"
|
||||
t.Parent = sg
|
||||
local pad = Instance.new("UIPadding")
|
||||
pad.PaddingLeft, pad.PaddingRight = UDim.new(0.04, 0), UDim.new(0.04, 0)
|
||||
pad.PaddingTop, pad.PaddingBottom = UDim.new(0.14, 0), UDim.new(0.14, 0)
|
||||
pad.Parent = t
|
||||
end
|
||||
-- подсказка магазина на стойке
|
||||
local top = find("Counter_Top")
|
||||
if top then
|
||||
local pp = oldPrompt and oldPrompt:Clone() or Instance.new("ProximityPrompt")
|
||||
if not oldPrompt then
|
||||
pp.ActionText, pp.ObjectText = "Магазин", "Продавец Михалыч"
|
||||
pp:SetAttribute("Action", "Shop")
|
||||
end
|
||||
pp.HoldDuration = 0
|
||||
pp.RequiresLineOfSight = false
|
||||
pp.MaxActivationDistance = math.max(pp.MaxActivationDistance, 14)
|
||||
pp.Parent = top
|
||||
end
|
||||
-- Михалыч за стойкой: стойка в Z −2.6 (модель), за ней свободно — ставим на Z = 0.5, лицом к покупателям
|
||||
-- на ступеньке: стойка высокая и на ней ящик со снастями, без ступеньки видно только макушку
|
||||
local STEP = 1.4
|
||||
local stand = base * CFrame.new(0, 0, 0.5 * SCALE)
|
||||
local step = Instance.new("Part")
|
||||
step.Name = "SellerStep"
|
||||
step.Anchored = true
|
||||
step.Size = Vector3.new(3, STEP, 2.2)
|
||||
step.CFrame = stand * CFrame.new(0, STEP / 2, 0)
|
||||
step.Color = Color3.fromRGB(110, 74, 46)
|
||||
step.Material = Enum.Material.WoodPlanks
|
||||
step.Parent = model
|
||||
spot.CFrame = CFrame.new(stand.Position + Vector3.new(0, STEP + 3, 0)) * (base - base.Position)
|
||||
|
||||
return ("Лавка удочек: %d деталей, подсказка %s, старая лавка в резерве (%d объектов)"):format(
|
||||
#model:GetDescendants(), oldPrompt and "перенесена" or "новая", #folder:GetChildren())
|
||||
Reference in new issue
Block a user