mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-03-23 20:50:40 +01:00
parent
60b6b205ad
commit
8065e3d804
@ -428,11 +428,12 @@ Save the current WorldEdit region using the Minetest Schematic format to "(world
|
|||||||
//mtschemcreate some random filename
|
//mtschemcreate some random filename
|
||||||
//mtschemcreate huge_base
|
//mtschemcreate huge_base
|
||||||
|
|
||||||
### `//mtschemplace <file>`
|
### `//mtschemplace <file> [rotation]`
|
||||||
|
|
||||||
Load nodes from "(world folder)/schems/`<file>`.mts" with position 1 of the current WorldEdit region as the origin.
|
Load nodes from "(world folder)/schems/`<file>`.mts" with position 1 of the current WorldEdit region as the origin.
|
||||||
|
Valid values for `[rotation]` are 0, 90, 180 and 270.
|
||||||
|
|
||||||
//mtschemplace some random filename
|
//mtschemplace a_tree 270
|
||||||
//mtschemplace huge_base
|
//mtschemplace huge_base
|
||||||
|
|
||||||
### `//mtschemprob start/finish/get`
|
### `//mtschemprob start/finish/get`
|
||||||
|
@ -209,23 +209,26 @@ worldedit.register_command("mtschemplace", {
|
|||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(param)
|
parse = function(param)
|
||||||
if param == "" then
|
local found, _, filename, rotation = param:find("^(.+)%s+([012789]+)$")
|
||||||
return false
|
if found == nil then
|
||||||
|
filename = param
|
||||||
|
elseif rotation ~= "0" and rotation ~= "90" and rotation ~= "180" and rotation ~= "270" then
|
||||||
|
return false, S("Invalid rotation: @1", rotation)
|
||||||
end
|
end
|
||||||
if not check_filename(param) then
|
if not check_filename(filename) then
|
||||||
return false, S("Disallowed file name: @1", param)
|
return false, S("Disallowed file name: @1", filename)
|
||||||
end
|
end
|
||||||
return true, param
|
return true, filename, rotation
|
||||||
end,
|
end,
|
||||||
func = function(name, param)
|
func = function(name, filename, rotation)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
|
|
||||||
local path = minetest.get_worldpath() .. "/schems/" .. param .. ".mts"
|
local path = minetest.get_worldpath() .. "/schems/" .. filename .. ".mts"
|
||||||
if minetest.place_schematic(pos, path) == nil then
|
if minetest.place_schematic(pos, path, rotation) == nil then
|
||||||
return false, S("failed to place Minetest schematic")
|
return false, S("failed to place Minetest schematic")
|
||||||
end
|
end
|
||||||
return true, S("placed Minetest schematic @1 at @2",
|
return true, S("placed Minetest schematic @1 at @2",
|
||||||
param, minetest.pos_to_string(pos))
|
filename, minetest.pos_to_string(pos))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user