Factorio: display required rocket-silo ingredients ahead of time.

This commit is contained in:
Fabian Dill 2021-07-31 19:45:17 +02:00
parent db0604f585
commit 1d954b192c
2 changed files with 12 additions and 1 deletions

View File

@ -211,6 +211,10 @@ class CommonContext():
text = self.jsontotextparser(args["data"])
logger.info(text)
def on_package(self, cmd: str, args: dict):
"""For custom package handling in subclasses."""
pass
async def server_loop(ctx: CommonContext, address=None):
cached_address = None
@ -396,6 +400,8 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
else:
logger.debug(f"unknown command {cmd}")
ctx.on_package(cmd, args)
async def console_loop(ctx: CommonContext):
import sys
@ -415,4 +421,4 @@ async def console_loop(ctx: CommonContext):
if input_text:
commandprocessor(input_text)
except Exception as e:
logging.exception(e)
logger.exception(e)

View File

@ -85,6 +85,11 @@ new_tree_copy.unit.count = math.max(1, math.floor(new_tree_copy.unit.count * {{
{%- if (tech_tree_information == 2 or original_tech_name in static_nodes) and item_name in base_tech_table -%}
{#- copy Factorio Technology Icon -#}
copy_factorio_icon(new_tree_copy, "{{ item_name }}")
{%- if original_tech_name == "rocket-silo" and original_tech_name in static_nodes %}
{%- for ingredient in custom_recipes["rocket-part"].ingredients %}
table.insert(new_tree_copy.effects, {type = "nothing", effect_description = "Ingredient {{ loop.index }}: {{ ingredient }}"})
{% endfor -%}
{% endif -%}
{%- elif (tech_tree_information == 2 or original_tech_name in static_nodes) and item_name in progressive_technology_table -%}
copy_factorio_icon(new_tree_copy, "{{ progressive_technology_table[item_name][0] }}")
{%- else -%}