[Mod] Schematic Saver [schematic_save]

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

[Mod] Schematic Saver [schematic_save]

by duane » Thu Apr 07, 2016 19:05

This mod lets you mark two positions and save everything inside as a lua schematic file. Node names and rotation data are included, and air is automatically set to prob = 0, so that it won't overwrite anything else. The format is reasonably compact:

Code: Select all
local n1 = { name = "default:sand" }
local n2 = { name = "default:river_water_source" }
local n3 = { name = "default:river_water_flowing", param2 = 7 }
...

local schem = {
   yslice_prob = {

   },
   size = {
      y = 14,
      x = 15,
      z = 11
   }
   ,
   data = {
      n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n3, n3,
      n4, n4, n4, n4, n4, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5,
      n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5,
      ...
   }
}


The code is almost entirely lifted from WorldEdit, and marking positions works the same way. Go to a spot and type "//pos1", then another and type "//pos2". Then type in "//save <file>". The schematic will be saved in your world directory, with a ".txt" suffix. You can then copy it to an appropriate file and add register_decoration code.

Image

The source is available on github.

License: AGPL 3

Mod dependencies: none

Download: https://github.com/duane-r/schematic_sa ... master.zip
Believe in people and you don't need to believe anything else.
 

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Issues

by duane » Thu Apr 07, 2016 19:05

There are no issues that I know of. However, there are no permissions required to use this mod, so it's not something you'll want to keep running all the time.
Believe in people and you don't need to believe anything else.
 

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [Mod] Schematic Saver [schematic_save]

by duane » Thu Apr 07, 2016 19:12

If anyone wants a really big example, here's a building from Cityscape. Don't set your fill_ratio too high with this. It gets ugly.
Attachments
cityscape-schem-example.zip
(10.18 KiB) Downloaded 28 times
Believe in people and you don't need to believe anything else.
 

User avatar
TumeniNodes
Member
 
Posts: 2546
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [Mod] Schematic Saver [schematic_save]

by TumeniNodes » Fri Apr 08, 2016 01:08

Don't mean to sound dumb..., it just comes natural to me :D
So this means I could take a building from one world I built, and transfer it to another world I'd like it to be in?
I'm not your buddy, guy...
 

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [Mod] Schematic Saver [schematic_save]

by duane » Fri Apr 08, 2016 02:20

thegreatone wrote:Don't mean to sound dumb..., it just comes natural to me :D
So this means I could take a building from one world I built, and transfer it to another world I'd like it to be in?


That's more in line with WorldEdit. This is for developers who want to make schematics easily from something they built and want to put everywhere in a mod. You have to use lua to place the schematic.
Believe in people and you don't need to believe anything else.
 

User avatar
TumeniNodes
Member
 
Posts: 2546
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
 

User avatar
paramat
Developer
 
Posts: 3254
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod] Schematic Saver [schematic_save]

by paramat » Sat Apr 09, 2016 22:37

Useful, the WE version seems to have problems.
Adding the ability to set probability and per-node force-place would be useful.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Schematic Saver [schematic_save]

by Sokomine » Fri Apr 22, 2016 16:14

TumeniNodes wrote:So this means I could take a building from one world I built, and transfer it to another world I'd like it to be in?

For that, you might also want to take a look at the build chest from my handle_schematics mod. It makes loading buildings a lot more convenient than with plain WorldEdit.
A list of my mods can be found here.
 

User avatar
TumeniNodes
Member
 
Posts: 2546
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [Mod] Schematic Saver [schematic_save]

by TumeniNodes » Fri Apr 22, 2016 16:51

Thank you Sokomine, I will definitely check that out.
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Schematic Saver [schematic_save]

by burli » Sat Aug 13, 2016 05:16

and air is automatically set to prob = 0, so that it won't overwrite anything else.


What if air should overwrite? I saw last time grass in wooden planks because it was mat removed
 

User avatar
D00Med
Member
 
Posts: 937
Joined: Sat Feb 07, 2015 22:49
Location: Australia...somewhere
GitHub: D00Med
 

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [Mod] Schematic Saver [schematic_save]

by duane » Sat Aug 13, 2016 23:36

burli wrote:
and air is automatically set to prob = 0, so that it won't overwrite anything else.


