1
0
mirror of git://repo.or.cz/minetest_schemedit.git synced 2025-07-04 17:10:24 +02:00

5 Commits
1.3.0 ... 1.4.0

Author SHA1 Message Date
e19d5e0bfa Version 1.4.0 2020-06-03 16:31:47 +02:00
b6e4d2f7f0 Fix incorrect size importing 2020-06-03 16:31:03 +02:00
abfd913862 Replace deprecated get/set_attribute 2020-06-03 15:58:34 +02:00
01a3a970d2 Add buttons to convert air to void to air 2020-06-03 15:48:57 +02:00
e389fcc041 Fix text area being too large 2020-05-31 00:13:25 +02:00
4 changed files with 36 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Schematic Editor [`schemedit`]
## Version
1.3.0
1.4.0
## Description
This is a mod which allows you to edit and export schematics (`.mts` files).

View File

@ -142,7 +142,8 @@ function schemedit.show_formspec(pos, player, tab, show, ...)
-- Update player attribute
if forms[tab].cache_name ~= false then
player:set_attribute("schemedit:tab", tab)
local pmeta = player:get_meta()
pmeta:set_string("schemedit:tab", tab)
end
else
minetest.close_formspec(pname, "schemedit:"..tab)
@ -300,15 +301,18 @@ schemedit.add_form("main", {
button[0.5,3.5;6,1;export;]]..F(S("Export schematic")).."]"..
import_btn..[[
textarea[0.8,4.5;6.2,5;;]]..F(S("Export/import path:\n@1",
textarea[0.8,4.5;6.2,1;;]]..F(S("Export/import path:\n@1",
export_path_trunc .. DIR_DELIM .. F(S("<name>"))..".mts"))..[[;]
button[0.5,5.5;3,1;air2void;]]..F(S("Air to voids"))..[[]
button[3.5,5.5;3,1;void2air;]]..F(S("Voids to air"))..[[]
tooltip[air2void;]]..F(S("Turn all air nodes into schematic void nodes"))..[[]
tooltip[void2air;]]..F(S("Turn all schematic void nodes into air nodes"))..[[]
field[0.8,7;2,1;x;]]..F(S("X size:"))..[[;]]..xs..[[]
field[2.8,7;2,1;y;]]..F(S("Y size:"))..[[;]]..ys..[[]
field[4.8,7;2,1;z;]]..F(S("Z size:"))..[[;]]..zs..[[]
field_close_on_enter[x;false]
field_close_on_enter[y;false]
field_close_on_enter[z;false]
button[0.5,7.5;3,1;save;]]..F(S("Save size"))..[[]
]]..
border_button
@ -357,6 +361,21 @@ schemedit.add_form("main", {
meta.schem_name = fields.name
end
-- Node conversion
if (fields.air2void) then
local pos1, pos2 = schemedit.size(pos)
pos1, pos2 = schemedit.sort_pos(pos1, pos2)
local nodes = minetest.find_nodes_in_area(pos1, pos2, {"air"})
minetest.bulk_set_node(nodes, {name="schemedit:void"})
return
elseif (fields.void2air) then
local pos1, pos2 = schemedit.size(pos)
pos1, pos2 = schemedit.sort_pos(pos1, pos2)
local nodes = minetest.find_nodes_in_area(pos1, pos2, {"schemedit:void"})
minetest.bulk_set_node(nodes, {name="air"})
return
end
-- Toggle border
if fields.border then
if meta.schem_border == "true" and schemedit.markers[hashpos] then
@ -441,10 +460,12 @@ schemedit.add_form("main", {
if node.param2 == 1 then
pos1 = vector.add(pos, {x=1,y=0,z=-meta.z_size+1})
meta.x_size, meta.z_size = meta.z_size, meta.x_size
elseif node.param2 == 2 then
pos1 = vector.add(pos, {x=-meta.x_size+1,y=0,z=-meta.z_size})
elseif node.param2 == 3 then
pos1 = vector.add(pos, {x=-meta.x_size,y=0,z=0})
meta.x_size, meta.z_size = meta.z_size, meta.x_size
else
pos1 = vector.add(pos, {x=0,y=0,z=1})
end
@ -1046,7 +1067,8 @@ S("With a schematic node probability tool, you can set a probability for each no
if meta:get_string("owner") == name or
minetest.check_player_privs(player, "schematic_override") == true then
-- Get player attribute
local tab = player:get_attribute("schemedit:tab")
local pmeta = player:get_meta()
local tab = pmeta:get_string("schemedit:tab")
if not forms[tab] or not tab then
tab = "main"
end

View File

@ -74,3 +74,8 @@ Insufficient privileges! You need the “@1” privilege to use this.=Unzureiche
Convert .mts schematic file to .lua file (loaded from @1)=„.mts“-Schematicdatei zu „.lua“-Datei konvertieren (geladen von @1)
<schematic name>[.mts] [comments]=<Schematic-Name>[.mts] [comments]
Failed.=Fehlgeschlagen.
Air to voids=Luft zu Lücken
Voids to air=Lücken zu Luft
Turn all air nodes into schematic void nodes=Alle Luft-Nodes zu Schematic-Lücken umwandeln
Turn all schematic void nodes into air nodes=Alle Schematic-Lücken zu Luft-Nodes umwandeln

View File

@ -72,3 +72,7 @@ Insufficient privileges! You need the “@1” privilege to use this.=
Convert .mts schematic file to .lua file (loaded from @1)=
<schematic name>[.mts] [comments]=
Failed.=
Air to voids=
Voids to air=
Turn all air nodes into schematic void nodes=
Turn all schematic void nodes into air nodes=