Line 33: |
Line 33: |
| | | |
| function NanaminFleet:ship_card(ship) | | function NanaminFleet:ship_card(ship) |
| + | if not ship then |
| + | return Formatting:format_image{"Catbomb.png"} |
| + | end |
| return Formatting:format_image{ship:card()} | | return Formatting:format_image{ship:card()} |
| end | | end |
Line 38: |
Line 41: |
| function NanaminFleet:slot_equipment(ship) | | function NanaminFleet:slot_equipment(ship) |
| local slots = {} | | local slots = {} |
− | local ship_slot_count = ship:slots() | + | local ship_slot_count = ship.card ~= "function" and 0 or ship:slots() |
| + | |
| for i = 1, 4 do | | for i = 1, 4 do |
| local equip, plane_count, icon, equip_type | | local equip, plane_count, icon, equip_type |
− | if i > ship_slot_count then | + | if ship.card == "function" or i > ship_slot_count then |
| equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false | | equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false |
| else | | else |
Line 67: |
Line 71: |
| end | | end |
| | | |
− | function NanaminFleet.create_table(args) | + | function NanaminFleet:create_table(args) |
| local ships = {} | | local ships = {} |
| local vars = {} | | local vars = {} |
| for i = 1, 6 do | | for i = 1, 6 do |
− | ships[i] = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"]) | + | ships[i] = {} |
| + | ships[i].object = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"]) |
| | | |
| --Get the equips categorized under each ship specifically so the ship number doesn't have to be passed. | | --Get the equips categorized under each ship specifically so the ship number doesn't have to be passed. |
Line 79: |
Line 84: |
| end | | end |
| | | |
− | vars["ship_card" .. i] = self:ship_card(ships[i]) | + | vars["ship_card" .. i] = self:ship_card(ships[i].object) |
− | vars["ship_equips" .. i] = self:slot_equipment(ships[i]) | + | vars["ship_equips" .. i] = self:slot_equipment(ships[i].object) |
| end | | end |
| | | |
| mw.log(format(self._template, vars)) | | mw.log(format(self._template, vars)) |
| return format(self._template, vars) | | return format(self._template, vars) |
| + | end |
| + | |
| + | function test(frame) |
| + | args = {} |
| + | NanaminFleet:create_table(args) |
| end | | end |
| | | |
| return NanaminFleet | | return NanaminFleet |