Restrict to Debug Only and Server Admin

This commit is contained in:
2026-02-15 23:50:43 -05:00
parent cacf4eb701
commit b93cee7afb
3 changed files with 71 additions and 0 deletions

View File

@@ -6,6 +6,24 @@ local BLOCK_RADIUS = 6 -- radius processed each tick
local TOTAL_RADIUS = 60 -- final total radius
local BLOCK_STEP = (BLOCK_RADIUS * 2) + 1 -- 13 when BLOCK_RADIUS=6
local function isDebugModeEnabled()
if type(isDebugEnabled) == "function" then
return isDebugEnabled() == true
end
return false
end
local function isAdminPlayer(player)
if not isClient() then
return true
end
if not player or not player.getAccessLevel then
return false
end
local accessLevel = tostring(player:getAccessLevel() or ""):lower()
return accessLevel == "admin"
end
local function makeBlocksList(totalRadius, step)
local blocks = {}
local start = -totalRadius
@@ -79,6 +97,7 @@ end
local function startProgressiveRemoval(player)
if not player then return end
if not isAdminPlayer(player) then return end
local px = math.floor(player:getX())
local py = math.floor(player:getY())
local pz = math.floor(player:getZ() or 0)
@@ -128,6 +147,8 @@ local function onFillWorldObjectContextMenu(playerOrNum, context, worldObjects,
local player
if type(playerOrNum) == "number" then player = getSpecificPlayer(playerOrNum) else player = playerOrNum end
if not player then return end
if not isDebugModeEnabled() then return end
if not isAdminPlayer(player) then return end
context:addOption("Progressively remove 'street' tiles (radius "..tostring(TOTAL_RADIUS)..")", worldObjects, function()
startProgressiveRemoval(player)