forked from mtcontrib/Minetest-WorldEdit
Add //fixedpos command and document it.
This commit is contained in:
parent
faa4a7b065
commit
7e1be63344
@ -56,6 +56,14 @@ Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching
|
||||
//p set2
|
||||
//p get
|
||||
|
||||
### //fixedpos set1 x y z
|
||||
|
||||
Set a WorldEdit region position to the position at (<x>, <y>, <z>).
|
||||
|
||||
//fixedpos set1 0, 0, 0
|
||||
//fixedpos set1 -30, 5, 28
|
||||
//fixedpos set2 1004, -200, 432
|
||||
|
||||
### //volume
|
||||
|
||||
Display the volume of the current WorldEdit region.
|
||||
|
@ -173,6 +173,29 @@ minetest.register_chatcommand("/p", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("/fixedpos", {
|
||||
params = "set1/set2 x y z",
|
||||
description = "Set a WorldEdit region position to the position at (<x>, <y>, <z>)",
|
||||
privs = {worldedit=true},
|
||||
func = function(name, param)
|
||||
local found, _, flag, x, y, z = param:find("^(set[12])%s+([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)$")
|
||||
if found == nil then
|
||||
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||
return
|
||||
end
|
||||
local pos = {x=x, y=y, z=z}
|
||||
if flag == "set1" then
|
||||
worldedit.pos1[name] = pos
|
||||
worldedit.mark_pos1(name)
|
||||
worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos))
|
||||
else --flag == "set2"
|
||||
worldedit.pos2[name] = pos
|
||||
worldedit.mark_pos2(name)
|
||||
worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
local name = puncher:get_player_name()
|
||||
if name ~= "" and worldedit.set_pos[name] ~= nil then --currently setting position
|
||||
|
Loading…
Reference in New Issue
Block a user