Line 211: |
Line 211: |
| local seasonal_forms = {} | | local seasonal_forms = {} |
| for suffix, data in pairs(ship_data) do | | for suffix, data in pairs(ship_data) do |
− | if data._seasonal == true and data._name and data._suffix then | + | if data._seasonal then |
| local normal = data._cg ~= false | | local normal = data._cg ~= false |
| local damaged = data._cg_damaged ~= false | | local damaged = data._cg_damaged ~= false |
− | table.insert(seasonal_forms, { name = data._name .. "/" .. data._suffix, seasonal = true, normal = normal, damaged = damaged }) | + | table.insert(seasonal_forms, { |
| + | name = (data._name or ship_name) .. "/" .. (data._suffix or suffix), |
| + | seasonal = true, |
| + | normal = normal, |
| + | damaged = damaged, |
| + | season = data._seasonal ~= true and data._seasonal, |
| + | }) |
| end | | end |
| end | | end |
Line 239: |
Line 245: |
| local forms = ship_cgs(ship_name) | | local forms = ship_cgs(ship_name) |
| local result = {} | | local result = {} |
| + | local first_seasonal |
| for _, form in ipairs(forms) do | | for _, form in ipairs(forms) do |
| local name, suffix = Ship:process_ship_key(form.name) | | local name, suffix = Ship:process_ship_key(form.name) |
| suffix = suffix or "" | | suffix = suffix or "" |
| local title = form.seasonal and suffix or suffix == "" and name == ship_name and "Base" or suffix | | local title = form.seasonal and suffix or suffix == "" and name == ship_name and "Base" or suffix |
− | table.insert(result, "<h2>" .. title .. "</h2>") | + | if not first_seasonal and form.seasonal then |
| + | first_seasonal = true |
| + | table.insert(result, "<h2>[[Seasonal]]s</h2>") |
| + | elseif form.seasonal then |
| + | table.insert(result, form.season and format{ |
| + | "<h3>[[Seasonal/${season}|${season}]] (${title})</h3>", |
| + | title = title, |
| + | season = form.season |
| + | } or ("<h3>" .. title .. "</h3>")) |
| + | else |
| + | table.insert(result, "<h2>" .. title .. "</h2>") |
| + | end |
| if form.normal then | | if form.normal then |
| table.insert(result, ShipGraphicKai:Asset({ form.name, link = "nil" })) | | table.insert(result, ShipGraphicKai:Asset({ form.name, link = "nil" })) |