Дома на Острове 2: код из Studio перенесён в src и соединён с GameServer/FishingClient

This commit is contained in:
heyshawtyy committed 2026-11-13 14:32:46 +05:00
1 parent a9bc4207cb
commit 0fe8bd35a0
8 files changed
+2032 -4

No files matched your search

+37 -2
View File
@@ -7713577,7 +7713577,7 @@ local function teleportLoading(targetId, delay)
loadingGui:SetAttribute("Ready", false)
loadingGui:SetAttribute("StartAt", now)
loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport)
loadingGui:SetAttribute("Title", placeTitle(target))
loadingGui:SetAttribute("Title", targetId == "Home" and "🏠 Мой дом" or placeTitle(target))
loadingGui:SetAttribute("Visible", true)
end
task.spawn(function()
@@ -7713587,7 +7713587,18 @@ local function teleportLoading(targetId, delay)
repeat
task.wait()
w = currentWorld()
until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken
local arrived
if targetId == "Home" then
-- остров «Мой дом» не мир из Config: ждём, пока персонаж окажется рядом с его спавном
local island = workspace:FindFirstChild("Island2")
local spawnPart = island and island:FindFirstChild("HomeSpawn")
local char = Players.LocalPlayer.Character
local hrp = char and char:FindFirstChild("HumanoidRootPart")
arrived = spawnPart ~= nil and hrp ~= nil and (hrp.Position - spawnPart.Position).Magnitude < 300
else
arrived = (w and w.id or "Lobby") == targetId
end
until arrived or os.clock() > deadline or token ~= teleportToken
if token ~= teleportToken then
return
end
@@ -7730092,6 +7730103,7 @@ local Potions = require(script.Parent:WaitForChild("Potions"))
local Market = require(script.Parent:WaitForChild("Market"))
local Telemetry = require(script.Parent:WaitForChild("Telemetry"))
local PlayerStore = require(script.Parent:WaitForChild("PlayerStore"))
local Houses = require(script.Parent:WaitForChild("Houses")) -- дома игроков на острове «Мой дом»
local E = Config.Economy
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
@@ -7730188,6 +7730200,7 @@ local function defaultData()
settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx },
-- гильдия: жемчуг, печати, отдых (ранг, заказы, наживку, ловушки дополняет Guild.defaults)
pearls = 0, seals = 0, rest = 0,
houseLevel = 0, -- уровень дома на острове «Мой дом» (0 — пустой участок)
}
end
@@ -7730469,6 +7730482,7 @@ local function updateStats(player)
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
player:SetAttribute("Mastery", masteryCount(data))
player:SetAttribute("Passes", table.concat(ps, ","))
player:SetAttribute("HouseLevel", data.houseLevel or 0)
Guild.attrs(player, data)
local ls = player:FindFirstChild("leaderstats")
@@ -7730509,6 +7730523,8 @@ Guild.init({
addCoins = addCoins, spendCoins = spendCoins, tierOf = tierOf,
})
Houses.init({ profiles = profiles, notify = notify, updateStats = updateStats, spendCoins = spendCoins, addCoins = addCoins, remote = remote })
-- зелье-награда: в сумку зелий (пить — когда игрок сам решит)
local function givePotion(player, data, def)
if def and Potions.add(data, def.id, 1) then
@@ -7731674,6 +7731690,8 @@ local function teleportTo(player, worldId)
local markerName
if worldId == "Lobby" then
markerName = "LobbySpawn"
elseif worldId == "Home" then
markerName = "HomeSpawn" -- остров «Мой дом» (Workspace.Island2)
else
local world = Config.Find(Config.Worlds, worldId)
if not world then
@@ -7731696,6 +7731714,10 @@ local function teleportTo(player, worldId)
end
local map = workspace:FindFirstChild("FishingMap")
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
if not m and worldId == "Home" then
local island = workspace:FindFirstChild("Island2")
m = island and island:FindFirstChild(markerName, true)
end
if m and not teleporting[player] then
-- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно
teleporting[player] = true
@@ -7731746,6 +7731768,10 @@ ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
sellItems(player, nil)
elseif action == "Portal" then
teleportTo(player, prompt:GetAttribute("World"))
elseif action == "House" then
Houses.onPrompt(player, prompt)
elseif action == "HouseComputer" then
Houses.onComputer(player, prompt)
elseif action == "Talk" then
talk(player)
elseif action == "Daily" then
@@ -7731827,6 +7731853,14 @@ local function onRemote(player, action, a, b)
potionCooldown[player] = t + 0.4
drinkPotion(player, a, b)
end
elseif action == "HouseUpgrade" then
Houses.upgrade(player)
elseif action == "HouseSpin" then
Houses.spin(player, a, b)
elseif action == "HouseEquip" then
Houses.equip(player, a, b)
elseif action == "HouseReveal" then
Houses.reveal(player)
elseif Market.onAction(player, action, a, b) then
return
else
@@ -7732049,6 +7732083,7 @@ local function onPlayerAdded(player)
loadPasses(player, data)
ensureChain(data)
Guild.defaults(data)
Houses.defaults(data)
-- экономика v2: перенос старого сохранения (уровень, доля опыта, зелье, id рыбы); повторно не выполняется
if Progression.migrate(data, { now = os.time(), userId = player.UserId, name = player.DisplayName }) then
Telemetry.event(player, "EconomyMigrated", 1, { tostring(data.migration and data.migration.from), tostring(data.level) })