diff --git a/init.lua b/init.lua index 89333f4..e17c46d 100644 --- a/init.lua +++ b/init.lua @@ -373,7 +373,6 @@ minetest.register_on_joinplayer( scale = { x = 4, y = 4 } } local dot_def = table.copy(map_def) - dot_def.text = "maps_x.tga" -- "player.png^[resize:4x8" maps.maps[player_name] = player:hud_add(map_def) maps.dots[player_name] = player:hud_add(dot_def) maps.minp[player_name] = { x=-32000, y=0, z=0 } @@ -428,6 +427,35 @@ minetest.register_globalstep( maps.posx[player_name] = pos.x maps.posz[player_name] = pos.z end + local marker + local yaw = ( + math.floor( + player:get_look_horizontal() + * 180 / math.pi / 45 + 0.5 + ) % 8 + ) * 45 + if ( + yaw == 0 or + yaw == 90 or + yaw == 180 or + yaw == 270 + ) then + marker = "maps_arrow.tga" .. "^[transformR" .. yaw + elseif ( + yaw == 45 or + yaw == 135 or + yaw == 225 or + yaw == 315 + ) then + marker = "maps_arrow_diagonal.tga" .. "^[transformR" .. (yaw - 45) + end + if marker then + player:hud_change( + maps.dots[player_name], + "text", + marker + ) + end end end ) diff --git a/textures/maps_arrow.tga b/textures/maps_arrow.tga new file mode 100644 index 0000000..91fccf4 Binary files /dev/null and b/textures/maps_arrow.tga differ diff --git a/textures/maps_arrow_diagonal.tga b/textures/maps_arrow_diagonal.tga new file mode 100644 index 0000000..6798c9f Binary files /dev/null and b/textures/maps_arrow_diagonal.tga differ