mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 20:41:11 +01:00
Commandblock: Fix help btn not working if no priv
This commit is contained in:
parent
3bcb868f8b
commit
1ea2b09ecb
1 changed files with 6 additions and 5 deletions
|
@ -266,19 +266,20 @@ minetest.register_node("mesecons_commandblock:commandblock_on", {
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if string.sub(formname, 1, 13) == "commandblock_" then
|
if string.sub(formname, 1, 13) == "commandblock_" then
|
||||||
if (not fields.submit and not fields.key_enter and not fields.doc) or (not fields.commands) then
|
if fields.doc and minetest.get_modpath("doc") then
|
||||||
|
doc.show_entry(player:get_player_name(), "nodes", "mesecons_commandblock:commandblock_off", true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if (not fields.submit and not fields.key_enter) or (not fields.commands) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local privs = minetest.get_player_privs(player:get_player_name())
|
local privs = minetest.get_player_privs(player:get_player_name())
|
||||||
if not privs.maphack then
|
if not privs.maphack then
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Access denied. You need the “maphack” privilege to edit command blocks."))
|
minetest.chat_send_player(player:get_player_name(), S("Access denied. You need the “maphack” privilege to edit command blocks."))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.doc and minetest.get_modpath("doc") then
|
|
||||||
doc.show_entry(player:get_player_name(), "nodes", "mesecons_commandblock:commandblock_off", true)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local index, _, x, y, z = string.find(formname, "commandblock_(-?%d+)_(-?%d+)_(-?%d+)")
|
local index, _, x, y, z = string.find(formname, "commandblock_(-?%d+)_(-?%d+)_(-?%d+)")
|
||||||
if index ~= nil and x ~= nil and y ~= nil and z ~= nil then
|
if index ~= nil and x ~= nil and y ~= nil and z ~= nil then
|
||||||
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||||
|
|
Loading…
Reference in a new issue