Changes

New disabled slot logic that takes into account the fact that a disabled slot with equipment in it still provides equipment effects, and a disabled slot can provide aircraft space
Line 368: Line 368:     
function ShipInfoKai:slot_details()
 
function ShipInfoKai:slot_details()
local slots = {}
+
local slots, num_of_slots, num_of_enabled_slots, slots_to_show = {}, self._ship:slots_length(), self._ship:slots()
local num_of_slots = self._ship:slots_length()
  −
local slots_to_show
   
if num_of_slots then
 
if num_of_slots then
 
slots_to_show = math.max(self._default_slot_num, num_of_slots)
 
slots_to_show = math.max(self._default_slot_num, num_of_slots)
Line 377: Line 375:  
end
 
end
 
for i = 1, slots_to_show do
 
for i = 1, slots_to_show do
local equipment, size, estimation, icon, color, equipment_type
+
local disabled, equipment, size, estimation, icon, color, equipment_type = num_of_enabled_slots and i > num_of_enabled_slots
 
if num_of_slots and i > num_of_slots then
 
if num_of_slots and i > num_of_slots then
 
equipment, size, estimation, icon, color, equipment_type = "- Locked -", false, false, "", 0, false
 
equipment, size, estimation, icon, color, equipment_type = "- Locked -", false, false, "", 0, false
Line 388: Line 386:  
equipment = Formatting:format_link(equipment:link())
 
equipment = Formatting:format_link(equipment:link())
 
else
 
else
icon = false
+
icon = disabled and "" or false
 
color = 0
 
color = 0
equipment = equipment == false and "- Unequipped -" or Formatting:format_stat(equipment)
+
equipment = equipment == false and (disabled and "- Locked -" or "- Unequipped -") or Formatting:format_stat(equipment)
 
equipment_type = false
 
equipment_type = false
 
end
 
end
if size == false then
+
 
equipment = Formatting:strike(equipment)
  −
end
   
icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = Formatting:format_equipment_type(equipment_type)}
 
icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = Formatting:format_equipment_type(equipment_type)}
 
end
 
end
Anonymous user