Save mapdata in world directory
This commit is contained in:
parent
b7ceb45544
commit
d82769a68a
@ -16,9 +16,8 @@ The tutorial castle is saved in the game itself in schematics and other binary m
|
|||||||
6. Edit the map to your likings
|
6. Edit the map to your likings
|
||||||
7. Grant yourselves the `tutorialmap` privilege
|
7. Grant yourselves the `tutorialmap` privilege
|
||||||
8. Use `/tsave` command to save the map
|
8. Use `/tsave` command to save the map
|
||||||
9. Test your world: Disable the two settings from steps 2 and 3, create a new world and test it
|
|
||||||
|
|
||||||
The changes will end up in `mods/tutorial_mapgen/mapdata`. If everything worked, you can now commit the changes, use them in a patch or whatever.
|
The changes will end up in `<world directory>/mapdata`. Copy this directory to `<game directory>/mods/tutorial_mapgen`, overwriting files, if neccessary.
|
||||||
|
|
||||||
If you want to edit item spawn positions, see the details below.
|
If you want to edit item spawn positions, see the details below.
|
||||||
|
|
||||||
@ -41,7 +40,9 @@ tutorial_debug_edit_item_spawners = true
|
|||||||
This enables the `/treset` and `/tsave` commands to help editing the schematic. It also forces the Tutorial to only generate the raw castle, not the grasslands. Also, the item spawners become visible.
|
This enables the `/treset` and `/tsave` commands to help editing the schematic. It also forces the Tutorial to only generate the raw castle, not the grasslands. Also, the item spawners become visible.
|
||||||
|
|
||||||
Create a new world in Creative Mode. Now edit the map to your likings using your instant digging power and the creative inventory. You can of course WorldEdit to speed up the process.
|
Create a new world in Creative Mode. Now edit the map to your likings using your instant digging power and the creative inventory. You can of course WorldEdit to speed up the process.
|
||||||
If you're finished, grant yourself the `tutorialmap` privilege and use the `/tsave` command. This updates the map files in `mods/tutorial_mapgen/mapdata`. Note that there are limits as for how big the tutorial castle can be.
|
If you're finished, grant yourself the `tutorialmap` privilege and use the `/tsave` command. This updates the map files in `<world directory>/mapdata`. Note that there are limits as for how big the tutorial castle can be.
|
||||||
|
|
||||||
|
Copy the contents of this directory to the `tutorial_mapgen` mod under `mapdata` and overwrite files as neccessary. Test your changes by creating a new world. If everything went fine, you can commit your changes now.
|
||||||
|
|
||||||
### About item spawners
|
### About item spawners
|
||||||
To place items in the map, you must use the item spawners, these are simple nodes that spawn items. They have 2 states: active and inactive.
|
To place items in the map, you must use the item spawners, these are simple nodes that spawn items. They have 2 states: active and inactive.
|
||||||
|
@ -16,6 +16,7 @@ local c_grass = minetest.get_content_id("default:grass_5")
|
|||||||
|
|
||||||
-- Directory where the map data will be stored
|
-- Directory where the map data will be stored
|
||||||
tutorial.map_directory = minetest.get_modpath("tutorial_mapgen").."/mapdata/"
|
tutorial.map_directory = minetest.get_modpath("tutorial_mapgen").."/mapdata/"
|
||||||
|
tutorial.map_save_directory = minetest.get_worldpath().."/mapdata/"
|
||||||
|
|
||||||
local insecure_environment = minetest.request_insecure_environment()
|
local insecure_environment = minetest.request_insecure_environment()
|
||||||
|
|
||||||
@ -233,9 +234,12 @@ local function load_region(minp, filename, vmanip, rotation, replacements, force
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function save_schematic()
|
local function save_schematic()
|
||||||
|
minetest.log("action", "[tutorial_mapgen] Map data save requested")
|
||||||
|
minetest.chat_send_all("Saving map data, please wait ...")
|
||||||
local success = true
|
local success = true
|
||||||
|
minetest.mkdir(tutorial.map_save_directory)
|
||||||
for k,sector in pairs(tutorial.map_sector) do
|
for k,sector in pairs(tutorial.map_sector) do
|
||||||
local filename = tutorial.map_directory .. "sector_"..k
|
local filename = tutorial.map_save_directory .. "sector_"..k
|
||||||
local minp = sector
|
local minp = sector
|
||||||
local maxp = {
|
local maxp = {
|
||||||
x = sector.x + sector.l,
|
x = sector.x + sector.l,
|
||||||
@ -247,6 +251,9 @@ local function save_schematic()
|
|||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if success then
|
||||||
|
minetest.chat_send_all("Map data saved to: "..tutorial.map_save_directory)
|
||||||
|
end
|
||||||
return success
|
return success
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -305,9 +312,7 @@ if map_editing then
|
|||||||
description = "Saves the tutorial map",
|
description = "Saves the tutorial map",
|
||||||
privs = {tutorialmap=true},
|
privs = {tutorialmap=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if save_schematic() then
|
if not save_schematic() then
|
||||||
minetest.chat_send_player(name, "Tutorial World schematic saved")
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "An error occurred while saving Tutorial World schematic")
|
minetest.chat_send_player(name, "An error occurred while saving Tutorial World schematic")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user