экономика

This commit is contained in:
listik committed 2026-11-11 16:31:57 +03:00
1 parent 0e90e8d28e
commit 8f721a99db
3 files changed
+32 -8

No files matched your search

@@ -83,6 +83,16 @@ pcall(function()
store = DataStoreService:GetDataStore("FishingGame_v2")
marketStore = DataStoreService:GetDataStore("FishMarket_v1")
end)
-- неопубликованный плейс / Studio без доступа к API: GetDataStore проходит, но любой запрос падает.
-- Тогда сразу играем без сохранения (иначе вход ждал бы повторов загрузки и интерфейс стоял пустым)
if store and RunService:IsStudio() then
local ok = pcall(function()
store:GetAsync("probe")
end)
if not ok then
store, marketStore = nil, nil
end
end
-- замок сессии: профиль открыт только на одном сервере (без этого возможен дюп между серверами и на рынке)
local playerStore = store and PlayerStore.new(store, { staleAfter = 600 }) or nil
+6 -4
View File
@@ -53,12 +53,14 @@ function PlayerStore:load(key)
return "ok", value
end
lastErr = err
if attempt < self.loadTries then
self.wait(locked and 5 or 2)
-- ошибка хранилища: не больше 3 попыток (игрок не ждёт долго); чужой замок — ждём дольше
if not locked and attempt >= math.min(3, self.loadTries) then
return "error", lastErr
end
if attempt == self.loadTries and locked then
return "locked", nil
if attempt == self.loadTries then
return locked and "locked" or "error", lastErr
end
self.wait(locked and 5 or 1)
end
return "error", lastErr
end