Add height data to maps

This commit is contained in:
Hugues Ross 2020-02-19 19:56:31 -05:00
parent e5371e19ed
commit 1404058a06
3 changed files with 24 additions and 11 deletions

View File

@ -29,20 +29,29 @@ local function generate_map(data, x, y, w, h, player_x, player_y, spawn_x, spawn
local name = minetest.get_biome_name(column[j].biome);
local height = column[j].height;
local biome = cartographer.get_biome_texture(name, math.floor(height + 0.5), detail);
local depth = math.min(math.max(math.floor(height / 8), -8), 0) * -1
height = math.max(math.min(math.floor(height / 4), 8), 0)
local mod = "";
if height > 0 then
mod = "^[colorize:white:"..tostring(height * 10)
elseif depth > 0 then
mod = "^[colorize:#1f1f34:"..tostring(depth * 10)
end
if biome == nil then
-- minetest.chat_send_all(name);
str = str..tile:format(fx, fy, scale, scale, "cartographer_unknown_biome." .. tostring(get_variant(random)) .. ".png")
else
if height > 0 then
str = str..tile:format(fx, fy, scale, scale, "cartographer_cliff.png")
str = str..tile:format(fx, fy - (height * 0.05) + scale - 0.01, scale, (height * 0.05) + 0.01, "cartographer_cliff.png")
end
str = str..tile:format(fx, fy, scale, scale, biome .. "." .. tostring(get_variant(random)) .. ".png")
str = str..tile:format(fx, fy - (height * 0.05), scale, scale, biome .. "." .. tostring(get_variant(random)) .. ".png" .. mod)
end
if i == player_x and j == player_y then
str = str..marker:format(fx, fy, scale, scale, "cartographer_player_icon.png", 2, 500)
str = str..marker:format(fx, fy - (height * 0.05), scale, scale, "cartographer_player_icon.png", 2, 500)
-- elseif i == death_x and j == death_y then
-- str = str..marker:format(fx, fy - (height * 0.025), scale, scale, "dicon.png")
-- elseif i == spawn_x and j == spawn_y then

View File

@ -58,7 +58,11 @@ cartographer.register_biome("Wasteland", {
"cartographer_colored_sand",
"cartographer_colored_sand",
"cartographer_wasteland",
});
}, 1);
cartographer.register_biome("Wasteland", {
"cartographer_simple_water",
"cartographer_colored_water",
}, nil, 0);
cartographer.register_biome("Grassland Ocean", {
"cartographer_simple_water",
"cartographer_colored_water",
@ -66,16 +70,16 @@ cartographer.register_biome("Grassland Ocean", {
cartographer.register_biome("Grassland Ocean", {
"cartographer_simple_land",
"cartographer_colored_sand",
}, 0);
}, 1);
cartographer.register_biome("Gravel Beach", {
"cartographer_simple_water",
"cartographer_colored_water",
}, nil, 0);
cartographer.register_biome("Gravel Beach", {
"cartographer_simple_land",
"cartographer_colored_sand",
"cartographer_gravel",
}, 0);
cartographer.register_biome("Gravel Beach", {
"cartographer_simple_water",
"cartographer_colored_water",
}, nil, 0);
}, 1);
cartographer.register_biome("Savanna Ocean", {
"cartographer_simple_water",
"cartographer_colored_water",
@ -83,7 +87,7 @@ cartographer.register_biome("Savanna Ocean", {
cartographer.register_biome("Savanna Ocean", {
"cartographer_simple_land",
"cartographer_colored_sand",
}, 0);
}, 1);
-- Materials
cartographer.register_map_material_name("default:paper", "fiber", 5);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 963 B