Changes

Trying to add range column option
Line 25: Line 25:  
! style="width: 24px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: silver;" | ${aircraft}
+
${range_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: silver;" | ${aircraft}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
Line 36: Line 36:  
},
 
},
 
_night_battle_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle; background-color: slategrey;" | ${firepower}${torpedo}
 
_night_battle_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle; background-color: slategrey;" | ${firepower}${torpedo}
 +
]],
 +
_range_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle;" | ${range}
 
]],
 
]],
 
_base_columns = { --gets copied to self._columns in create_table_prep so we can mutate it. Don't mutate base_columns!
 
_base_columns = { --gets copied to self._columns in create_table_prep so we can mutate it. Don't mutate base_columns!
Line 51: Line 53:  
"armor",
 
"armor",
 
"evasion",
 
"evasion",
"speed",
+
"speed", --range is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
 
"aircraft",
 
"aircraft",
 
"fuel",
 
"fuel",
Line 161: Line 163:  
end
 
end
 
return {values = {value = Formatting:format_stat(night_battle)}, bg_color = self:get_bg_color(self._cell_color.night_battle, night_battle, self._args.night_battle_operator, self._args.night_battle_outstanding, self._args.night_battle_good, self._args.night_battle_bad), text_align = self._center_align}
 
return {values = {value = Formatting:format_stat(night_battle)}, bg_color = self:get_bg_color(self._cell_color.night_battle, night_battle, self._args.night_battle_operator, self._args.night_battle_outstanding, self._args.night_battle_good, self._args.night_battle_bad), text_align = self._center_align}
 +
end
 +
 +
function EliteShipsKai:range(ship)
 +
local range = ship:range()
 +
return {values = {value = Formatting:format_range(range)}, bg_color = self:get_bg_color(self._cell_color.range, range, self._args.range_operator, self._args.range_outstanding, self._args.range_good, self._args.range_bad), text_align = self._center_align}
 
end
 
end
   Line 298: Line 305:  
     if self._args.night_battle then
 
     if self._args.night_battle then
 
         table.insert(self._columns, 7, "night_battle")
 
         table.insert(self._columns, 7, "night_battle")
 +
    end
 +
    if self._args.range then
 +
        table.insert(self._columns, self._args.night_battle and 16 or 15, "range")
 
     end
 
     end
 
end
 
end
Line 340: Line 350:  
evasion = StatIcons.evasion,
 
evasion = StatIcons.evasion,
 
speed = StatIcons.speed,
 
speed = StatIcons.speed,
 +
range = StatIcons.range,
 
aircraft = StatIcons.aircraft,
 
aircraft = StatIcons.aircraft,
 
fuel = ResourceIcons.fuel,
 
fuel = ResourceIcons.fuel,
Line 347: Line 358:  
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
 
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
 
end
 
end
self._header = format(format{self._header_template, night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or ""}, header_icons)
+
self._header = format(format{
 +
self._header_template,
 +
night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or "",
 +
range_header_cell = self._args.range and self._range_header_cell or ""
 +
}, header_icons)
 
end
 
end
    
return EliteShipsKai
 
return EliteShipsKai
cssedit, gkautomate
7,064

edits