Draw house icons on map

This commit is contained in:
Nils Dagsson Moskopp 2022-05-19 15:09:08 +02:00
parent 88d90cfa20
commit 42ea5635f4
Signed by untrusted user who does not match committer: erlehmann
GPG Key ID: A3BC671C35191080
1 changed files with 46 additions and 0 deletions

View File

@ -171,6 +171,52 @@ maps.create_map = function(pos, player_name)
local image = tga_encoder.image(pixels)
local positions = minetest.find_nodes_in_area(
minp,
maxp,
"group:door"
)
for _, p in ipairs(positions) do
local z = p.z - minp.z + 1
local x = p.x - minp.x + 1
local draw_house = (
z > 1 and
z < size - 7 and
x > 4 and
x < size - 4
)
if draw_house then
local _ = { nil } -- transparent
local O = { 8 } -- outline
local F = { 9 } -- filling
local house = {
{ _, _, _, _, _, _, _ },
{ _, O, O, O, O, O, _ },
{ _, O, F, F, F, O, _ },
{ _, O, F, F, F, O, _ },
{ _, O, F, F, F, O, _ },
{ _, _, O, F, O, _, _ },
{ _, _, _, O, _, _, _ },
{ _, _, _, _, _, _, _ },
}
image:blit_icon(
house,
{
x = x - 5,
z = z - 1,
},
{
[4] = true,
[5] = true,
[6] = true,
[7] = true,
[8] = true,
[9] = true,
}
)
end
end
local positions = minetest.find_nodes_in_area_under_air(
minp,
maxp,