Changes

no edit summary
Line 99: Line 99:  
function EnemyShipListKai:equipment(ship)
 
function EnemyShipListKai:equipment(ship)
 
local icons, roles = {}, {}
 
local icons, roles = {}, {}
local sonar
+
local sonar, dc = false, false
local dc
      
for i = 1, ship:slots_length() do
 
for i = 1, ship:slots_length() do
Line 107: Line 106:  
icon = equipment:icon()
 
icon = equipment:icon()
 
equipment_type = equipment:type()
 
equipment_type = equipment:type()
 +
if ShipCapabilities:_is_sonar(equipment) then
 +
sonar = true
 +
elseif ShipCapabilities:_is_depth_charge(equipment) then
 +
dc = true
 +
end
 
equipment_link, equipment = Formatting:format_link(equipment:link())
 
equipment_link, equipment = Formatting:format_link(equipment:link())
 
equipment = equipment or equipment_link
 
equipment = equipment or equipment_link
Line 122: Line 126:  
if ShipCapabilities:_is_submarine(ship) then
 
if ShipCapabilities:_is_submarine(ship) then
 
if ship:opening_torpedo() then
 
if ship:opening_torpedo() then
table.insert(value, self._opening_torpedo_label)
+
table.insert(roles, self._opening_torpedo_label)
 
end
 
end
 
else
 
else
 
if midget_submarine then
 
if midget_submarine then
table.insert(value, self._opening_torpedo_label)
+
table.insert(roles, self._opening_torpedo_label)
 
end
 
end
 
end
 
end
 
if sonar or dc then
 
if sonar or dc then
 
if sonar and dc then
 
if sonar and dc then
table.insert(value, self._high_asw_label)
+
table.insert(roles, self._high_asw_label)
 
else
 
else
table.insert(value, self._asw_label)
+
table.insert(roles, self._asw_label)
 
end
 
end
 
end
 
end
   −
return {value = table.concat(values) .. '<br/>' .. table.concat(roles, ", "), bg_color = self._transparent, text_align = self._start_align}
+
return {value = table.concat(icons) .. '<br/>' .. table.concat(roles, ", "), bg_color = self._transparent, text_align = self._start_align}
 
end
 
end
  
Anonymous user