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 == -- == DEBUG SETTINGS ==
-- If true, the generated tutorial map is in "map editing" mode, only generating -- 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") local map_editing = minetest.settings:get_bool("tutorial_debug_map_editing")
-- == END OF DEBUG SETTINGS == -- == END OF DEBUG SETTINGS ==
@ -273,8 +276,9 @@ end
------ Commands ------ Commands
minetest.register_privilege("tutorialmap", "Can use commands to manage the tutorial map") if map_editing then
minetest.register_chatcommand("treset", { minetest.register_privilege("tutorialmap", "Can use commands to manage the tutorial map")
minetest.register_chatcommand("treset", {
params = "", params = "",
description = "Resets the tutorial map", description = "Resets the tutorial map",
privs = {tutorialmap=true}, privs = {tutorialmap=true},
@ -287,10 +291,10 @@ minetest.register_chatcommand("treset", {
-- TODO: re-load entities? -- TODO: re-load entities?
end, end,
}) })
-- Add commands for saving map and entities, but only if tutorial mod is trusted -- Add commands for saving map and entities, but only if tutorial mod is trusted
if insecure_environment then if insecure_environment then
minetest.register_chatcommand("tsave", { minetest.register_chatcommand("tsave", {
params = "", params = "",
description = "Saves the tutorial map", description = "Saves the tutorial map",
@ -303,6 +307,7 @@ if insecure_environment then
end end
end, end,
}) })
end
end end
------ Map Generation ------ Map Generation