[Mod] Schematic Saver [schematic_save]

Post Reply
User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

[Mod] Schematic Saver [schematic_save]

by duane » Post

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: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Issues

by duane » Post

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: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by duane » Post

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 82 times
Believe in people and you don't need to believe anything else.

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

Re: [Mod] Schematic Saver [schematic_save]

by TumeniNodes » Post

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?
A Wonderful World

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

Re: [Mod] Schematic Saver [schematic_save]

by duane » Post

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: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by TumeniNodes » Post

Ok, thank you
A Wonderful World

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

Re: [Mod] Schematic Saver [schematic_save]

by paramat » Post

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: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Schematic Saver [schematic_save]

by Sokomine » Post

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: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by TumeniNodes » Post

Thank you Sokomine, I will definitely check that out.
A Wonderful World

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

Re: [Mod] Schematic Saver [schematic_save]

by burli » Post

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: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: [Mod] Schematic Saver [schematic_save]

by D00Med » Post

ooh nice idea! I'll definitely be using this.
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

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

Re: [Mod] Schematic Saver [schematic_save]

by duane » Post

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: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by azekill_DIABLO » Post

+1
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

Re: [Mod] Schematic Saver [schematic_save]

by burli » Post

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: 255
Joined: Thu May 28, 2015 06:45
GitHub: tchncs
IRC: Passant
In-game: Milan Passant
Location: Germany
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by Milan* » Post

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

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

Re: [Mod] Schematic Saver [schematic_save]

by burli » Post

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: 255
Joined: Thu May 28, 2015 06:45
GitHub: tchncs
IRC: Passant
In-game: Milan Passant
Location: Germany
Contact:

Re: [Mod] Schematic Saver [schematic_save]

by Milan* » Post

Sure, but the most horrible work is done by your mod. :)

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

Re: [Mod] Schematic Saver [schematic_save]

by duane » Post

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: 1643
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Schematic Saver [schematic_save]

by burli » Post

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, 

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests