2021-01-27 10:56:53 +02:00
|
|
|
--
|
|
|
|
function settlements.convert_mts_to_lua()
|
2021-01-29 20:49:33 +02:00
|
|
|
local building = schem_path.."townhall.mts"
|
|
|
|
local str = minetest.serialize_schematic(building, "lua", {lua_use_comments = true, lua_num_indent_spaces = 0}).." return(schematic)"
|
|
|
|
local schematic = loadstring(str)()
|
|
|
|
local file = io.open(schem_path.."church"..".lua", "w")
|
|
|
|
file:write(dump(schematic))
|
|
|
|
file:close()
|
|
|
|
print(dump(schematic))
|
2021-01-27 10:56:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function settlements.mts_save()
|
2021-01-29 20:49:33 +02:00
|
|
|
local f = assert(io.open(schem_path.."hut.lua", "r"))
|
|
|
|
local content = f:read("*all").." return(schematic2)"
|
|
|
|
f:close()
|
2021-01-27 10:56:53 +02:00
|
|
|
|
2021-01-29 20:49:33 +02:00
|
|
|
local schematic2 = loadstring("schematic2 = "..content)()
|
|
|
|
local seb = minetest.serialize_schematic(schematic2, "mts", {})
|
2021-01-27 10:56:53 +02:00
|
|
|
local filename = schem_path .. "hut2" .. ".mts"
|
|
|
|
filename = filename:gsub("\"", "\\\""):gsub("\\", "\\\\")
|
|
|
|
local file, err = io.open(filename, "wb")
|
|
|
|
if err == nil and seb then
|
|
|
|
file:write(seb)
|
|
|
|
file:flush()
|
|
|
|
file:close()
|
|
|
|
end
|
|
|
|
print("Wrote: " .. filename)
|
2021-01-29 20:49:33 +02:00
|
|
|
end
|