Files
Fishing/tools/widen-lobby-undo.lua
T
2026-11-06 12:34:01 +05:00

43 lines
1.3 KiB
Lua

-- Откат tools/widen-lobby.lua: всё, что сдвинуто, возвращается на прежние места и размеры,
-- украшения торгового ряда удаляются. Запуск в Studio в режиме редактирования, потом Ctrl+S.
local TAG = "LobbyWide"
local map = workspace.FishingMap
local n = 0
local function restore(o)
local cf = o:GetAttribute(TAG .. "Orig")
if typeof(cf) ~= "CFrame" then
return
end
if o:IsA("Model") then
local s = o:GetAttribute(TAG .. "Scale")
if s then
o:ScaleTo(s)
end
o:PivotTo(cf)
elseif o:IsA("BasePart") then
local size = o:GetAttribute(TAG .. "Size")
if size then
o.Size = size
end
o.CFrame = cf
end
for _, a in ipairs({ "Orig", "Scale", "Size" }) do
o:SetAttribute(TAG .. a, nil)
end
n += 1
end
for _, root in ipairs({ map, workspace }) do
for _, o in ipairs(root == map and map:GetDescendants() or workspace:GetChildren()) do
if (o:IsA("Model") or o:IsA("BasePart")) and o:GetAttribute(TAG .. "Orig") ~= nil then
restore(o)
end
end
end
local decor = map:FindFirstChild("LobbyMarketDecor")
if decor then
decor:Destroy()
end
map:SetAttribute(TAG, nil)
map:SetAttribute(TAG .. "Market", nil)
return "возвращено объектов: " .. n