Factorio: Differentiate advancement items.

This commit is contained in:
Fabian Dill 2021-05-22 10:46:27 +02:00
parent 80b7e2e188
commit d8e33fe596
3 changed files with 12 additions and 6 deletions

View File

@ -37,6 +37,12 @@ function set_ap_icon(tech)
tech.icon_size = 128 tech.icon_size = 128
end end
function set_ap_unimportant_icon(tech)
tech.icon = "__{{ mod_name }}__/graphics/icons/ap_unimportant.png"
tech.icons = nil
tech.icon_size = 128
end
function copy_factorio_icon(tech, tech_source) function copy_factorio_icon(tech, tech_source)
tech.icon = table.deepcopy(technologies[tech_source].icon) tech.icon = table.deepcopy(technologies[tech_source].icon)
tech.icons = table.deepcopy(technologies[tech_source].icons) tech.icons = table.deepcopy(technologies[tech_source].icons)
@ -46,7 +52,7 @@ end
table.insert(data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories, "crafting-with-fluid") table.insert(data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories, "crafting-with-fluid")
{# each randomized tech gets set to be invisible, with new nodes added that trigger those #} {# each randomized tech gets set to be invisible, with new nodes added that trigger those #}
{%- for original_tech_name, item_name, receiving_player in locations %} {%- for original_tech_name, item_name, receiving_player, advancement in locations %}
original_tech = technologies["{{original_tech_name}}"] original_tech = technologies["{{original_tech_name}}"]
{#- the tech researched by the local player #} {#- the tech researched by the local player #}
new_tree_copy = table.deepcopy(template_tech) new_tree_copy = table.deepcopy(template_tech)
@ -60,7 +66,7 @@ new_tree_copy.unit.count = math.max(1, math.floor(new_tree_copy.unit.count * {{
copy_factorio_icon(new_tree_copy, "{{ item_name }}") copy_factorio_icon(new_tree_copy, "{{ item_name }}")
{%- else -%} {%- else -%}
{#- use default AP icon if no Factorio graphics exist -#} {#- use default AP icon if no Factorio graphics exist -#}
set_ap_icon(new_tree_copy) {% if advancement %}set_ap_icon(new_tree_copy){% else %}set_ap_unimportant_icon(new_tree_copy){% endif %}
{%- endif -%} {%- endif -%}
{#- connect Technology #} {#- connect Technology #}
{%- if original_tech_name in tech_tree_layout_prerequisites %} {%- if original_tech_name in tech_tree_layout_prerequisites %}

View File

@ -1,6 +1,6 @@
[technology-name] [technology-name]
{% for original_tech_name, item_name, receiving_player in locations %} {% for original_tech_name, item_name, receiving_player, advancement in locations %}
{%- if visibility -%} {%- if visibility -%}
ap-{{ tech_table[original_tech_name] }}-={{ player_names[receiving_player] }}'s {{ item_name }} ap-{{ tech_table[original_tech_name] }}-={{ player_names[receiving_player] }}'s {{ item_name }}
{% else %} {% else %}
@ -9,9 +9,9 @@ ap-{{ tech_table[original_tech_name] }}-= An Archipelago Sendable
{% endfor %} {% endfor %}
[technology-description] [technology-description]
{% for original_tech_name, item_name, receiving_player in locations %} {% for original_tech_name, item_name, receiving_player, advancement in locations %}
{%- if visibility -%} {%- if visibility -%}
ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends {{ item_name }} to {{ player_names[receiving_player] }}. ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends {{ item_name }} to {{ player_names[receiving_player] }}{% if advancement %}, which is considered a logical advancement{% endif %}.
{% else %} {% else %}
ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends something to someone. ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends something to someone.
{%- endif -%} {%- endif -%}

View File

@ -47,7 +47,7 @@ def generate_mod(world: MultiWorld, player: int):
locations = [] locations = []
for location in world.get_filled_locations(player): for location in world.get_filled_locations(player):
if location.address: if location.address:
locations.append((location.name, location.item.name, location.item.player)) locations.append((location.name, location.item.name, location.item.player, location.item.advancement))
mod_name = f"AP-{world.seed_name}-P{player}-{world.player_names[player][0]}" mod_name = f"AP-{world.seed_name}-P{player}-{world.player_names[player][0]}"
tech_cost = {0: 0.1, tech_cost = {0: 0.1,
1: 0.25, 1: 0.25,