Line 181: |
Line 181: |
| end | | end |
| | | |
− | function ship_cgs(ship_name, seasonal_forms, j) | + | function ship_cgs(ship_name, j) |
| j = j or 1 | | j = j or 1 |
| local forms = { { name = ship_name, normal = true, damaged = true } } | | local forms = { { name = ship_name, normal = true, damaged = true } } |
Line 192: |
Line 192: |
| end | | end |
| local form_data = ship_data[""] | | local form_data = ship_data[""] |
− | if seasonal_forms then | + | 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 == true and data._name and data._suffix then |
− | table.insert(seasonal_forms, data._name .. "/" .. data._suffix)
| + | table.insert(seasonal_forms, { name = data._name .. "/" .. data._suffix, seasonal = true }) |
− | end
| |
| end | | end |
| end | | end |
Line 203: |
Line 202: |
| local ship_name_next, ship_suffix_next = Ship:process_ship_key(form_data._remodel_to) | | local ship_name_next, ship_suffix_next = Ship:process_ship_key(form_data._remodel_to) |
| if ship_name_next ~= ship_name then | | if ship_name_next ~= ship_name then |
− | return Utils.concat(forms, ship_cgs(ship_name_next, seasonal_forms, j + 1)) | + | return Utils.concat(forms, Utils.concat(seasonal_forms, ship_cgs(ship_name_next, j + 1))) |
| else | | else |
| local name = form_data._remodel_to | | local name = form_data._remodel_to |
Line 213: |
Line 212: |
| i = i + 1 | | i = i + 1 |
| end | | end |
− | return forms | + | return Utils.concat(forms, seasonal_forms) |
| end | | end |
| | | |
Line 223: |
Line 222: |
| args = args or Utils.getTemplateArgs(frame) | | args = args or Utils.getTemplateArgs(frame) |
| local ship_name = args.explicit.ship or args.implicit.pagename or "" | | local ship_name = args.explicit.ship or args.implicit.pagename or "" |
− | local seasonal_forms = {}
| + | local forms = ship_cgs(ship_name) |
− | local forms = ship_cgs(ship_name, seasonal_forms) | |
| local result = { "{{#tag:tabber|" } | | local result = { "{{#tag:tabber|" } |
| for _, form in ipairs(forms) do | | for _, form in ipairs(forms) do |
− | mw.log(form.name) | + | if form.seasonal then |
− | if form.normal or form.damaged then | + | local name, suffix = Ship:process_ship_key(form.name) |
| + | local image = ShipGraphicKai:Asset({ form.name, link = "nil", size = "300px" }) |
| + | local image_damaged = ShipGraphicKai:Asset({ form.name, link = "nil", damaged = true, size = "300px" }) |
| + | table.insert(result, "{{!}}-{{!}}" .. suffix .. "=") |
| + | table.insert(result, format{ |
| + | ShipPage._gallery_tabber, |
| + | image = image, |
| + | image_damaged = image_damaged |
| + | }) |
| + | elseif form.normal or form.damaged then |
| local name, suffix = Ship:process_ship_key(form.name) | | local name, suffix = Ship:process_ship_key(form.name) |
| suffix = suffix or "" | | suffix = suffix or "" |
Line 258: |
Line 265: |
| end | | end |
| end | | end |
− | end
| |
− | for _, form in ipairs(seasonal_forms) do
| |
− | local name, suffix = Ship:process_ship_key(form)
| |
− | local image = ShipGraphicKai:Asset({ form, link = "nil", size = "300px" })
| |
− | local image_damaged = ShipGraphicKai:Asset({ form, link = "nil", damaged = true, size = "300px" })
| |
− | table.insert(result, "{{!}}-{{!}}" .. suffix .. "=")
| |
− | table.insert(result, format{
| |
− | ShipPage._gallery_tabber,
| |
− | image = image,
| |
− | image_damaged = image_damaged
| |
− | })
| |
| end | | end |
| table.insert(result, "}}") | | table.insert(result, "}}") |
Line 281: |
Line 277: |
| }) | | }) |
| end | | end |
| + | -- print(p.TestGalleryTabber("Taigei")) |
| + | -- print(p.TestGalleryTabber("Ayanami")) |
| + | -- print(p.TestGalleryTabber("Iowa")) |
| + | -- print(p.TestGalleryTabber("Kasuga Maru")) |
| ]]-- | | ]]-- |
| | | |