1
0
mirror of https://github.com/luanti-org/minetest_game.git synced 2025-11-19 07:35:18 +01:00

Override /pulverize and /clearinv to require interact (#3217)

This commit is contained in:
sfan5
2025-11-17 23:25:40 +01:00
committed by GitHub
parent 052ccb0928
commit e4fe9c3c61
2 changed files with 29 additions and 0 deletions

28
mods/default/chat.lua Normal file
View File

@@ -0,0 +1,28 @@
-- mods/default/chat.lua
local function match_old(privs)
local ok = false
for k, v in pairs(privs) do
if k == "give" and v then
ok = true
elseif v then
return false
end
end
return ok
end
-- Change /pulverize and /clearinv to not require give, like it used to be
-- before Luanti 5.15
for _, cmd in ipairs({"pulverize", "clearinv"}) do
local def = core.registered_chatcommands[cmd]
if def then
if match_old(def.privs) then
core.override_chatcommand(cmd, {
privs = {interact=true},
})
else
minetest.log("info", "Privileges of command /" .. cmd .. " look modified, not overriding them.")
end
end
end

View File

@@ -75,6 +75,7 @@ dofile(default_path.."/item_entity.lua")
dofile(default_path.."/craftitems.lua")
dofile(default_path.."/crafting.lua")
dofile(default_path.."/mapgen.lua")
dofile(default_path.."/chat.lua")
dofile(default_path.."/aliases.lua")
dofile(default_path.."/legacy.lua")