{% extends "multitracker.html" %}
{# establish the to be tracked data. Display Name, factorio/AP internal name, display image #}
{%- set science_packs = [
    ("Logistic Science Pack", "logistic-science-pack",
    "https://wiki.factorio.com/images/thumb/Logistic_science_pack.png/32px-Logistic_science_pack.png"),
    ("Military Science Pack", "military-science-pack",
    "https://wiki.factorio.com/images/thumb/Military_science_pack.png/32px-Military_science_pack.png"),
    ("Chemical Science Pack", "chemical-science-pack",
    "https://wiki.factorio.com/images/thumb/Chemical_science_pack.png/32px-Chemical_science_pack.png"),
    ("Production Science Pack", "production-science-pack",
    "https://wiki.factorio.com/images/thumb/Production_science_pack.png/32px-Production_science_pack.png"),
    ("Utility Science Pack", "utility-science-pack",
    "https://wiki.factorio.com/images/thumb/Utility_science_pack.png/32px-Utility_science_pack.png"),
    ("Space Science Pack", "space-science-pack",
    "https://wiki.factorio.com/images/thumb/Space_science_pack.png/32px-Space_science_pack.png"),
] -%}

{%- block custom_table_headers %}
{#- macro that creates a table header with display name and image -#}
{%- macro make_header(name, img_src) %}
<th class="center-column">
    <img class="icon-sprite" src="{{ img_src }}" alt="{{ name }}" title="{{ name }}" />
</th>
{% endmacro -%}
{#- call the macro to build the table header -#}
{%- for name, internal_name, img_src in science_packs %}
    {{ make_header(name, img_src) }}
{% endfor -%}
{% endblock %}

{% block custom_table_row scoped  %}
    {%- set player_inventory = inventories[(team, player)] -%}
    {%- set prog_science = player_inventory["progressive-science-pack"] -%}
    {%- for name, internal_name, img_src in science_packs %}
        {% if player_inventory[internal_name] or prog_science > loop.index0 %}
            <td class="center-column item-acquired">✔️</td>
        {% else %}
            <td class="center-column"></td>
        {% endif %}
    {% endfor -%}
{% endblock%}
