Lobby
This commit is contained in:
1 parent
73a2db8bb8
commit
44cf31ce6b
231 files changed
+3396887
-1109081
No files matched your search
@@ -0,0 +1,195 @@
|
||||
-- ActivityFeed (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Постоянная активность на экране: лента событий игроков (уловы, уровни, покупки) и крупный баннер
|
||||
-- со звуком, когда кто-то ловит редкую или мутировавшую рыбу. События шлёт GameServer: remote "Feed".
|
||||
-- Самые редкие уловы приходят и с других серверов (помечены 🌍). Настройки — Config.Feed.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||
local C = Theme.C
|
||||
local F = Config.Feed
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||||
|
||||
local function new(class, props, children)
|
||||
local o = Instance.new(class)
|
||||
for k, v in pairs(props) do
|
||||
if k ~= "Parent" then
|
||||
o[k] = v
|
||||
end
|
||||
end
|
||||
for _, c in ipairs(children or {}) do
|
||||
c.Parent = o
|
||||
end
|
||||
o.Parent = props.Parent
|
||||
return o
|
||||
end
|
||||
local function fmt(n)
|
||||
local s = tostring(math.floor(n))
|
||||
local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse()
|
||||
return (out:gsub("^ ", ""))
|
||||
end
|
||||
local function hex(c)
|
||||
return string.format("#%02X%02X%02X", c.R * 255, c.G * 255, c.B * 255)
|
||||
end
|
||||
local function esc(s)
|
||||
return (tostring(s):gsub("&", "&"):gsub("<", "<"):gsub(">", ">"))
|
||||
end
|
||||
|
||||
local gui = new("ScreenGui", { Name = "ActivityFeed", ResetOnSpawn = false, DisplayOrder = 5, Parent = player:WaitForChild("PlayerGui") })
|
||||
local root = Theme.followScale(gui)
|
||||
|
||||
---------------------------------------------------------------- лента
|
||||
|
||||
local list = new("Frame", { BackgroundTransparency = 1, Parent = root }, {
|
||||
new("UIListLayout", { Padding = UDim.new(0, 4), SortOrder = Enum.SortOrder.LayoutOrder, VerticalAlignment = Enum.VerticalAlignment.Bottom }),
|
||||
})
|
||||
local maxLines = F.lines
|
||||
Theme.onLayout(function(compact)
|
||||
if compact then
|
||||
-- телефон: справа под плашкой погоды (слева внизу — джойстик)
|
||||
list.AnchorPoint = Vector2.new(1, 0)
|
||||
list.Position = UDim2.new(1, -12, 0, 130)
|
||||
list.Size = UDim2.fromOffset(300, 4 * 30)
|
||||
maxLines = 4
|
||||
else
|
||||
list.AnchorPoint = Vector2.new(0, 1)
|
||||
list.Position = UDim2.new(0, 12, 1, -14)
|
||||
list.Size = UDim2.fromOffset(420, F.lines * 30)
|
||||
maxLines = F.lines
|
||||
end
|
||||
end)
|
||||
|
||||
local order = 0
|
||||
local function line(richText)
|
||||
order += 1
|
||||
local rows = {}
|
||||
for _, c in ipairs(list:GetChildren()) do
|
||||
if c:IsA("Frame") then
|
||||
table.insert(rows, c)
|
||||
end
|
||||
end
|
||||
table.sort(rows, function(a, b) return a.LayoutOrder < b.LayoutOrder end)
|
||||
while #rows >= maxLines do
|
||||
table.remove(rows, 1):Destroy()
|
||||
end
|
||||
local row = new("Frame", {
|
||||
Size = UDim2.fromOffset(0, 26), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.woodDark,
|
||||
BackgroundTransparency = 0.25, LayoutOrder = order, Parent = list,
|
||||
}, {
|
||||
new("UICorner", { CornerRadius = UDim.new(0, 8) }),
|
||||
new("UIStroke", { Color = C.goldDark, Thickness = 1, Transparency = 0.5 }),
|
||||
new("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10) }),
|
||||
})
|
||||
local label = new("TextLabel", {
|
||||
Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1,
|
||||
FontFace = Theme.BODY2_FACE, TextSize = 15, TextColor3 = C.text, RichText = true, Text = richText,
|
||||
TextXAlignment = Enum.TextXAlignment.Left, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.6, Parent = row,
|
||||
})
|
||||
-- появляется плавно, через lineTime так же уходит
|
||||
row.BackgroundTransparency, label.TextTransparency = 1, 1
|
||||
TweenService:Create(row, TweenInfo.new(0.3), { BackgroundTransparency = 0.25 }):Play()
|
||||
TweenService:Create(label, TweenInfo.new(0.3), { TextTransparency = 0 }):Play()
|
||||
task.delay(F.lineTime, function()
|
||||
if row.Parent then
|
||||
TweenService:Create(row, TweenInfo.new(0.6), { BackgroundTransparency = 1 }):Play()
|
||||
TweenService:Create(label, TweenInfo.new(0.6), { TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
|
||||
task.wait(0.65)
|
||||
row:Destroy()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- баннер редкого улова
|
||||
|
||||
local banner = new("Frame", {
|
||||
-- внизу над полосой подсечки (она занимает 100…224 px от низа): верх экрана — для своих уведомлений и карточки улова
|
||||
Size = UDim2.fromOffset(560, 92), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -240),
|
||||
BackgroundColor3 = Color3.new(1, 1, 1), Visible = false, ZIndex = 20, Parent = root,
|
||||
}, { new("UICorner", { CornerRadius = UDim.new(0, 12) }), Theme.woodGradient(C.wood, C.woodDark) })
|
||||
local bannerStroke = new("UIStroke", { Thickness = 3, Color = C.gold, Parent = banner })
|
||||
Theme.innerBorder(banner, 5, 8, C.gold, 0.45)
|
||||
Theme.rivets(banner, 8, 6)
|
||||
local bannerScale = new("UIScale", { Parent = banner })
|
||||
local bTop = new("TextLabel", {
|
||||
Size = UDim2.new(1, -30, 0, 20), Position = UDim2.fromOffset(15, 8), BackgroundTransparency = 1, ZIndex = 21,
|
||||
FontFace = Theme.BODY_FACE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = banner,
|
||||
})
|
||||
local bMain = new("TextLabel", {
|
||||
Size = UDim2.new(1, -30, 0, 34), Position = UDim2.fromOffset(15, 28), BackgroundTransparency = 1, ZIndex = 21,
|
||||
FontFace = Theme.TITLE_FACE, TextSize = 26, TextColor3 = C.text, RichText = true, TextScaled = true, Text = "",
|
||||
TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.4, Parent = banner,
|
||||
})
|
||||
new("UITextSizeConstraint", { MaxTextSize = 26, Parent = bMain })
|
||||
local bSub = new("TextLabel", {
|
||||
Size = UDim2.new(1, -30, 0, 20), Position = UDim2.fromOffset(15, 64), BackgroundTransparency = 1, ZIndex = 21,
|
||||
FontFace = Theme.BODY2_FACE, TextSize = 15, TextColor3 = C.text, RichText = true, Text = "", Parent = banner,
|
||||
})
|
||||
|
||||
local queue, showing = {}, false
|
||||
local function showNext()
|
||||
local info = table.remove(queue, 1)
|
||||
if not info then
|
||||
showing = false
|
||||
return
|
||||
end
|
||||
showing = true
|
||||
local r = Config.Rarities[info.rarity] or Config.Rarities.Common
|
||||
local mut = info.mutation and Config.Find(Config.Mutations, info.mutation)
|
||||
local color = mut and mut.color or r.color
|
||||
bannerStroke.Color = color
|
||||
bTop.Text = info.remote and "🌍 УЛОВ НА ДРУГОМ СЕРВЕРЕ" or "🌟 РЕДКИЙ УЛОВ"
|
||||
bTop.TextColor3 = color
|
||||
-- мутация — отдельной меткой: её название в женском роде («Золотая» рыба), а у рыбы может быть любой
|
||||
bMain.Text = ("<b>%s</b> поймал <font color=\"%s\">%s</font>%s!"):format(esc(info.name), hex(color),
|
||||
esc(info.fish), mut and (" <font color=\"%s\">✦ %s</font>"):format(hex(mut.color), mut.name) or "")
|
||||
bSub.Text = ("<font color=\"%s\">%s</font> · %s %s%s"):format(hex(r.color), r.name, fmt(info.value or 0), Theme.SILVER,
|
||||
info.world and (" · " .. info.world) or "")
|
||||
banner.Visible = true
|
||||
bannerScale.Scale = 0.4
|
||||
TweenService:Create(bannerScale, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||||
-- звук: легендарная, мифическая и радужная — фанфары, остальное — искристый звон
|
||||
local grand = r.rank >= 5 or info.mutation == "Rainbow"
|
||||
Audio.play(grand and "fanfare" or "sparkle")
|
||||
task.delay(4.2, function()
|
||||
TweenService:Create(bannerScale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.In), { Scale = 0 }):Play()
|
||||
task.wait(0.3)
|
||||
banner.Visible = false
|
||||
showNext()
|
||||
end)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- события
|
||||
|
||||
local RANK_ICON = { "🎣", "🎣", "🐟", "✨", "🌟", "💫" }
|
||||
remote.OnClientEvent:Connect(function(action, kind, info)
|
||||
if action ~= "Feed" or type(info) ~= "table" then
|
||||
return
|
||||
end
|
||||
local who = ("<b>%s</b>"):format(esc(info.name or "?"))
|
||||
if kind == "catch" then
|
||||
local r = Config.Rarities[info.rarity] or Config.Rarities.Common
|
||||
local mut = info.mutation and Config.Find(Config.Mutations, info.mutation)
|
||||
local color = mut and mut.color or r.color
|
||||
line(("%s%s %s поймал <font color=\"%s\">%s</font>%s%s"):format(
|
||||
info.remote and "🌍 " or "", RANK_ICON[r.rank] or "🎣", who, hex(color), esc(info.fish),
|
||||
mut and (" <font color=\"%s\">✦ %s</font>"):format(hex(mut.color), mut.name) or "",
|
||||
r.rank >= 3 and (" <font color=\"%s\">· %s</font>"):format(hex(r.color), r.name) or ""))
|
||||
-- свой улов игрок и так видит крупно — баннер только про других
|
||||
if info.big and info.userId ~= player.UserId then
|
||||
table.insert(queue, info)
|
||||
if not showing then
|
||||
showNext()
|
||||
end
|
||||
end
|
||||
elseif kind == "level" then
|
||||
line(("⭐ %s достиг уровня <font color=\"%s\">%d</font>"):format(who, Theme.HEX.gold, info.level or 0))
|
||||
elseif kind == "buy" then
|
||||
line(("💎 %s купил %s"):format(who, esc(info.item or "")))
|
||||
end
|
||||
end)
|
||||
@@ -66,6 +66,7 @@ local LOOK = {
|
||||
local camera = workspace.CurrentCamera
|
||||
local weatherCC = new("ColorCorrectionEffect", { Name = "WeatherCC", Parent = camera })
|
||||
local nightCC = new("ColorCorrectionEffect", { Name = "NightCC", Parent = camera })
|
||||
-- цветокоррекция действует только на 3D-сцену, экран загрузки она не затемняет — выключать её на время загрузки не нужно
|
||||
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
|
||||
camera = workspace.CurrentCamera
|
||||
weatherCC.Parent = camera
|
||||
@@ -282,6 +283,63 @@ local function refreshPill(clock, night, w, placeId)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- фонари: днём погашены, к ночи зажигаются
|
||||
-- лампа — небольшая неоновая деталь со светом внутри (фонари площади, лавок, досок лидеров, домиков).
|
||||
-- Днём неон и свет дают пересвет и ореолы, поэтому лампа становится матовым тёплым стеклом без света.
|
||||
-- Порталы и прочее крупное свечение не трогаем.
|
||||
|
||||
local LAMP_ON_AT = 0.3 -- с какой «ночности» (0 — день, 1 — ночь) фонари зажигаются
|
||||
local lamps, lampScanAt, lampsLit = {}, -math.huge, nil
|
||||
|
||||
local function scanLamps()
|
||||
local map = workspace:FindFirstChild("FishingMap")
|
||||
if not map then
|
||||
return
|
||||
end
|
||||
for _, d in ipairs(map:GetDescendants()) do
|
||||
if d:IsA("Light") and d.Parent:IsA("BasePart") and not lamps[d.Parent] then
|
||||
local bulb = d.Parent
|
||||
local s = bulb.Size
|
||||
if bulb.Material == Enum.Material.Neon and math.max(s.X, s.Y, s.Z) <= 2.5 then
|
||||
lamps[bulb] = { color = bulb.Color, lights = {} }
|
||||
end
|
||||
end
|
||||
end
|
||||
for bulb, l in pairs(lamps) do
|
||||
table.clear(l.lights)
|
||||
for _, c in ipairs(bulb:GetChildren()) do
|
||||
if c:IsA("Light") then
|
||||
table.insert(l.lights, c)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function updateLamps(nightness)
|
||||
if os.clock() - lampScanAt > 10 then
|
||||
lampScanAt = os.clock()
|
||||
scanLamps()
|
||||
lampsLit = nil -- новые лампы — применить ещё раз
|
||||
end
|
||||
local lit = nightness >= LAMP_ON_AT
|
||||
if lit == lampsLit then
|
||||
return
|
||||
end
|
||||
lampsLit = lit
|
||||
for bulb, l in pairs(lamps) do
|
||||
if bulb.Parent then
|
||||
bulb.Material = lit and Enum.Material.Neon or Enum.Material.SmoothPlastic
|
||||
-- погашенная лампа — тёплое матовое стекло чуть темнее горящей
|
||||
bulb.Color = lit and l.color or l.color:Lerp(Color3.fromRGB(150, 120, 90), 0.35)
|
||||
for _, light in ipairs(l.lights) do
|
||||
light.Enabled = lit
|
||||
end
|
||||
else
|
||||
lamps[bulb] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- главный цикл
|
||||
|
||||
-- часы двигаются каждый кадр (плавно), остальное проверяется раз в полсекунды
|
||||
@@ -304,6 +362,7 @@ task.spawn(function()
|
||||
local clock = clockNow()
|
||||
local nightness = Config.DayNight.enabled and Config.Nightness(clock) or 0
|
||||
local night = nightness >= 0.5
|
||||
updateLamps(nightness)
|
||||
local w = currentWeather()
|
||||
local _, placeId = currentPlace()
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
-- ChestAnimation (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Сундук ежедневной награды (модель с атрибутом DailyChest: Base, Lid, Coins, Lock) оживает у каждого игрока:
|
||||
-- подпрыгивает, на падении крышка откидывается, после удара о землю монеты подскакивают, крышка остаётся
|
||||
-- приоткрытой, потом плавно возвращается. На ударе — глухой стук, звон монет и облачко пыли.
|
||||
-- Анимация только на клиенте: сервер сундук не двигает.
|
||||
|
||||
local RunService = game:GetService("RunService")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||||
|
||||
local HOP = 2.1 -- высота прыжка, studs
|
||||
local LID_FALL = 32 -- на сколько градусов откидывается крышка в падении
|
||||
local LID_REST = 14 -- приоткрыта после приземления
|
||||
local COIN_HOP = 0.55 -- подскок монет
|
||||
local PERIOD = 5 -- секунд на весь цикл (прыжок + пауза)
|
||||
local VIEW_DIST = 150 -- дальше камеры не анимируем
|
||||
|
||||
-- 0..1: прыжок вверх, падение, приземление, удержание, закрытие крышки
|
||||
local T_UP, T_DOWN, T_LAND, T_HOLD, T_CLOSE = 0.34, 0.3, 0.5, 2.3, 0.7
|
||||
local T_IMPACT = T_UP + T_DOWN -- момент удара о землю
|
||||
|
||||
local function easeOut(x) return 1 - (1 - x) ^ 2 end
|
||||
local function easeIn(x) return x * x end
|
||||
local function smooth(x) return x * x * (3 - 2 * x) end
|
||||
|
||||
local chest, rest, fx
|
||||
|
||||
-- звуки идут от самого сундука (слышно рядом), громкость — по настройке «Звуки»
|
||||
local function sound(name, parent)
|
||||
local def = Config.Sounds[name]
|
||||
local s = Instance.new("Sound")
|
||||
s.Name = name
|
||||
s.SoundId = def.id
|
||||
s.Volume = def.volume or 0.5
|
||||
s.RollOffMode = Enum.RollOffMode.InverseTapered
|
||||
s.RollOffMinDistance, s.RollOffMaxDistance = 10, 70
|
||||
s.SoundGroup = Audio.groups.sfx
|
||||
s.Parent = parent
|
||||
return s, def.pitch
|
||||
end
|
||||
|
||||
local rng = Random.new()
|
||||
local function play(entry)
|
||||
local s, pitch = entry[1], entry[2]
|
||||
if pitch then
|
||||
s.PlaybackSpeed = rng:NextNumber(pitch[1], pitch[2])
|
||||
end
|
||||
s:Play()
|
||||
end
|
||||
|
||||
-- пыль от удара: низкое облачко, разлетается в стороны и быстро оседает
|
||||
local function makeDust(base)
|
||||
local att = Instance.new("Attachment")
|
||||
att.Name = "ChestDust"
|
||||
att.Position = Vector3.new(0, -base.Size.Y / 2 + 0.15, 0)
|
||||
att.Parent = base
|
||||
local pe = Instance.new("ParticleEmitter")
|
||||
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||||
pe.Rate = 0
|
||||
pe.Color = ColorSequence.new(Color3.fromRGB(222, 202, 168), Color3.fromRGB(196, 176, 146))
|
||||
pe.LightInfluence = 0.8
|
||||
pe.Lifetime = NumberRange.new(0.6, 1.1)
|
||||
pe.Speed = NumberRange.new(7, 11)
|
||||
pe.Drag = 6
|
||||
pe.SpreadAngle = Vector2.new(86, 86) -- почти горизонтально во все стороны
|
||||
pe.Acceleration = Vector3.new(0, 1.2, 0)
|
||||
pe.Rotation = NumberRange.new(0, 360)
|
||||
pe.RotSpeed = NumberRange.new(-60, 60)
|
||||
pe.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.7), NumberSequenceKeypoint.new(0.4, 1.8), NumberSequenceKeypoint.new(1, 2.6) })
|
||||
pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.35), NumberSequenceKeypoint.new(0.6, 0.7), NumberSequenceKeypoint.new(1, 1) })
|
||||
pe.EmissionDirection = Enum.NormalId.Top
|
||||
pe.Parent = att
|
||||
return pe
|
||||
end
|
||||
|
||||
local function bind(model)
|
||||
local base, lid = model:FindFirstChild("Base"), model:FindFirstChild("Lid")
|
||||
if not (base and lid) then
|
||||
return
|
||||
end
|
||||
local pivot = model:GetPivot()
|
||||
local function rel(name)
|
||||
local p = model:FindFirstChild(name)
|
||||
return p and { part = p, cf = pivot:ToObjectSpace(p.CFrame) }
|
||||
end
|
||||
-- петли крышки — задняя верхняя кромка корпуса (замок спереди, по +Z модели)
|
||||
local hinge = pivot:ToObjectSpace(base.CFrame * CFrame.new(0, base.Size.Y / 2, -base.Size.Z / 2))
|
||||
chest = model
|
||||
fx = {
|
||||
hop = { sound("chestHop", base) },
|
||||
land = { sound("chestLand", base) },
|
||||
coins = { sound("coins", base) },
|
||||
dust = makeDust(base),
|
||||
}
|
||||
rest = {
|
||||
pivot = pivot, hinge = CFrame.new(hinge.Position),
|
||||
base = rel("Base"), lid = rel("Lid"), lock = rel("Lock"), coins = rel("Coins"),
|
||||
}
|
||||
end
|
||||
|
||||
local function findChest()
|
||||
local map = workspace:FindFirstChild("FishingMap")
|
||||
if not map then
|
||||
return
|
||||
end
|
||||
for _, d in ipairs(map:GetDescendants()) do
|
||||
if d:IsA("Model") and d:GetAttribute("DailyChest") then
|
||||
bind(d)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- поза в момент t цикла: подъём корпуса, угол крышки (градусы), подскок монет
|
||||
local function pose(t)
|
||||
local h, lid, coin = 0, 0, 0
|
||||
if t < T_UP then
|
||||
h = HOP * easeOut(t / T_UP)
|
||||
elseif t < T_UP + T_DOWN then
|
||||
local u = (t - T_UP) / T_DOWN
|
||||
h = HOP * (1 - easeIn(u))
|
||||
lid = LID_FALL * easeOut(u) -- крышку подбрасывает воздухом
|
||||
else
|
||||
local t2 = t - T_UP - T_DOWN
|
||||
if t2 < T_LAND then
|
||||
local u = t2 / T_LAND
|
||||
coin = COIN_HOP * math.sin(math.pi * u) -- монеты подскакивают от удара
|
||||
-- крышка с лёгким «отскоком» оседает в приоткрытое положение
|
||||
lid = LID_REST + (LID_FALL - LID_REST) * (1 - smooth(u)) + 4 * math.sin(math.pi * u * 2) * (1 - u)
|
||||
h = 0.12 * math.sin(math.pi * math.min(1, u * 2)) -- маленький отскок корпуса
|
||||
elseif t2 < T_LAND + T_HOLD then
|
||||
lid = LID_REST
|
||||
elseif t2 < T_LAND + T_HOLD + T_CLOSE then
|
||||
lid = LID_REST * (1 - smooth((t2 - T_LAND - T_HOLD) / T_CLOSE))
|
||||
end
|
||||
end
|
||||
return h, lid, coin
|
||||
end
|
||||
|
||||
local function apply(h, lidDeg, coin)
|
||||
local r = rest
|
||||
local p = r.pivot * CFrame.new(0, h, 0)
|
||||
r.base.part.CFrame = p * r.base.cf
|
||||
-- крышка и замок поворачиваются вокруг петель (минус — передняя кромка идёт вверх)
|
||||
local open = r.hinge * CFrame.Angles(-math.rad(lidDeg), 0, 0) * r.hinge:Inverse()
|
||||
r.lid.part.CFrame = p * open * r.lid.cf
|
||||
if r.lock then
|
||||
r.lock.part.CFrame = p * open * r.lock.cf
|
||||
end
|
||||
if r.coins then
|
||||
r.coins.part.CFrame = p * CFrame.new(0, coin, 0) * r.coins.cf
|
||||
end
|
||||
end
|
||||
|
||||
-- прыгает только для тех, кому есть что забрать: DailyNextAt (ставит сервер) — когда откроется следующая
|
||||
-- награда, 0 — уже доступна. Забрал — сундук доигрывает текущий прыжок и замирает до следующего дня.
|
||||
local player = game:GetService("Players").LocalPlayer
|
||||
local function rewardReady()
|
||||
local nextAt = player:GetAttribute("DailyNextAt")
|
||||
return nextAt ~= nil and workspace:GetServerTimeNow() >= nextAt
|
||||
end
|
||||
|
||||
local scanAt = -math.huge
|
||||
local cycleT = nil -- время внутри текущего цикла; nil — сундук стоит
|
||||
local resting = false
|
||||
RunService.RenderStepped:Connect(function(dt)
|
||||
if not chest or not chest.Parent then
|
||||
chest = nil
|
||||
if os.clock() - scanAt > 3 then
|
||||
scanAt = os.clock()
|
||||
findChest()
|
||||
end
|
||||
return
|
||||
end
|
||||
local cam = workspace.CurrentCamera
|
||||
if cam and (cam.CFrame.Position - rest.pivot.Position).Magnitude > VIEW_DIST then
|
||||
return
|
||||
end
|
||||
if not cycleT then
|
||||
if not rewardReady() then
|
||||
if not resting then
|
||||
resting = true
|
||||
apply(0, 0, 0) -- стоит закрытый, как в редакторе
|
||||
end
|
||||
return
|
||||
end
|
||||
cycleT, resting = 0, false
|
||||
play(fx.hop)
|
||||
end
|
||||
local prev = cycleT
|
||||
cycleT += dt
|
||||
-- удар о землю
|
||||
if prev < T_IMPACT and cycleT >= T_IMPACT then
|
||||
play(fx.land)
|
||||
task.delay(0.08, play, fx.coins) -- монеты звенят чуть позже удара, когда подпрыгивают
|
||||
fx.dust:Emit(26)
|
||||
end
|
||||
if cycleT >= PERIOD then
|
||||
cycleT = nil -- цикл закончен; следующий начнётся, только если награда всё ещё доступна
|
||||
apply(0, 0, 0)
|
||||
return
|
||||
end
|
||||
apply(pose(cycleT))
|
||||
end)
|
||||
@@ -195,33 +195,50 @@ H.rod = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128
|
||||
|
||||
-- баннер события (справа сверху)
|
||||
local eventBanner = new("Frame", {
|
||||
Name = "EventBanner", -- по имени его ставит под таблицу игроков HudBar.client.lua
|
||||
Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10),
|
||||
BackgroundColor3 = WHITE, Visible = false, Parent = screen,
|
||||
}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) })
|
||||
local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner })
|
||||
local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner })
|
||||
|
||||
-- кнопки слева
|
||||
-- столбик на компьютере, сетка 2×N на телефоне (раскладка — в applyLayout ниже)
|
||||
-- меню слева: деревянная панель в рамке с вкладкой «≡» сверху, внутри — широкие кнопки (значок и подпись в строку).
|
||||
-- side — сетка кнопок внутри панели H.sidePanel (раскладку для телефона и компьютера задаёт applyLayout ниже)
|
||||
H.sidePanel = new("Frame", {
|
||||
Name = "SideMenu", Size = UDim2.fromOffset(170, 0), AutomaticSize = Enum.AutomaticSize.Y, Position = UDim2.fromOffset(12, 228),
|
||||
BackgroundColor3 = WHITE, Parent = screen,
|
||||
}, { corner(10), stroke(C.goldDark, 2.5, 0), Theme.woodGradient(C.wood, C.woodDark) })
|
||||
Theme.rivets(H.sidePanel, 7, 6)
|
||||
do
|
||||
local tab = new("Frame", {
|
||||
Size = UDim2.fromOffset(48, 24), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5, 0, 0, 0),
|
||||
BackgroundColor3 = WHITE, ZIndex = 3, Parent = H.sidePanel,
|
||||
}, { corner(8), stroke(C.goldDark, 2, 0), Theme.woodGradient(C.woodLight, C.wood) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 18, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.goldBright, Text = "≡", ZIndex = 4, Parent = tab })
|
||||
end
|
||||
local side = new("Frame", {
|
||||
Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60),
|
||||
BackgroundTransparency = 1, Parent = screen,
|
||||
}, { new("UIGridLayout", { CellSize = UDim2.fromOffset(68, 68), CellPadding = UDim2.fromOffset(8, 8), FillDirectionMaxCells = 1, SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||
Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, Parent = H.sidePanel,
|
||||
}, {
|
||||
new("UIPadding", { PaddingTop = UDim.new(0, 18), PaddingBottom = UDim.new(0, 10), PaddingLeft = UDim.new(0, 8), PaddingRight = UDim.new(0, 8) }),
|
||||
new("UIGridLayout", { CellSize = UDim2.fromOffset(154, 40), CellPadding = UDim2.fromOffset(6, 6), FillDirectionMaxCells = 1, SortOrder = Enum.SortOrder.LayoutOrder }),
|
||||
})
|
||||
|
||||
local sideDots = {}
|
||||
local function sideButton(order, icon, label, key, color, onClick)
|
||||
-- деревянная плитка; цвет раздела — полоска-лента снизу
|
||||
local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = C.woodLight, LayoutOrder = order, Parent = side }, onClick)
|
||||
-- широкая деревянная кнопка: цветной значок слева, подпись, справа — клавиша
|
||||
local b = btn({ Size = UDim2.fromOffset(154, 40), BackgroundColor3 = C.woodLight, LayoutOrder = order, Parent = side }, onClick)
|
||||
b:FindFirstChildOfClass("UIStroke").Color = C.goldDark
|
||||
b:FindFirstChildOfClass("UIStroke").Thickness = 2.5
|
||||
new("Frame", { Size = UDim2.new(1, -10, 0, 4), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -4), BackgroundColor3 = color, BorderSizePixel = 0, Parent = b }, { corner(2) })
|
||||
text({ Size = UDim2.fromScale(1, 0.5), Position = UDim2.fromScale(0, 0.06), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b })
|
||||
text({ Size = UDim2.fromScale(1, 0.24), Position = UDim2.fromScale(0, 0.6), Font = TITLE, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = b })
|
||||
b:FindFirstChildOfClass("UIStroke").Thickness = 2
|
||||
local badge = new("Frame", { Size = UDim2.new(0, 30, 1, -10), Position = UDim2.fromOffset(5, 5), BackgroundColor3 = color, Parent = b },
|
||||
{ corner(6), stroke(C.ink, 1.5, 0.3), gradient(WHITE, Color3.fromRGB(170, 170, 170), 90) })
|
||||
text({ Size = UDim2.fromScale(1, 1), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = badge })
|
||||
new("UITextSizeConstraint", { MaxTextSize = 17, Parent = text({ Size = UDim2.new(1, -66, 1, 0), Position = UDim2.fromOffset(42, 0), Font = TITLE,
|
||||
TextScaled = true, Text = label, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = b }) })
|
||||
if key and not UserInputService.TouchEnabled then
|
||||
local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) })
|
||||
local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -6, 0.5, 0), BackgroundColor3 = C.bg, Parent = b }, { corner(5), stroke(C.gold, 1.2) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag })
|
||||
end
|
||||
local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) })
|
||||
local dot = new("Frame", { Size = UDim2.fromOffset(14, 14), Position = UDim2.new(0, -4, 0, -4), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(7), stroke(WHITE, 2) })
|
||||
sideDots[label] = dot
|
||||
return b
|
||||
end
|
||||
@@ -235,20 +252,12 @@ local SOFT_EDGES = NumberSequence.new({
|
||||
NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1),
|
||||
})
|
||||
-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт)
|
||||
<<<<<<< HEAD
|
||||
local HINT_FONT = Theme.HINT_FACE
|
||||
-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует.
|
||||
-- Цвет — тёмное дерево
|
||||
local function softPlate(props, textProps)
|
||||
local plate = new("Frame", props)
|
||||
plate.BackgroundColor3 = C.woodDark
|
||||
=======
|
||||
local HINT_FONT = Font.new("rbxasset://fonts/families/Nunito.json", Enum.FontWeight.Heavy)
|
||||
-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует
|
||||
local function softPlate(props, textProps)
|
||||
local plate = new("Frame", props)
|
||||
plate.BackgroundColor3 = BLACK
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
plate.BackgroundTransparency = 0
|
||||
corner(30).Parent = plate
|
||||
new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate })
|
||||
@@ -274,11 +283,7 @@ end
|
||||
-- уведомления — под подсказкой обучения, которая стоит в самом верху
|
||||
local toasts = new("Frame", {
|
||||
Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84),
|
||||
<<<<<<< HEAD
|
||||
BackgroundTransparency = 1, ZIndex = 30, Parent = screen,
|
||||
=======
|
||||
BackgroundTransparency = 1, Parent = gui,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||
local toastOrder = 0
|
||||
local toastTimers = {}
|
||||
@@ -308,12 +313,8 @@ local function notify(msg, color)
|
||||
items[1]:Destroy()
|
||||
end
|
||||
local t, l = softPlate(
|
||||
{ Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts },
|
||||
<<<<<<< HEAD
|
||||
{ TextSize = 30, TextColor3 = color or C.text, Text = msg }
|
||||
=======
|
||||
{ TextSize = 30, TextColor3 = color or WHITE, Text = msg }
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
{ Size = UDim2.new(0, 0, 0, 44), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts },
|
||||
{ TextSize = 24, TextColor3 = color or C.text, Text = msg }
|
||||
)
|
||||
popIn(t)
|
||||
t:SetAttribute("Msg", msg)
|
||||
@@ -346,6 +347,17 @@ local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.from
|
||||
local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard })
|
||||
local catchToken = 0
|
||||
|
||||
-- уведомления и карточка улова — в одной колонке сверху: пока карточка видна, уведомления уходят под неё
|
||||
H.toastBaseY = 84
|
||||
function H.placeToasts(cardShown)
|
||||
local y = H.toastBaseY
|
||||
if cardShown then
|
||||
local sc = catchCard:FindFirstChildOfClass("UIScale")
|
||||
y = 120 + catchCard.Size.Y.Offset * (sc and sc.Scale or 1) + 10
|
||||
end
|
||||
TweenService:Create(toasts, TweenInfo.new(0.3, Enum.EasingStyle.Quad), { Position = UDim2.new(0.5, 0, 0, y) }):Play()
|
||||
end
|
||||
|
||||
local function showCatch(fish, extra)
|
||||
catchToken += 1
|
||||
local my = catchToken
|
||||
@@ -361,18 +373,16 @@ local function showCatch(fish, extra)
|
||||
catchName.TextColor3 = r.color
|
||||
catchInfo.Text = ("<font color=\"%s\">%s</font>%s · %.2f кг"):format(
|
||||
hex(r.color), r.name, mut and (" · <font color=\"" .. hex(mut.color) .. "\">" .. mut.name .. " x" .. mut.mult .. "</font>") or "", fish.weight)
|
||||
<<<<<<< HEAD
|
||||
catchValue.Text = ("⚪ %s ⭐ +%d XP%s"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1),
|
||||
=======
|
||||
catchValue.Text = ("💰 %s ⭐ +%d XP%s"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1),
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
(extra and extra.combo and extra.combo > 1.001) and (" 🔥 x%.1f"):format(extra.combo) or "")
|
||||
catchCard.Visible = true
|
||||
H.placeToasts(true)
|
||||
TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play()
|
||||
task.delay(3.4, function()
|
||||
if my == catchToken then
|
||||
local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) })
|
||||
tw:Play()
|
||||
H.placeToasts(false)
|
||||
tw.Completed:Wait()
|
||||
if my == catchToken then
|
||||
catchCard.Visible = false
|
||||
@@ -397,11 +407,7 @@ end
|
||||
|
||||
-- вверху, на месте подсказки обучения (она во время рыбалки скрыта)
|
||||
local statusLabel = softPlate(
|
||||
<<<<<<< HEAD
|
||||
{ Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = screen },
|
||||
=======
|
||||
{ Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = gui },
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
{ TextSize = 36, Text = "🎣 Ждём клёв…" }
|
||||
)
|
||||
wobble(statusLabel, 1.2, 1.4)
|
||||
@@ -426,6 +432,13 @@ local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.
|
||||
---------------------------------------------------------------- окна
|
||||
|
||||
local openWindow = nil
|
||||
-- окно, открытое у ларька (сразу после нажатия на подсказку), закрывается, если отойти дальше WINDOW_CLOSE_DIST
|
||||
-- (5 м ≈ 18 studs); окна, открытые клавишами и кнопками меню, так не закрываются
|
||||
H.WINDOW_CLOSE_DIST = 18
|
||||
H.promptAt = -math.huge
|
||||
game:GetService("ProximityPromptService").PromptTriggered:Connect(function()
|
||||
H.promptAt = os.clock()
|
||||
end)
|
||||
|
||||
local function makeWindow(title, accent, tabs)
|
||||
local w = { pages = {}, tabButtons = {}, current = nil }
|
||||
@@ -437,6 +450,8 @@ local function makeWindow(title, accent, tabs)
|
||||
}, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) })
|
||||
Theme.innerBorder(frame, 7, 8, C.gold, 0.2)
|
||||
Theme.rivets(frame, 12, 8)
|
||||
-- Modal: пока окно открыто, Roblox отпускает курсор и в виде от первого лица (иначе он прибит к центру экрана)
|
||||
new("TextButton", { Name = "FreeCursor", Size = UDim2.fromOffset(1, 1), BackgroundTransparency = 1, Text = "", Modal = true, Parent = frame })
|
||||
local scale = new("UIScale", { Parent = frame })
|
||||
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundTransparency = 1, Parent = frame })
|
||||
-- багровая лента по центру, ширина — по тексту
|
||||
@@ -495,6 +510,9 @@ local function makeWindow(title, accent, tabs)
|
||||
openWindow = w
|
||||
if not frame.Visible then
|
||||
Audio.play("open")
|
||||
-- открыли у ларька — запоминаем, где стоим; отойдёт игрок — окно закроется само
|
||||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||
w.anchor = (hrp and os.clock() - H.promptAt < 2) and hrp.Position or nil
|
||||
end
|
||||
frame.Visible = true
|
||||
scale.Scale = 0.85
|
||||
@@ -503,6 +521,7 @@ local function makeWindow(title, accent, tabs)
|
||||
end
|
||||
function w.close()
|
||||
frame.Visible = false
|
||||
w.anchor = nil
|
||||
if openWindow == w then
|
||||
openWindow = nil
|
||||
end
|
||||
@@ -525,6 +544,21 @@ local function makeWindow(title, accent, tabs)
|
||||
return w
|
||||
end
|
||||
|
||||
-- отошёл от ларька — его окно закрывается
|
||||
RunService.Heartbeat:Connect(function()
|
||||
local w = openWindow
|
||||
if not (w and w.anchor) then
|
||||
return
|
||||
end
|
||||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||
if hrp then
|
||||
local d = hrp.Position - w.anchor
|
||||
if Vector3.new(d.X, 0, d.Z).Magnitude > H.WINDOW_CLOSE_DIST then
|
||||
w.close()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local function scrollArea(parent, cell, topOffset)
|
||||
local sf = new("ScrollingFrame", {
|
||||
Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0),
|
||||
@@ -572,6 +606,7 @@ Theme.kit = {
|
||||
makeWindow = makeWindow, scrollArea = scrollArea, itemRow = itemRow, progressBar = progressBar,
|
||||
sideButton = sideButton, notify = notify, popIn = popIn, fmt = fmt, timeStr = timeStr,
|
||||
screen = screen, hud = hud, TITLE = TITLE, BODY = BODY, BODY2 = BODY2,
|
||||
viewport = viewport, VIEW = VIEW, -- 3D-превью моделей (удочки на нижней панели — HudBar.client.lua)
|
||||
}
|
||||
|
||||
---------------------------------------------------------------- данные с сервера
|
||||
@@ -994,11 +1029,7 @@ questWin.render = function(tab)
|
||||
end
|
||||
text({
|
||||
Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true,
|
||||
<<<<<<< HEAD
|
||||
Text = ("%s <font color=\"#C0AC88\" size=\"15\">круг %d · награда сразу, следующее задание — тоже</font>"):format(chain.name, chain.round), Parent = questList,
|
||||
=======
|
||||
Text = ("%s <font color=\"#AAB4CD\" size=\"15\">круг %d · награда сразу, следующее задание — тоже</font>"):format(chain.name, chain.round), Parent = questList,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
})
|
||||
for i, st in ipairs(chain.steps) do
|
||||
local done, cur = i < chain.step, i == chain.step
|
||||
@@ -1011,11 +1042,7 @@ questWin.render = function(tab)
|
||||
})
|
||||
text({
|
||||
Size = UDim2.fromOffset(180, 28), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, cur and 8 or 14), Font = TITLE, TextSize = 17,
|
||||
<<<<<<< HEAD
|
||||
TextXAlignment = Enum.TextXAlignment.Right, TextColor3 = done and C.muted or C.gold, Text = ("+%s ⚪ +%s XP"):format(fmt(st.coins), fmt(st.xp)), Parent = row,
|
||||
=======
|
||||
TextXAlignment = Enum.TextXAlignment.Right, TextColor3 = done and C.muted or C.gold, Text = ("+%s 💰 +%s XP"):format(fmt(st.coins), fmt(st.xp)), Parent = row,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
})
|
||||
if cur then
|
||||
progressBar(row, UDim2.fromOffset(16, 44), UDim2.new(1, -110, 0, 16), chain.progress / st.goal, C.gold)
|
||||
@@ -1028,11 +1055,7 @@ questWin.render = function(tab)
|
||||
{ corner(14), stroke(C.purple, 2, 0.2), gradient(Color3.fromRGB(70, 40, 100), C.panel, 90) })
|
||||
text({
|
||||
Size = UDim2.new(1, -32, 1, 0), Position = UDim2.fromOffset(16, 0), Font = TITLE, TextSize = 18, RichText = true,
|
||||
<<<<<<< HEAD
|
||||
Text = ("🎁 За всю цепочку: <font color=\"#FFD45A\">+%s ⚪ +%s XP</font>%s"):format(fmt(b.coins), fmt(b.xp), b.potion and (" + " .. b.potion) or ""), Parent = row,
|
||||
=======
|
||||
Text = ("🎁 За всю цепочку: <font color=\"#FFD45A\">+%s 💰 +%s XP</font>%s"):format(fmt(b.coins), fmt(b.xp), b.potion and (" + " .. b.potion) or ""), Parent = row,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
})
|
||||
elseif tab == "daily" then
|
||||
clear(dailyPage)
|
||||
@@ -1091,11 +1114,8 @@ robuxWin.render = function(tab)
|
||||
notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120))
|
||||
return
|
||||
end
|
||||
if tab == "passes" then
|
||||
MarketplaceService:PromptGamePassPurchase(player, it.id)
|
||||
else
|
||||
MarketplaceService:PromptProductPurchase(player, it.id)
|
||||
end
|
||||
-- и наборы, и пропуска — Developer Products; пропуск сервер запоминает навсегда
|
||||
MarketplaceService:PromptProductPurchase(player, it.id)
|
||||
end,
|
||||
})
|
||||
end
|
||||
@@ -1165,6 +1185,7 @@ end)
|
||||
sideButton(6, "⚙", "Звук", nil, Color3.fromRGB(150, 120, 80), function()
|
||||
settingsWin.toggle()
|
||||
end)
|
||||
Theme.kit.bagWin = bagWin -- кнопка «Рюкзак» внизу справа (HudBar.client.lua)
|
||||
|
||||
-- раскладка: компьютер — как раньше; телефон — HUD и кнопки компактнее, кнопки сеткой 3×N под HUD
|
||||
-- (левый низ свободен под джойстик, правый низ — под кнопку прыжка)
|
||||
@@ -1177,15 +1198,16 @@ do
|
||||
Theme.onLayout(function(compact)
|
||||
scaleOf(hud.Parent).Scale = compact and 0.82 or 1
|
||||
hud.Parent.Position = compact and UDim2.fromOffset(8, 6) or UDim2.fromOffset(12, 10)
|
||||
grid.CellSize = compact and UDim2.fromOffset(52, 52) or UDim2.fromOffset(62, 62)
|
||||
grid.CellPadding = compact and UDim2.fromOffset(6, 6) or UDim2.fromOffset(6, 6)
|
||||
grid.FillDirectionMaxCells = compact and 3 or 1
|
||||
side.AnchorPoint = Vector2.zero
|
||||
-- меню: на компьютере — столбик широких кнопок, на телефоне — два столбика поуже
|
||||
grid.CellSize = compact and UDim2.fromOffset(112, 32) or UDim2.fromOffset(154, 40)
|
||||
grid.CellPadding = compact and UDim2.fromOffset(5, 5) or UDim2.fromOffset(6, 6)
|
||||
grid.FillDirectionMaxCells = compact and 2 or 1
|
||||
-- под HUD (он выше на строку гильдии — её добавляет GuildClient)
|
||||
side.Position = compact and UDim2.fromOffset(8, 172) or UDim2.fromOffset(12, 216)
|
||||
side.Size = compact and UDim2.fromOffset(170, 240) or UDim2.fromOffset(70, 480)
|
||||
H.sidePanel.Position = compact and UDim2.fromOffset(8, 176) or UDim2.fromOffset(12, 228)
|
||||
H.sidePanel.Size = compact and UDim2.fromOffset(2 * 112 + 5 + 16, 0) or UDim2.fromOffset(154 + 16, 0)
|
||||
toasts.Size = compact and UDim2.fromOffset(640, 200) or UDim2.fromOffset(900, 200)
|
||||
toasts.Position = compact and UDim2.new(0.5, 0, 0, 66) or UDim2.new(0.5, 0, 0, 84)
|
||||
H.toastBaseY = compact and 66 or 84
|
||||
toasts.Position = UDim2.new(0.5, 0, 0, H.toastBaseY)
|
||||
scaleOf(toasts).Scale = compact and 0.75 or 1
|
||||
scaleOf(catchCard).Scale = compact and 0.8 or 1
|
||||
scaleOf(mgFrame).Scale = compact and 0.85 or 1
|
||||
@@ -1317,7 +1339,7 @@ end
|
||||
---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки
|
||||
-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе
|
||||
|
||||
local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе
|
||||
local REST_ANGLE, BACK_ANGLE = 42, 110 -- удочка в покое (как в GameServer) и в полном замахе
|
||||
local function gripCF(angle)
|
||||
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
|
||||
end
|
||||
@@ -1340,11 +1362,7 @@ end
|
||||
local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32
|
||||
local gauge = new("Frame", {
|
||||
Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0),
|
||||
<<<<<<< HEAD
|
||||
BackgroundTransparency = 1, Visible = false, Parent = screen,
|
||||
=======
|
||||
BackgroundTransparency = 1, Visible = false, Parent = gui,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
})
|
||||
local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо
|
||||
local function arcPoint(v, r)
|
||||
@@ -1627,6 +1645,24 @@ local function onActivate()
|
||||
end
|
||||
end
|
||||
|
||||
-- клик пришёлся на видимый элемент интерфейса (кнопка, панель, картинка), а не в мир
|
||||
local GuiService = game:GetService("GuiService")
|
||||
local function pointerOverGui()
|
||||
local pos = UserInputService:GetMouseLocation() - GuiService:GetGuiInset()
|
||||
for _, g in ipairs(player.PlayerGui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
|
||||
if g.Visible and (g:IsA("GuiButton") or g:IsA("TextBox") or g.BackgroundTransparency < 0.95
|
||||
or (g:IsA("ImageLabel") and g.ImageTransparency < 0.95)) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- пока открыто любое окно (сумка, магазин, настройки, гильдия...), клики по удочке не работают
|
||||
local function menuOpen()
|
||||
return openWindow ~= nil and openWindow.isOpen()
|
||||
end
|
||||
|
||||
local hooked = setmetatable({}, { __mode = "k" })
|
||||
local function hookTool(tool)
|
||||
if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then
|
||||
@@ -1634,7 +1670,13 @@ local function hookTool(tool)
|
||||
end
|
||||
hooked[tool] = true
|
||||
tool.Activated:Connect(function()
|
||||
if menuOpen() then
|
||||
return
|
||||
end
|
||||
if state == "idle" then
|
||||
if pointerOverGui() then
|
||||
return -- нажали кнопку или панель интерфейса — это не заброс
|
||||
end
|
||||
startCharge(tool)
|
||||
else
|
||||
onActivate()
|
||||
@@ -1762,7 +1804,6 @@ local function setLook(obj, goal, instant)
|
||||
end
|
||||
end
|
||||
|
||||
<<<<<<< HEAD
|
||||
-- погода сгущает дымку поверх настроек локации (туман — сильно, дождь и гроза — слегка)
|
||||
local WEATHER_ATMO = {
|
||||
Fog = { Density = 0.22, Haze = 1.5 },
|
||||
@@ -1774,8 +1815,6 @@ local function weatherAtmo(prop)
|
||||
return (add and add[prop]) or 0
|
||||
end
|
||||
|
||||
=======
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local function applyLook(world, instant)
|
||||
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
|
||||
for _, w in ipairs(lookSources) do
|
||||
@@ -1799,12 +1838,9 @@ local function applyLook(world, instant)
|
||||
for prop, def in pairs(defaults) do
|
||||
local v = look[section] and look[section][prop]
|
||||
if v == nil then v = def end
|
||||
<<<<<<< HEAD
|
||||
if section == "atmosphere" and typeof(v) == "number" then
|
||||
v += weatherAtmo(prop)
|
||||
end
|
||||
=======
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
-- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу
|
||||
local kind = typeof(v)
|
||||
if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end
|
||||
@@ -1821,15 +1857,10 @@ local function applyAmbience(world, instant)
|
||||
end
|
||||
table.clear(lookTweens)
|
||||
world = world or Config.Lobby
|
||||
<<<<<<< HEAD
|
||||
-- при смене суток часы двигает Ambience; иначе у каждой локации своё время
|
||||
if not Config.DayNight.enabled then
|
||||
setLook(Lighting, { ClockTime = (world and world.clock) or 14.5 }, instant)
|
||||
end
|
||||
=======
|
||||
local clock = (world and world.clock) or 14.5
|
||||
setLook(Lighting, { ClockTime = clock }, instant)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
|
||||
if cc then
|
||||
setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant)
|
||||
@@ -1933,7 +1964,6 @@ local function enterWorld(w, instant)
|
||||
end
|
||||
end
|
||||
|
||||
<<<<<<< HEAD
|
||||
-- погода сменилась: плавно пересчитываем дымку текущей локации
|
||||
workspace:GetAttributeChangedSignal("Weather"):Connect(function()
|
||||
if lastWorldId ~= "none" and not loadingVisible() then
|
||||
@@ -1953,8 +1983,6 @@ do
|
||||
end)
|
||||
end
|
||||
|
||||
=======
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки
|
||||
task.spawn(function()
|
||||
local char = player.Character or player.CharacterAdded:Wait()
|
||||
@@ -2032,7 +2060,6 @@ local guideStep = 0 -- шаг, отправленный на сервер (ат
|
||||
|
||||
-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает»
|
||||
local guideHint, guideHintText = softPlate(
|
||||
<<<<<<< HEAD
|
||||
{ Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = screen },
|
||||
{ TextSize = 42, Text = "" }
|
||||
)
|
||||
@@ -2040,12 +2067,6 @@ wobble(guideHint, 1.2, 1.6)
|
||||
Theme.onLayout(function(compact)
|
||||
guideHintText.TextSize = compact and 30 or 42
|
||||
end)
|
||||
=======
|
||||
{ Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = gui },
|
||||
{ TextSize = 42, Text = "" }
|
||||
)
|
||||
wobble(guideHint, 1.2, 1.6)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local lastHint = nil
|
||||
|
||||
local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace })
|
||||
@@ -2149,6 +2170,11 @@ local function setInterfaceHidden(hidden)
|
||||
boardGui.Enabled = hidden
|
||||
pcall(function()
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden)
|
||||
if not hidden then
|
||||
-- рюкзак и список игроков Roblox заменены своими (HudBar.client.lua)
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
|
||||
end
|
||||
end)
|
||||
-- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было
|
||||
if hidden then
|
||||
@@ -2246,11 +2272,7 @@ local function guideRoute(step, pos, world)
|
||||
elseif step == 2 and inW1 then
|
||||
return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier"
|
||||
elseif step == 3 and inW1 then
|
||||
<<<<<<< HEAD
|
||||
return { sellTargetW1() }, "⚪ Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
|
||||
=======
|
||||
return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
end
|
||||
return nil
|
||||
end
|
||||
@@ -2415,19 +2437,11 @@ local FIRE = Color3.fromRGB(255, 150, 60)
|
||||
|
||||
-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит
|
||||
local comboBox = new("Frame", {
|
||||
<<<<<<< HEAD
|
||||
Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = screen,
|
||||
}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) })
|
||||
local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox })
|
||||
local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox })
|
||||
local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = C.dark, Parent = comboBox }, { corner(3) })
|
||||
=======
|
||||
Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||||
}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) })
|
||||
local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox })
|
||||
local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox })
|
||||
local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = comboBox }, { corner(3) })
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) })
|
||||
|
||||
local function refreshCombo(pop)
|
||||
@@ -2450,7 +2464,6 @@ refreshCombo(false)
|
||||
-- правая колонка: босс и цели
|
||||
local rightCol = new("Frame", {
|
||||
Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10),
|
||||
<<<<<<< HEAD
|
||||
BackgroundTransparency = 1, Parent = screen,
|
||||
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||
|
||||
@@ -2463,20 +2476,11 @@ Theme.onLayout(function(compact)
|
||||
comboBox.Position = compact and UDim2.fromOffset(254, 6) or UDim2.fromOffset(310, 10)
|
||||
end)
|
||||
|
||||
=======
|
||||
BackgroundTransparency = 1, Parent = gui,
|
||||
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol },
|
||||
{ corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) })
|
||||
local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox })
|
||||
local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox })
|
||||
<<<<<<< HEAD
|
||||
local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = C.dark, Parent = bossBox }, { corner(9) })
|
||||
=======
|
||||
local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = bossBox }, { corner(9) })
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) })
|
||||
local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack })
|
||||
local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox })
|
||||
@@ -2491,11 +2495,7 @@ text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize =
|
||||
local function trackerLine(order, onClick)
|
||||
local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker })
|
||||
local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root })
|
||||
<<<<<<< HEAD
|
||||
local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = C.dark, Parent = root }, { corner(4) })
|
||||
=======
|
||||
local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = root }, { corner(4) })
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) })
|
||||
if onClick then
|
||||
root.MouseButton1Click:Connect(onClick)
|
||||
@@ -2550,11 +2550,7 @@ local function buyGoal()
|
||||
elseif coins >= r.price then
|
||||
return ("🎣 <b>%s</b> — можно купить!"):format(r.name), 1, C.green
|
||||
end
|
||||
<<<<<<< HEAD
|
||||
return ("🎣 До «%s»: ещё <b>%s</b> ⚪"):format(r.name, fmt(r.price - coins)), coins / r.price, C.gold
|
||||
=======
|
||||
return ("🎣 До «%s»: ещё <b>%s</b> 💰"):format(r.name, fmt(r.price - coins)), coins / r.price, C.gold
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
end
|
||||
end
|
||||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
|
||||
@@ -2564,11 +2560,7 @@ local function buyGoal()
|
||||
if coins >= cost then
|
||||
return ("✨ Улучшение до +%d — можно купить!"):format(rl + 1), 1, C.green
|
||||
end
|
||||
<<<<<<< HEAD
|
||||
return ("✨ До улучшения +%d: ещё <b>%s</b> ⚪"):format(rl + 1, fmt(cost - coins)), coins / cost, C.gold
|
||||
=======
|
||||
return ("✨ До улучшения +%d: ещё <b>%s</b> 💰"):format(rl + 1, fmt(cost - coins)), coins / cost, C.gold
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
end
|
||||
return nil
|
||||
end
|
||||
@@ -2712,11 +2704,7 @@ end)
|
||||
-- у скупщика после продажи: предложение купить то, на что уже хватает
|
||||
local offerCard = new("Frame", {
|
||||
Size = UDim2.fromOffset(440, 96), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110),
|
||||
<<<<<<< HEAD
|
||||
BackgroundColor3 = WHITE, Visible = false, Parent = screen,
|
||||
=======
|
||||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
}, { corner(16), stroke(C.green, 2.5, 0.05), gradient(Color3.fromRGB(30, 85, 55), C.bg, 90) })
|
||||
local offerIcon = text({ Size = UDim2.fromOffset(70, 70), Position = UDim2.fromOffset(12, 13), TextSize = 46, TextXAlignment = CENTER, Text = "", Parent = offerCard })
|
||||
local offerTitle = text({ Size = UDim2.new(1, -250, 0, 26), Position = UDim2.fromOffset(90, 12), Font = TITLE, TextSize = 19, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = offerCard })
|
||||
@@ -2729,19 +2717,11 @@ end
|
||||
local offerBuy = btn({ Size = UDim2.fromOffset(146, 52), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, TextSize = 18, Text = "", Parent = offerCard }, function()
|
||||
if offerItem then
|
||||
remote:FireServer("Buy", offerItem.kind, offerItem.id)
|
||||
<<<<<<< HEAD
|
||||
Audio.play("coins")
|
||||
end
|
||||
hideOffer()
|
||||
end)
|
||||
btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "×", TextSize = 22, Parent = offerCard }, hideOffer)
|
||||
=======
|
||||
playUiSound(DING, 0.5)
|
||||
end
|
||||
hideOffer()
|
||||
end)
|
||||
btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "✕", TextSize = 14, Parent = offerCard }, hideOffer)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
|
||||
bestOffer = function(bagWasFull)
|
||||
local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1
|
||||
@@ -2793,11 +2773,7 @@ showOffer = function(o)
|
||||
offerIcon.Text = o.icon
|
||||
offerTitle.Text = o.title
|
||||
offerDesc.Text = o.desc
|
||||
<<<<<<< HEAD
|
||||
offerBuy.Text = ("Купить · %s ⚪"):format(fmt(o.price))
|
||||
=======
|
||||
offerBuy.Text = ("Купить · %s 💰"):format(fmt(o.price))
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
offerCard.Visible = true
|
||||
popIn(offerCard, 0.6)
|
||||
task.delay(9, function()
|
||||
@@ -2826,12 +2802,9 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
setState("waiting")
|
||||
startCastCam(a, b)
|
||||
elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then
|
||||
<<<<<<< HEAD
|
||||
if action == "Escaped" then
|
||||
Audio.play("escape")
|
||||
end
|
||||
=======
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
if action == "CastFail" and castTool and castTool.Parent then
|
||||
castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе
|
||||
end
|
||||
@@ -2860,20 +2833,12 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
Audio.play("sparkle")
|
||||
end
|
||||
elseif action == "Sold" then
|
||||
<<<<<<< HEAD
|
||||
Audio.play("coins")
|
||||
if tutorialStep() == 3 then
|
||||
advanceTutorial(Config.TutorialDone)
|
||||
end
|
||||
floatText("+" .. fmt(a) .. " ⚪", C.gold)
|
||||
notify(("⚪ +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140))
|
||||
=======
|
||||
if tutorialStep() == 3 then
|
||||
advanceTutorial(Config.TutorialDone)
|
||||
end
|
||||
floatText("+" .. fmt(a) .. " 💰", C.gold)
|
||||
notify(("💰 +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140))
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
-- монеты приходят атрибутом чуть позже события, поэтому предложение — с задержкой
|
||||
local wasFull = offerState.bagWasFull
|
||||
offerState.bagWasFull = false
|
||||
@@ -2902,30 +2867,17 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
refreshDots()
|
||||
refreshTracker()
|
||||
elseif action == "QuestDone" then
|
||||
<<<<<<< HEAD
|
||||
notify(("✅ %s +%s ⚪ +%s XP"):format(questText(a, b), fmt(c), fmt(d or 0)), Color3.fromRGB(120, 255, 140))
|
||||
Audio.play("quest")
|
||||
elseif action == "ChainDone" then
|
||||
floatText("🏆 Цепочка пройдена!", C.gold)
|
||||
notify(("🎁 %s: +%s ⚪ +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold)
|
||||
Audio.play("fanfare")
|
||||
=======
|
||||
notify(("✅ %s +%s 💰 +%s XP"):format(questText(a, b), fmt(c), fmt(d or 0)), Color3.fromRGB(120, 255, 140))
|
||||
playUiSound(DING, 0.6)
|
||||
elseif action == "ChainDone" then
|
||||
floatText("🏆 Цепочка пройдена!", C.gold)
|
||||
notify(("🎁 %s: +%s 💰 +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold)
|
||||
playUiSound(DING, 0.8)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
elseif action == "ComboLost" then
|
||||
notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110))
|
||||
elseif action == "BossStart" then
|
||||
notify(("👑 %s в мире «%s»! Ловите всем сервером"):format(a, b), C.gold)
|
||||
<<<<<<< HEAD
|
||||
Audio.play("quest")
|
||||
=======
|
||||
playUiSound(DING, 0.8)
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
elseif action == "BossHit" then
|
||||
floatText(("⚔ -%d боссу"):format(a), Color3.fromRGB(255, 130, 100))
|
||||
elseif action == "BossDone" then
|
||||
@@ -2935,11 +2887,7 @@ remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||||
notify(("🌊 %s ушёл на глубину…"):format(b), C.muted)
|
||||
end
|
||||
elseif action == "BossReward" then
|
||||
<<<<<<< HEAD
|
||||
notify(("🎁 За босса: +%s ⚪ +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140))
|
||||
=======
|
||||
notify(("🎁 За босса: +%s 💰 +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140))
|
||||
>>>>>>> 1ff7ef7e83a97a0e100d5c3805ebc4ad762a2806
|
||||
elseif action == "OpenShop" then
|
||||
shopWin.open("rods")
|
||||
elseif action == "OpenQuests" then
|
||||
|
||||
@@ -302,15 +302,19 @@ end
|
||||
local bar = new("Frame", {
|
||||
Size = UDim2.fromOffset(250, 56), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -12, 1, -12), BackgroundTransparency = 1, Parent = K.screen,
|
||||
}, { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, HorizontalAlignment = Enum.HorizontalAlignment.Right, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||||
local baitBtn = btn({ Size = UDim2.fromOffset(110, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 16, LayoutOrder = 1, Parent = bar }, function()
|
||||
-- наживка теперь — карточка на нижней панели (HudBar.client.lua); старая кнопка скрыта, вкладку открывает K.openBait
|
||||
local baitBtn = btn({ Size = UDim2.fromOffset(110, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 16, LayoutOrder = 1, Visible = false, Parent = bar }, function()
|
||||
openGuild("bait")
|
||||
end)
|
||||
K.openBait = function()
|
||||
openGuild("bait")
|
||||
end
|
||||
local autoBtn = btn({ Size = UDim2.fromOffset(130, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 15, LayoutOrder = 2, Visible = false, Parent = bar }, function()
|
||||
remote:FireServer("AutoFish", not player:GetAttribute("AutoFish"))
|
||||
end)
|
||||
Theme.onLayout(function(compact)
|
||||
-- на телефоне — внизу, левее кнопки прыжка (над ней — панель целей)
|
||||
bar.Position = compact and UDim2.new(1, -140, 1, -8) or UDim2.new(1, -12, 1, -12)
|
||||
-- над кнопкой «Рюкзак» (правый низ): на телефоне — левее кнопки прыжка
|
||||
bar.Position = compact and UDim2.new(1, -140, 1, -66) or UDim2.new(1, -12, 1, -92)
|
||||
end)
|
||||
|
||||
local function refreshBar()
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
-- HudBar (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Нижняя панель и правый верх в стиле игры (вместо стандартных панелей Roblox):
|
||||
-- слоты удочек со стрелками (клик / клавиши 1–3 — выбрать удочку и взять её в руки),
|
||||
-- карточка удочки в руке (клик — взять или убрать), карточка наживки (⇄ — вкладка наживки гильдии),
|
||||
-- кнопка «Рюкзак» с заполненностью сумки, таблица игроков (уровень, серебро, улов) справа сверху —
|
||||
-- под ней встают плашка погоды и баннер события.
|
||||
-- Стиль и помощники — из FishingClient (Theme.kit), всё лежит в его холсте и прячется вместе с ним.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local StarterGui = game:GetService("StarterGui")
|
||||
local UserInputService = game:GetService("UserInputService")
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||||
local Theme = require(script.Parent:WaitForChild("UiTheme"))
|
||||
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||||
while not Theme.kit do
|
||||
task.wait(0.1)
|
||||
end
|
||||
local K = Theme.kit
|
||||
local C = Theme.C
|
||||
local new, text, btn, corner, stroke, gradient, fmt = K.new, K.text, K.btn, K.corner, K.stroke, K.gradient, K.fmt
|
||||
local TITLE, BODY2 = K.TITLE, K.BODY2
|
||||
local CENTER = Enum.TextXAlignment.Center
|
||||
local WHITE = Color3.new(1, 1, 1)
|
||||
|
||||
-- стандартные рюкзак и список игроков Roblox заменены своими
|
||||
local function hideCore()
|
||||
for _ = 1, 20 do
|
||||
local ok = pcall(function()
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
|
||||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
|
||||
end)
|
||||
if ok then
|
||||
return
|
||||
end
|
||||
task.wait(0.5)
|
||||
end
|
||||
end
|
||||
task.spawn(hideCore)
|
||||
|
||||
-- деревянная панель в стиле HUD
|
||||
local function woodPanel(props)
|
||||
local f = new("Frame", props, { corner(10), stroke(C.goldDark, 2.5, 0), Theme.woodGradient(C.wood, C.woodDark) })
|
||||
Theme.innerBorder(f, 4, 7, C.gold, 0.55)
|
||||
return f
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- удочки и наживка (низ по центру)
|
||||
|
||||
local SLOTS = 3
|
||||
local bar = woodPanel({
|
||||
Name = "HotBar", Size = UDim2.fromOffset(0, 74), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 1),
|
||||
Position = UDim2.new(0.5, 0, 1, -10), BackgroundColor3 = WHITE, Parent = K.screen,
|
||||
})
|
||||
Theme.rivets(bar, 7, 6)
|
||||
new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), Parent = bar })
|
||||
local row = new("Frame", { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, BackgroundTransparency = 1, Parent = bar }, {
|
||||
new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, VerticalAlignment = Enum.VerticalAlignment.Center, Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }),
|
||||
})
|
||||
-- ярлычок над слотами
|
||||
do
|
||||
local tag = new("Frame", {
|
||||
Size = UDim2.fromOffset(0, 24), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 34, 0, 6),
|
||||
BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar,
|
||||
}, { corner(8), stroke(C.goldDark, 2, 0), Theme.woodGradient(C.woodLight, C.wood), new("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10) }) })
|
||||
text({ Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, Font = BODY2, TextSize = 13, TextColor3 = C.parchment, Text = "Выбрать удочку", ZIndex = 4, Parent = tag })
|
||||
end
|
||||
|
||||
local page = 0 -- какие удочки видны в слотах: page*SLOTS + 1 …
|
||||
local refresh -- обновление панели, объявлена ниже
|
||||
local function ownedRods()
|
||||
local set = {}
|
||||
for id in string.gmatch(player:GetAttribute("OwnedRods") or "Basic", "[^,]+") do
|
||||
set[id] = true
|
||||
end
|
||||
local list = {}
|
||||
for _, r in ipairs(Config.Rods) do
|
||||
if set[r.id] then
|
||||
table.insert(list, r)
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
local function rodLevel(id)
|
||||
for pair in string.gmatch(player:GetAttribute("RodLevels") or "", "[^,]+") do
|
||||
local k, v = pair:match("^(%w+):(%d+)$")
|
||||
if k == id then
|
||||
return tonumber(v)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local function rodTool()
|
||||
for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do
|
||||
if container then
|
||||
for _, t in ipairs(container:GetChildren()) do
|
||||
if t:IsA("Tool") and t:GetAttribute("IsRod") then
|
||||
return t
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function inHand()
|
||||
local t = rodTool()
|
||||
return t ~= nil and t.Parent == player.Character
|
||||
end
|
||||
local function equip(on)
|
||||
local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
|
||||
if not hum then
|
||||
return
|
||||
end
|
||||
if on then
|
||||
local t = rodTool()
|
||||
if t then
|
||||
hum:EquipTool(t)
|
||||
end
|
||||
else
|
||||
hum:UnequipTools()
|
||||
end
|
||||
end
|
||||
|
||||
-- 3D-модель удочки (как в магазине): картинки-иконки удочек могут быть недоступны (права на ассет),
|
||||
-- модель строится из деталей и видна всегда. В квадрате удочка наклонена по диагонали, иначе она — тонкая черта
|
||||
local function rodView(holder, rodId, lvl)
|
||||
local key = rodId and (rodId .. ":" .. lvl) or ""
|
||||
if holder:GetAttribute("Shown") == key then
|
||||
return
|
||||
end
|
||||
holder:SetAttribute("Shown", key)
|
||||
for _, c in ipairs(holder:GetChildren()) do
|
||||
if c:IsA("ViewportFrame") then
|
||||
c:Destroy()
|
||||
end
|
||||
end
|
||||
if rodId and K.viewport then
|
||||
local ok, model = pcall(Models.buildRod, rodId, lvl, true)
|
||||
if ok and model then
|
||||
local p = model:GetPivot()
|
||||
model:PivotTo(CFrame.new(p.Position) * CFrame.Angles(math.rad(42), 0, 0) * (p - p.Position))
|
||||
K.viewport(holder, model, K.VIEW.rod, 0.62)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function arrow(order, label, dir)
|
||||
local b = btn({ Size = UDim2.fromOffset(26, 56), BackgroundColor3 = C.woodLight, Text = label, TextSize = 18, LayoutOrder = order, Parent = row }, function()
|
||||
local count = #ownedRods()
|
||||
local pages = math.max(1, math.ceil(count / SLOTS))
|
||||
page = (page + dir) % pages
|
||||
refresh()
|
||||
end)
|
||||
return b
|
||||
end
|
||||
|
||||
arrow(1, "‹", -1)
|
||||
local slots = {}
|
||||
for i = 1, SLOTS do
|
||||
local s = btn({ Size = UDim2.fromOffset(56, 56), BackgroundColor3 = C.wood, Text = "", LayoutOrder = 1 + i, Parent = row }, function()
|
||||
local rod = slots[i].rod
|
||||
if rod then
|
||||
if rod.id ~= player:GetAttribute("Rod") then
|
||||
remote:FireServer("Buy", "Rod", rod.id) -- своя удочка — бесплатно, сервер выдаёт её в руки
|
||||
task.delay(0.4, equip, true)
|
||||
else
|
||||
equip(not inHand())
|
||||
end
|
||||
end
|
||||
end)
|
||||
local icon = new("Frame", { Size = UDim2.new(1, -6, 1, -6), Position = UDim2.fromOffset(3, 3), BackgroundTransparency = 1, Parent = s })
|
||||
local num = new("Frame", { Size = UDim2.fromOffset(18, 18), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, 6), BackgroundColor3 = C.bg, ZIndex = 3, Parent = s },
|
||||
{ corner(9), stroke(C.gold, 1.2) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 11, TextXAlignment = CENTER, TextColor3 = C.goldBright, Text = tostring(i), ZIndex = 4, Parent = num })
|
||||
slots[i] = { button = s, icon = icon, stroke = s:FindFirstChildOfClass("UIStroke") }
|
||||
end
|
||||
arrow(10, "›", 1)
|
||||
|
||||
-- разделитель
|
||||
new("Frame", { Size = UDim2.fromOffset(2, 52), BackgroundColor3 = C.goldDark, BorderSizePixel = 0, LayoutOrder = 11, Parent = row })
|
||||
|
||||
-- удочка в руке
|
||||
local rodCard = btn({ Size = UDim2.fromOffset(196, 60), BackgroundColor3 = C.woodLight, Text = "", LayoutOrder = 12, Parent = row }, function()
|
||||
equip(not inHand())
|
||||
end)
|
||||
local rodIcon = new("Frame", { Size = UDim2.fromOffset(52, 52), Position = UDim2.fromOffset(4, 4), BackgroundTransparency = 1, Parent = rodCard })
|
||||
local rodName = text({ Size = UDim2.new(1, -66, 1, -8), Position = UDim2.fromOffset(58, 4), Font = TITLE, TextScaled = true, TextWrapped = true, Text = "", Parent = rodCard })
|
||||
new("UITextSizeConstraint", { MaxTextSize = 17, Parent = rodName })
|
||||
local rodCheck = new("Frame", { Size = UDim2.fromOffset(22, 22), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -4, 0, 4), BackgroundColor3 = C.forest, ZIndex = 3, Parent = rodCard },
|
||||
{ corner(11), stroke(WHITE, 2) })
|
||||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 13, TextXAlignment = CENTER, Text = "✓", ZIndex = 4, Parent = rodCheck })
|
||||
|
||||
-- наживка
|
||||
local baitCard = new("Frame", { Size = UDim2.fromOffset(190, 60), BackgroundColor3 = WHITE, LayoutOrder = 13, Parent = row },
|
||||
{ corner(8), stroke(C.gold, 1.5, 0.15), Theme.woodGradient(C.woodLight, C.wood) })
|
||||
local baitIcon = text({ Size = UDim2.fromOffset(44, 44), Position = UDim2.fromOffset(6, 8), TextScaled = true, TextXAlignment = CENTER, Text = "🐛", Parent = baitCard })
|
||||
local baitName = text({ Size = UDim2.new(1, -104, 0, 24), Position = UDim2.fromOffset(54, 6), Font = TITLE, TextScaled = true, Text = "", Parent = baitCard })
|
||||
new("UITextSizeConstraint", { MaxTextSize = 17, Parent = baitName })
|
||||
local baitCount = text({ Size = UDim2.new(1, -104, 0, 20), Position = UDim2.fromOffset(54, 32), Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "", Parent = baitCard })
|
||||
btn({ Size = UDim2.fromOffset(40, 40), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.wood, Text = "⇄", TextSize = 20, Parent = baitCard }, function()
|
||||
if K.openBait then
|
||||
K.openBait()
|
||||
end
|
||||
end)
|
||||
|
||||
---------------------------------------------------------------- рюкзак (правый низ)
|
||||
|
||||
local pack = btn({
|
||||
Name = "BackpackButton", Size = UDim2.fromOffset(170, 70), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -12, 1, -12),
|
||||
BackgroundColor3 = C.woodLight, Text = "", Parent = K.screen,
|
||||
}, function()
|
||||
if K.bagWin then
|
||||
K.bagWin.toggle("fish")
|
||||
end
|
||||
end)
|
||||
pack:FindFirstChildOfClass("UIStroke").Color = C.goldDark
|
||||
pack:FindFirstChildOfClass("UIStroke").Thickness = 2.5
|
||||
text({ Size = UDim2.fromOffset(52, 52), Position = UDim2.fromOffset(8, 9), TextScaled = true, TextXAlignment = CENTER, Text = "🎒", Parent = pack })
|
||||
text({ Size = UDim2.new(1, -70, 0, 30), Position = UDim2.fromOffset(64, 8), Font = TITLE, TextSize = 22, Text = "Рюкзак", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = pack })
|
||||
local packCount = text({ Size = UDim2.new(1, -70, 0, 22), Position = UDim2.fromOffset(64, 38), Font = BODY2, TextSize = 15, Text = "", Parent = pack })
|
||||
|
||||
---------------------------------------------------------------- таблица игроков (правый верх)
|
||||
|
||||
local ROW_H, MAX_ROWS = 26, 6
|
||||
local board = woodPanel({
|
||||
Name = "PlayersBoard", Size = UDim2.fromOffset(310, 34), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 8),
|
||||
BackgroundColor3 = WHITE, Parent = K.screen,
|
||||
})
|
||||
local function cols(parent, y, a, b, c, d, color, font)
|
||||
local function cell(x, w, t, align)
|
||||
text({ Size = UDim2.fromOffset(w, ROW_H), Position = UDim2.fromOffset(x, y), Font = font or BODY2, TextSize = 13, TextColor3 = color,
|
||||
TextXAlignment = align or CENTER, TextTruncate = Enum.TextTruncate.AtEnd, Text = t, Parent = parent })
|
||||
end
|
||||
cell(12, 130, a, Enum.TextXAlignment.Left)
|
||||
cell(142, 46, b)
|
||||
cell(188, 62, c)
|
||||
cell(250, 50, d)
|
||||
end
|
||||
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 30), BackgroundTransparency = 1, Parent = board })
|
||||
cols(header, 3, "👥 Игроки", "Уровень", "Серебро", "Улов", C.muted)
|
||||
local rowsFrame = new("Frame", { Size = UDim2.new(1, 0, 1, -32), Position = UDim2.fromOffset(0, 30), BackgroundTransparency = 1, Parent = board })
|
||||
local collapsed = false
|
||||
|
||||
local function stat(p, name)
|
||||
local ls = p:FindFirstChild("leaderstats")
|
||||
local v = ls and ls:FindFirstChild(name)
|
||||
return v and v.Value or 0
|
||||
end
|
||||
|
||||
local function placeBelowBoard()
|
||||
-- плашку погоды (Ambience) и баннер события (FishingClient) ставим под таблицей
|
||||
local y = 8 + board.Size.Y.Offset + 8
|
||||
local weather = player.PlayerGui:FindFirstChild("WeatherHud")
|
||||
local pill = weather and weather:FindFirstChild("Root") and weather.Root:FindFirstChildOfClass("Frame")
|
||||
if pill then
|
||||
pill.Position = UDim2.new(1, -12, 0, y)
|
||||
y += pill.Size.Y.Offset + 8
|
||||
end
|
||||
local ev = K.screen:FindFirstChild("EventBanner")
|
||||
if ev then
|
||||
ev.Position = UDim2.new(1, -12, 0, y)
|
||||
end
|
||||
end
|
||||
|
||||
local function refreshBoard()
|
||||
for _, c in ipairs(rowsFrame:GetChildren()) do
|
||||
c:Destroy()
|
||||
end
|
||||
local list = Players:GetPlayers()
|
||||
table.sort(list, function(a, b)
|
||||
local la, lb = stat(a, "Уровень"), stat(b, "Уровень")
|
||||
if la ~= lb then
|
||||
return la > lb
|
||||
end
|
||||
return stat(a, "Серебро") > stat(b, "Серебро")
|
||||
end)
|
||||
local shown = collapsed and 0 or math.min(#list, MAX_ROWS)
|
||||
for i = 1, shown do
|
||||
local p = list[i]
|
||||
local me = p == player
|
||||
local r = new("Frame", { Size = UDim2.new(1, -12, 0, ROW_H - 2), Position = UDim2.fromOffset(6, (i - 1) * ROW_H), BackgroundColor3 = me and C.goldDark or C.woodDark,
|
||||
BackgroundTransparency = me and 0.55 or 0.6, Parent = rowsFrame }, { corner(5) })
|
||||
cols(r, -1, p.DisplayName, fmt(stat(p, "Уровень")), fmt(stat(p, "Серебро")), fmt(stat(p, "Улов")), me and C.goldBright or C.parchment, me and TITLE or BODY2)
|
||||
end
|
||||
board.Size = UDim2.fromOffset(310, 34 + shown * ROW_H + (shown > 0 and 6 or 0))
|
||||
placeBelowBoard()
|
||||
end
|
||||
|
||||
-- Tab — свернуть/развернуть, как стандартный список
|
||||
UserInputService.InputBegan:Connect(function(input, processed)
|
||||
if not processed and input.KeyCode == Enum.KeyCode.Tab then
|
||||
collapsed = not collapsed
|
||||
refreshBoard()
|
||||
end
|
||||
end)
|
||||
|
||||
---------------------------------------------------------------- обновление
|
||||
|
||||
refresh = function()
|
||||
-- слоты удочек
|
||||
local rods = ownedRods()
|
||||
local pages = math.max(1, math.ceil(#rods / SLOTS))
|
||||
page = math.clamp(page, 0, pages - 1)
|
||||
local current = player:GetAttribute("Rod") or "Basic"
|
||||
local hand = inHand()
|
||||
for i, s in ipairs(slots) do
|
||||
local rod = rods[page * SLOTS + i]
|
||||
s.rod = rod
|
||||
rodView(s.icon, rod and rod.id, rod and rodLevel(rod.id) or 0)
|
||||
s.button.BackgroundColor3 = rod and C.woodLight or C.woodDark
|
||||
s.button.AutoButtonColor = rod ~= nil
|
||||
local on = rod and rod.id == current
|
||||
s.stroke.Color = on and Color3.fromRGB(120, 230, 255) or C.goldDark
|
||||
s.stroke.Thickness = on and 3 or 1.5
|
||||
end
|
||||
-- удочка в руке
|
||||
local rod = Config.Find(Config.Rods, current) or Config.Rods[1]
|
||||
local lvl = rodLevel(rod.id)
|
||||
rodView(rodIcon, rod.id, lvl)
|
||||
rodName.Text = rod.name .. (lvl > 0 and (" +" .. lvl) or "")
|
||||
rodCheck.Visible = hand
|
||||
rodCard:FindFirstChildOfClass("UIStroke").Color = hand and Color3.fromRGB(120, 230, 255) or C.gold
|
||||
-- наживка
|
||||
local id = player:GetAttribute("Bait")
|
||||
local b = id and id ~= "" and Config.Find(Config.Baits, id)
|
||||
baitIcon.Text = b and b.icon or "🐛"
|
||||
baitName.Text = b and b.name or "Наживка"
|
||||
baitCount.Text = b and ("×%d"):format(player:GetAttribute("BaitCount") or 0) or "не выбрана"
|
||||
-- рюкзак
|
||||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||||
packCount.Text = ("📦 %d / %d"):format(count, cap)
|
||||
packCount.TextColor3 = count >= cap and Color3.fromRGB(255, 130, 120) or C.parchment
|
||||
end
|
||||
|
||||
-- клавиши 1–3: удочка из слота (взять в руки; повторно — убрать)
|
||||
UserInputService.InputBegan:Connect(function(input, processed)
|
||||
if processed then
|
||||
return
|
||||
end
|
||||
local n = ({ [Enum.KeyCode.One] = 1, [Enum.KeyCode.Two] = 2, [Enum.KeyCode.Three] = 3 })[input.KeyCode]
|
||||
local rod = n and slots[n].rod
|
||||
if rod then
|
||||
if rod.id ~= player:GetAttribute("Rod") then
|
||||
remote:FireServer("Buy", "Rod", rod.id)
|
||||
task.delay(0.4, equip, true)
|
||||
else
|
||||
equip(not inHand())
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Theme.onLayout(function(compact)
|
||||
local function scale(obj, s)
|
||||
local sc = obj:FindFirstChild("LayoutScale") or new("UIScale", { Name = "LayoutScale", Parent = obj })
|
||||
sc.Scale = s
|
||||
end
|
||||
-- телефон: всё мельче; рюкзак левее кнопки прыжка, таблица игроков — компактнее
|
||||
scale(bar, compact and 0.62 or 1)
|
||||
bar.Position = compact and UDim2.new(0.5, 0, 1, -4) or UDim2.new(0.5, 0, 1, -10)
|
||||
scale(pack, compact and 0.7 or 1)
|
||||
pack.Position = compact and UDim2.new(1, -140, 1, -6) or UDim2.new(1, -12, 1, -12)
|
||||
scale(board, compact and 0.75 or 1)
|
||||
MAX_ROWS = compact and 4 or 6
|
||||
refreshBoard()
|
||||
end)
|
||||
|
||||
player.AttributeChanged:Connect(refresh)
|
||||
local function watchChar(char)
|
||||
char.ChildAdded:Connect(refresh)
|
||||
char.ChildRemoved:Connect(refresh)
|
||||
end
|
||||
if player.Character then
|
||||
watchChar(player.Character)
|
||||
end
|
||||
player.CharacterAdded:Connect(watchChar)
|
||||
refresh()
|
||||
|
||||
-- таблица: игроки приходят и уходят, значения меняются
|
||||
local function watchPlayer(p)
|
||||
local ls = p:WaitForChild("leaderstats", 30)
|
||||
if ls then
|
||||
for _, v in ipairs(ls:GetChildren()) do
|
||||
v.Changed:Connect(refreshBoard)
|
||||
end
|
||||
ls.ChildAdded:Connect(function(v)
|
||||
v.Changed:Connect(refreshBoard)
|
||||
end)
|
||||
end
|
||||
refreshBoard()
|
||||
end
|
||||
for _, p in ipairs(Players:GetPlayers()) do
|
||||
task.spawn(watchPlayer, p)
|
||||
end
|
||||
Players.PlayerAdded:Connect(function(p)
|
||||
task.spawn(watchPlayer, p)
|
||||
end)
|
||||
Players.PlayerRemoving:Connect(function()
|
||||
task.defer(refreshBoard)
|
||||
end)
|
||||
refreshBoard()
|
||||
-- плашка погоды создаётся другим скриптом — подождать её
|
||||
task.delay(3, placeBelowBoard)
|
||||
@@ -0,0 +1,479 @@
|
||||
-- LobbyLife (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Живое лобби у этого игрока (всё — на клиенте, сервер не нагружается):
|
||||
-- NPC поворачивают голову к игроку и машут, когда он подходит;
|
||||
-- кот ходит за игроком по площади, а один — ложится у фонтана;
|
||||
-- чайки над скалами, бабочки у цветов, ночью — светлячки у фонарей и клумб;
|
||||
-- деревья, трава, цветы и кусты колышутся от ветра (только рядом с камерой), с деревьев падают листья.
|
||||
-- Общие для всех вещи (idle NPC, гуляющие жители) — в LobbyLife.server.lua.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local RunService = game:GetService("RunService")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local V = Vector3.new
|
||||
local rng = Random.new()
|
||||
local LOBBY = V(0, 1, 0) -- центр лобби, пол на высоте 1
|
||||
local LOBBY_VIEW = 170 -- дальше камеры от центра лобби — ничего не анимируем
|
||||
local WAVE_ANIM = "rbxassetid://507770239"
|
||||
local LEAF_TEXTURE = "rbxassetid://138319345672122"
|
||||
|
||||
local map = workspace:WaitForChild("FishingMap")
|
||||
local fx = Instance.new("Folder")
|
||||
fx.Name = "LobbyLifeFX"
|
||||
fx.Parent = workspace
|
||||
|
||||
local function part(props)
|
||||
local p = Instance.new(props.Class or "Part")
|
||||
p.Anchored = true
|
||||
p.CanCollide, p.CanQuery, p.CanTouch, p.CastShadow = false, false, false, false
|
||||
p.Material = Enum.Material.SmoothPlastic
|
||||
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||||
for k, v in pairs(props) do
|
||||
if k ~= "Class" then
|
||||
p[k] = v
|
||||
end
|
||||
end
|
||||
p.Parent = props.Parent or fx
|
||||
return p
|
||||
end
|
||||
|
||||
local function camPos()
|
||||
local cam = workspace.CurrentCamera
|
||||
return cam and cam.CFrame.Position or LOBBY
|
||||
end
|
||||
local function myRoot()
|
||||
return player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- NPC: взгляд и приветствие
|
||||
|
||||
local npcs = {}
|
||||
local function scanNpcs()
|
||||
for _, d in ipairs(map:GetDescendants()) do
|
||||
if d:IsA("Model") and d:GetAttribute("Npc") and not npcs[d] then
|
||||
local head = d:FindFirstChild("Head")
|
||||
local neck = head and head:FindFirstChild("Neck")
|
||||
local torso = d:FindFirstChild("UpperTorso")
|
||||
if neck and neck:IsA("Motor6D") and torso then
|
||||
npcs[d] = { neck = neck, c0 = neck.C0, torso = torso, head = head, yaw = 0, pitch = 0, waveAt = -math.huge }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function wave(rig, info)
|
||||
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||||
local animator = hum and hum:FindFirstChildOfClass("Animator")
|
||||
if not animator then
|
||||
return
|
||||
end
|
||||
if not info.waveTrack then
|
||||
local a = Instance.new("Animation")
|
||||
a.AnimationId = WAVE_ANIM
|
||||
local ok, track = pcall(function() return animator:LoadAnimation(a) end)
|
||||
info.waveTrack = ok and track or false
|
||||
end
|
||||
if info.waveTrack then
|
||||
info.waveTrack.Priority = Enum.AnimationPriority.Action
|
||||
info.waveTrack:Play(0.2)
|
||||
end
|
||||
end
|
||||
|
||||
local function updateNpcs(dt)
|
||||
local root = myRoot()
|
||||
local myHead = player.Character and player.Character:FindFirstChild("Head")
|
||||
local now = os.clock()
|
||||
for rig, n in pairs(npcs) do
|
||||
if not rig.Parent then
|
||||
npcs[rig] = nil
|
||||
else
|
||||
local wantYaw, wantPitch = 0, 0
|
||||
local dist = root and (root.Position - n.head.Position).Magnitude or math.huge
|
||||
if myHead and dist < 24 then
|
||||
-- куда смотреть: в системе координат торса, лицо — по -Z
|
||||
local rel = n.torso.CFrame:PointToObjectSpace(myHead.Position)
|
||||
local headRel = n.torso.CFrame:PointToObjectSpace(n.head.Position)
|
||||
local d = rel - headRel
|
||||
wantYaw = math.clamp(math.atan2(-d.X, -d.Z), math.rad(-70), math.rad(70))
|
||||
wantPitch = math.clamp(math.atan2(d.Y, math.sqrt(d.X * d.X + d.Z * d.Z)), math.rad(-20), math.rad(30))
|
||||
-- голову к игроку, только если он перед NPC, а не за спиной
|
||||
if math.abs(math.atan2(-d.X, -d.Z)) > math.rad(110) then
|
||||
wantYaw, wantPitch = 0, 0
|
||||
end
|
||||
-- подошёл близко — помахать (не чаще раза в 25 секунд)
|
||||
if dist < 11 and now - n.waveAt > 25 then
|
||||
n.waveAt = now
|
||||
wave(rig, n)
|
||||
end
|
||||
end
|
||||
local k = math.min(1, dt * 4)
|
||||
n.yaw += (wantYaw - n.yaw) * k
|
||||
n.pitch += (wantPitch - n.pitch) * k
|
||||
n.neck.C0 = n.c0 * CFrame.Angles(0, n.yaw, 0) * CFrame.Angles(n.pitch, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- кот
|
||||
|
||||
local cat = {}
|
||||
do
|
||||
local GINGER, WHITE, PINK = Color3.fromRGB(232, 150, 70), Color3.fromRGB(245, 238, 228), Color3.fromRGB(240, 150, 160)
|
||||
cat.body = part({ Size = V(1.3, 1.0, 2.3), Color = GINGER })
|
||||
cat.belly = part({ Size = V(1.0, 0.3, 1.9), Color = WHITE })
|
||||
cat.head = part({ Size = V(1.15, 1.0, 1.0), Color = GINGER })
|
||||
cat.muzzle = part({ Size = V(0.6, 0.35, 0.25), Color = WHITE })
|
||||
cat.nose = part({ Size = V(0.18, 0.12, 0.08), Color = PINK })
|
||||
cat.eyes = {
|
||||
part({ Size = V(0.16, 0.2, 0.05), Color = Color3.fromRGB(40, 40, 30) }),
|
||||
part({ Size = V(0.16, 0.2, 0.05), Color = Color3.fromRGB(40, 40, 30) }),
|
||||
}
|
||||
cat.ears = {
|
||||
part({ Class = "WedgePart", Size = V(0.3, 0.45, 0.35), Color = GINGER }),
|
||||
part({ Class = "WedgePart", Size = V(0.3, 0.45, 0.35), Color = GINGER }),
|
||||
}
|
||||
cat.legs = {}
|
||||
for i = 1, 4 do
|
||||
cat.legs[i] = part({ Size = V(0.32, 0.7, 0.32), Color = (i <= 2) and WHITE or GINGER })
|
||||
end
|
||||
cat.tail = {}
|
||||
for i = 1, 5 do
|
||||
cat.tail[i] = part({ Size = V(0.24, 0.24, 0.42), Color = (i == 5) and WHITE or GINGER })
|
||||
end
|
||||
cat.pos = LOBBY + V(10, 0, 12)
|
||||
cat.dir = V(0, 0, -1)
|
||||
cat.speed = 0
|
||||
cat.lying = 0 -- 0 стоит … 1 лежит
|
||||
cat.walk = 0 -- фаза шага
|
||||
cat.home = LOBBY + V(-9, 0, 13) -- лежанка у фонтана
|
||||
end
|
||||
|
||||
local function catTarget(root)
|
||||
if root and (root.Position - LOBBY).Magnitude < 70 and (root.Position - cat.pos).Magnitude < 40 then
|
||||
-- за игроком: держится чуть сбоку и позади
|
||||
local look = root.CFrame.LookVector
|
||||
local side = root.CFrame.RightVector
|
||||
return V(root.Position.X, LOBBY.Y, root.Position.Z) - look * 3 + side * 2.2, 3.5, true
|
||||
end
|
||||
return cat.home, 0.5, false
|
||||
end
|
||||
|
||||
local function updateCat(dt, t)
|
||||
local root = myRoot()
|
||||
local target, stopDist, following = catTarget(root)
|
||||
local flat = V(target.X - cat.pos.X, 0, target.Z - cat.pos.Z)
|
||||
local dist = flat.Magnitude
|
||||
local want = 0
|
||||
if dist > stopDist then
|
||||
want = math.clamp(dist * 1.2, 4, following and 15 or 6) -- догоняет бегом, домой идёт шагом
|
||||
end
|
||||
cat.speed += (want - cat.speed) * math.min(1, dt * 5)
|
||||
if dist > 0.05 and cat.speed > 0.2 then
|
||||
cat.dir = cat.dir:Lerp(flat.Unit, math.min(1, dt * 6)).Unit
|
||||
local step = math.min(dist, cat.speed * dt)
|
||||
cat.pos += cat.dir * step
|
||||
end
|
||||
-- не заходим в чашу фонтана и на прилавки
|
||||
local r = V(cat.pos.X, 0, cat.pos.Z).Magnitude
|
||||
if r < 14 then
|
||||
cat.pos = LOBBY + V(cat.pos.X, 0, cat.pos.Z).Unit * 14
|
||||
elseif r > 54 then
|
||||
cat.pos = LOBBY + V(cat.pos.X, 0, cat.pos.Z).Unit * 54
|
||||
end
|
||||
local resting = not following and dist <= 0.6 and cat.speed < 0.5
|
||||
cat.lying += ((resting and 1 or 0) - cat.lying) * math.min(1, dt * 2)
|
||||
cat.walk += cat.speed * dt * 2.2
|
||||
|
||||
local L = cat.lying
|
||||
local base = CFrame.lookAt(cat.pos, cat.pos + cat.dir) -- -Z — нос
|
||||
local bob = math.abs(math.sin(cat.walk)) * 0.08 * math.min(1, cat.speed / 4)
|
||||
local bodyY = 1.05 - 0.55 * L + bob
|
||||
local body = base * CFrame.new(0, bodyY, 0)
|
||||
cat.body.CFrame = body
|
||||
cat.belly.CFrame = body * CFrame.new(0, -0.4, 0)
|
||||
local headTurn = L > 0.5 and math.sin(t * 0.4) * 0.3 or 0
|
||||
local head = body * CFrame.new(0, 0.55 - 0.25 * L, -1.35) * CFrame.Angles(0, headTurn, 0)
|
||||
cat.head.CFrame = head
|
||||
cat.muzzle.CFrame = head * CFrame.new(0, -0.18, -0.55)
|
||||
cat.nose.CFrame = head * CFrame.new(0, -0.02, -0.66)
|
||||
cat.eyes[1].CFrame = head * CFrame.new(-0.25, 0.12, -0.51)
|
||||
cat.eyes[2].CFrame = head * CFrame.new(0.25, 0.12, -0.51)
|
||||
cat.ears[1].CFrame = head * CFrame.new(-0.35, 0.68, 0.05) * CFrame.Angles(0, math.pi, 0)
|
||||
cat.ears[2].CFrame = head * CFrame.new(0.35, 0.68, 0.05) * CFrame.Angles(0, math.pi, 0)
|
||||
-- лапы: шагают попеременно, лёжа прячутся под корпус
|
||||
local swing = math.sin(cat.walk) * 0.6 * math.min(1, cat.speed / 3)
|
||||
local legPos = { { -0.42, -0.85 }, { 0.42, -0.85 }, { -0.42, 0.85 }, { 0.42, 0.85 } }
|
||||
for i, lp in ipairs(legPos) do
|
||||
local s = ((i == 1 or i == 4) and swing or -swing)
|
||||
cat.legs[i].CFrame = body * CFrame.new(lp[1], -0.5 - 0.15 * (1 - L) + 0.25 * L, lp[2]) * CFrame.Angles(s, 0, 0)
|
||||
* CFrame.new(0, -0.25 * (1 - L), 0)
|
||||
end
|
||||
-- хвост: цепочка сегментов, кончик покачивается
|
||||
local tcf = body * CFrame.new(0, 0.3, 1.15) * CFrame.Angles(math.rad(35 - 25 * L), 0, 0)
|
||||
for i, seg in ipairs(cat.tail) do
|
||||
local sway = math.sin(t * 2.2 - i * 0.6) * (0.18 + 0.05 * i)
|
||||
tcf = tcf * CFrame.Angles(math.rad(10), sway, 0) * CFrame.new(0, 0, 0.38)
|
||||
seg.CFrame = tcf
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- чайки
|
||||
|
||||
local gulls = {}
|
||||
for i = 1, 4 do
|
||||
local g = {
|
||||
body = part({ Size = V(0.7, 0.6, 1.9), Color = Color3.fromRGB(245, 245, 248) }),
|
||||
head = part({ Size = V(0.5, 0.5, 0.55), Color = Color3.fromRGB(250, 250, 252) }),
|
||||
beak = part({ Size = V(0.15, 0.15, 0.45), Color = Color3.fromRGB(245, 180, 60) }),
|
||||
wings = { part({ Size = V(2.4, 0.1, 0.9), Color = Color3.fromRGB(205, 210, 220) }), part({ Size = V(2.4, 0.1, 0.9), Color = Color3.fromRGB(205, 210, 220) }) },
|
||||
tips = { part({ Size = V(0.8, 0.1, 0.7), Color = Color3.fromRGB(60, 62, 70) }), part({ Size = V(0.8, 0.1, 0.7), Color = Color3.fromRGB(60, 62, 70) }) },
|
||||
r = rng:NextNumber(70, 115), h = rng:NextNumber(52, 78), w = rng:NextNumber(0.1, 0.17) * (i % 2 == 0 and 1 or -1),
|
||||
a = rng:NextNumber(0, math.pi * 2), flap = rng:NextNumber(0, 10),
|
||||
}
|
||||
gulls[i] = g
|
||||
end
|
||||
|
||||
local function updateGulls(dt, t)
|
||||
for _, g in ipairs(gulls) do
|
||||
g.a += g.w * dt
|
||||
local r = g.r + math.sin(t * 0.13 + g.a) * 12
|
||||
local pos = V(math.cos(g.a) * r, g.h + math.sin(t * 0.4 + g.r) * 4, math.sin(g.a) * r)
|
||||
local ahead = V(math.cos(g.a + 0.05 * math.sign(g.w)) * r, pos.Y, math.sin(g.a + 0.05 * math.sign(g.w)) * r)
|
||||
local bank = -math.sign(g.w) * math.rad(18)
|
||||
local cf = CFrame.lookAt(pos, ahead) * CFrame.Angles(0, 0, bank)
|
||||
-- машет крыльями урывками, потом планирует
|
||||
local flapping = math.sin(t * 0.5 + g.flap) > 0.2
|
||||
local wing = flapping and math.sin(t * 9 + g.flap) * math.rad(35) or math.rad(4)
|
||||
g.body.CFrame = cf
|
||||
g.head.CFrame = cf * CFrame.new(0, 0.25, -1.05)
|
||||
g.beak.CFrame = cf * CFrame.new(0, 0.2, -1.5)
|
||||
for s = 1, 2 do
|
||||
local side = (s == 1) and -1 or 1
|
||||
local hinge = cf * CFrame.new(side * 0.35, 0.15, -0.1) * CFrame.Angles(0, 0, side * wing)
|
||||
g.wings[s].CFrame = hinge * CFrame.new(side * 1.2, 0, 0)
|
||||
g.tips[s].CFrame = hinge * CFrame.new(side * 2.4, 0, 0.05) * CFrame.Angles(0, 0, side * wing * 0.5) * CFrame.new(side * 0.35, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- бабочки и светлячки
|
||||
|
||||
local butterflies = {}
|
||||
local fireflyEmitters = {}
|
||||
local function setupFlowersFX()
|
||||
local anchors = {}
|
||||
local foot = map:FindFirstChild("LobbyCliffFoot")
|
||||
local flowers = foot and foot:FindFirstChild("Flowers")
|
||||
if flowers then
|
||||
for _, f in ipairs(flowers:GetChildren()) do
|
||||
table.insert(anchors, f:GetPivot().Position)
|
||||
end
|
||||
end
|
||||
if #anchors == 0 then
|
||||
for i = 1, 12 do
|
||||
local a = i / 12 * math.pi * 2
|
||||
table.insert(anchors, LOBBY + V(math.cos(a) * 70, 0, math.sin(a) * 70))
|
||||
end
|
||||
end
|
||||
local COLORS = { Color3.fromRGB(255, 200, 80), Color3.fromRGB(255, 255, 255), Color3.fromRGB(150, 200, 255), Color3.fromRGB(255, 150, 200), Color3.fromRGB(255, 160, 70) }
|
||||
for i = 1, 16 do
|
||||
local anchor = anchors[rng:NextInteger(1, #anchors)]
|
||||
local c = COLORS[rng:NextInteger(1, #COLORS)]
|
||||
table.insert(butterflies, {
|
||||
anchor = V(anchor.X, LOBBY.Y, anchor.Z), seed = rng:NextNumber(0, 100),
|
||||
body = part({ Size = V(0.08, 0.08, 0.4), Color = Color3.fromRGB(50, 40, 35) }),
|
||||
wings = { part({ Size = V(0.45, 0.04, 0.4), Color = c }), part({ Size = V(0.45, 0.04, 0.4), Color = c }) },
|
||||
})
|
||||
end
|
||||
-- светлячки: у фонарей лобби и у клумб, светятся только ночью
|
||||
local spots = {}
|
||||
for _, d in ipairs(map:GetDescendants()) do
|
||||
if d:IsA("PointLight") and d.Parent:IsA("BasePart") then
|
||||
local p = d.Parent.Position
|
||||
if (V(p.X, 0, p.Z)).Magnitude < 80 and p.Y < 20 then
|
||||
table.insert(spots, p - V(0, 3, 0))
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = 1, math.min(10, #anchors) do
|
||||
table.insert(spots, anchors[rng:NextInteger(1, #anchors)] + V(0, 1.5, 0))
|
||||
end
|
||||
for _, p in ipairs(spots) do
|
||||
local box = part({ Size = V(6, 3, 6), Transparency = 1, CFrame = CFrame.new(p) })
|
||||
local pe = Instance.new("ParticleEmitter")
|
||||
pe.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||||
pe.Color = ColorSequence.new(Color3.fromRGB(220, 255, 120))
|
||||
pe.LightEmission = 1
|
||||
pe.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(0.2, 0.22), NumberSequenceKeypoint.new(0.8, 0.22), NumberSequenceKeypoint.new(1, 0) })
|
||||
pe.Lifetime = NumberRange.new(3, 5)
|
||||
pe.Rate = 1.5
|
||||
pe.Speed = NumberRange.new(0.3, 0.8)
|
||||
pe.SpreadAngle = Vector2.new(180, 180)
|
||||
pe.Acceleration = V(0, 0.15, 0)
|
||||
pe.Shape = Enum.ParticleEmitterShape.Box
|
||||
pe.Enabled = false
|
||||
pe.Parent = box
|
||||
table.insert(fireflyEmitters, pe)
|
||||
end
|
||||
end
|
||||
|
||||
local function updateButterflies(dt, t)
|
||||
for _, b in ipairs(butterflies) do
|
||||
local s = b.seed
|
||||
local off = V(math.sin(t * 0.37 + s) * 2.6 + math.sin(t * 0.9 + s * 2) * 0.8, 1.6 + math.sin(t * 0.7 + s) * 0.9 + 0.5,
|
||||
math.cos(t * 0.31 + s) * 2.6 + math.cos(t * 1.1 + s) * 0.8)
|
||||
local pos = b.anchor + off
|
||||
local vel = V(math.cos(t * 0.37 + s) * 0.37 * 2.6, 0, -math.sin(t * 0.31 + s) * 0.31 * 2.6)
|
||||
local cf = CFrame.lookAt(pos, pos + (vel.Magnitude > 0.01 and vel or V(0, 0, -1)))
|
||||
local flap = math.sin(t * 17 + s) * math.rad(60) + math.rad(15)
|
||||
b.body.CFrame = cf
|
||||
b.wings[1].CFrame = cf * CFrame.Angles(0, 0, flap) * CFrame.new(-0.24, 0, 0)
|
||||
b.wings[2].CFrame = cf * CFrame.Angles(0, 0, -flap) * CFrame.new(0.24, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local nightCheckAt = 0
|
||||
local function updateFireflies(t)
|
||||
if t - nightCheckAt < 1 then
|
||||
return
|
||||
end
|
||||
nightCheckAt = t
|
||||
local night = false
|
||||
if Config.DayNight and Config.DayNight.enabled and Config.Nightness and Config.ClockAt then
|
||||
local clock = Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))
|
||||
night = Config.Nightness(clock) > 0.4
|
||||
end
|
||||
for _, pe in ipairs(fireflyEmitters) do
|
||||
pe.Enabled = night
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- ветер: деревья, трава, цветы, кусты
|
||||
|
||||
local swayers = {}
|
||||
local function addSway(model, amp, freq, range)
|
||||
local parts, rel = {}, {}
|
||||
local cf, size = model:GetBoundingBox()
|
||||
local base = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2, cf.Position.Z)
|
||||
for _, p in ipairs(model:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
table.insert(parts, p)
|
||||
table.insert(rel, base:ToObjectSpace(p.CFrame))
|
||||
end
|
||||
end
|
||||
if #parts > 0 then
|
||||
table.insert(swayers, {
|
||||
parts = parts, rel = rel, base = base, amp = math.rad(amp) * rng:NextNumber(0.8, 1.2),
|
||||
freq = freq * rng:NextNumber(0.85, 1.15), phase = rng:NextNumber(0, math.pi * 2), range = range,
|
||||
height = size.Y,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local leafTrees = {}
|
||||
local function setupSway()
|
||||
local function each(folder, amp, freq, range, leaves)
|
||||
if not folder then
|
||||
return
|
||||
end
|
||||
for _, m in ipairs(folder:GetChildren()) do
|
||||
if m:IsA("Model") then
|
||||
addSway(m, amp, freq, range)
|
||||
if leaves then
|
||||
table.insert(leafTrees, m)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- амплитуда (градусы) и частота (качаний в секунду): деревья — чуть заметно и медленно, трава — живее
|
||||
each(map:FindFirstChild("LobbyTrees"), 0.6, 0.32, 130, true)
|
||||
each(map:FindFirstChild("LobbyForest"), 0.6, 0.32, 130, true)
|
||||
local foot = map:FindFirstChild("LobbyCliffFoot")
|
||||
if foot then
|
||||
each(foot:FindFirstChild("Grass"), 2.8, 0.8, 50)
|
||||
each(foot:FindFirstChild("Flowers"), 3.2, 0.85, 50)
|
||||
each(foot:FindFirstChild("Bushes"), 1, 0.5, 60)
|
||||
end
|
||||
-- падающие листья: у ближайших к площади деревьев, из объёма кроны
|
||||
table.sort(leafTrees, function(a, b)
|
||||
return V(a:GetPivot().Position.X, 0, a:GetPivot().Position.Z).Magnitude < V(b:GetPivot().Position.X, 0, b:GetPivot().Position.Z).Magnitude
|
||||
end)
|
||||
for i = 1, math.min(24, #leafTrees) do
|
||||
local cf, size = leafTrees[i]:GetBoundingBox()
|
||||
local crown = part({ Size = V(size.X * 0.8, size.Y * 0.35, size.Z * 0.8), Transparency = 1, CFrame = cf * CFrame.new(0, size.Y * 0.2, 0) })
|
||||
local pe = Instance.new("ParticleEmitter")
|
||||
pe.Texture = LEAF_TEXTURE
|
||||
pe.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255), Color3.fromRGB(255, 235, 170))
|
||||
pe.Size = NumberSequence.new(0.45)
|
||||
pe.Lifetime = NumberRange.new(6, 9)
|
||||
pe.Rate = 0.15
|
||||
pe.Speed = NumberRange.new(0.2, 0.6)
|
||||
pe.Acceleration = V(0.6, -1.1, 0.2)
|
||||
pe.Drag = 0.6
|
||||
pe.Rotation = NumberRange.new(0, 360)
|
||||
pe.RotSpeed = NumberRange.new(-140, 140)
|
||||
pe.Orientation = Enum.ParticleOrientation.VelocityPerpendicular
|
||||
pe.Shape = Enum.ParticleEmitterShape.Box
|
||||
pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.08, 0), NumberSequenceKeypoint.new(0.85, 0), NumberSequenceKeypoint.new(1, 1) })
|
||||
pe.LightInfluence = 1
|
||||
pe.Parent = crown
|
||||
end
|
||||
end
|
||||
|
||||
local swayAcc = 0
|
||||
local bulkParts, bulkCFrames = {}, {}
|
||||
local function updateSway(dt, t)
|
||||
swayAcc += dt
|
||||
if swayAcc < 1 / 30 then
|
||||
return
|
||||
end
|
||||
swayAcc = 0
|
||||
local cam = camPos()
|
||||
-- порывы: ветер то стихает, то усиливается
|
||||
local gust = 0.75 + 0.2 * math.sin(t * 0.23) + 0.08 * math.sin(t * 0.71)
|
||||
table.clear(bulkParts)
|
||||
table.clear(bulkCFrames)
|
||||
for _, s in ipairs(swayers) do
|
||||
if (s.base.Position - cam).Magnitude < s.range then
|
||||
local a = s.amp * gust
|
||||
local ax = a * math.sin(t * s.freq * math.pi * 2 + s.phase)
|
||||
local az = a * 0.6 * math.sin(t * s.freq * math.pi * 1.3 + s.phase * 1.7) + a * 0.2 -- лёгкий наклон по ветру
|
||||
local pose = s.base * CFrame.Angles(ax, 0, az)
|
||||
for i, p in ipairs(s.parts) do
|
||||
table.insert(bulkParts, p)
|
||||
table.insert(bulkCFrames, pose * s.rel[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
if #bulkParts > 0 then
|
||||
workspace:BulkMoveTo(bulkParts, bulkCFrames, Enum.BulkMoveMode.FireCFrameChanged)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- запуск
|
||||
|
||||
task.wait(3) -- карта и NPC успевают появиться
|
||||
scanNpcs()
|
||||
setupFlowersFX()
|
||||
setupSway()
|
||||
local scanAt = os.clock()
|
||||
local t0 = os.clock()
|
||||
RunService.RenderStepped:Connect(function(dt)
|
||||
local t = os.clock() - t0
|
||||
if os.clock() - scanAt > 5 then
|
||||
scanAt = os.clock()
|
||||
scanNpcs()
|
||||
end
|
||||
updateNpcs(dt)
|
||||
if (camPos() - LOBBY).Magnitude > LOBBY_VIEW then
|
||||
return -- игрок в другом мире: лобби не анимируем
|
||||
end
|
||||
updateCat(dt, t)
|
||||
updateGulls(dt, t)
|
||||
updateButterflies(dt, t)
|
||||
updateFireflies(t)
|
||||
updateSway(dt, t)
|
||||
end)
|
||||
@@ -0,0 +1,45 @@
|
||||
-- NpcTalk (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||||
-- Реплики NPC в пузыре над головой, когда игрок подходит (только у этого игрока).
|
||||
-- Реплики задаёт NpcLooks (атрибут рига NpcLines: строки через «|»). Взгляд, idle и взмах рукой — LobbyLife.
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local TextChatService = game:GetService("TextChatService")
|
||||
|
||||
local player = Players.LocalPlayer
|
||||
local NEAR, COOLDOWN = 12, 30 -- studs; секунд между репликами одного NPC
|
||||
|
||||
local lastAt, lastLine = {}, {}
|
||||
|
||||
local function say(head, text)
|
||||
local ok = pcall(function()
|
||||
TextChatService:DisplayBubble(head, text)
|
||||
end)
|
||||
if not ok then
|
||||
pcall(function()
|
||||
game:GetService("Chat"):Chat(head, text)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
while true do
|
||||
task.wait(0.5)
|
||||
local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||
local map = workspace:FindFirstChild("FishingMap")
|
||||
if root and map then
|
||||
local now = os.clock()
|
||||
for _, rig in ipairs(map:GetChildren()) do
|
||||
local lines = rig:IsA("Model") and rig:GetAttribute("NpcLines")
|
||||
local head = lines and rig:FindFirstChild("Head")
|
||||
if head and (head.Position - root.Position).Magnitude < NEAR and now - (lastAt[rig] or -math.huge) > COOLDOWN then
|
||||
lastAt[rig] = now
|
||||
local list = string.split(lines, "|")
|
||||
local i = math.random(1, #list)
|
||||
if #list > 1 and i == lastLine[rig] then
|
||||
i = i % #list + 1
|
||||
end
|
||||
lastLine[rig] = i
|
||||
say(head, list[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user