Changes

Attempt at fixing range being slotted into the wrong column for sortable tables
Line 1: Line 1:  
local EliteShipsKai = require('Module:EliteShipsKai')
 
local EliteShipsKai = require('Module:EliteShipsKai')
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
 +
 +
local split = require('Module:Utils').split
    
local EliteShipsKaiSortable = EliteShipsKai{
 
local EliteShipsKaiSortable = EliteShipsKai{
Line 59: Line 61:  
local luck_max = ship:luck_max()
 
local luck_max = ship:luck_max()
 
return {values = {value = self:get_emphasis(luck_max, Formatting:format_stat(luck_max), self._args.luck_max_operator, self._args.luck_max_good)}, bg_color = self._transparent, text_align = self._center_align}
 
return {values = {value = self:get_emphasis(luck_max, Formatting:format_stat(luck_max), self._args.luck_max_operator, self._args.luck_max_good)}, bg_color = self._transparent, text_align = self._center_align}
 +
end
 +
 +
function EliteShipsKaiSortable:create_table_prep()
 +
    self._columns = {}
 +
    for _, column in ipairs(self._base_columns) do
 +
        table.insert(self._columns, column)
 +
    end
 +
if self._args.reference_type then
 +
self._reference_types = {}
 +
for _, reference_type in ipairs(split(self._args.reference_type, ',%s*')) do
 +
self._reference_types[tonumber(reference_type)] = true
 +
end
 +
    end
 +
    if self._args.night_battle then
 +
        table.insert(self._columns, 7, "night_battle")
 +
    end
 +
    if self._args.range then
 +
        table.insert(self._columns, self._args.night_battle and 17 or 16, "range")
 +
    end
 
end
 
end