Merge branch 'clean'

This commit is contained in:
Wuzzy 2021-04-05 00:58:19 +02:00
commit 9715b7818c
3 changed files with 28 additions and 8 deletions

View File

@ -1297,11 +1297,16 @@ end
-- [chatcommand] Place schematic
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},
params = S("<schematic name>[.mts] [<x> <y> <z>]"),
params = S("<schematic name>[.mts] [-c] [<x> <y> <z>]"),
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)
if not schem then
@ -1321,10 +1326,25 @@ minetest.register_chatcommand("placeschem", {
-- files when we reload. minetest.read_schematic circumvents that.
local schematic = minetest.read_schematic(schem_path, {})
if schematic then
if clear then
-- Clear same size for X and Z because
-- because schematic is randomly rotated
local max_xz = math.max(schematic.size.x, schematic.size.z)
local posses = {}
for z=pos.z, pos.z+max_xz-1 do
for y=pos.y, pos.y+schematic.size.y-1 do
for x=pos.x, pos.x+max_xz-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)
end
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)
end

View File

@ -71,8 +71,8 @@ The node HUD is not updated automatically and may be outdated. The node HUD only
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.
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)
<schematic name>[.mts] [<x> <y> <z>]=<Schematic-Name>[.mts] [<x> <y> <z>]
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] [-c] [<x> <y> <z>]=<Schematic-Name>[.mts] [-c] [<x> <y> <z>]
No schematic file specified.=Keinen Schematic-Namen angegeben.
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)

View File

@ -71,8 +71,8 @@ The node HUD is not updated automatically and may be outdated. The node HUD only
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.=
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)=
<schematic name>[.mts] [<x> <y> <z>]=
Place schematic at the position specified or the current player position (loaded from @1). “-c” will clear the area first=
<schematic name>[.mts] [-c] [<x> <y> <z>]=
No schematic file specified.=
Schematic file could not be loaded!=
Convert .mts schematic file to .lua file (loaded from @1)=