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

@ -508,10 +508,10 @@ def main(args, seed=None):
for item in world.precollected_items:
precollected_items[item.player].append(item.code)
precollected_hints = {player: set() for player in range(1, world.players + 1)}
# for now special case Factorio visibility
# for now special case Factorio tech_tree_information
sending_visible_players = set()
for player in world.factorio_player_ids:
if world.visibility[player]:
if world.tech_tree_information[player].value == 2:
sending_visible_players.add(player)
for i, team in enumerate(parsed_names):

View File

@ -348,8 +348,8 @@ class MaxSciencePack(Choice):
default = 6
def get_allowed_packs(self):
return {option.replace("_", "-") for option, value in self.options.items()
if value <= self.value}
return {option.replace("_", "-") for option, value in self.options.items() if value <= self.value} - \
{"space-science-pack"} # with rocket launch being the goal, post-launch techs don't make sense
class TechCost(Choice):
@ -388,10 +388,11 @@ class TechTreeLayout(Choice):
default = 0
class Visibility(Choice):
class TechTreeInformation(Choice):
option_none = 0
option_sending = 1
default = 1
option_advancement = 1
option_full = 2
default = 2
class RecipeTime(Choice):
@ -411,7 +412,7 @@ factorio_options: typing.Dict[str, type(Option)] = {
"tech_tree_layout": TechTreeLayout,
"tech_cost": TechCost,
"free_samples": FreeSamples,
"visibility": Visibility,
"tech_tree_information": TechTreeInformation,
"starting_items": FactorioStartItems,
"recipe_time": RecipeTime,
"imported_blueprints": DefaultOnToggle,

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 -%}

View File

@ -91,9 +91,10 @@ Factorio:
single_craft: 0
half_stack: 0
stack: 0
visibility:
tech_tree_information:
none: 0
sending: 1
advancement: 0 # show which items are a logical advancement
full: 1 # show full info on each tech node
imported_blueprints: # can be turned off to prevent access to blueprints created outside the current world
on: 1
off: 0