mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-07-04 17:10:24 +02:00
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
05ca8d90be | |||
84d6dc3c69 | |||
fedc4c51fa | |||
4199f645f3 | |||
a639c2b9c0 | |||
7f279bbd7a | |||
54aa7f35df | |||
bbed49e365 | |||
5cf551dccd | |||
b8cbb66d83 | |||
a6cf015631 | |||
5aba3aada8 | |||
3c7c208dcb | |||
0fc0180a04 | |||
2c8e6fae3e | |||
cdcda91fd6 | |||
1d53577085 | |||
59cf898ddc | |||
02acad209b | |||
fee142eab2 | |||
9cb700327a | |||
476f62c286 | |||
d7363f470d | |||
713deec575 | |||
442329d886 | |||
f4470596dc | |||
27c0c2764c | |||
7797aa8de6 | |||
ab122a1692 | |||
16950a773d | |||
2fea0b3d27 | |||
4d5bde773a | |||
8f7dbdc56f | |||
9fde0b8422 | |||
c740737a58 | |||
6dbca794c9 | |||
491f8a11d6 | |||
a1dfdd0cbe | |||
2134116746 | |||
d8e59c4cf1 | |||
b411433d90 | |||
67cf59e66e |
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
MIT License
|
||||
Copyright (c) 2017 Elijah Duffy
|
||||
Copyright (c) 2017-2020 Elijah Duffy and Wuzzy
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
|
19
README.md
19
README.md
@ -1,23 +1,34 @@
|
||||
# Schematic Editor [`schemedit`]
|
||||
|
||||
## Version
|
||||
1.0.0
|
||||
1.3.0
|
||||
|
||||
## Description
|
||||
This is a mod which allows you to edit and export schematics (`.mts` files).
|
||||
|
||||
It supports node porbabilities, forced node placement and slice probabilities.
|
||||
This mod works in Minetest 5.0.0 or later, but recommended is version 5.1.0
|
||||
or later.
|
||||
|
||||
It supports node probabilities, forced node placement and slice probabilities.
|
||||
|
||||
It adds 3 items:
|
||||
|
||||
* Schematic Creator: Used to mark a region and export it as schematic
|
||||
* Schematic Creator: Used to mark a region and export or import it as schematic
|
||||
* Schematic Void: Marks a position in a schematic which should not replace anything when placed as a schematic
|
||||
* Schematic Node Probability Tool: Set per-node probabilities and forced node placement
|
||||
|
||||
It also adds the server command `placeschem` to place a schematic.
|
||||
Note: The import feature requires Minetest 5.1.0 or later.
|
||||
|
||||
It also adds these server commands:
|
||||
|
||||
* `placeschem` to place a schematic
|
||||
* `mts2lua` to convert .mts files to .lua files (Lua code)
|
||||
|
||||
There's also a setting `schemedit_export_lua` to enable automatic export to .lua files.
|
||||
|
||||
## Usage help
|
||||
Usage help can be found when you use the optional Help modpack (mods `doc` and `doc_items`).
|
||||
The “server” privilege is required for most features.
|
||||
|
||||
You should also refer to the Minetest Lua API documentation to understand more about schematics.
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
doc?
|
@ -1 +0,0 @@
|
||||
Advanced tool for modders and advanced users to create and edit schematics.
|
519
init.lua
519
init.lua
@ -1,14 +1,20 @@
|
||||
local S = minetest.get_translator("schemedit")
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
local schemedit = {}
|
||||
|
||||
-- Directory delimeter fallback (normally comes from builtin)
|
||||
if not DIR_DELIM then
|
||||
DIR_DELIM = "/"
|
||||
end
|
||||
local DIR_DELIM = "/"
|
||||
|
||||
local export_path_full = table.concat({minetest.get_worldpath(), "schems"}, DIR_DELIM)
|
||||
|
||||
-- truncated export path so the server directory structure is not exposed publicly
|
||||
local export_path_trunc = table.concat({S("<world path>"), "schems"}, DIR_DELIM)
|
||||
|
||||
local text_color = "#D79E9E"
|
||||
local text_color_number = 0xD79E9E
|
||||
|
||||
local can_import = minetest.read_schematic ~= nil
|
||||
|
||||
schemedit.markers = {}
|
||||
|
||||
-- [local function] Renumber table
|
||||
@ -20,6 +26,38 @@ local function renumber(t)
|
||||
return res
|
||||
end
|
||||
|
||||
local NEEDED_PRIV = "server"
|
||||
local function check_priv(player_name, quit)
|
||||
local privs = minetest.get_player_privs(player_name)
|
||||
if privs[NEEDED_PRIV] then
|
||||
return true
|
||||
else
|
||||
if not quit then
|
||||
minetest.chat_send_player(player_name, minetest.colorize("red",
|
||||
S("Insufficient privileges! You need the “@1” privilege to use this.", NEEDED_PRIV)))
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Lua export
|
||||
local export_schematic_to_lua
|
||||
if can_import then
|
||||
export_schematic_to_lua = function(schematic, filepath, options)
|
||||
if not options then options = {} end
|
||||
local str = minetest.serialize_schematic(schematic, "lua", options)
|
||||
local file = io.open(filepath, "w")
|
||||
if file and str then
|
||||
file:write(str)
|
||||
file:flush()
|
||||
file:close()
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
--- Formspec API
|
||||
---
|
||||
@ -175,8 +213,8 @@ end
|
||||
-- The itemstack is updated in-place.
|
||||
local function set_item_metadata(itemstack, prob, force_place)
|
||||
local smeta = itemstack:get_meta()
|
||||
local prob_desc = "\nProbability: "..(prob) or
|
||||
smeta:get_string("schemedit_prob") or "Not Set"
|
||||
local prob_desc = "\n"..S("Probability: @1", prob or
|
||||
smeta:get_string("schemedit_prob") or S("Not Set"))
|
||||
-- Update probability
|
||||
if prob and prob >= 0 and prob < 255 then
|
||||
smeta:set_string("schemedit_prob", tostring(prob))
|
||||
@ -185,8 +223,8 @@ local function set_item_metadata(itemstack, prob, force_place)
|
||||
prob_desc = ""
|
||||
smeta:set_string("schemedit_prob", nil)
|
||||
else
|
||||
prob_desc = "\nProbability: "..(smeta:get_string("schemedit_prob") or
|
||||
"Not Set")
|
||||
prob_desc = "\n"..S("Probability: @1", smeta:get_string("schemedit_prob") or
|
||||
S("Not Set"))
|
||||
end
|
||||
|
||||
-- Update force place
|
||||
@ -212,7 +250,7 @@ local function set_item_metadata(itemstack, prob, force_place)
|
||||
|
||||
local force_desc = ""
|
||||
if smeta:get_string("schemedit_force_place") == "true" then
|
||||
force_desc = "\n".."Force placement"
|
||||
force_desc = "\n"..S("Force placement")
|
||||
end
|
||||
|
||||
desc = desc..minetest.colorize(text_color, prob_desc..force_desc)
|
||||
@ -225,10 +263,13 @@ end
|
||||
---
|
||||
--- Formspec Tabs
|
||||
---
|
||||
|
||||
local import_btn = ""
|
||||
if can_import then
|
||||
import_btn = "button[0.5,2.5;6,1;import;"..F(S("Import schematic")).."]"
|
||||
end
|
||||
schemedit.add_form("main", {
|
||||
tab = true,
|
||||
caption = "Main",
|
||||
caption = S("Main"),
|
||||
get = function(self, pos, name)
|
||||
local meta = minetest.get_meta(pos):to_table().fields
|
||||
local strpos = minetest.pos_to_string(pos)
|
||||
@ -236,49 +277,84 @@ schemedit.add_form("main", {
|
||||
|
||||
local border_button
|
||||
if meta.schem_border == "true" and schemedit.markers[hashpos] then
|
||||
border_button = "button[3.5,7.5;3,1;border;Hide border]"
|
||||
border_button = "button[3.5,7.5;3,1;border;"..F(S("Hide border")).."]"
|
||||
else
|
||||
border_button = "button[3.5,7.5;3,1;border;Show border]"
|
||||
border_button = "button[3.5,7.5;3,1;border;"..F(S("Show border")).."]"
|
||||
end
|
||||
|
||||
-- TODO: Show information regarding volume, pos1, pos2, etc... in formspec
|
||||
local xs, ys, zs = meta.x_size or 1, meta.y_size or 1, meta.z_size or 1
|
||||
local size = {x=xs, y=ys, z=zs}
|
||||
local schem_name = meta.schem_name or ""
|
||||
|
||||
local form = [[
|
||||
size[7,8]
|
||||
label[0.5,-0.1;Position: ]]..strpos..[[]
|
||||
label[3,-0.1;Owner: ]]..name..[[]
|
||||
label[0.5,-0.1;]]..F(S("Position: @1", strpos))..[[]
|
||||
label[3,-0.1;]]..F(S("Owner: @1", name))..[[]
|
||||
label[0.5,0.4;]]..F(S("Schematic name: @1", F(schem_name)))..[[]
|
||||
label[0.5,0.9;]]..F(S("Size: @1", minetest.pos_to_string(size)))..[[]
|
||||
|
||||
field[0.8,1;5,1;name;Schematic name:;]]..minetest.formspec_escape(meta.schem_name or "")..[[]
|
||||
button[5.3,0.69;1.2,1;save_name;Save]
|
||||
tooltip[save_name;Save schematic name]
|
||||
field[0.8,2;5,1;name;]]..F(S("Schematic name:"))..[[;]]..F(schem_name or "")..[[]
|
||||
button[5.3,1.69;1.2,1;save_name;]]..F(S("OK"))..[[]
|
||||
tooltip[save_name;]]..F(S("Save schematic name"))..[[]
|
||||
field_close_on_enter[name;false]
|
||||
|
||||
button[0.5,1.5;6,1;export;Export schematic]
|
||||
textarea[0.8,2.5;6.2,5;;The schematic will be exported as a .mts file and stored in]]..
|
||||
"\n" .. export_path_full .. DIR_DELIM .. [[<name>.mts.;]
|
||||
field[0.8,7;2,1;x;X size:;]]..meta.x_size..[[]
|
||||
field[2.8,7;2,1;y;Y size:;]]..meta.y_size..[[]
|
||||
field[4.8,7;2,1;z;Z size:;]]..meta.z_size..[[]
|
||||
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",
|
||||
export_path_trunc .. DIR_DELIM .. F(S("<name>"))..".mts"))..[[;]
|
||||
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;Save size]
|
||||
button[0.5,7.5;3,1;save;]]..F(S("Save size"))..[[]
|
||||
]]..
|
||||
border_button
|
||||
if minetest.get_modpath("doc") then
|
||||
form = form .. "image_button[6.4,-0.2;0.8,0.8;doc_button_icon_lores.png;doc;]" ..
|
||||
"tooltip[doc;Help]"
|
||||
"tooltip[doc;"..F(S("Help")).."]"
|
||||
end
|
||||
return form
|
||||
end,
|
||||
handle = function(self, pos, name, fields)
|
||||
if fields.doc then
|
||||
doc.show_entry(name, "nodes", "schemedit:creator", true)
|
||||
return
|
||||
end
|
||||
|
||||
if not check_priv(name, fields.quit) then
|
||||
return
|
||||
end
|
||||
|
||||
local realmeta = minetest.get_meta(pos)
|
||||
local meta = realmeta:to_table().fields
|
||||
local hashpos = minetest.hash_node_position(pos)
|
||||
|
||||
if fields.doc then
|
||||
doc.show_entry(name, "nodes", "schemedit:creator", true)
|
||||
return
|
||||
-- Save size vector values
|
||||
if (fields.x and fields.x ~= "") then
|
||||
local x = tonumber(fields.x)
|
||||
if x then
|
||||
meta.x_size = math.max(x, 1)
|
||||
end
|
||||
end
|
||||
if (fields.y and fields.y ~= "") then
|
||||
local y = tonumber(fields.y)
|
||||
if y then
|
||||
meta.y_size = math.max(y, 1)
|
||||
end
|
||||
end
|
||||
if (fields.z and fields.z ~= "") then
|
||||
local z = tonumber(fields.z)
|
||||
if z then
|
||||
meta.z_size = math.max(z, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- Save schematic name
|
||||
if fields.name then
|
||||
meta.schem_name = fields.name
|
||||
end
|
||||
|
||||
-- Toggle border
|
||||
@ -292,30 +368,6 @@ schemedit.add_form("main", {
|
||||
end
|
||||
end
|
||||
|
||||
-- Save size vector values
|
||||
if (fields.save or fields.key_enter_field == "x" or
|
||||
fields.key_enter_field == "y" or fields.key_enter_field == "z")
|
||||
and (fields.x and fields.y and fields.z and fields.x ~= ""
|
||||
and fields.y ~= "" and fields.z ~= "") then
|
||||
local x, y, z = tonumber(fields.x), tonumber(fields.y), tonumber(fields.z)
|
||||
|
||||
if x then
|
||||
meta.x_size = math.max(x, 1)
|
||||
end
|
||||
if y then
|
||||
meta.y_size = math.max(y, 1)
|
||||
end
|
||||
if z then
|
||||
meta.z_size = math.max(z, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- Save schematic name
|
||||
if fields.save_name or fields.key_enter_field == "name" and fields.name and
|
||||
fields.name ~= "" then
|
||||
meta.schem_name = fields.name
|
||||
end
|
||||
|
||||
-- Export schematic
|
||||
if fields.export and meta.schem_name and meta.schem_name ~= "" then
|
||||
local pos1, pos2 = schemedit.size(pos)
|
||||
@ -351,13 +403,102 @@ schemedit.add_form("main", {
|
||||
|
||||
if res then
|
||||
minetest.chat_send_player(name, minetest.colorize("#00ff00",
|
||||
"Exported schematic to "..filepath))
|
||||
S("Exported schematic to @1", filepath)))
|
||||
-- Additional export to Lua file if MTS export was successful
|
||||
local schematic = minetest.read_schematic(filepath, {})
|
||||
if schematic and minetest.settings:get_bool("schemedit_export_lua") then
|
||||
local filepath_lua = path..meta.schem_name..".lua"
|
||||
res = export_schematic_to_lua(schematic, filepath_lua)
|
||||
if res then
|
||||
minetest.chat_send_player(name, minetest.colorize("#00ff00",
|
||||
S("Exported schematic to @1", filepath_lua)))
|
||||
end
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, minetest.colorize("red",
|
||||
"Failed to export schematic to "..filepath))
|
||||
S("Failed to export schematic to @1", filepath)))
|
||||
end
|
||||
end
|
||||
|
||||
-- Import schematic
|
||||
if fields.import and meta.schem_name and meta.schem_name ~= "" then
|
||||
if not can_import then
|
||||
return
|
||||
end
|
||||
local pos1
|
||||
local node = minetest.get_node(pos)
|
||||
local path = export_path_full .. DIR_DELIM
|
||||
|
||||
local filepath = path..meta.schem_name..".mts"
|
||||
local schematic = minetest.read_schematic(filepath, {write_yslice_prob="low"})
|
||||
local success = false
|
||||
|
||||
if schematic then
|
||||
meta.x_size = schematic.size.x
|
||||
meta.y_size = schematic.size.y
|
||||
meta.z_size = schematic.size.z
|
||||
meta.slices = minetest.serialize(schematic.yslice_prob)
|
||||
|
||||
if node.param2 == 1 then
|
||||
pos1 = vector.add(pos, {x=1,y=0,z=-meta.z_size+1})
|
||||
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})
|
||||
else
|
||||
pos1 = vector.add(pos, {x=0,y=0,z=1})
|
||||
end
|
||||
|
||||
local schematic_for_meta = table.copy(schematic)
|
||||
-- Strip probability data for placement
|
||||
schematic.yslice_prob = {}
|
||||
for d=1, #schematic.data do
|
||||
schematic.data[d].prob = nil
|
||||
end
|
||||
|
||||
-- Place schematic
|
||||
success = minetest.place_schematic(pos1, schematic, "0", nil, true)
|
||||
|
||||
-- Add special schematic data to nodes
|
||||
if success then
|
||||
local d = 1
|
||||
for z=0, meta.z_size-1 do
|
||||
for y=0, meta.y_size-1 do
|
||||
for x=0, meta.x_size-1 do
|
||||
local data = schematic_for_meta.data[d]
|
||||
local pp = {x=pos1.x+x, y=pos1.y+y, z=pos1.z+z}
|
||||
if data.prob == 0 then
|
||||
minetest.set_node(pp, {name="schemedit:void"})
|
||||
else
|
||||
local meta = minetest.get_meta(pp)
|
||||
if data.prob and data.prob ~= 255 and data.prob ~= 254 then
|
||||
meta:set_string("schemedit_prob", tostring(data.prob))
|
||||
else
|
||||
meta:set_string("schemedit_prob", "")
|
||||
end
|
||||
if data.force_place then
|
||||
meta:set_string("schemedit_force_place", "true")
|
||||
else
|
||||
meta:set_string("schemedit_force_place", "")
|
||||
end
|
||||
end
|
||||
d = d + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if success then
|
||||
minetest.chat_send_player(name, minetest.colorize("#00ff00",
|
||||
S("Imported schematic from @1", filepath)))
|
||||
else
|
||||
minetest.chat_send_player(name, minetest.colorize("red",
|
||||
S("Failed to import schematic from @1", filepath)))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Save meta before updating visuals
|
||||
local inv = realmeta:get_inventory():get_lists()
|
||||
realmeta:from_table({fields = meta, inventory = inv})
|
||||
@ -375,7 +516,7 @@ schemedit.add_form("main", {
|
||||
})
|
||||
|
||||
schemedit.add_form("slice", {
|
||||
caption = "Y Slices",
|
||||
caption = S("Y Slices"),
|
||||
tab = true,
|
||||
get = function(self, pos, name, visible_panel)
|
||||
local meta = minetest.get_meta(pos):to_table().fields
|
||||
@ -385,8 +526,8 @@ schemedit.add_form("slice", {
|
||||
local slice_list = minetest.deserialize(meta.slices)
|
||||
local slices = ""
|
||||
for _, i in pairs(slice_list) do
|
||||
local insert = "Y = "..tostring(i.ypos).."; Probability = "..tostring(i.prob)
|
||||
slices = slices..minetest.formspec_escape(insert)..","
|
||||
local insert = F(S("Y = @1; Probability = @2", tostring(i.ypos), tostring(i.prob)))
|
||||
slices = slices..insert..","
|
||||
end
|
||||
slices = slices:sub(1, -2) -- Remove final comma
|
||||
|
||||
@ -397,9 +538,9 @@ schemedit.add_form("slice", {
|
||||
|
||||
if self.panel_add or self.panel_edit then
|
||||
local ypos_default, prob_default = "", ""
|
||||
local done_button = "button[5,7.18;2,1;done_add;Done]"
|
||||
local done_button = "button[5,7.18;2,1;done_add;"..F(S("Done")).."]"
|
||||
if self.panel_edit then
|
||||
done_button = "button[5,7.18;2,1;done_edit;Done]"
|
||||
done_button = "button[5,7.18;2,1;done_edit;"..F(S("Done")).."]"
|
||||
if slice_list[self.selected] then
|
||||
ypos_default = slice_list[self.selected].ypos
|
||||
prob_default = slice_list[self.selected].prob
|
||||
@ -407,27 +548,27 @@ schemedit.add_form("slice", {
|
||||
end
|
||||
|
||||
form = form..[[
|
||||
field[0.3,7.5;2.5,1;ypos;Y position (max. ]]..(meta.y_size - 1)..[[):;]]..ypos_default..[[]
|
||||
field[2.8,7.5;2.5,1;prob;Probability (0-255):;]]..prob_default..[[]
|
||||
field[0.3,7.5;2.5,1;ypos;]]..F(S("Y position (max. @1):", (meta.y_size - 1)))..[[;]]..ypos_default..[[]
|
||||
field[2.8,7.5;2.5,1;prob;]]..F(S("Probability (0-255):"))..[[;]]..prob_default..[[]
|
||||
field_close_on_enter[ypos;false]
|
||||
field_close_on_enter[prob;false]
|
||||
]]..done_button
|
||||
end
|
||||
|
||||
if not self.panel_edit then
|
||||
form = form.."button[0,6;2,1;add;+ Add slice]"
|
||||
form = form.."button[0,6;2.4,1;add;"..F(S("+ Add slice")).."]"
|
||||
end
|
||||
|
||||
if slices ~= "" and self.selected and not self.panel_add then
|
||||
if not self.panel_edit then
|
||||
form = form..[[
|
||||
button[2,6;2,1;remove;- Remove slice]
|
||||
button[4,6;2,1;edit;+/- Edit slice]
|
||||
button[2.4,6;2.4,1;remove;]]..F(S("- Remove slice"))..[[]
|
||||
button[4.8,6;2.4,1;edit;]]..F(S("+/- Edit slice"))..[[]
|
||||
]]
|
||||
else
|
||||
form = form..[[
|
||||
button[2,6;2,1;remove;- Remove slice]
|
||||
button[4,6;2,1;edit;+/- Edit slice]
|
||||
button[2.4,6;2.4,1;remove;]]..F(S("- Remove slice"))..[[]
|
||||
button[4.8,6;2.4,1;edit;]]..F(S("+/- Edit slice"))..[[]
|
||||
]]
|
||||
end
|
||||
end
|
||||
@ -435,6 +576,10 @@ schemedit.add_form("slice", {
|
||||
return form
|
||||
end,
|
||||
handle = function(self, pos, name, fields)
|
||||
if not check_priv(name, fields.quit) then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
@ -497,7 +642,7 @@ schemedit.add_form("slice", {
|
||||
|
||||
schemedit.add_form("probtool", {
|
||||
cache_name = false,
|
||||
caption = "Schematic Node Probability Tool",
|
||||
caption = S("Schematic Node Probability Tool"),
|
||||
get = function(self, pos, name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
@ -519,17 +664,21 @@ schemedit.add_form("probtool", {
|
||||
force_place = "false"
|
||||
end
|
||||
local form = "size[5,4]"..
|
||||
"label[0,0;Schematic Node Probability Tool]"..
|
||||
"field[0.75,1;4,1;prob;Probability (0-255);"..prob.."]"..
|
||||
"checkbox[0.60,1.5;force_place;Force placement;" .. force_place .. "]" ..
|
||||
"button_exit[0.25,3;2,1;cancel;Cancel]"..
|
||||
"button_exit[2.75,3;2,1;submit;Apply]"..
|
||||
"tooltip[prob;Probability that the node will be placed]"..
|
||||
"tooltip[force_place;If enabled, the node will replace nodes other than air and ignore]"..
|
||||
"label[0,0;"..F(S("Schematic Node Probability Tool")).."]"..
|
||||
"field[0.75,1;4,1;prob;"..F(S("Probability (0-255)"))..";"..prob.."]"..
|
||||
"checkbox[0.60,1.5;force_place;"..F(S("Force placement"))..";" .. force_place .. "]" ..
|
||||
"button_exit[0.25,3;2,1;cancel;"..F(S("Cancel")).."]"..
|
||||
"button_exit[2.75,3;2,1;submit;"..F(S("Apply")).."]"..
|
||||
"tooltip[prob;"..F(S("Probability that the node will be placed")).."]"..
|
||||
"tooltip[force_place;"..F(S("If enabled, the node will replace nodes other than air and ignore")).."]"..
|
||||
"field_close_on_enter[prob;false]"
|
||||
return form
|
||||
end,
|
||||
handle = function(self, pos, name, fields)
|
||||
if not check_priv(name, fields.quit) then
|
||||
return
|
||||
end
|
||||
|
||||
if fields.submit then
|
||||
local prob = tonumber(fields.prob)
|
||||
if prob then
|
||||
@ -546,6 +695,9 @@ schemedit.add_form("probtool", {
|
||||
|
||||
set_item_metadata(probtool, prob, force_place)
|
||||
|
||||
-- Repurpose the tool's wear bar to display the set probability
|
||||
probtool:set_wear(math.floor(((255-prob)/255)*65535))
|
||||
|
||||
player:set_wielded_item(probtool)
|
||||
end
|
||||
end
|
||||
@ -642,7 +794,7 @@ function schemedit.mark(pos)
|
||||
local marker = minetest.add_entity({x = pos1.x + sizex - 0.5, y = pos1.y + sizey - 0.5, z = z + offset}, "schemedit:display")
|
||||
if marker ~= nil then
|
||||
marker:set_properties({
|
||||
visual_size={x=(sizex+0.01) * 2, y=sizey * 2},
|
||||
visual_size={x=(sizex+0.01) * 2, y=(sizey+0.01) * 2},
|
||||
})
|
||||
marker:get_luaentity().id = id
|
||||
marker:get_luaentity().owner = owner
|
||||
@ -663,9 +815,9 @@ function schemedit.mark(pos)
|
||||
local marker = minetest.add_entity({x = x + offset, y = pos1.y + sizey - 0.5, z = pos1.z + sizez - 0.5}, "schemedit:display")
|
||||
if marker ~= nil then
|
||||
marker:set_properties({
|
||||
visual_size={x=(sizez+0.01) * 2, y=sizey * 2},
|
||||
visual_size={x=(sizez+0.01) * 2, y=(sizey+0.01) * 2},
|
||||
})
|
||||
marker:set_yaw(math.pi / 2)
|
||||
marker:set_rotation({x=0, y=math.pi / 2, z=0})
|
||||
marker:get_luaentity().id = id
|
||||
marker:get_luaentity().owner = owner
|
||||
table.insert(m, marker)
|
||||
@ -673,6 +825,30 @@ function schemedit.mark(pos)
|
||||
low = false
|
||||
end
|
||||
|
||||
low = true
|
||||
-- XZ plane markers
|
||||
for _, y in ipairs({pos1.y - 0.5, pos2.y + 0.5}) do
|
||||
if low then
|
||||
offset = -0.01
|
||||
else
|
||||
offset = 0.01
|
||||
end
|
||||
|
||||
local marker = minetest.add_entity({x = pos1.x + sizex - 0.5, y = y + offset, z = pos1.z + sizez - 0.5}, "schemedit:display")
|
||||
if marker ~= nil then
|
||||
marker:set_properties({
|
||||
visual_size={x=(sizex+0.01) * 2, y=(sizez+0.01) * 2},
|
||||
})
|
||||
marker:set_rotation({x=math.pi/2, y=0, z=0})
|
||||
marker:get_luaentity().id = id
|
||||
marker:get_luaentity().owner = owner
|
||||
table.insert(m, marker)
|
||||
end
|
||||
low = false
|
||||
end
|
||||
|
||||
|
||||
|
||||
schemedit.markers[id] = m
|
||||
return true
|
||||
end
|
||||
@ -697,12 +873,12 @@ end
|
||||
-- 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.
|
||||
-- The distance to the node is also displayed below that. This can't be avoided and is
|
||||
-- and artifact of the waypoint HUD element. TODO: Hide displayed distance.
|
||||
-- and artifact of the waypoint HUD element.
|
||||
function schemedit.display_node_prob(player, pos, prob, force_place)
|
||||
local wpstring
|
||||
if prob and force_place == true then
|
||||
wpstring = string.format("%d [F]", prob)
|
||||
elseif prob then
|
||||
wpstring = string.format("%s [F]", prob)
|
||||
elseif prob and type(tonumber(prob)) == "number" then
|
||||
wpstring = prob
|
||||
elseif force_place == true then
|
||||
wpstring = "[F]"
|
||||
@ -711,6 +887,7 @@ function schemedit.display_node_prob(player, pos, prob, force_place)
|
||||
return player:hud_add({
|
||||
hud_elem_type = "waypoint",
|
||||
name = wpstring,
|
||||
precision = 0,
|
||||
text = "m", -- For the distance artifact
|
||||
number = text_color_number,
|
||||
world_pos = pos,
|
||||
@ -723,7 +900,7 @@ end
|
||||
-- But the boundaries can optionally be set explicitly with pos1 and pos2.
|
||||
function schemedit.display_node_probs_region(player, pos1, pos2)
|
||||
local playername = player:get_player_name()
|
||||
local pos = vector.round(player:getpos())
|
||||
local pos = vector.round(player:get_pos())
|
||||
|
||||
local dist = 5
|
||||
-- Default: 5 nodes away from player in any direction
|
||||
@ -747,7 +924,7 @@ function schemedit.display_node_probs_region(player, pos1, pos2)
|
||||
|
||||
local prob, force_place
|
||||
local meta = minetest.get_meta(checkpos)
|
||||
prob = tonumber(meta:get_string("schemedit_prob"))
|
||||
prob = meta:get_string("schemedit_prob")
|
||||
force_place = meta:get_string("schemedit_force_place") == "true"
|
||||
local hud_id = schemedit.display_node_prob(player, checkpos, prob, force_place)
|
||||
if hud_id then
|
||||
@ -809,19 +986,25 @@ end)
|
||||
|
||||
-- [priv] schematic_override
|
||||
minetest.register_privilege("schematic_override", {
|
||||
description = "Allows you to access schemedit nodes not owned by you",
|
||||
description = S("Allows you to access schemedit nodes not owned by you"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
|
||||
local help_import = ""
|
||||
if can_import then
|
||||
help_import = S("Importing a schematic will load a schematic from the world directory, place it in front of the schematic creator and sets probability and force-place data accordingly.").."\n"
|
||||
end
|
||||
|
||||
-- [node] Schematic creator
|
||||
minetest.register_node("schemedit:creator", {
|
||||
description = "Schematic Creator",
|
||||
_doc_items_longdesc = "The schematic creator is used to save a region of the world into a schematic file (.mts).",
|
||||
_doc_items_usagehelp = "To get started, place the block facing directly in front of any bottom left corner of the structure you want to save. This block can only be accessed by the placer or by anyone with the “schematic_override” privilege.".."\n"..
|
||||
"To save a region, rightclick the block, enter the size, a schematic name and hit “Export schematic”. The file will always be saved in the world directory. Note you can use this name in the /placeschem command to place the schematic again.".."\n\n"..
|
||||
"The other features of the schematic creator are optional and are used to allow to add randomness and fine-tuning.".."\n\n"..
|
||||
"Y slices are used to remove entire slices based on chance. For each slice of the schematic region along the Y axis, you can specify that it occours only with a certain chance. In the Y slice tab, you have to specify the Y slice height (0 = bottom) and a probability from 0 to 255 (255 is for 100%). By default, all Y slices occour always.".."\n\n"..
|
||||
"With a schematic node probability tool, you can set a probability for each node and enable them to overwrite all nodes when placed as schematic. This tool must be used prior to the file export.",
|
||||
description = S("Schematic Creator"),
|
||||
_doc_items_longdesc = S("The schematic creator is used to save a region of the world into a schematic file (.mts)."),
|
||||
_doc_items_usagehelp = S("To get started, place the block facing directly in front of any bottom left corner of the structure you want to save. This block can only be accessed by the placer or by anyone with the “schematic_override” privilege.").."\n"..
|
||||
S("To save a region, use the block, enter the size and a schematic name and hit “Export schematic”. The file will always be saved in the world directory. Note you can use this name in the /placeschem command to place the schematic again.").."\n\n"..
|
||||
help_import..
|
||||
S("The other features of the schematic creator are optional and are used to allow to add randomness and fine-tuning.").."\n\n"..
|
||||
S("Y slices are used to remove entire slices based on chance. For each slice of the schematic region along the Y axis, you can specify that it occurs only with a certain chance. In the Y slice tab, you have to specify the Y slice height (0 = bottom) and a probability from 0 to 255 (255 is for 100%). By default, all Y slices occur always.").."\n\n"..
|
||||
S("With a schematic node probability tool, you can set a probability for each node and enable them to overwrite all nodes when placed as schematic. This tool must be used prior to the file export."),
|
||||
tiles = {"schemedit_creator_top.png", "schemedit_creator_bottom.png",
|
||||
"schemedit_creator_sides.png"},
|
||||
groups = { dig_immediate = 2},
|
||||
@ -833,7 +1016,7 @@ minetest.register_node("schemedit:creator", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
meta:set_string("owner", name)
|
||||
meta:set_string("infotext", "Schematic Creator\n(owned by "..name..")")
|
||||
meta:set_string("infotext", S("Schematic Creator").."\n"..S("(owned by @1)", name))
|
||||
meta:set_string("prob_list", minetest.serialize({}))
|
||||
meta:set_string("slices", minetest.serialize({}))
|
||||
|
||||
@ -874,33 +1057,42 @@ minetest.register_node("schemedit:creator", {
|
||||
after_destruct = function(pos)
|
||||
schemedit.unmark(pos)
|
||||
end,
|
||||
|
||||
-- No support for Minetest Game's screwdriver
|
||||
on_rotate = false,
|
||||
})
|
||||
|
||||
minetest.register_tool("schemedit:probtool", {
|
||||
description = "Schematic Node Probability Tool",
|
||||
description = S("Schematic Node Probability Tool"),
|
||||
_doc_items_longdesc =
|
||||
"This is an advanced tool which only makes sense when used together with a schematic creator. It is used to finetune the way how nodes from a schematic are placed.".."\n"..
|
||||
"It allows you to set two things:".."\n"..
|
||||
"1) Set probability: Chance for any particular node to be actually placed (default: always placed)".."\n"..
|
||||
"2) Enable force placement: These nodes replace node other than air and ignored when placed in a schematic (default: off)",
|
||||
S("This is an advanced tool which only makes sense when used together with a schematic creator. It is used to finetune the way how nodes from a schematic are placed.").."\n"..
|
||||
S("It allows you to set two things:").."\n"..
|
||||
S("1) Set probability: Chance for any particular node to be actually placed (default: always placed)").."\n"..
|
||||
S("2) Enable force placement: These nodes replace node other than air and ignore when placed in a schematic (default: off)"),
|
||||
_doc_items_usagehelp = "\n"..
|
||||
"BASIC USAGE:".."\n"..
|
||||
"Punch to configure the tool. Select a probability (0-255; 255 is for 100%) and enable or disable force placement. Now place the tool on any node to apply these values to the node. This information is preserved in the node until it is destroyed or changed by the tool again. This tool has no effect on schematic voids.".."\n"..
|
||||
"Now you can use a schematic creator to save a region as usual, the nodes will now be saved with the special node settings applied.".."\n\n"..
|
||||
"NODE HUD:".."\n"..
|
||||
"To help you remember the node values, the nodes with special values are labelled in the HUD. The first line shows probability and force placement (with “[F]”). The second line is the current distance to the node. Nodes with default settings and schematic voids are not labelled.".."\n"..
|
||||
"To disable the node HUD, unselect the tool or hit “place” while not pointing anything.".."\n\n"..
|
||||
"UPDATING THE NODE HUD:".."\n"..
|
||||
"The node HUD is not updated automatically any may be outdated. The node HUD only updates the HUD for nodes close to you whenever you place the tool or press the punch and sneak keys simutanously. If you sneak-punch a schematic creator, then the node HUd is updated for all nodes within the schematic creator's region, even if this region is very big.",
|
||||
S("BASIC USAGE:").."\n"..
|
||||
S("Punch to configure the tool. Select a probability (0-255; 255 is for 100%) and enable or disable force placement. Now place the tool on any node to apply these values to the node. This information is preserved in the node until it is destroyed or changed by the tool again. This tool has no effect on schematic voids.").."\n"..
|
||||
S("Now you can use a schematic creator to save a region as usual, the nodes will now be saved with the special node settings applied.").."\n\n"..
|
||||
S("NODE HUD:").."\n"..
|
||||
S("To help you remember the node values, the nodes with special values are labelled in the HUD. The first line shows probability and force placement (with “[F]”). The second line is the current distance to the node. Nodes with default settings and schematic voids are not labelled.").."\n"..
|
||||
S("To disable the node HUD, unselect the tool or hit “place” while not pointing anything.").."\n\n"..
|
||||
S("UPDATING THE NODE HUD:").."\n"..
|
||||
S("The node HUD is not updated automatically and may be outdated. The node HUD only updates the HUD for nodes close to you whenever you place the tool or press the punch and sneak keys simutanously. If you sneak-punch a schematic creator, then the node HUD is updated for all nodes within the schematic creator's region, even if this region is very big."),
|
||||
wield_image = "schemedit_probtool.png",
|
||||
inventory_image = "schemedit_probtool.png",
|
||||
liquids_pointable = true,
|
||||
groups = { disable_repair = 1 },
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local uname = user:get_player_name()
|
||||
if uname and not check_priv(uname) then
|
||||
return
|
||||
end
|
||||
|
||||
local ctrl = user:get_player_control()
|
||||
-- Simple use
|
||||
if not ctrl.sneak then
|
||||
-- Open dialog to change the probability to apply to nodes
|
||||
schemedit.show_formspec(user:getpos(), user, "probtool", true)
|
||||
schemedit.show_formspec(user:get_pos(), user, "probtool", true)
|
||||
|
||||
-- Use + sneak
|
||||
else
|
||||
@ -910,7 +1102,7 @@ minetest.register_tool("schemedit:probtool", {
|
||||
-- within the creator's region.
|
||||
local use_creator_region = false
|
||||
if pointed_thing and pointed_thing.type == "node" and pointed_thing.under then
|
||||
punchpos = pointed_thing.under
|
||||
local punchpos = pointed_thing.under
|
||||
local node = minetest.get_node(punchpos)
|
||||
if node.name == "schemedit:creator" then
|
||||
local pos1, pos2 = schemedit.size(punchpos)
|
||||
@ -925,10 +1117,20 @@ minetest.register_tool("schemedit:probtool", {
|
||||
end
|
||||
end,
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
local uname = user:get_player_name()
|
||||
if uname and not check_priv(uname) then
|
||||
return
|
||||
end
|
||||
|
||||
schemedit.clear_displayed_node_probs(user)
|
||||
end,
|
||||
-- Set note probability and force_place and enable node probability display
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pname = placer:get_player_name()
|
||||
if pname and not check_priv(pname) then
|
||||
return
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
@ -969,9 +1171,9 @@ minetest.register_tool("schemedit:probtool", {
|
||||
})
|
||||
|
||||
minetest.register_node("schemedit:void", {
|
||||
description = "Schematic Void",
|
||||
_doc_items_longdesc = "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.",
|
||||
_doc_items_usagehelp = "Just place the schematic void like any other block and use the schematic creator to save a portion of the world.",
|
||||
description = S("Schematic Void"),
|
||||
_doc_items_longdesc = S("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."),
|
||||
_doc_items_usagehelp = S("Just place the schematic void like any other block and use the schematic creator to save a portion of the world."),
|
||||
tiles = { "schemedit_void.png" },
|
||||
drawtype = "nodebox",
|
||||
is_ground_content = false,
|
||||
@ -992,8 +1194,10 @@ minetest.register_entity("schemedit:display", {
|
||||
visual = "upright_sprite",
|
||||
textures = {"schemedit_border.png"},
|
||||
visual_size = {x=10, y=10},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
pointable = false,
|
||||
physical = false,
|
||||
static_save = false,
|
||||
glow = minetest.LIGHT_MAX,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
if not self.id then
|
||||
@ -1007,39 +1211,104 @@ minetest.register_entity("schemedit:display", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Reset schematic creator border entities",
|
||||
name = "schemedit:reset_border",
|
||||
nodenames = "schemedit:creator",
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("schem_border", "false")
|
||||
end,
|
||||
})
|
||||
|
||||
local function add_suffix(schem)
|
||||
-- Automatically add file name suffix if omitted
|
||||
local schem_full, schem_lua
|
||||
if string.sub(schem, string.len(schem)-3, string.len(schem)) == ".mts" then
|
||||
schem_full = schem
|
||||
schem_lua = string.sub(schem, 1, -5) .. ".lua"
|
||||
else
|
||||
schem_full = schem .. ".mts"
|
||||
schem_lua = schem .. ".lua"
|
||||
end
|
||||
return schem_full, schem_lua
|
||||
end
|
||||
|
||||
-- [chatcommand] Place schematic
|
||||
minetest.register_chatcommand("placeschem", {
|
||||
description = "Place schematic at the position specified or the current "..
|
||||
"player position (loaded from "..export_path_full..".",
|
||||
privs = {debug = true},
|
||||
params = "<schematic name>[.mts] [<x> <y> <z>]",
|
||||
description = S("Place schematic at the position specified or the current player position (loaded from @1)", export_path_trunc),
|
||||
privs = {server = true},
|
||||
params = S("<schematic name>[.mts] [<x> <y> <z>]"),
|
||||
func = function(name, param)
|
||||
local schem, p = string.match(param, "^([^ ]+) *(.*)$")
|
||||
local pos = minetest.string_to_pos(p)
|
||||
|
||||
if not schem then
|
||||
return false, "No schematic file specified."
|
||||
return false, S("No schematic file specified.")
|
||||
end
|
||||
|
||||
if not pos then
|
||||
pos = minetest.get_player_by_name(name):get_pos()
|
||||
end
|
||||
|
||||
-- Automatiically add file name suffix if omitted
|
||||
local schem_full
|
||||
if string.sub(schem, string.len(schem)-3, string.len(schem)) == ".mts" then
|
||||
schem_full = schem
|
||||
local schem_full, schem_lua = add_suffix(schem)
|
||||
local success = false
|
||||
local schem_path = export_path_full .. DIR_DELIM .. schem_full
|
||||
if minetest.read_schematic then
|
||||
-- We don't call minetest.place_schematic with the path name directly because
|
||||
-- this would trigger the caching and we wouldn't get any updates to the schematic
|
||||
-- files when we reload. minetest.read_schematic circumvents that.
|
||||
local schematic = minetest.read_schematic(schem_path, {})
|
||||
if schematic then
|
||||
success = minetest.place_schematic(pos, schematic, "random", nil, false)
|
||||
end
|
||||
else
|
||||
schem_full = schem .. ".mts"
|
||||
-- Legacy support for Minetest versions that do not have minetest.read_schematic
|
||||
success = minetest.place_schematic(schem_path, schematic, "random", nil, false)
|
||||
end
|
||||
|
||||
local success = minetest.place_schematic(pos, export_path_full .. DIR_DELIM .. schem_full, "random", nil, false)
|
||||
|
||||
if success == nil then
|
||||
return false, "Schematic file could not be loaded!"
|
||||
return false, S("Schematic file could not be loaded!")
|
||||
else
|
||||
return true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
if can_import then
|
||||
-- [chatcommand] Convert MTS schematic file to .lua file
|
||||
minetest.register_chatcommand("mts2lua", {
|
||||
description = S("Convert .mts schematic file to .lua file (loaded from @1)", export_path_trunc),
|
||||
privs = {server = true},
|
||||
params = S("<schematic name>[.mts] [comments]"),
|
||||
func = function(name, param)
|
||||
local schem, comments_str = string.match(param, "^([^ ]+) *(.*)$")
|
||||
|
||||
if not schem then
|
||||
return false, S("No schematic file specified.")
|
||||
end
|
||||
|
||||
local comments = comments_str == "comments"
|
||||
|
||||
-- Automatically add file name suffix if omitted
|
||||
local schem_full, schem_lua = add_suffix(schem)
|
||||
local schem_path = export_path_full .. DIR_DELIM .. schem_full
|
||||
local schematic = minetest.read_schematic(schem_path, {})
|
||||
|
||||
if schematic then
|
||||
local str = minetest.serialize_schematic(schematic, "lua", {lua_use_comments=comments})
|
||||
local lua_path = export_path_full .. DIR_DELIM .. schem_lua
|
||||
local file = io.open(lua_path, "w")
|
||||
if file and str then
|
||||
file:write(str)
|
||||
file:flush()
|
||||
file:close()
|
||||
return true, S("Exported schematic to @1", lua_path)
|
||||
else
|
||||
return false, S("Failed!")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
76
locale/schemedit.de.tr
Normal file
76
locale/schemedit.de.tr
Normal file
@ -0,0 +1,76 @@
|
||||
# textdomain: schemedit
|
||||
<world path>=<Weltpfad>
|
||||
<name>=<Name>
|
||||
Probability: @1=Wahrscheinlichkeit: @1
|
||||
Not Set=Nicht gesetzt
|
||||
Force placement=Platzierung erzwingen
|
||||
Hide border=Rand verbergen
|
||||
Show border=Rand anzeigen
|
||||
Position: @1=Position: @1
|
||||
Owner: @1=Eigentümer: @1
|
||||
Size: @1=Größe: @1
|
||||
Schematic name: @1=Schematic-Name: @1
|
||||
Schematic name:=Schematic-Name:
|
||||
OK=OK
|
||||
Save schematic name=Schematic-Name speichern
|
||||
Export schematic=Schematic exportieren
|
||||
Import schematic=Schematic importieren
|
||||
Imported schematic from @1=Schematic von @1 importiert
|
||||
Failed to import schematic from @1=Schematic konnte nicht von @1 importiert werden
|
||||
The schematic will be exported as a .mts file and stored in@n@1=Das Schematic wird als .mts-Datei gespeichert in:@n@1
|
||||
Export/import path:@n@1=Export-/Importpfad:@n@1
|
||||
Save size=Größe speichern
|
||||
Help=Hilfe
|
||||
Exported schematic to @1=Schematic nach @1 exportiert
|
||||
Failed to export schematic to @1=Schematic konnte nicht nach @1 exportiert werden
|
||||
Y Slices=Y-Scheiben
|
||||
Y @= @1; Probability @= @2=Y @= @1; Wahrscheinlichkeit @= @2
|
||||
Done=Fertig
|
||||
Y position (max. @1):=Y-Position (max. @1):
|
||||
Probability (0-255):=Wahrscheinlichkeit (0-255):
|
||||
+ Add slice=+ Neue Scheibe
|
||||
+/- Edit slice=+/- Scheibe bearbeiten
|
||||
- Remove slice=- Scheibe entfernen
|
||||
Schematic Node Probability Tool=Schematic-Node-Wahrscheinlichkeitswerkzeug
|
||||
Probability (0-255)=Wahrscheinlichkeit
|
||||
Cancel=Abbrechen
|
||||
Apply=Anwenden
|
||||
Probability that the node will be placed=Wahrscheinlichkeit, dass der Node platizert wird
|
||||
If enabled, the node will replace nodes other than air and ignore=Wenn aktiviert, wird der Node alle Nodes außer Luft und Ignorieren ersetzen
|
||||
Allows you to access schemedit nodes not owned by you=Damit können Sie auf Schemedit-Nodes, die ihnen nicht gehören, zugreifen
|
||||
Schematic Creator=Schematic-Macher
|
||||
The schematic creator is used to save a region of the world into a schematic file (.mts).=Der Schematic-Macher wird benutzt, um eine Region der Welt in eine Schematic-Datei (.mts) zu speichern.
|
||||
To get started, place the block facing directly in front of any bottom left corner of the structure you want to save. This block can only be accessed by the placer or by anyone with the “schematic_override” privilege.=Um anzufangen, platzieren Sie den Block direkt vor einer beliebigen unteren linken Ecke des Gebäudes, das Sie speichern möchten. Dieser Block kann nur vom Platzierer oder von Spielern mit dem „schematic_override“-Privileg benutzt werden.
|
||||
To save a region, use the block, enter the size and a schematic name and hit “Export schematic”. The file will always be saved in the world directory. Note you can use this name in the /placeschem command to place the schematic again.=Um eine Region zu speichern, benutzen Sie den Block, geben Sie die Größe und einen Schematic-Namen ein und klicken Sie auf „Schematic exportieren“. Die Datei wird immer im Weltverzeichnis gespeichert. Beachten Sie, dass Sie diesen Namen im „/placeschem“-Befehl benutzen können, um das Schematic erneut zu platzieren.
|
||||
Importing a schematic will load a schematic from the world directory, place it in front of the schematic creator and sets probability and force-place data accordingly.=Das Importieren eines Schematics wird eine Schematicdatei aus dem Weltverzeichnis laden, sie vor dem Schematic-Macher platzieren und die Wahrscheinlichkeits- und Zwangsplatzierungsdaten entsprechend setzen.
|
||||
The other features of the schematic creator are optional and are used to allow to add randomness and fine-tuning.=Die anderen Funktionen des Schematic-Machers sind optional und werden für Zufälligkeit und Feinjustierungen benutzt.
|
||||
Y slices are used to remove entire slices based on chance. For each slice of the schematic region along the Y axis, you can specify that it occurs only with a certain chance. In the Y slice tab, you have to specify the Y slice height (0 @= bottom) and a probability from 0 to 255 (255 is for 100%). By default, all Y slices occur always.=Y-Scheiben werden benutzt, um ganze Scheiben mit einer gewissen Wahrscheinlichkeit auszulassen. Für jede Scheibe der Schematic-Region entlang der Y-Achse können Sie festlegen, dass sie nur mit einer gewissen Wahrscheinlichkeit auftritt. In der Registerkarte „Y-Scheiben“ müssen Sie die Höhe der Y-Scheibe festlegen (0 @= Boden) sowie eine Wahrscheinlichkeit zwischen 0 und 255 (255 steht für 100%). Standardmäßig treten alle Y-Scheiben immer auf.
|
||||
With a schematic node probability tool, you can set a probability for each node and enable them to overwrite all nodes when placed as schematic. This tool must be used prior to the file export.=Mit einem Schematic-Node-Wahrscheinlichkeitswerkzeug können Sie die Wahrscheinlichkeit für jeden Node setzen und sie dazu aktivieren, alle Nodes zu ersetzen, wenn sie als Schematic platziert werden. Dieses Werkzeug muss vor dem Dateiexport benutzt werden.
|
||||
(owned by @1)=(Eigentümer: @1)
|
||||
This is an advanced tool which only makes sense when used together with a schematic creator. It is used to finetune the way how nodes from a schematic are placed.=Dies ist ein fortgeschrittenes Werkzeug, der nur sinnvoll in Verwendung mit einem Schematic-Macher benutzt werden kann. Er wird benutzt, um die Art und Weise, wie Nodes aus einem Schematic platziert werden, feinzujustieren.
|
||||
It allows you to set two things:=Damit können Sie zwei Dinge setzen:
|
||||
1) Set probability: Chance for any particular node to be actually placed (default: always placed)=1) Wahrscheinlichkeit setzen: Wahrscheinlichkeit für einen bestimmten Node, dass er tatsächlich platziert wird (Standard: immer platziert)
|
||||
2) Enable force placement: These nodes replace node other than air and ignore when placed in a schematic (default: off)=2) Zwangsplatzierung aktivieren: Diese Nodes ersetzen alle Nodes außer Luft und Ignorieren, wenn Sie in einem Schematic platziert werden (Standard: aus)
|
||||
BASIC USAGE:=GRUNDLEGENDE BENUTZUNG:
|
||||
Punch to configure the tool. Select a probability (0-255; 255 is for 100%) and enable or disable force placement. Now place the tool on any node to apply these values to the node. This information is preserved in the node until it is destroyed or changed by the tool again. This tool has no effect on schematic voids.=Schlagen Sie zu, um das Werkzeug zu konfigurieren. Wählen Sie eine Wahrscheinlichkeit (0-255; 255 steht für 100%) und aktivieren oder deaktivieren Sie die erzwungene Platzierung. Platzieren Sie nun das Werkzeug auf einen beliebigen Node, um diese Werte auf dem Node anzuwenden. Diese Information bleibt im Node erhalten, bis er zerstört oder erneut vom Werkzeug geändert wird. Dieses Werkzeug hat keine Auswirkung auf Schematic-Lücken.
|
||||
Now you can use a schematic creator to save a region as usual, the nodes will now be saved with the special node settings applied.=Anschließend können Sie einen Schematic-Macher benutzen, um eine Region wie gewöhnlich zu speichern, die Nodes werden nun mit den besonderen Node-Einstellungen gespeichert.
|
||||
NODE HUD:=NODE-HUD:
|
||||
To help you remember the node values, the nodes with special values are labelled in the HUD. The first line shows probability and force placement (with “[F]”). The second line is the current distance to the node. Nodes with default settings and schematic voids are not labelled.=Um Ihnen dabei zu helfen, sich die Node-Werte zu merken, werden die Nodes mit besonderen Werten in der Benutzeroberfläche gekennzeichnet. Die erste Zeile zeigt die Wahrscheinlichkeit und die Zwangsplatzierung (mit „[F]“) an. Die zweite Zeile zeigt die momentane Entfernung zum Node an. Nodes mit den Standardeinstellungen und Schematic-Lücken werden nicht gekennzeichnet.
|
||||
To disable the node HUD, unselect the tool or hit “place” while not pointing anything.=Um die Node-HUD zu deaktivieren, wählen Sie das Werkzeug ab oder drücken Sie die Platzierentaste, während Sie auf nichts zeigen.
|
||||
UPDATING THE NODE HUD:=NODE-HUD AKTUALISIEREN:
|
||||
The node HUD is not updated automatically and may be outdated. The node HUD only updates the HUD for nodes close to you whenever you place the tool or press the punch and sneak keys simutanously. If you sneak-punch a schematic creator, then the node HUD is updated for all nodes within the schematic creator's region, even if this region is very big.=Die Node-HUD wird nicht automatisch aktualisiert und kann veraltet sein. Die Node-HUD wird nur die HUD für Nodes in Ihrer Nähe aktualisieren oder wenn Sie das Werkzeug benutzen oder gleichzeitig die Schlag- und Schleichtaste drücken. Wenn Sie auf einen Schematic-Macher schleichschlagen, wird die Node-HUD für alle Nodes innerhalb der Region des Schematic-Machers aktualisiert, selbst, wenn diese Region sehr groß ist.
|
||||
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 speichern (geladen von @1)
|
||||
<schematic name>[.mts] [<x> <y> <z>]=<Schematic-Name>[.mts] [<x> <y> <z>]
|
||||
No schematic file specified.=Keinen Schematic-Namen angegeben.
|
||||
Schematic file could not be loaded!=Schematic-Datei konnte nicht geladen werden!
|
||||
Main=Grundeinstellungen
|
||||
X size:=X-Größe:
|
||||
Y size:=Y-Größe:
|
||||
Z size:=Z-Größe:
|
||||
Insufficient privileges! You need the “@1” privilege to use this.=Unzureichende Privilegien! Sie benötigen das „@1“-Privileg, um dies benutzen zu können.
|
||||
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.
|
74
locale/template.txt
Normal file
74
locale/template.txt
Normal file
@ -0,0 +1,74 @@
|
||||
# textdomain: schemedit
|
||||
<world path>=
|
||||
<name>=
|
||||
Not Set=
|
||||
Probability: @1=
|
||||
Force placement=
|
||||
Hide border=
|
||||
Show border=
|
||||
Position: @1=
|
||||
Owner: @1=
|
||||
Size: @1=
|
||||
Schematic name: @1=
|
||||
Schematic name:=
|
||||
OK=
|
||||
Save schematic name=
|
||||
Export schematic=
|
||||
Import schematic=
|
||||
Imported schematic from @1=
|
||||
Failed to import schematic from @1=
|
||||
Export/import path:@n@1=
|
||||
Save size=
|
||||
Help=
|
||||
Exported schematic to @1=
|
||||
Failed to export schematic to @1=
|
||||
Y Slices=
|
||||
Y @= @1; Probability @= @2=
|
||||
Done=
|
||||
Y position (max. @1):=
|
||||
Probability (0-255):=
|
||||
+ Add slice=
|
||||
+/- Edit slice=
|
||||
Schematic Node Probability Tool=
|
||||
Probability (0-255)=
|
||||
Cancel=
|
||||
Apply=
|
||||
Probability that the node will be placed=
|
||||
If enabled, the node will replace nodes other than air and ignore=
|
||||
Allows you to access schemedit nodes not owned by you=
|
||||
Schematic Creator=
|
||||
The schematic creator is used to save a region of the world into a schematic file (.mts).=
|
||||
To get started, place the block facing directly in front of any bottom left corner of the structure you want to save. This block can only be accessed by the placer or by anyone with the “schematic_override” privilege.=
|
||||
To save a region, use the block, enter the size and a schematic name and hit “Export schematic”. The file will always be saved in the world directory. Note you can use this name in the /placeschem command to place the schematic again.=
|
||||
The other features of the schematic creator are optional and are used to allow to add randomness and fine-tuning.=
|
||||
Y slices are used to remove entire slices based on chance. For each slice of the schematic region along the Y axis, you can specify that it occurs only with a certain chance. In the Y slice tab, you have to specify the Y slice height (0 @= bottom) and a probability from 0 to 255 (255 is for 100%). By default, all Y slices occur always.=
|
||||
With a schematic node probability tool, you can set a probability for each node and enable them to overwrite all nodes when placed as schematic. This tool must be used prior to the file export.=
|
||||
Importing a schematic will load a schematic from the world directory, place it in front of the schematic creator and sets probability and force-place data accordingly.=
|
||||
(owned by @1)=
|
||||
This is an advanced tool which only makes sense when used together with a schematic creator. It is used to finetune the way how nodes from a schematic are placed.=
|
||||
It allows you to set two things:=
|
||||
1) Set probability: Chance for any particular node to be actually placed (default: always placed)=
|
||||
2) Enable force placement: These nodes replace node other than air and ignore when placed in a schematic (default: off)=
|
||||
BASIC USAGE:=
|
||||
Punch to configure the tool. Select a probability (0-255; 255 is for 100%) and enable or disable force placement. Now place the tool on any node to apply these values to the node. This information is preserved in the node until it is destroyed or changed by the tool again. This tool has no effect on schematic voids.=
|
||||
Now you can use a schematic creator to save a region as usual, the nodes will now be saved with the special node settings applied.=
|
||||
NODE HUD:=
|
||||
To help you remember the node values, the nodes with special values are labelled in the HUD. The first line shows probability and force placement (with “[F]”). The second line is the current distance to the node. Nodes with default settings and schematic voids are not labelled.=
|
||||
To disable the node HUD, unselect the tool or hit “place” while not pointing anything.=
|
||||
UPDATING THE NODE HUD:=
|
||||
The node HUD is not updated automatically and may be outdated. The node HUD only updates the HUD for nodes close to you whenever you place the tool or press the punch and sneak keys simutanously. If you sneak-punch a schematic creator, then the node HUD is updated for all nodes within the schematic creator's region, even if this region is very big.=
|
||||
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>]=
|
||||
No schematic file specified.=
|
||||
Schematic file could not be loaded!=
|
||||
Main=
|
||||
X size:=
|
||||
Y size:=
|
||||
Z size:=
|
||||
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.=
|
2
mod.conf
2
mod.conf
@ -1 +1,3 @@
|
||||
name = schemedit
|
||||
optional_depends = doc
|
||||
description = Advanced tool for modders and advanced users to create and edit schematics.
|
||||
|
3
settingtypes.txt
Normal file
3
settingtypes.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# If enabled, exporting a schematic will also create a .lua file
|
||||
# in addition to the .mts file.
|
||||
schemedit_export_lua (.lua file schematic export) bool false
|
Reference in New Issue
Block a user