Changes

Revamped improvement system
Line 274: Line 274:  
end
 
end
   −
function EquipmentData:improvement()
+
function EquipmentData:improvement_products()
return not not self._improvement
+
if self._products_keys ~= nil then
 +
return self._products_keys
 +
end
 +
if self._improvements and self._improvements._products then
 +
self._products_keys = {}
 +
for key, _ in pairs(self._improvements._products) do
 +
table.insert(self._products_keys, key)
 +
end
 +
table.sort(self._products_keys)
 +
return self._products_keys
 +
else
 +
self._products_keys = false
 +
end
 +
end
 +
 
 +
function EquipmentData:improvement_ships(product)
 +
if self._improvements and self._improvements._products then
 +
if self._ships_keys == nil then
 +
self._ships_keys = {}
 +
end
 +
if not self._ships_keys[product] then
 +
self._ships_keys[product] = {}
 +
for ship, _ in pairs(self._improvements._products[product]) do
 +
table.insert(self._ships_keys[product])
 +
end
 +
table.sort(self._ships_keys[product])
 +
end
 +
return self._ships_keys[product]
 +
end
 +
end
 +
 
 +
function EquipmentData:improvement_resources(slider, product, stars)
 +
if self._improvements and self._improvements._products and self._improvements._products[product] then
 +
local product_info = self._improvements._product[products]
 +
if not stars then
 +
return {
 +
fuel = product_info._fuel,
 +
ammo = product_info._ammo,
 +
steel = product_info._steel,
 +
bauxite = product_info._bauxite,
 +
}
 +
elseif product_info[stars] then
 +
return {
 +
devmat = slider and product_info[stars]._development_material_x or product_info[stars]._development_material,
 +
screw = slider and product_info[stars]._improvement_material_x or product_info[stars]._improvement_material,
 +
equipment = product_info._equipment,
 +
}
 +
end
 +
end
 +
end
 +
 
 +
function EquipmentData:improvement_availability(product, ship)
 +
if self._improvements and self._improvements._products and self._improvements._products[product] then
 +
return self._improvements._products[product][ship]
 +
end
 
end
 
end
  
Anonymous user