Page 1 of 1

Modifying and using schematics

PostPosted: Thu Mar 09, 2017 00:46
by Wuzzy
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?

Re: Modifying and using schematics

PostPosted: Thu Mar 09, 2017 06:37
by burli
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

Re: Modifying and using schematics

PostPosted: Thu Mar 09, 2017 06:56
by sofar
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/

Re: Modifying and using schematics

PostPosted: Thu Mar 09, 2017 16:18
by bell07
handle_schematics does have working mts parser written in lua. https://github.com/Sokomine/handle_schematics/blob/master/analyze_mts_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-schemlib/blob/master/schematics.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.

Re: Modifying and using schematics

PostPosted: Thu Mar 09, 2017 18:50
by Wuzzy
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?

Re: Modifying and using schematics

PostPosted: Thu Mar 09, 2017 19:14
by sofar
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?


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.

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.

Re: Modifying and using schematics

PostPosted: Fri Mar 10, 2017 00:07
by Wuzzy
OK, thanks for the help so far.