Skip to content
Snippets Groups Projects
Commit 3bcff3ca authored by DarkGod's avatar DarkGod
Browse files

When mousing over a zone change there will be a minimum level indicator in the tooltip

parent 496d0186
No related branches found
No related tags found
No related merge requests found
......@@ -176,6 +176,30 @@ function _M:tooltip(x, y)
tstr:add(true)
end
if self.change_zone then
-- Lets make very very sure that funky weird zone files dont explode things
local ok, data = pcall(function()
local fakezone = {short_name=self.change_zone}
local base = engine.Zone.getBaseName(fakezone)
local f = loadfile(base.."/zone.lua")
if f then
setfenv(f, setmetatable({self=fakezone, short_name=fakezone.short_name}, {__index=_G}))
local ok, z = pcall(f)
return z
end
end)
if ok and data then
if data.level_range then
local p = game:getPlayer(true)
local color = "AQUAMARINE"
if p.level <= data.level_range[1] - 10 then color = "CRIMSON"
elseif p.level <= data.level_range[1] - 4 then color = "ORANGE"
end
tstr:add(true, {"font","bold"}, {"color", color}, "Min.level: "..data.level_range[1], {"color", "LAST"}, {"font","normal"}, true)
end
end
end
if game.level.entrance_glow and self.change_zone and not game.visited_zones[self.change_zone] then
tstr:add(true, {"font","bold"}, {"color","CRIMSON"}, "Never visited yet", {"color", "LAST"}, {"font","normal"}, true)
end
......
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