Changes

no edit summary
Line 9: Line 9:  
}
 
}
   −
function ShipData:name(raw)
+
function ShipData:name()
if self:suffix() and (raw or self:display_suffix() ~= false) then
+
local suffix = self:display_suffix()
return self:base_name() .. " " .. (raw and self:suffix() or self:display_suffix())
+
if suffix ~= false then
 +
return self:base_name() .. " " .. suffix
 
else
 
else
 
return self:base_name()
 
return self:base_name()
 
end
 
end
 +
end
 +
 +
function ShipData:unique_name()
 +
return self:base_name() .. " " .. self:suffix()
 
end
 
end
   Line 26: Line 31:     
function ShipData:display_suffix()
 
function ShipData:display_suffix()
if self._display_suffix == false then
+
if self._display_suffix ~= nil then
 
return self._display_suffix
 
return self._display_suffix
 
end
 
end
return self._display_suffix or self._suffix
+
return self._suffix
 
end
 
end
   Line 406: Line 411:  
function ShipData:slots()
 
function ShipData:slots()
 
if self._equipment then
 
if self._equipment then
return #self._equipment
+
local i = 0
 +
for _, v in ipairs(self._equipment) do
 +
size = v.size
 +
if size ~= false then
 +
i = i + 1
 +
end
 +
end
 +
return i
 
end
 
end
 
return nil
 
return nil
Line 418: Line 430:  
local size
 
local size
 
for _, v in ipairs(self._equipment) do
 
for _, v in ipairs(self._equipment) do
size = v["size"]
+
size = v.size
 
if size == nil then
 
if size == nil then
 
total_space = nil
 
total_space = nil
Line 477: Line 489:  
function ShipData:asw_attack()
 
function ShipData:asw_attack()
 
return self._asw_attack
 
return self._asw_attack
 +
end
 +
 +
function ShipData:seasonal()
 +
return self._seasonal
 
end
 
end
  
Anonymous user