Draw grass icons on map

This commit is contained in:
Nils Dagsson Moskopp 2022-05-19 03:35:26 +02:00
parent 9dea792ca8
commit 0ac4ce19fd
Signed by: erlehmann
GPG Key ID: A3BC671C35191080
1 changed files with 42 additions and 0 deletions

View File

@ -235,6 +235,48 @@ maps.create_map = function(pos, player_name)
end end
end end
local positions = minetest.find_nodes_in_area_under_air(
minp,
maxp,
"group:grass"
)
for _, p in ipairs(positions) do
local z = p.z - minp.z + 1
local x = p.x - minp.x + 1
local draw_grass = (
z > 1 and
z < size - 4 and
x > 4 and
x < size - 4
)
if draw_grass then
local _ = { nil } -- transparent
local G = { 8 } -- line
local grass = {
{ _, _, _, _, _, _, _ },
{ _, G, _, G, _, G, _ },
{ _, G, _, G, _, G, _ },
{ _, _, _, G, _, _, _ },
{ _, _, _, _, _, _, _ },
}
image:blit_icon(
grass,
{
x = x - 5,
z = z - 1,
},
{
[3] = true,
[4] = true,
[5] = true,
[6] = true,
[7] = true,
[8] = true
}
)
end
end
local filepath = textures_dir .. filename local filepath = textures_dir .. filename
image:save( image:save(
filepath, filepath,