What if air should overwrite? I saw last time grass in wooden planks because it was mat removed


Code: Select all
sed -i -e 's/prob = 0/prob = 255/g' filename
Believe in people and you don't need to believe anything else.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Schematic Saver [schematic_save]

by burli » Tue Feb 14, 2017 08:34

I use this mod to save trees I build. Works fine so far. But is it possible to format the output of data like this? This makes it easier to edit the data. Currently I format this by hand

Code: Select all
   size = {
      y = 10,
      x = 9,
      z = 11
   }
,
   data = {
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, lf, lf, lf, ai, lf, lf, lf, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, lf, ai, ai, ai, ai, ai, ai,
         lf, lf, lf, lf, lf, lf, lf, lf, lf,
         ai, lf, lf, lf, ai, lf, lf, lf, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, lf, lf, lf, ai, ai, lf, ai, ai,
         lf, lf, n3, lf, lf, lf, n4, lf, lf,
         ai, lf, lf, lf, lf, lf, lf, lf, lf,
         ai, ai, lf, lf, lf, lf, lf, lf, ai,
         
 

User avatar
Milan*
Member
 
Posts: 248
Joined: Thu May 28, 2015 06:45
Location: Germany
GitHub: tchncs
IRC: Passant
In-game: Milan Passant

Re: [Mod] Schematic Saver [schematic_save]

by Milan* » Sun Feb 26, 2017 19:38

Oh wonderful, so i don't have to write them by hand anymore - thanks. :)
Illuna Minetestservers | Mastodon | [ matrix ] | I may host you a Minetestserver, just contact me.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Schematic Saver [schematic_save]

by burli » Sun Feb 26, 2017 19:54

Milan* wrote:Oh wonderful, so i don't have to write them by hand anymore - thanks. :)


You still have some work to do, but it is a lot easier
 

User avatar
Milan*
Member
 
Posts: 248
Joined: Thu May 28, 2015 06:45
Location: Germany
GitHub: tchncs
IRC: Passant
In-game: Milan Passant

Re: [Mod] Schematic Saver [schematic_save]

by Milan* » Sun Feb 26, 2017 19:55

Sure, but the most horrible work is done by your mod. :)
Illuna Minetestservers | Mastodon | [ matrix ] | I may host you a Minetestserver, just contact me.
 

User avatar
duane
Member
 
Posts: 1274
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [Mod] Schematic Saver [schematic_save]

by duane » Mon Feb 27, 2017 00:40

burli wrote:I use this mod to save trees I build. Works fine so far. But is it possible to format the output of data like this? This makes it easier to edit the data. Currently I format this by hand

Code: Select all
   size = {
      y = 10,
      x = 9,
      z = 11
   }
,
   data = {
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, lf, lf, lf, ai, lf, lf, lf, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, lf, ai, ai, ai, ai, ai, ai,
         lf, lf, lf, lf, lf, lf, lf, lf, lf,
         ai, lf, lf, lf, ai, lf, lf, lf, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, ai, ai, ai, ai, ai, ai, ai, ai,
         ai, lf, lf, lf, ai, ai, lf, ai, ai,
         lf, lf, n3, lf, lf, lf, n4, lf, lf,
         ai, lf, lf, lf, lf, lf, lf, lf, lf,
         ai, ai, lf, lf, lf, lf, lf, lf, ai,
         


It's certainly possible. It's not a high priority for me. You're just talking about replacing elements with variables, I take it?
Believe in people and you don't need to believe anything else.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Schematic Saver [schematic_save]

by burli » Mon Feb 27, 2017 08:20

I don't talk about the variable names. I talk about the structure. Let's assume the schematic has a size of 3x3x3 and only air. Currently the output looks something like this

Code: Select all
ai, ai, ai, ai, ai, ai, ai, ai,
ai, ai, ai, ai, ai, ai, ai, ai,
ai, ai, ai, ai, ai, ai, ai, ai,
ai, ai, ai,


This would be easier to edit

Code: Select all
ai, ai, ai,
ai, ai, ai,
ai, ai, ai,

ai, ai, ai,
ai, ai, ai,
ai, ai, ai,

ai, ai, ai,
ai, ai, ai,
ai, ai, ai,
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 2 guests