mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
tooltip fix
This commit is contained in:
parent
68c9f0ccf2
commit
f7918088ab
@ -5,6 +5,7 @@ local Rank = require 'features.rank_system'
|
||||
local Donator = require 'features.donator'
|
||||
local PlayerStats = require 'features.player_stats'
|
||||
local Utils = require 'utils.core'
|
||||
local LocaleBuilder = require 'utils.locale_builder'
|
||||
local Report = require 'features.report'
|
||||
local table = require 'utils.table'
|
||||
local Color = require 'resources.color_presets'
|
||||
@ -24,7 +25,6 @@ local ipairs = ipairs
|
||||
local pairs = pairs
|
||||
local abs = math.abs
|
||||
local round = math.round
|
||||
local remove = table.remove
|
||||
local insert = table.insert
|
||||
local concat = table.concat
|
||||
local get_rank_color = Rank.get_rank_color
|
||||
@ -32,6 +32,8 @@ local get_rank_name = Rank.get_rank_name
|
||||
local get_player_rank = Rank.get_player_rank
|
||||
local donator_is_donator = Donator.is_donator
|
||||
|
||||
local tooltip_lines_cap = 53
|
||||
|
||||
local poke_cooldown_time = 240 -- in ticks.
|
||||
local sprite_time_step = 54000 -- in ticks
|
||||
local symbol_asc = ' ▲'
|
||||
@ -361,23 +363,30 @@ local column_builders = {
|
||||
return label
|
||||
end,
|
||||
draw_cell = function(parent, cell_data)
|
||||
local tooltip = {''}
|
||||
for name, count in pairs(cell_data.causes) do
|
||||
local tooltip = LocaleBuilder.new()
|
||||
|
||||
local causes = cell_data.causes
|
||||
local lines = 1
|
||||
for name, count in pairs(causes) do
|
||||
if lines > tooltip_lines_cap then
|
||||
break
|
||||
end
|
||||
lines = lines + 1
|
||||
|
||||
if not prototype_locale_string_cache[name] then
|
||||
local prototype = game.entity_prototypes[name]
|
||||
if not prototype then
|
||||
prototype = game.item_prototypes[name]
|
||||
end
|
||||
prototype_locale_string_cache[name] = prototype and prototype.localised_name or {name}
|
||||
prototype_locale_string_cache[name] = prototype and prototype.localised_name or {'', name}
|
||||
end
|
||||
|
||||
insert(tooltip, prototype_locale_string_cache[name])
|
||||
insert(tooltip, ': ')
|
||||
insert(tooltip, count)
|
||||
insert(tooltip, '\n')
|
||||
end
|
||||
if #tooltip > 1 then
|
||||
remove(tooltip)
|
||||
local str = ': ' .. count
|
||||
if next(causes, name) ~= nil then
|
||||
str = str .. '\n'
|
||||
end
|
||||
|
||||
tooltip = tooltip:add(prototype_locale_string_cache[name]):add(str)
|
||||
end
|
||||
|
||||
local label =
|
||||
|
Loading…
Reference in New Issue
Block a user