add Factorio world gen settings

This commit is contained in:
Fabian Dill
2021-07-02 01:29:49 +02:00
parent eee6fc0f10
commit 0a64caf4c5
7 changed files with 46 additions and 9 deletions

View File

@@ -0,0 +1,2 @@
{% from "macros.lua" import dict_to_lua %}
data.raw["map-gen-presets"].default["archipelago"] = {{ dict_to_lua({"default": False, "order": "a", "basic_settings": world_gen}) }}

View File

@@ -1,3 +1,8 @@
[map-gen-preset-name]
archipelago=Archipelago
[map-gen-preset-description]
archipelago=World preset created by the Archipelago Randomizer. World may or may not contain actual archipelagos.
[technology-name]
{% for original_tech_name, item_name, receiving_player, advancement in locations %}

View File

@@ -1,10 +1,17 @@
{% macro dict_to_lua(dict) -%}
{
{%- for key, value in dict.items() -%}
["{{ key }}"] = {% if value is mapping %}{{ dict_to_lua(value) }}{% else %}{{ value | safe }}{% endif %}{% if not loop.last %},{% endif %}
["{{ key }}"] = {{ variable_to_lua(value) }}{% if not loop.last %},{% endif %}
{% endfor -%}
}
{%- endmacro %}
{%- macro variable_to_lua(value) %}
{%- if value is mapping -%}{{ dict_to_lua(value) }}
{%- elif value is boolean -%}{{ value | string | lower }}
{%- elif value is string -%} "{{ value | safe }}"
{%- else -%} {{ value | safe }}
{%- endif -%}
{%- endmacro -%}
{% macro dict_to_recipe(dict) -%}
{
{%- for key, value in dict.items() -%}