[Mod] Save and import buildings [handle_schematics]

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Update:

It is now possible to "manually" build a house from a schematic. This is also useful for NPC that want to "help" and for letting villages grow (perhaps in the future).

You still need to type "/giveme handle_schematics:build" in order to get a chest as there is no craft receipe yet. I won't add one before I've added checks that the area the house will be placed at can actually be used by the player. If you have the creative priv, placing schematics with the chest and restoring backups will work as usual. But: If you don't have the creative priv (type "/revoke singleplayer creative"), then you'll only get hints as to what needs to be done in order to build the house:

Image
This digging indicator tells you (and hopefully also NPC in the future once they learn this) to dig down a certain amount of blocks at this location because they're the wrong blocks here. The amount of blocks is also provided as metadata.

Image
If there is no wrong block in the way, a scaffolding node like in the picture will be placed. If you point at it with your mouse you'll see which block is wanted there. Right-clicking the scaffolding node will take the target node from your inventory (provided you have one of that type), remove the scaffolding node and place the needed node from your inventory with the correct rotation. Again, information about which block belongs there and how to rotate it is provided via metadata. NPC ought to be able to "help" or even build by themshelves without having to know the big picture.

Image
The structure in the foreground is composed of these nodes. The house in the background has been built the same way and is almost finished.

"Dig here"-indicators and scaffolding nodes can be digged. They do not drop anything as they're automaticly placed nodes. The build chest provides an update function.
Attachments
handle_schematics_example.jpg
handle_schematics_example.jpg (249.23 KiB) Viewed 888 times
handle_schematics_scaffolding_setup.jpg
handle_schematics_scaffolding_setup.jpg (39.87 KiB) Viewed 888 times
handle_schematics_dig_here.jpg
handle_schematics_dig_here.jpg (25.05 KiB) Viewed 888 times
A list of my mods can be found here.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Image
And this is how the menu of the build chest will look in this non-creative mode. Once you've digged a few surplus nodes and placed others by right-clicking the scaffolding nodes, just click on "Check project status/update", and any missing dig-here-indicators or scaffolding nodes will be placed. The display of missing nodes will then also be updated. Aborting a project can be done by clicking on "restore original landscape", then "abort this project and select new", confirm with "yes"-button and click on "back" as often as necessary.
Attachments
handle_schematics_progres.jpg
handle_schematics_progres.jpg (127.55 KiB) Viewed 888 times
A list of my mods can be found here.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Sometimes you may wish to edit a schematic and save a modified version. At least I need to do so quite often. Removing the build chest with worldedit and placing new chests in order to save the new building was a bit tiresome. Therefore there's now an option to save the current stage of the building:
Image

After clicking on "Save current building as..", you will be asked for the filename:
Image

Keep in mind that handle_schematics adds two values to the filename. The first one is how deep the building is burried. Cellars can be handled that way. In the example above, the value is "_1" - meaning: "include the floor". The second parameter is the rotation in degrees (_0, _90, _180 or _270). If you want to overwrite the existing file, you'll have to remove the "_1_180" in this case here. It will be automaticly added again.
Attachments
handle_schematics_save2.jpg
handle_schematics_save2.jpg (32.1 KiB) Viewed 888 times
handle_schematics_save.jpg
handle_schematics_save.jpg (273.91 KiB) Viewed 888 times
A list of my mods can be found here.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Please note: You no longer need to add handle_schematics to the list of trusted mods. It does not need an exception. What I originally wanted to do - provide a file browser for schematics from diffrent worlds and mods - is not possible with mod_security beeing enabled because mod_security is too restrictive even when reading files. Disabling mod_security would be a very bad idea. Thus you're stuck with copying schematics you want to use to your WORLD/schems/ folder manually.
A list of my mods can be found here.

Robsoie
Member
Posts: 104
Joined: Fri Apr 29, 2016 16:22

Re: Save and import buildings [handle_schematics]

by Robsoie » Post

Hello,

Just tried this to see if it made the mts importing more convenient as it seemed to have some interesting options instead of using the worldedit gui.

But unlike the worldedit gui that had me just placing the position 1 block and type //mtschemplace nameofmymts , handle schematic is really puzzling me as it really does not do that :

After putting down a chest, i use it and simply press the "import from world" button, the "current world" and then the mts i had previously placed in the ....\worldfoldername\schems\

Then the menu show me the various nodes that i can replace with something else if i wish to see, then i press Proceed as all that is default is convenient for my test.

After that, i notice the "scaffold" is created, even if i don't want it that's ok as it's probably some placeholder to show me where the thing is going to appear.

"check project status/update" shows me the list of materials i need, it evens tell me how much blocks will be dug, i don't need that information but ok it's nice to have.
I can save the building into a new mts , ok

And after looking at the other buttons i'm now puzzled : i don't find any button that get rid of the ugly scaffold that i do not need and actually create the actual building i want to import.

I checked a video :
https://www.youtube.com/watch?v=jyqM-k1P02s
But it was done very likely before the scaffolding stuff was implemented so it's not giving much help

