mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-01-09 17:40:32 +01:00
Fix buggy placeschem command
This commit is contained in:
parent
12ec91fc16
commit
0993c6e7c6
15
init.lua
15
init.lua
@ -928,14 +928,23 @@ minetest.register_chatcommand("placeschem", {
|
|||||||
params = "<schematic name>.mts [<x> <y> <z>]",
|
params = "<schematic name>.mts [<x> <y> <z>]",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local schem, p = string.match(param, "^([^ ]+) *(.*)$")
|
local schem, p = string.match(param, "^([^ ]+) *(.*)$")
|
||||||
local pos = minetest.string_to_pos(p)
|
local pos = minetest.string_to_pos(p)
|
||||||
|
|
||||||
|
if not schem then
|
||||||
|
return false, "No schematic file specified."
|
||||||
|
end
|
||||||
|
|
||||||
if not pos then
|
if not pos then
|
||||||
pos = minetest.get_player_by_name(name):get_pos()
|
pos = minetest.get_player_by_name(name):get_pos()
|
||||||
end
|
end
|
||||||
|
|
||||||
return true, "Success: "..dump(minetest.place_schematic(pos,
|
local success = minetest.place_schematic(pos, minetest.get_worldpath().."/schems/"..schem..".mts", "random", nil, false)
|
||||||
minetest.get_worldpath().."/schems/"..schem..".mts", "random", nil, false))
|
|
||||||
|
if success == nil then
|
||||||
|
return false, "Schematic file could not be loaded!"
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user