Changes

no edit summary
Line 10: Line 10:  
_item_class = Equipment,
 
_item_class = Equipment,
 
_header_template = [[
 
_header_template = [[
! style="text-align: center; padding: 5px;" | Improvement Cost: ${resources}
+
! style="text-align: center; padding: 5px;" | ${resources}
 
! style="text-align: center; padding: 5px;" | ★
 
! style="text-align: center; padding: 5px;" | ★
 
! style="text-align: center; padding: 5px;" | ${devmat}
 
! style="text-align: center; padding: 5px;" | ${devmat}
Line 44: Line 44:  
10
 
10
 
},
 
},
 +
_basic_resources_label = "Improvement Cost: ",
 
_consumed_equipment_label = "<small>Consumes: ${list}</small>",
 
_consumed_equipment_label = "<small>Consumes: ${list}</small>",
 
_produced_equipment_label = "<b><small>Produces: 1x ${icon}${name}</small></b>",
 
_produced_equipment_label = "<b><small>Produces: 1x ${icon}${name}</small></b>",
Line 65: Line 66:  
self._title_row = format{[[|+ ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
 
self._title_row = format{[[|+ ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
 
else
 
else
self._custom_rows[item:name()] = format{[[| colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
+
self._custom_rows[item:name()] = format{[[! colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name} / ${resources}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link()), resources = Formatting:format_resources(item:improvement_resources())}
 
table.insert(result, item:name())
 
table.insert(result, item:name())
 
end
 
end
Line 222: Line 223:  
end
 
end
   −
function ImprovementTableKai:create_header()
+
function ImprovementTableKai:create_table_prep()
local header_icons = {
+
self._header_icons = {
 
devmat = ResourceIcons.devmat,
 
devmat = ResourceIcons.devmat,
 
screw = ResourceIcons.screw,
 
screw = ResourceIcons.screw,
 
}
 
}
for key, value in pairs(header_icons) do
+
for key, value in pairs(self._header_icons) do
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
+
self._header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
 
end
 
end
 +
end
 +
 +
function ImprovementTableKai:create_header()
 
if self._single_item then
 
if self._single_item then
header_icons.resources = Formatting:format_resources(self._items[1].item:improvement_resources())
+
self._header_icons.resources = self._basic_resources_label .. Formatting:format_resources(self._items[1].item:improvement_resources())
 +
else
 +
self._header_icons.resources = ""
 +
end
 +
self._header = format(self._header_template, self._header_icons)
 +
end
 +
 
 +
function ImprovementTableKai:finish_rows()
 +
if not self._single_item then
 +
table.insert(self._rows, self._row_starter)
 +
table.insert(self._rows, self._header_bottom or self._header)
 
end
 
end
self._header = format(self._header_template, header_icons)
+
table.insert(self._rows, self._table_end)
 
end
 
end
  
Anonymous user