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:
parent
07d61f6d47
commit
023a798ac1
4
Main.py
4
Main.py
|
@ -508,10 +508,10 @@ def main(args, seed=None):
|
||||||
for item in world.precollected_items:
|
for item in world.precollected_items:
|
||||||
precollected_items[item.player].append(item.code)
|
precollected_items[item.player].append(item.code)
|
||||||
precollected_hints = {player: set() for player in range(1, world.players + 1)}
|
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()
|
sending_visible_players = set()
|
||||||
for player in world.factorio_player_ids:
|
for player in world.factorio_player_ids:
|
||||||
if world.visibility[player]:
|
if world.tech_tree_information[player].value == 2:
|
||||||
sending_visible_players.add(player)
|
sending_visible_players.add(player)
|
||||||
|
|
||||||
for i, team in enumerate(parsed_names):
|
for i, team in enumerate(parsed_names):
|
||||||
|
|
13
Options.py
13
Options.py
|
@ -348,8 +348,8 @@ class MaxSciencePack(Choice):
|
||||||
default = 6
|
default = 6
|
||||||
|
|
||||||
def get_allowed_packs(self):
|
def get_allowed_packs(self):
|
||||||
return {option.replace("_", "-") for option, value in self.options.items()
|
return {option.replace("_", "-") for option, value in self.options.items() if value <= self.value} - \
|
||||||
if value <= self.value}
|
{"space-science-pack"} # with rocket launch being the goal, post-launch techs don't make sense
|
||||||
|
|
||||||
|
|
||||||
class TechCost(Choice):
|
class TechCost(Choice):
|
||||||
|
@ -388,10 +388,11 @@ class TechTreeLayout(Choice):
|
||||||
default = 0
|
default = 0
|
||||||
|
|
||||||
|
|
||||||
class Visibility(Choice):
|
class TechTreeInformation(Choice):
|
||||||
option_none = 0
|
option_none = 0
|
||||||
option_sending = 1
|
option_advancement = 1
|
||||||
default = 1
|
option_full = 2
|
||||||
|
default = 2
|
||||||
|
|
||||||
|
|
||||||
class RecipeTime(Choice):
|
class RecipeTime(Choice):
|
||||||
|
@ -411,7 +412,7 @@ factorio_options: typing.Dict[str, type(Option)] = {
|
||||||
"tech_tree_layout": TechTreeLayout,
|
"tech_tree_layout": TechTreeLayout,
|
||||||
"tech_cost": TechCost,
|
"tech_cost": TechCost,
|
||||||
"free_samples": FreeSamples,
|
"free_samples": FreeSamples,
|
||||||
"visibility": Visibility,
|
"tech_tree_information": TechTreeInformation,
|
||||||
"starting_items": FactorioStartItems,
|
"starting_items": FactorioStartItems,
|
||||||
"recipe_time": RecipeTime,
|
"recipe_time": RecipeTime,
|
||||||
"imported_blueprints": DefaultOnToggle,
|
"imported_blueprints": DefaultOnToggle,
|
||||||
|
|
|
@ -23,7 +23,7 @@ template_tech.effects = {}
|
||||||
template_tech.prerequisites = {}
|
template_tech.prerequisites = {}
|
||||||
|
|
||||||
function prep_copy(new_copy, old_tech)
|
function prep_copy(new_copy, old_tech)
|
||||||
old_tech.enabled = false
|
old_tech.hidden = true
|
||||||
new_copy.unit = table.deepcopy(old_tech.unit)
|
new_copy.unit = table.deepcopy(old_tech.unit)
|
||||||
local ingredient_filter = allowed_ingredients[old_tech.name]
|
local ingredient_filter = allowed_ingredients[old_tech.name]
|
||||||
if ingredient_filter ~= nil then
|
if ingredient_filter ~= nil then
|
||||||
|
@ -69,12 +69,12 @@ prep_copy(new_tree_copy, original_tech)
|
||||||
{% if tech_cost_scale != 1 %}
|
{% if tech_cost_scale != 1 %}
|
||||||
new_tree_copy.unit.count = math.max(1, math.floor(new_tree_copy.unit.count * {{ tech_cost_scale }}))
|
new_tree_copy.unit.count = math.max(1, math.floor(new_tree_copy.unit.count * {{ tech_cost_scale }}))
|
||||||
{% endif %}
|
{% 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 Technology Icon -#}
|
||||||
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 -#}
|
||||||
{% 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 -%}
|
{%- endif -%}
|
||||||
{#- connect Technology #}
|
{#- connect Technology #}
|
||||||
{%- if original_tech_name in tech_tree_layout_prerequisites %}
|
{%- if original_tech_name in tech_tree_layout_prerequisites %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
[technology-name]
|
[technology-name]
|
||||||
{% for original_tech_name, item_name, receiving_player, advancement in locations %}
|
{% 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 }}
|
ap-{{ tech_table[original_tech_name] }}-={{ player_names[receiving_player] }}'s {{ item_name }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ap-{{ tech_table[original_tech_name] }}-=An Archipelago Sendable
|
ap-{{ tech_table[original_tech_name] }}-=An Archipelago Sendable
|
||||||
|
@ -10,8 +10,10 @@ ap-{{ tech_table[original_tech_name] }}-= An Archipelago Sendable
|
||||||
|
|
||||||
[technology-description]
|
[technology-description]
|
||||||
{% for original_tech_name, item_name, receiving_player, advancement in locations %}
|
{% 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 %}.
|
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 %}
|
{% 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 -%}
|
||||||
|
|
|
@ -91,9 +91,10 @@ Factorio:
|
||||||
single_craft: 0
|
single_craft: 0
|
||||||
half_stack: 0
|
half_stack: 0
|
||||||
stack: 0
|
stack: 0
|
||||||
visibility:
|
tech_tree_information:
|
||||||
none: 0
|
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
|
imported_blueprints: # can be turned off to prevent access to blueprints created outside the current world
|
||||||
on: 1
|
on: 1
|
||||||
off: 0
|
off: 0
|
||||||
|
|
Loading…
Reference in New Issue