Skip to content
Snippets Groups Projects
Commit 8ee5c99c authored by DarkGod's avatar DarkGod
Browse files

Add range to the map tooltip

parent f7dbe5af
No related branches found
No related tags found
No related merge requests found
......@@ -125,15 +125,23 @@ end
function _M:tooltip(x, y)
local tstr
local dist = nil
if game.player.x and game.player.y then dist = tstring{" (range: ", {"font", "italic"}, {"color", "LIGHT_GREEN"}, tostring(core.fov.distance(game.player.x, game.player.y, x, y)), {"color", "LAST"}, {"font", "normal"}, ")"} end
if self.show_tooltip then
local name = ((self.show_tooltip == true) and self.name or self.show_tooltip)
if self.desc then
tstr = tstring{{"uid", self.uid}, name, true, self.desc, true}
tstr = tstring{{"uid", self.uid}, name}
if dist then tstr:merge(dist) end
tstr:add(true, self.desc, true)
else
tstr = tstring{{"uid", self.uid}, name, true}
tstr = tstring{{"uid", self.uid}, name}
if dist then tstr:merge(dist) end
tstr:add(true)
end
else
tstr = tstring{{"uid", self.uid}, self.name, true}
tstr = tstring{{"uid", self.uid}, self.name}
if dist then tstr:merge(dist) end
tstr:add(true)
end
if game.level.entrance_glow and self.change_zone and not game.visited_zones[self.change_zone] then
......@@ -147,6 +155,7 @@ function _M:tooltip(x, y)
if self:attr("air_level") and self:attr("air_level") < 0 then tstr:add({"color", "LIGHT_BLUE"}, "Special breathing method required", {"color", "LAST"}, true) end
if self:attr("dig") then tstr:add({"color", "LIGHT_UMBER"}, "Diggable", {"color", "LAST"}, true) end
if game.level.map.attrs(x, y, "no_teleport") then tstr:add({"color", "VIOLET"}, "Cannot teleport to this place", {"color", "LAST"}, true) end
if config.settings.cheat then
tstr:add(true, tostring(rawget(self, "type")), " / ", tostring(rawget(self, "subtype")))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment