mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-01-09 09:30:32 +01:00
Add -c switch to /placeschem to clean area first
This commit is contained in:
parent
a56b2d431f
commit
98b3ae87ea
25
init.lua
25
init.lua
@ -1299,11 +1299,16 @@ end
|
|||||||
|
|
||||||
-- [chatcommand] Place schematic
|
-- [chatcommand] Place schematic
|
||||||
minetest.register_chatcommand("placeschem", {
|
minetest.register_chatcommand("placeschem", {
|
||||||
description = S("Place schematic at the position specified or the current player position (loaded from @1)", export_path_trunc),
|
description = S("Place schematic at the position specified or the current player position (loaded from @1). “-c” will clear the area first", export_path_trunc),
|
||||||
privs = {server = true},
|
privs = {server = true},
|
||||||
params = S("<schematic name>[.mts] [<x> <y> <z>]"),
|
params = S("<schematic name>[.mts] [-c] [<x> <y> <z>]"),
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local schem, p = string.match(param, "^([^ ]+) *(.*)$")
|
local schem, clear, p = string.match(param, "^([^ ]+) (%-c) *(.*)$")
|
||||||
|
if not schem then
|
||||||
|
schem, p = string.match(param, "^([^ ]+) *(.*)$")
|
||||||
|
end
|
||||||
|
clear = clear == "-c"
|
||||||
|
|
||||||
local pos = minetest.string_to_pos(p)
|
local pos = minetest.string_to_pos(p)
|
||||||
|
|
||||||
if not schem then
|
if not schem then
|
||||||
@ -1323,10 +1328,22 @@ minetest.register_chatcommand("placeschem", {
|
|||||||
-- files when we reload. minetest.read_schematic circumvents that.
|
-- files when we reload. minetest.read_schematic circumvents that.
|
||||||
local schematic = minetest.read_schematic(schem_path, {})
|
local schematic = minetest.read_schematic(schem_path, {})
|
||||||
if schematic then
|
if schematic then
|
||||||
|
if clear then
|
||||||
|
local posses = {}
|
||||||
|
for z=pos.z, pos.z+schematic.size.z-1 do
|
||||||
|
for y=pos.y, pos.y+schematic.size.y-1 do
|
||||||
|
for x=pos.x, pos.x+schematic.size.x-1 do
|
||||||
|
table.insert(posses, {x=x,y=y,z=z})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.bulk_set_node(posses, {name="air"})
|
||||||
|
end
|
||||||
success = minetest.place_schematic(pos, schematic, "random", nil, false)
|
success = minetest.place_schematic(pos, schematic, "random", nil, false)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Legacy support for Minetest versions that do not have minetest.read_schematic
|
-- Legacy support for Minetest versions that do not have minetest.read_schematic.
|
||||||
|
-- Note: "-c" is ignored here.
|
||||||
success = minetest.place_schematic(schem_path, schematic, "random", nil, false)
|
success = minetest.place_schematic(schem_path, schematic, "random", nil, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ The node HUD is not updated automatically and may be outdated. The node HUD only
|
|||||||
Schematic Void=Schematic-Lücke
|
Schematic Void=Schematic-Lücke
|
||||||
This is an utility block used in the creation of schematic files. It should be used together with a schematic creator. When saving a schematic, all nodes with a schematic void will be left unchanged when the schematic is placed again. Technically, this is equivalent to a block with the node probability set to 0.=Dies ist ein Hilfsblock, der bei der Erstellung von Schematic-Dateien benutzt wird. Er sollte zusammen mit einem Schematic-Macher benutzt werden. Wenn ein Schematic gespeichert wird, werden alle Nodes mit einer Schematic-Lücke unverändert gelassen, wenn das Schematic erneut platziert wird. Technisch gesehen ist dieses Verhalten identisch mit einem Block, der eine Node-Wahrscheinlichkeit von 0 hat.
|
This is an utility block used in the creation of schematic files. It should be used together with a schematic creator. When saving a schematic, all nodes with a schematic void will be left unchanged when the schematic is placed again. Technically, this is equivalent to a block with the node probability set to 0.=Dies ist ein Hilfsblock, der bei der Erstellung von Schematic-Dateien benutzt wird. Er sollte zusammen mit einem Schematic-Macher benutzt werden. Wenn ein Schematic gespeichert wird, werden alle Nodes mit einer Schematic-Lücke unverändert gelassen, wenn das Schematic erneut platziert wird. Technisch gesehen ist dieses Verhalten identisch mit einem Block, der eine Node-Wahrscheinlichkeit von 0 hat.
|
||||||
Just place the schematic void like any other block and use the schematic creator to save a portion of the world.=Platzieren Sie einfach die Schematic-Lücke wie jeden anderen Block und benutzen Sie den Schematic-Macher, um einen Teil der Welt zu speichern.
|
Just place the schematic void like any other block and use the schematic creator to save a portion of the world.=Platzieren Sie einfach die Schematic-Lücke wie jeden anderen Block und benutzen Sie den Schematic-Macher, um einen Teil der Welt zu speichern.
|
||||||
Place schematic at the position specified or the current player position (loaded from @1)=Schematic an der angegebenen Position oder der aktuellen Spielerposition platzieren (geladen von @1)
|
Place schematic at the position specified or the current player position (loaded from @1). “-c” will clear the area first=Schematic an der angegebenen Position oder der aktuellen Spielerposition platzieren (geladen von @1). Mit „-c“ wird das Gebiet zuerst geleert
|
||||||
<schematic name>[.mts] [<x> <y> <z>]=<Schematic-Name>[.mts] [<x> <y> <z>]
|
<schematic name>[.mts] [-c] [<x> <y> <z>]=<Schematic-Name>[.mts] [-c] [<x> <y> <z>]
|
||||||
No schematic file specified.=Keinen Schematic-Namen angegeben.
|
No schematic file specified.=Keinen Schematic-Namen angegeben.
|
||||||
Schematic file could not be loaded!=Schematic-Datei konnte nicht geladen werden!
|
Schematic file could not be loaded!=Schematic-Datei konnte nicht geladen werden!
|
||||||
Convert .mts schematic file to .lua file (loaded from @1)=„.mts“-Schematicdatei zu „.lua“-Datei konvertieren (geladen von @1)
|
Convert .mts schematic file to .lua file (loaded from @1)=„.mts“-Schematicdatei zu „.lua“-Datei konvertieren (geladen von @1)
|
||||||
|
@ -71,8 +71,8 @@ The node HUD is not updated automatically and may be outdated. The node HUD only
|
|||||||
Schematic Void=
|
Schematic Void=
|
||||||
This is an utility block used in the creation of schematic files. It should be used together with a schematic creator. When saving a schematic, all nodes with a schematic void will be left unchanged when the schematic is placed again. Technically, this is equivalent to a block with the node probability set to 0.=
|
This is an utility block used in the creation of schematic files. It should be used together with a schematic creator. When saving a schematic, all nodes with a schematic void will be left unchanged when the schematic is placed again. Technically, this is equivalent to a block with the node probability set to 0.=
|
||||||
Just place the schematic void like any other block and use the schematic creator to save a portion of the world.=
|
Just place the schematic void like any other block and use the schematic creator to save a portion of the world.=
|
||||||
Place schematic at the position specified or the current player position (loaded from @1)=
|
Place schematic at the position specified or the current player position (loaded from @1). “-c” will clear the area first=
|
||||||
<schematic name>[.mts] [<x> <y> <z>]=
|
<schematic name>[.mts] [-c] [<x> <y> <z>]=
|
||||||
No schematic file specified.=
|
No schematic file specified.=
|
||||||
Schematic file could not be loaded!=
|
Schematic file could not be loaded!=
|
||||||
Convert .mts schematic file to .lua file (loaded from @1)=
|
Convert .mts schematic file to .lua file (loaded from @1)=
|
||||||
|
Loading…
Reference in New Issue
Block a user