So help please ?

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Robsoie wrote: After that, i notice the "scaffold" is created, even if i don't want it that's ok as it's probably some placeholder to show me where the thing is going to appear.
If you do not have the "creative" priv, the building will only be placed as scaffolding. Unified_inventory uses the creative priv as well. If you have that priv, you can obtain selected items for free from the inventory, refill stacks and repair tools easily while still not having to switch to playing in creative mode. Just type "/grant singleplayer creative" in your singleplayer world and you'll get the entire building and not only the scaffolding structure which is intended for manual building and for npc. If you want to build manually, just right-click one of the scaffolding nodes while having the right materials in your inventory.
A list of my mods can be found here.

Robsoie
Member
Posts: 104
Joined: Fri Apr 29, 2016 16:22

Re: Save and import buildings [handle_schematics]

by Robsoie » Post

I was in creative mode when i tested and i only see the scaffolding for the imported mts, i don't get the actual building.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

You need the creative privilege - not creative mode. That's something else and independent of this :-) Grant yourshelf creative ("/grant singleplayer all" will also do) and you'll get the full buildings. Unified_inventory uses the creative priv to determine if it can create materials out of thin air, and so I used the same priv for handle_schematics.
A list of my mods can be found here.

Robsoie
Member
Posts: 104
Joined: Fri Apr 29, 2016 16:22

Re: Save and import buildings [handle_schematics]

by Robsoie » Post

/grant singleplayer all and still only scaffolding after re-importing the mts :

Image

edit : after trying /grant singleplayer creative from a previous post of yours, i received the message "unknown privilege creative"

I guessed that maybe unified inventory wasn't optional at all and was actually required , and i was right.
After enabling unified inventory, when doing /grant singleplayer creative, it indeed provided me that privilege and i was able to actually import the mts with handle schematic

Image

you may want to add in your first post that handle schematic require unified inventory to have the actual import work and not only the scaffolding.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Robsoie wrote: I guessed that maybe unified inventory wasn't optional at all and was actually required , and i was right.
After enabling unified inventory, when doing /grant singleplayer creative, it indeed provided me that privilege and i was able to actually import the mts with handle schematic
Sorry for that. Unified_inventory got such a standard mod for me that none of my worlds is without it. I did believe that the creative priv came from minetest_game. Thanks for spotting that error! The newest version of handle_schematics defines the creative priv now so that you don't need unified_inventory.
A list of my mods can be found here.

Robsoie
Member
Posts: 104
Joined: Fri Apr 29, 2016 16:22

Re: Save and import buildings [handle_schematics]

by Robsoie » Post

I just re-downloaded handle schematics to test your priv change and i confirm it now works without the need of unified inventory.

Though i'm running into another problem : how to really "complete" a project to get rid of the chest ?

I mean after placing the chest and importing successfully a mts , i have now a new building in my world, i can restore things by using the chest etc...

But when i'm satisfied and consider the "project" finished, i am still unable to get rid of that chest because it is still "assigned to a project" and i see no button in the chest menu to end that assignement once the project is done, so i'm stuck with that chest i want to remove from the completed scenery.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Robsoie wrote: But when i'm satisfied and consider the "project" finished, i am still unable to get rid of that chest because it is still "assigned to a project" and i see no button in the chest menu to end that assignement once the project is done, so i'm stuck with that chest i want to remove from the completed scenery.
That's right. I have no idea yet as to how to best accomplish that. I want to avoid accidental digging of the chest and accidental loss of the "restore original landscape" option. In my worlds I usually use WorldEdit to get rid of surplus chests, but that's not a very good solution. A button might help. It just needs a good inscription. And maybe some asking of "are you sure?".
A list of my mods can be found here.

Robsoie
Member
Posts: 104
Joined: Fri Apr 29, 2016 16:22

Re: Save and import buildings [handle_schematics]

by Robsoie » Post

Yes, a confirmation would be useful to avoid a misclick and having the "restore landscape" possibility removed definitively.

BBmine
Member
Posts: 3476
Joined: Sun Jul 12, 2015 22:51
GitHub: BBmine
IRC: BBmine
In-game: Baggins
Location: USA

Re: Save and import buildings [handle_schematics]

by BBmine » Post

Code: Select all

2017-06-22 11:38:01: ERROR[Main]: ModError: Failed to load and run script from /home/bbmine/.minetest/games/noob_academy/mods/handle_schematics/init.lua:
2017-06-22 11:38:01: ERROR[Main]: ...andle_schematics/build_chest_add_schems_by_directory.lua:160: attempt to index field 'settings' (a nil value)
2017-06-22 11:38:01: ERROR[Main]: stack traceback:
2017-06-22 11:38:01: ERROR[Main]: 	...andle_schematics/build_chest_add_schems_by_directory.lua:160: in main chunk
2017-06-22 11:38:01: ERROR[Main]: 	[C]: in function 'dofile'
2017-06-22 11:38:01: ERROR[Main]: 	...etest/games/noob_academy/mods/handle_schematics/init.lua:83: in main chunk
What's wrong?

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

