Draw grass icons on map
This commit is contained in:
parent
9dea792ca8
commit
0ac4ce19fd
42
init.lua
42
init.lua
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue