Remove /treset if debug setting is not used

This commit is contained in:
Wuzzy 2019-03-14 11:17:34 +01:00
parent f62d3b8521
commit 56265bc513

View File

@ -2,7 +2,10 @@
-- == DEBUG SETTINGS ==
-- If true, the generated tutorial map is in "map editing" mode, only generating
-- the raw castle, no grass layer or other random decorations will be generated
-- the raw castle, no grass layer or other random decorations will be generated.
-- Also, 2 commands to manage the schematic will be available:
-- /treset and /tsave commands will be available.
-- (/tsave only if tutorial is trusted mod)
local map_editing = minetest.settings:get_bool("tutorial_debug_map_editing")
-- == END OF DEBUG SETTINGS ==
@ -273,8 +276,9 @@ end
------ Commands
minetest.register_privilege("tutorialmap", "Can use commands to manage the tutorial map")
minetest.register_chatcommand("treset", {
if map_editing then
minetest.register_privilege("tutorialmap", "Can use commands to manage the tutorial map")
minetest.register_chatcommand("treset", {
params = "",
description = "Resets the tutorial map",
privs = {tutorialmap=true},
@ -287,10 +291,10 @@ minetest.register_chatcommand("treset", {
-- TODO: re-load entities?
end,
})
})
-- Add commands for saving map and entities, but only if tutorial mod is trusted
if insecure_environment then
-- Add commands for saving map and entities, but only if tutorial mod is trusted
if insecure_environment then
minetest.register_chatcommand("tsave", {
params = "",
description = "Saves the tutorial map",
@ -303,6 +307,7 @@ if insecure_environment then
end
end,
})
end
end
------ Map Generation