From d8e33fe596f46e068d863582893a1f6afab013a9 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sat, 22 May 2021 10:46:27 +0200 Subject: [PATCH] Factorio: Differentiate advancement items. --- data/factorio/mod_template/data-final-fixes.lua | 10 ++++++++-- data/factorio/mod_template/locale/en/locale.cfg | 6 +++--- worlds/factorio/Mod.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/data/factorio/mod_template/data-final-fixes.lua b/data/factorio/mod_template/data-final-fixes.lua index 4d44b187..b46a43af 100644 --- a/data/factorio/mod_template/data-final-fixes.lua +++ b/data/factorio/mod_template/data-final-fixes.lua @@ -37,6 +37,12 @@ function set_ap_icon(tech) tech.icon_size = 128 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) tech.icon = table.deepcopy(technologies[tech_source].icon) 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") {# 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}}"] {#- the tech researched by the local player #} 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 }}") {%- else -%} {#- 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 -%} {#- connect Technology #} {%- if original_tech_name in tech_tree_layout_prerequisites %} diff --git a/data/factorio/mod_template/locale/en/locale.cfg b/data/factorio/mod_template/locale/en/locale.cfg index 24b7ce05..bce4d5f9 100644 --- a/data/factorio/mod_template/locale/en/locale.cfg +++ b/data/factorio/mod_template/locale/en/locale.cfg @@ -1,6 +1,6 @@ [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 -%} ap-{{ tech_table[original_tech_name] }}-={{ player_names[receiving_player] }}'s {{ item_name }} {% else %} @@ -9,9 +9,9 @@ ap-{{ tech_table[original_tech_name] }}-= An Archipelago Sendable {% endfor %} [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 -%} -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 %} ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends something to someone. {%- endif -%} diff --git a/worlds/factorio/Mod.py b/worlds/factorio/Mod.py index 7f34f684..6d7a73e7 100644 --- a/worlds/factorio/Mod.py +++ b/worlds/factorio/Mod.py @@ -47,7 +47,7 @@ def generate_mod(world: MultiWorld, player: int): locations = [] for location in world.get_filled_locations(player): 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]}" tech_cost = {0: 0.1, 1: 0.25,