mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-11-20 16:05:24 +01:00
Override /pulverize and /clearinv to require interact (#3217)
This commit is contained in:
28
mods/default/chat.lua
Normal file
28
mods/default/chat.lua
Normal 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
|
||||||
@@ -75,6 +75,7 @@ dofile(default_path.."/item_entity.lua")
|
|||||||
dofile(default_path.."/craftitems.lua")
|
dofile(default_path.."/craftitems.lua")
|
||||||
dofile(default_path.."/crafting.lua")
|
dofile(default_path.."/crafting.lua")
|
||||||
dofile(default_path.."/mapgen.lua")
|
dofile(default_path.."/mapgen.lua")
|
||||||
|
dofile(default_path.."/chat.lua")
|
||||||
dofile(default_path.."/aliases.lua")
|
dofile(default_path.."/aliases.lua")
|
||||||
dofile(default_path.."/legacy.lua")
|
dofile(default_path.."/legacy.lua")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user