[Solved] Modifying and using schematics
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
[Solved] Modifying and using schematics
I feel really dumb now but I can't get started with Minetest schematics (.mts files).
There does not seem much information on the file format.
I want to modify a schematic file but I don't know how. WorldEdit can only load .we files. So how can I modify an existing schematic file or somehow load it into WorldEdit so that I can actually use it?
And finally, can I find any more documentation on schematics other than the 2 Lua API functions?
There does not seem much information on the file format.
I want to modify a schematic file but I don't know how. WorldEdit can only load .we files. So how can I modify an existing schematic file or somehow load it into WorldEdit so that I can actually use it?
And finally, can I find any more documentation on schematics other than the 2 Lua API functions?
Last edited by Wuzzy on Tue Dec 05, 2017 10:25, edited 1 time in total.
Re: Modifying and using schematics
There is no mts "editor". You have to convert mts to lua. Look at my code for an example
https://github.com/MarkuBu/minetest_mod ... e/init.lua
I would recommend to use the lua schematics cause they are more flexible to use. Take a look at this code how I use them
https://github.com/MarkuBu/minetest_mod ... e/init.lua
I would recommend to use the lua schematics cause they are more flexible to use. Take a look at this code how I use them
Re: Modifying and using schematics
saveschems is how we do this for minetest_game's tree schematics. We use a simple lua table to describe, and "easily " edit tree shapes, and then write them as .mts. We never go from .mts to lua, although it is possible. You lose too much annotation to make it easy to work with.
https://github.com/minetest-mods/saveschems/
https://github.com/minetest-mods/saveschems/
Re: Modifying and using schematics
handle_schematics does have working mts parser written in lua. https://github.com/Sokomine/handle_sche ... s_file.lua. In the file you find a store_mts_file function to save mts files too, I did not tried it.
A slightly modified version (parser only) you can find in my schemlib mod https://github.com/bell07/minetest-sche ... matics.lua I'll check if I change it to minetest.serialize_schematic if I find time again for this project. Currently I did not tried the minetest.serialize_schematic() at the time.
A slightly modified version (parser only) you can find in my schemlib mod https://github.com/bell07/minetest-sche ... matics.lua I'll check if I change it to minetest.serialize_schematic if I find time again for this project. Currently I did not tried the minetest.serialize_schematic() at the time.
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: Modifying and using schematics
Meh, editing trees and other schematics by text files seems awfully tedious.
I look what WorldEdit can do for me.
What do you mean with “annotation”? MTS files just look like binary gibberish to me.
Is there maybe a way to go from the WorldEdit format (.we) to schematics and vice-versa?
I look what WorldEdit can do for me.
What do you mean with “annotation”? MTS files just look like binary gibberish to me.
Is there maybe a way to go from the WorldEdit format (.we) to schematics and vice-versa?
Re: Modifying and using schematics
MTS files can have probabilities for slices and individual nodes, as well as a force-place flag (bool). This annotation is easily lost if you don't retain it somehow.Wuzzy wrote:Meh, editing trees and other schematics by text files seems awfully tedious.
I look what WorldEdit can do for me.
What do you mean with “annotation”? MTS files just look like binary gibberish to me.
Is there maybe a way to go from the WorldEdit format (.we) to schematics and vice-versa?
I don't think WE schematics handle probabilities. The way we handle this in saveschems is to make easily understandable slice maps, where you can see the probabilities for nodes more easily.
That's how we can place a random amount of side branches in the apple tree schematic, and make the tree height vary:
https://github.com/minetest-mods/savesc ... t.lua#L286
https://github.com/minetest-mods/savesc ... t.lua#L319
yes, it's not the easiest format to work with, but it works well in the end and visualizes the result really well.
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: Modifying and using schematics
OK, thanks for the help so far.
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: Modifying and using schematics
WorldEdit can place a schematic, store it, load a WorldEdit file, store that...and MT itshelf is the editor. There's no good way to handle probability that way. For that case the lua tables seem to be the easiest option. My handle_schematics mod reads .we and .mts files and uses the inbuild minetest.create_schematic(..) for creating new schematics. It is useful if you want to transfer a building from one place or world to another. In such a case it matters if all mods are installed, if the structure will fit into the landscape at the new location, if the front of the house faces in the right direction etc. With trees, there're usually less diffrent nodes to take care of, rotation will not matter, and they'll be placed randomly by mapgen anyway. WorldEdits //mtschemplace and //mtschemcreate ought to be enough for the basics.Wuzzy wrote: Meh, editing trees and other schematics by text files seems awfully tedious.
I look what WorldEdit can do for me.
A list of my mods can be found here.
Re: Modifying and using schematics
and the big question is:
where is the documentation to lua tables?
i need it to create trees for my subgame...
where is the documentation to lua tables?
i need it to create trees for my subgame...
✨🏳️🌈♣️✨
Re: Modifying and using schematics
meow?Wuzzy wrote:That would be http://www.lua.org/manual/5.1/manual.html#2.2.
and how do you use 'that' to make tree models?
(with random height and branches and stuff)
✨🏳️🌈♣️✨
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Modifying and using schematics
Lua_api.txt https://github.com/minetest/minetest/bl ... .txt#L1111 and refer to saveschems mod for examples.
There may also be more advice in other threads in this forum.
There may also be more advice in other threads in this forum.
Re: Modifying and using schematics
thanks, that helps.paramat wrote:Lua_api.txt https://github.com/minetest/minetest/bl ... .txt#L1111 and refer to saveschems mod for examples.
There may also be more advice in other threads in this forum.
now a question about "* `place_center_y`: Placement of this decoration is centered along the Y axis."
can i select a specific node or y-slice as the center or does it always choose the middle?
i mean, how can i define which part of the tree is above ground and which part is underground?
✨🏳️🌈♣️✨
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
Re: Modifying and using schematics
I combined the before mentioned saveschems with duanes schematic_save into Schemtools, just for the very reason that there is no such thing out there to handle schematics comfortably. Maybe it helps.
For reverence this is how a file could look like.
It is easier to understand by example. Each letter is a node. I ordered them into blocks of x width and y height which gives nice sliced trough the tree - unfortunately upside down.
By default the bottom nodes are placed one node deeper than the terrain.
force_place here makes sure tree trunks are placed and not cut of by leaves of neighboring schems.
_ = {name = "air", prob = 0} makes sure no nodes are placed there. "prob" is probability (0-255).
yslice_prob removes a complete slice, the schematic then shrinks down. In this case it creates variable trunk heights.
I had to learn this all in the last days from spares documentation, form comments and some testing.
For reverence this is how a file could look like.
Code: Select all
-- Tree
local _ = {name = "air", prob = 0}
local L = {name = "default:leaves"}
local T = {name = "default:tree", force_place = true}
return = {
yslice_prob = {
{ypos = 2, prob = 127},
{ypos = 3, prob = 127},
{ypos = 4, prob = 127},
},
size = {
y = 10,
x = 5,
z = 5
},
data = {
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, L, _, _,
_, L, L, L, _,
_, _, L, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, L, L, L, _,
L, L, L, L, L,
_, L, L, L, _,
_, _, L, _, _,
_, _, T, _, _,
_, _, T, _, _,
_, _, T, _, _,
_, _, T, _, _,
_, _, T, _, _,
_, _, T, _, _,
L, L, T, L, L,
L, L, T, L, L,
L, L, L, L, L,
_, L, L, L, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, L, L, L, _,
L, L, L, L, L,
_, L, L, L, _,
_, _, L, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, _, _, _,
_, _, L, _, _,
_, L, L, L, _,
_, _, L, _, _,
_, _, _, _, _,
}
}
By default the bottom nodes are placed one node deeper than the terrain.
force_place here makes sure tree trunks are placed and not cut of by leaves of neighboring schems.
_ = {name = "air", prob = 0} makes sure no nodes are placed there. "prob" is probability (0-255).
yslice_prob removes a complete slice, the schematic then shrinks down. In this case it creates variable trunk heights.
I had to learn this all in the last days from spares documentation, form comments and some testing.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Modifying and using schematics
All of the previous post is correct.
> or does it always choose the middle?
i mean, how can i define which part of the tree is above ground and which part is underground?
It always chooses the middle.
What you can do is make the schematic taller than it needs to be and have some of it empty if you need a particular level to be the middle. I will be doing this with the larger jungletrees to add roots.
> or does it always choose the middle?
i mean, how can i define which part of the tree is above ground and which part is underground?
It always chooses the middle.
What you can do is make the schematic taller than it needs to be and have some of it empty if you need a particular level to be the middle. I will be doing this with the larger jungletrees to add roots.
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: Modifying and using schematics
I realize this is bumping an old thread but, I had not seen this before (overlooked it).
And I just want to say...
Very simple and easy to use/understand.
Thank you
And I just want to say...
Casimir, I love this new tool.Casimir wrote:I combined the before mentioned saveschems with duanes schematic_save into Schemtools, just for the very reason that there is no such thing out there to handle schematics comfortably. Maybe it helps.
Very simple and easy to use/understand.
Thank you
A Wonderful World
Who is online
Users browsing this forum: No registered users and 5 guests