Small update:
- Adding handle_schematics to secure.trusted_mods is no longer necessary.
- The mod works again with older versions of MT.
A list of my mods can be found here.

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: Save and import buildings [handle_schematics]

by ManElevation » Post

wow did is world edit copyed by this?
My Public Mods! Discord: Rottweiler Games#3368

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

ManElevation wrote: wow did is world edit copyed by this?
WorldEdit and handle_schematics serve diffrent purposes. You can save and load schematics in WorldEdit as well - by using pos1 and pos2 and /mtschemcreate. handle_schematics lets you place the build chest and select the schematic from a menu. It is also possible to restore the original landscape and to try out diffrent materials for your schematic.
A list of my mods can be found here.

User avatar
BirgitLachner
Member
Posts: 393
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: Save and import buildings [handle_schematics]

by BirgitLachner » Post

Hallo Sokomine,

I tried to import an mts file into a world. They are from the "Share you WorldEdit-Files" Thread. One was okay (the ship on the first page), but two others caused a crash (at first grey screen).

What is the reason for that or is there any chance to do this import without crash in a special and secret mode?

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: Save and import buildings [handle_schematics]

by twoelk » Post

might be problems with missing mods.
would be usefull to know which mts files you tried - some might not be compatible with the used mt version and some might be too large (out of memory problem of LuaJit although there is enough ram availiable)

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

BirgitLachner wrote: I tried to import an mts file into a world. They are from the "Share you WorldEdit-Files" Thread. One was okay (the ship on the first page), but two others caused a crash (at first grey screen).
It's hard to tell what went wrong for you without knowing the error message. When MT crashes, it usually says why in the debug.txt file and/or on the console where it was started. Can you please try again and tell me the error message? Out of memory errors are possible, but those are rare, and the share-your-worldedit-files-thread usually has rather small buildings.
A list of my mods can be found here.

User avatar
BirgitLachner
Member
Posts: 393
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: Save and import buildings [handle_schematics]

by BirgitLachner » Post

Code: Select all

2017-08-25 17:48:13: WARNING[Server]: Map::setNodeTimer(): Block not found
2017-08-25 17:48:17: WARNING[Server]: Map::setNodeTimer(): Block not found
2017-08-25 17:48:24: WARNING[Server]: Map::setNodeTimer(): Block not found
2017-08-25 17:48:30: WARNING[Server]: Map::setNodeTimer(): Block not found
2017-08-25 17:50:07: WARNING[Server]: Map::setNodeTimer(): Block not found
2017-08-25 17:50:20: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback node_on_receive_fields(): ...git/.minetest/mods/handle_schematics/place_buildings.lua:460: attempt to index a nil value
2017-08-25 17:50:20: ERROR[Main]: stack traceback:
2017-08-25 17:50:20: ERROR[Main]: 	...git/.minetest/mods/handle_schematics/place_buildings.lua:460: in function 'generate_building_what_to_place_here_and_how'
2017-08-25 17:50:20: ERROR[Main]: 	...git/.minetest/mods/handle_schematics/place_buildings.lua:693: in function 'generate_building'
2017-08-25 17:50:20: ERROR[Main]: 	...git/.minetest/mods/handle_schematics/place_buildings.lua:1032: in function 'place_building_using_voxelmanip'
2017-08-25 17:50:20: ERROR[Main]: 	...git/.minetest/mods/handle_schematics/place_buildings.lua:1126: in function 'place_building_from_file'
2017-08-25 17:50:20: ERROR[Main]: 	.../birgit/.minetest/mods/handle_schematics/build_chest.lua:764: in function <.../birgit/.minetest/mods/handle_schematics/build_chest.lua:624>
I tried to import the "hotel_blaue_augen"

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

BirgitLachner wrote: I tried to import the "hotel_blaue_augen"
The hotel is a very large building. I'm afraid it is too large for the approach handle_schematics takes. You may have more success with

Code: Select all

//mtschemplace hotel_blaue_augen.mts
from WorldEdit. That approach makes use of the engine's import function and does not read the file manually like handle_schematics does.

Unexpected results may also happen when trying to load something that makes use of hardware coloring. I need to adjust the code for that. But that's not a problem with the hotel.
A list of my mods can be found here.

lonestar
Member
Posts: 54
Joined: Mon Jul 17, 2017 03:25
Location: Texas,USA

Re: Save and import buildings [handle_schematics]

by lonestar » Post

Edit: nm , got it figured out

lonestar
Member
Posts: 54
Joined: Mon Jul 17, 2017 03:25
Location: Texas,USA

Re: Save and import buildings [handle_schematics]

by lonestar » Post

Also an issue that started recently, handle_schematics disables itself every time i exit world/game. i have to re-enable before starting world. Minetest ver 0.4.16

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Save and import buildings [handle_schematics]

by Sokomine » Post

lonestar wrote: Also an issue that started recently, handle_schematics disables itself every time i exit world/game. i have to re-enable before starting world. Minetest ver 0.4.16
I have no idea what might cause such behaviour.
A list of my mods can be found here.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 22 guests