mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-07-05 09:30:22 +02:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
ba323c7670 | |||
b221493219 | |||
100f3c65c5 | |||
82afdd8c1b | |||
259a6c72d5 | |||
0902a26926 | |||
26fcbcbed9 | |||
d1a35f9a07 | |||
35290e7eac | |||
2b6a759eac | |||
9715b7818c | |||
3b9f1b867b | |||
fd555ebdaf | |||
98b3ae87ea | |||
a56b2d431f | |||
a3572cd614 | |||
724f72bb86 | |||
14ffdc6ef5 | |||
781041b0fb |
@ -1,7 +1,7 @@
|
|||||||
# Schematic Editor [`schemedit`]
|
# Schematic Editor [`schemedit`]
|
||||||
|
|
||||||
## Version
|
## Version
|
||||||
1.4.2
|
1.5.1
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
This is a mod which allows you to edit and export schematics (`.mts` files).
|
This is a mod which allows you to edit and export schematics (`.mts` files).
|
||||||
|
74
init.lua
74
init.lua
@ -1,4 +1,9 @@
|
|||||||
local S = minetest.get_translator("schemedit")
|
local S
|
||||||
|
if minetest.get_translator then
|
||||||
|
S = minetest.get_translator("schemedit")
|
||||||
|
else
|
||||||
|
S = function(s) return s end
|
||||||
|
end
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
|
||||||
local schemedit = {}
|
local schemedit = {}
|
||||||
@ -415,7 +420,7 @@ schemedit.add_form("main", {
|
|||||||
local slice_list = {}
|
local slice_list = {}
|
||||||
for _, i in pairs(slist) do
|
for _, i in pairs(slist) do
|
||||||
slice_list[#slice_list + 1] = {
|
slice_list[#slice_list + 1] = {
|
||||||
ypos = pos.y + i.ypos,
|
ypos = i.ypos,
|
||||||
prob = schemedit.lua_prob_to_schematic_prob(i.prob),
|
prob = schemedit.lua_prob_to_schematic_prob(i.prob),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -563,6 +568,11 @@ schemedit.add_form("slice", {
|
|||||||
table[0,0;6.8,6;slices;]]..slices..[[;]]..selected..[[]
|
table[0,0;6.8,6;slices;]]..slices..[[;]]..selected..[[]
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
-- Close edit panel if no slices
|
||||||
|
if self.panel_edit and slices == "" then
|
||||||
|
self.panel_edit = nil
|
||||||
|
end
|
||||||
|
|
||||||
if self.panel_add or self.panel_edit then
|
if self.panel_add or self.panel_edit then
|
||||||
local ypos_default, prob_default = "", ""
|
local ypos_default, prob_default = "", ""
|
||||||
local done_button = "button[5,7.18;2,1;done_add;"..F(S("Add")).."]"
|
local done_button = "button[5,7.18;2,1;done_add;"..F(S("Add")).."]"
|
||||||
@ -923,8 +933,6 @@ end
|
|||||||
|
|
||||||
-- Show probability and force_place status of a particular position for player in HUD.
|
-- Show probability and force_place status of a particular position for player in HUD.
|
||||||
-- Probability is shown as a number followed by “[F]” if the node is force-placed.
|
-- Probability is shown as a number followed by “[F]” if the node is force-placed.
|
||||||
-- The distance to the node is also displayed below that. This can't be avoided and is
|
|
||||||
-- and artifact of the waypoint HUD element.
|
|
||||||
function schemedit.display_node_prob(player, pos, prob, force_place)
|
function schemedit.display_node_prob(player, pos, prob, force_place)
|
||||||
local wpstring
|
local wpstring
|
||||||
if prob and force_place == true then
|
if prob and force_place == true then
|
||||||
@ -939,9 +947,10 @@ function schemedit.display_node_prob(player, pos, prob, force_place)
|
|||||||
hud_elem_type = "waypoint",
|
hud_elem_type = "waypoint",
|
||||||
name = wpstring,
|
name = wpstring,
|
||||||
precision = 0,
|
precision = 0,
|
||||||
text = "m", -- For the distance artifact
|
text = "m", -- For the distance artifact [legacy]
|
||||||
number = text_color_number,
|
number = text_color_number,
|
||||||
world_pos = pos,
|
world_pos = pos,
|
||||||
|
z_index = -300,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -991,11 +1000,13 @@ end
|
|||||||
function schemedit.clear_displayed_node_probs(player)
|
function schemedit.clear_displayed_node_probs(player)
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
for nodehash, hud_id in pairs(displayed_waypoints[playername]) do
|
for nodehash, hud_id in pairs(displayed_waypoints[playername]) do
|
||||||
|
if nodehash ~= "display_active" then
|
||||||
player:hud_remove(hud_id)
|
player:hud_remove(hud_id)
|
||||||
displayed_waypoints[playername][nodehash] = nil
|
displayed_waypoints[playername][nodehash] = nil
|
||||||
displayed_waypoints[playername].display_active = false
|
displayed_waypoints[playername].display_active = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
displayed_waypoints[player:get_player_name()] = {
|
displayed_waypoints[player:get_player_name()] = {
|
||||||
@ -1297,11 +1308,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
|
||||||
@ -1321,10 +1337,25 @@ 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
|
||||||
|
-- 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)
|
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
|
||||||
|
|
||||||
@ -1336,6 +1367,31 @@ minetest.register_chatcommand("placeschem", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("listschems", {
|
||||||
|
description = S("List schematic files in world path"),
|
||||||
|
privs = {server = true},
|
||||||
|
params = "",
|
||||||
|
func = function(name, param)
|
||||||
|
local files = minetest.get_dir_list(minetest.get_worldpath()..DIR_DELIM.."schems", false)
|
||||||
|
if not files then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local out_files = {}
|
||||||
|
-- Only show files with “.mts” suffix
|
||||||
|
for f=#files, 1, -1 do
|
||||||
|
if string.sub(string.lower(files[f]), -4, -1) == ".mts" then
|
||||||
|
table.insert(out_files, files[f])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(out_files)
|
||||||
|
local str = table.concat(out_files, ", ")
|
||||||
|
if str == "" then
|
||||||
|
return true, S("No schematic files.")
|
||||||
|
end
|
||||||
|
return true, str
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
if can_import then
|
if can_import then
|
||||||
-- [chatcommand] Convert MTS schematic file to .lua file
|
-- [chatcommand] Convert MTS schematic file to .lua file
|
||||||
minetest.register_chatcommand("mts2lua", {
|
minetest.register_chatcommand("mts2lua", {
|
||||||
|
@ -71,10 +71,12 @@ 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 speichern (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!
|
||||||
|
List schematic files in world path=Schematic-Dateien im Weltpfad auflisten
|
||||||
|
No schematic files.=Keine Schematic-Dateien.
|
||||||
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)
|
||||||
<schematic name>[.mts] [comments]=<Schematic-Name>[.mts] [comments]
|
<schematic name>[.mts] [comments]=<Schematic-Name>[.mts] [comments]
|
||||||
Failed!=Fehlgeschlagen!
|
Failed!=Fehlgeschlagen!
|
||||||
|
@ -71,10 +71,12 @@ 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!=
|
||||||
|
List schematic files in world path=
|
||||||
|
No schematic files.=
|
||||||
Convert .mts schematic file to .lua file (loaded from @1)=
|
Convert .mts schematic file to .lua file (loaded from @1)=
|
||||||
<schematic name>[.mts] [comments]=
|
<schematic name>[.mts] [comments]=
|
||||||
Failed!=
|
Failed!=
|
||||||
|
1
mod.conf
1
mod.conf
@ -1,3 +1,4 @@
|
|||||||
name = schemedit
|
name = schemedit
|
||||||
optional_depends = doc
|
optional_depends = doc
|
||||||
description = Advanced tool for modders and advanced users to create and edit schematics.
|
description = Advanced tool for modders and advanced users to create and edit schematics.
|
||||||
|
min_minetest_version = 5.0
|
||||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 48 KiB |
Reference in New Issue
Block a user