Дома на Острове 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

@@ -19,6 +19,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")
@@ -115,6 +116,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
@@ -396,6 +398,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")
@@ -436,6 +439,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
@@ -1601,6 +1606,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
@@ -1623,6 +1630,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
@@ -1673,6 +1684,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
@@ -1754,6 +1769,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
@@ -1976,6 +1999,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) })
File diff suppressed because it is too large. Load diff