Changes

no edit summary
Line 3: Line 3:  
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
 
local ShipBattleCardKai = require('Module:ShipBattleCardKai')
 
local ShipBattleCardKai = require('Module:ShipBattleCardKai')
 +
local ShipCapabilities = require('Module:ShipCapabilities')
 
local StatIcons = require('Module:StatIcons')
 
local StatIcons = require('Module:StatIcons')
   Line 37: Line 38:  
_item_class = function(item_key) return EnemyShip(item_key) end,
 
_item_class = function(item_key) return EnemyShip(item_key) end,
 
_fragment_prefix = "enemyshiplistkai",
 
_fragment_prefix = "enemyshiplistkai",
_icon_caption_template = "${equipment} ${equipment_type}",
+
_icon_caption_template = "${equipment} | ${equipment_type}",
 
_installation_label = "Installation",
 
_installation_label = "Installation",
 +
_asw_label = "ASW",
 +
_high_asw_label = "High ASW",
 
}
 
}
   Line 95: Line 98:     
function EnemyShipListKai:equipment(ship)
 
function EnemyShipListKai:equipment(ship)
local icons = {}
+
local icons, roles = {}, {}
 +
local sonar
 +
local dc
 +
 
 
for i = 1, ship:slots_length() do
 
for i = 1, ship:slots_length() do
 
local equipment, size, estimation, icon, equipment_type, equipment_link = ship:slot(i)
 
local equipment, size, estimation, icon, equipment_type, equipment_link = ship:slot(i)
Line 114: Line 120:  
table.insert(icons, icon)
 
table.insert(icons, icon)
 
end
 
end
return {value = table.concat(icons), bg_color = self._transparent, text_align = self._start_align}
+
if ShipCapabilities:is_submarine(ship) then
 +
if ship:opening_torpedo() then
 +
table.insert(value, self._opening_torpedo_label)
 +
end
 +
else
 +
if midget_submarine then
 +
table.insert(value, self._opening_torpedo_label)
 +
end
 +
end
 +
if sonar or dc then
 +
if sonar and dc then
 +
table.insert(value, self._high_asw_label)
 +
else
 +
table.insert(value, self._asw_label)
 +
end
 +
end
 +
 
 +
return {value = table.concat(values) .. '<br/>' .. table.concat(roles, ", "), bg_color = self._transparent, text_align = self._start_align}
 
end
 
end
  
Anonymous user