Line 67: |
Line 67: |
| end, | | end, |
| | | |
| + | format_day_battle = function(ship) |
| + | return shipCapabilities:format_day_battle(shipCapabilities:day_battle()) |
| + | end, |
| + | |
| + | format_night_battle = function(ship) |
| + | return shipCapabilities:format_night_battle(shipCapabilities:night_battle()) |
| + | end, |
| + | |
| format_opening_torpedo = function(ship) | | format_opening_torpedo = function(ship) |
− | return shipCapabilities:format_opening_torpedo(shipCapabilities:opening_torpedo()) | + | return shipCapabilities:format_torpedo(shipCapabilities:opening_torpedo()) |
| + | end, |
| + | |
| + | format_closing_torpedo = function(ship) |
| + | return shipCapabilities:format_torpedo(shipCapabilities:closing_torpedo()) |
| + | end, |
| + | |
| + | format_asw_attack = function(ship) |
| + | return shipCapabilities:format_asw_attack(shipCapabilities:asw_attack()) |
| + | end, |
| + | |
| + | format_opening_airstrike = function(ship) |
| + | return shipCapabilities:format_opening_airstrike(shipCapabilities:opening_airstrike()) |
| + | end, |
| + | |
| + | slots = function(ship) |
| + | return U.imap(ship._equipment, function (e) return e.size end) |
| end, | | end, |
− |
| + | |
| code = function(obj) | | code = function(obj) |
| return equipment and | | return equipment and |
Line 202: |
Line 226: |
| | | |
| function format_value(key, ship, target) | | function format_value(key, ship, target) |
| + | local formatting_function = formatting_functions[key] |
| + | if formatting_function then |
| + | return formatting_function(ship, target) |
| + | end |
| if shipCapabilities[key] then | | if shipCapabilities[key] then |
| local a, b = shipCapabilities[key](shipCapabilities) | | local a, b = shipCapabilities[key](shipCapabilities) |
| return format_lua(b or a) | | return format_lua(b or a) |
− | end
| |
− | local formatting_function = formatting_functions[key]
| |
− | if formatting_function then
| |
− | return formatting_function(ship, target)
| |
| end | | end |
| if ship then | | if ship then |