Factorio: refactor visibility option into tech_tree_information

set vanilla technologies to be hidden instead of disabled
          fix advancement icon still showing when no information in tech was supposed to be given
This commit is contained in:
Fabian Dill
2021-06-21 22:25:49 +02:00
parent 07d61f6d47
commit 023a798ac1
5 changed files with 20 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ template_tech.effects = {}
template_tech.prerequisites = {}
function prep_copy(new_copy, old_tech)
old_tech.enabled = false
old_tech.hidden = true
new_copy.unit = table.deepcopy(old_tech.unit)
local ingredient_filter = allowed_ingredients[old_tech.name]
if ingredient_filter ~= nil then
@@ -69,12 +69,12 @@ prep_copy(new_tree_copy, original_tech)
{% if tech_cost_scale != 1 %}
new_tree_copy.unit.count = math.max(1, math.floor(new_tree_copy.unit.count * {{ tech_cost_scale }}))
{% endif %}
{%- if item_name in tech_table and visibility -%}
{%- if item_name in tech_table and tech_tree_information == 2 -%}
{#- copy Factorio Technology Icon -#}
copy_factorio_icon(new_tree_copy, "{{ item_name }}")
{%- else -%}
{#- use default AP icon if no Factorio graphics exist -#}
{% if advancement %}set_ap_icon(new_tree_copy){% else %}set_ap_unimportant_icon(new_tree_copy){% endif %}
{% if advancement or not tech_tree_information %}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 %}

View File

@@ -1,17 +1,19 @@
[technology-name]
{% for original_tech_name, item_name, receiving_player, advancement in locations %}
{%- if visibility -%}
{%- if tech_tree_information == 2 -%}
ap-{{ tech_table[original_tech_name] }}-={{ player_names[receiving_player] }}'s {{ item_name }}
{% else %}
ap-{{ tech_table[original_tech_name] }}-= An Archipelago Sendable
ap-{{ tech_table[original_tech_name] }}-=An Archipelago Sendable
{%- endif -%}
{% endfor %}
[technology-description]
{% for original_tech_name, item_name, receiving_player, advancement in locations %}
{%- if visibility -%}
{%- if tech_tree_information == 2 -%}
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 %}.
{%- elif tech_tree_information == 1 and advancement -%}
ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends something to someone, which is considered a logical advancement.
{% else %}
ap-{{ tech_table[original_tech_name] }}-=Researching this technology sends something to someone.
{%- endif -%}