Better documentation of /spawnstruct

Also require debug priv
This commit is contained in:
Wuzzy 2017-02-18 02:22:24 +01:00
parent 80f7008800
commit 35f1e4b1d2

View file

@ -227,7 +227,7 @@ random_struct.call_struct= function(pos, struct_style)
if struct_style == 1 then if struct_style == 1 then
random_struct.generatecity(pos) random_struct.generatecity(pos)
elseif struct_style == 2 then elseif struct_style == 2 then
random_struct.generate_temple_sand(pos) random_struct.generate_sand_temple(pos)
end end
end end
@ -241,7 +241,7 @@ random_struct.generatecity = function(pos)
random_struct.deserialise_WE(newpos, city ) random_struct.deserialise_WE(newpos, city )
end end
random_struct.generate_temple_sand = function(pos) random_struct.generate_sand_temple = function(pos)
-- No Generating for the temple ... Why using it ? No Change -- No Generating for the temple ... Why using it ? No Change
local temple = random_struct.get_struct("desert_temple.we") local temple = random_struct.get_struct("desert_temple.we")
local newpos = {x=pos.x,y=pos.y-12,z=pos.z} local newpos = {x=pos.x,y=pos.y-12,z=pos.z}
@ -254,24 +254,25 @@ end
-- Debug command -- Debug command
minetest.register_chatcommand("spawnstruct", { minetest.register_chatcommand("spawnstruct", {
params = "", params = "town | sand_temple",
description = "Spawn a Struct.", description = "Generate a pre-defined structure near your position.",
privs = {debug = true},
func = function(name, param) func = function(name, param)
local pos= minetest.get_player_by_name(name):getpos() local pos= minetest.get_player_by_name(name):getpos()
if not pos then if not pos then
return return
end end
if param == "" or param == "help" then if param == "" or param == "help" then
minetest.chat_send_player(name, "Please use instruction /spawnstruct TYPE") minetest.chat_send_player(name, "Please use “/spawnstruct <type>”.")
minetest.chat_send_player(name, "TYPE avaiable : town, temple_sand") minetest.chat_send_player(name, "Avaiable types: town, sand_temple")
end end
if param == "town" then if param == "town" then
random_struct.generatecity(pos) random_struct.generatecity(pos)
minetest.chat_send_player(name, "Town Created") minetest.chat_send_player(name, "Town created.")
end end
if param == "temple_sand" then if param == "sand_temple" then
random_struct.generate_temple_sand(pos) random_struct.generate_sand_temple(pos)
minetest.chat_send_player(name, "Temple Sand Created") minetest.chat_send_player(name, "Sand temple created")
end end
end end
}) })