1
0
Fork 0

Draw X on placed maps

This commit is contained in:
Nils Dagsson Moskopp 2022-05-21 22:11:08 +02:00
parent a4261aa369
commit 9ef748bcec
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
1 changed files with 20 additions and 11 deletions

View File

@ -535,6 +535,26 @@ xmaps.load_map_item = function(itemstack)
end
local texture = xmaps.load_map(map_id)
local meta_minp = meta:get_string("xmaps:minp")
assert( "" ~= meta_minp )
local minp = minetest.string_to_pos(meta_minp)
local meta_maxp = meta:get_string("xmaps:maxp")
assert( "" ~= meta_maxp )
local maxp = minetest.string_to_pos(meta_maxp)
local meta_xpos = meta:get_string("xmaps:xpos")
if "" ~= meta_xpos then
local xpos = minetest.string_to_pos(meta_xpos)
local x_x = xpos.x - minp.x - 4
local x_z = maxp.z - xpos.z - 4
local x_overlay = "^[combine:" ..
size .. "x" .. size .. ":" ..
x_x .. "," .. x_z .. "=xmaps_x.tga"
texture = texture .. x_overlay
end
return texture, itemstack
end
@ -599,17 +619,6 @@ xmaps.show_map_hud = function(player)
assert( "" ~= meta_maxp )
local maxp = minetest.string_to_pos(meta_maxp)
local meta_xpos = meta:get_string("xmaps:xpos")
if "" ~= meta_xpos then
local xpos = minetest.string_to_pos(meta_xpos)
local x_x = xpos.x - minp.x - 4
local x_z = maxp.z - xpos.z - 4
local x_overlay = "^[combine:" ..
size .. "x" .. size .. ":" ..
x_x .. "," .. x_z .. "=xmaps_x.tga"
texture = texture .. x_overlay
end
local light_level = minetest.get_node_light(pos) or 0
local darkness = 255 - (light_level * 17)
local light_level_overlay = "^[colorize:black:" .. darkness