diff --git a/worlds/factorio/Mod.py b/worlds/factorio/Mod.py index 00ef0d866a..b53b0fa05f 100644 --- a/worlds/factorio/Mod.py +++ b/worlds/factorio/Mod.py @@ -23,7 +23,6 @@ template_env: Optional[jinja2.Environment] = None data_template: Optional[jinja2.Template] = None data_final_template: Optional[jinja2.Template] = None -locale_template: Optional[jinja2.Template] = None control_template: Optional[jinja2.Template] = None settings_template: Optional[jinja2.Template] = None @@ -94,7 +93,7 @@ def generate_mod(world: "Factorio", output_directory: str): multiworld = world.multiworld random = world.random - global data_final_template, locale_template, control_template, data_template, settings_template + global data_final_template, control_template, data_template, settings_template with template_load_lock: if not data_final_template: def load_template(name: str): @@ -107,7 +106,6 @@ def generate_mod(world: "Factorio", output_directory: str): data_template = template_env.get_template("data.lua") data_final_template = template_env.get_template("data-final-fixes.lua") - locale_template = template_env.get_template(r"locale/en/locale.cfg") control_template = template_env.get_template("control.lua") settings_template = template_env.get_template("settings.lua") # get data for templates @@ -195,9 +193,7 @@ def generate_mod(world: "Factorio", output_directory: str): control_template.render(**template_data))) mod.writing_tasks.append(lambda: (versioned_mod_name + "/settings.lua", settings_template.render(**template_data))) - mod.writing_tasks.append(lambda: (versioned_mod_name + "/locale/en/locale.cfg", - locale_template.render(**template_data))) - + info = base_info.copy() info["name"] = mod_name mod.writing_tasks.append(lambda: (versioned_mod_name + "/info.json", diff --git a/worlds/factorio/data/mod/locale/en/locale.cfg b/worlds/factorio/data/mod/locale/en/locale.cfg new file mode 100644 index 0000000000..7d60d90b43 --- /dev/null +++ b/worlds/factorio/data/mod/locale/en/locale.cfg @@ -0,0 +1,36 @@ +[map-gen-preset-name] +archipelago=Archipelago + +[entity-name] +ap-energy-bridge=Archipelago EnergyLink Bridge + +[map-gen-preset-description] +archipelago=World preset created by the Archipelago Randomizer. World may or may not contain actual archipelagos. + +[technology-name] +ap-technology-full=__1__'s __2__ (__3__) +ap-technology-hidden=__1__ + +[technology-description] +ap-technology-full=Researching this technology sends __1__ to __2____3__. +ap-technology-item-advancement=, which is considered a logical advancement +ap-technology-item-useful=, which is considered useful +ap-technology-item-trap=, which is considered fun +ap-technology-hidden=Researching this technology sends something to someone__1__. + +[mod-setting-name] +archipelago-death-link=Death Link + +[mod-setting-description] +archipelago-death-link=Kill other players in the same Archipelago Multiworld that also have Death Link turned on, when you die. + +[archipelago] +receive-ap-item=Received __1__ from __2__. +receive-ap-catchup=Received __1__ as it is already checked. +receive-sample-item=Received __1__x __2__ +sample-inventory-full=Additional items will be sent when inventory space is available. +sample-error=Unable to receive __1__x [item=__2__] as this item does not exist. +fail-to-place=Failed to place __1__ in __2__ + +[traps] +new-evolution-factor=New evolution factor: __1__ diff --git a/worlds/factorio/data/mod_template/control.lua b/worlds/factorio/data/mod_template/control.lua index 3f754d925c..060fe56431 100644 --- a/worlds/factorio/data/mod_template/control.lua +++ b/worlds/factorio/data/mod_template/control.lua @@ -420,12 +420,12 @@ function update_player(index) sent = 0 end if sent > 0 then - player.print("Received " .. sent .. "x [item=" .. name .. ",quality={{ free_sample_quality_name }}]") + player.print({"archipelago.receive-sample-item", sent, "[item=" .. name .. ",quality="..stack.quality.."]"}) data.suppress_full_inventory_message = false end if sent ~= count then -- Couldn't full send. if not data.suppress_full_inventory_message then - player.print("Additional items will be sent when inventory space is available.", {r=1, g=1, b=0.25}) + player.print({"archipelago.sample-inventory-full"}, {r=1, g=1, b=0.25}) end data.suppress_full_inventory_message = true -- Avoid spamming them with repeated full inventory messages. samples[name] = count - sent -- Buffer the remaining items @@ -434,7 +434,7 @@ function update_player(index) samples[name] = nil -- Remove from the list end else - player.print("Unable to receive " .. count .. "x [item=" .. name .. "] as this item does not exist.") + player.print({"archipelago.sample-inventory-full", count, name}) samples[name] = nil end end @@ -665,7 +665,7 @@ function spawn_entity(surface, force, name, x, y, radius, randomize, avoid_ores) end end if new_entity == nil then - force.print("Failed to place " .. args.name .. " in " .. serpent.line({x = x, y = y, radius = radius})) + force.print({"archipelago.fail-to-place", args.name, serpent.line({x = x, y = y, radius = radius})}) end end @@ -725,7 +725,7 @@ end, local new_factor = game.forces["enemy"].get_evolution_factor("nauvis") + (TRAP_EVO_FACTOR * (1 - game.forces["enemy"].get_evolution_factor("nauvis"))) game.forces["enemy"].set_evolution_factor(new_factor, "nauvis") - game.print({"", "New evolution factor:", new_factor}) + game.print({"traps.new-evolution-factor", new_factor}) end, ["Teleport Trap"] = function() for _, player in ipairs(game.forces["player"].players) do @@ -780,7 +780,7 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi elseif index == -1 then -- for coop sync and restoring from an older savegame tech = force.technologies[item_name] if tech.researched ~= true then - game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."}) + game.print({"archipelago.receive-ap-catchup", "[technology=" .. tech.name .. "]"}) game.play_sound({path="utility/research_completed"}) tech.researched = true end @@ -792,7 +792,7 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi for _, item_name in ipairs(tech_stack) do tech = force.technologies[item_name] if tech.researched ~= true then - game.print({"", "Received [technology=" .. tech.name .. "] from ", source}) + game.print({"archipelago.receive-ap-item", "[technology=" .. tech.name .. "]", source}) game.play_sound({path="utility/research_completed"}) tech.researched = true return @@ -804,7 +804,7 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi if tech ~= nil then storage.index_sync[index] = tech if tech.researched ~= true then - game.print({"", "Received [technology=" .. tech.name .. "] from ", source}) + game.print({"archipelago.receive-ap-item", "[technology=" .. tech.name .. "]", source}) game.play_sound({path="utility/research_completed"}) tech.researched = true end @@ -812,7 +812,7 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi elseif TRAP_TABLE[item_name] ~= nil then if storage.index_sync[index] ~= item_name then -- not yet received trap storage.index_sync[index] = item_name - game.print({"", "Received ", item_name, " from ", source}) + game.print({"archipelago.receive-ap-item", item_name, source}) TRAP_TABLE[item_name]() end else diff --git a/worlds/factorio/data/mod_template/data-final-fixes.lua b/worlds/factorio/data/mod_template/data-final-fixes.lua index e459523019..bfffab6a61 100644 --- a/worlds/factorio/data/mod_template/data-final-fixes.lua +++ b/worlds/factorio/data/mod_template/data-final-fixes.lua @@ -154,6 +154,13 @@ technologies["{{ original_tech_name }}"].hidden_in_factoriopedia = true {#- the tech researched by the local player #} new_tree_copy = table.deepcopy(template_tech) new_tree_copy.name = "ap-{{ location.address }}-"{# use AP ID #} +{%- if location.revealed %} +new_tree_copy.localised_name = {"technology-name.ap-technology-full", "{{ player_names[item.player] }}", "{{ item.name }}", "{{ location.name }}"} +new_tree_copy.localised_description = {"technology-description.ap-technology-full", "{{ item.name }}", "{{ player_names[item.player] }}", {% if item.advancement %}{"technology-description.ap-technology-item-advancement"}{% elif item.useful %}{"technology-description.ap-technology-item-useful"}{% elif item.trap %}{"technology-description.ap-technology-item-trap"}{% else %}""{% endif %}} +{%- else %} +new_tree_copy.localised_name = {"technology-name.ap-technology-hidden", "{{location.name}}"} +new_tree_copy.localised_description = {"technology-description.ap-technology-hidden", {% if tech_tree_information == 1 and item.advancement %}{"technology-description.ap-technology-item-advancement"}{% else %}""{% endif %}} +{% endif -%} {% if location.crafted_item is not none %} new_tree_copy.research_trigger = { type = "{{ 'craft-fluid' if location.crafted_item in liquids else 'craft-item' }}", diff --git a/worlds/factorio/data/mod_template/data.lua b/worlds/factorio/data/mod_template/data.lua index 43151ff008..562999d5df 100644 --- a/worlds/factorio/data/mod_template/data.lua +++ b/worlds/factorio/data/mod_template/data.lua @@ -13,7 +13,6 @@ end local energy_bridge = table.deepcopy(data.raw["accumulator"]["accumulator"]) energy_bridge.name = "ap-energy-bridge" energy_bridge.minable.result = "ap-energy-bridge" -energy_bridge.localised_name = "Archipelago EnergyLink Bridge" energy_bridge.energy_source.buffer_capacity = "50MJ" energy_bridge.energy_source.input_flow_limit = "10MW" energy_bridge.energy_source.output_flow_limit = "10MW" @@ -25,7 +24,6 @@ data.raw["accumulator"]["ap-energy-bridge"] = energy_bridge local energy_bridge_item = table.deepcopy(data.raw["item"]["accumulator"]) energy_bridge_item.name = "ap-energy-bridge" -energy_bridge_item.localised_name = "Archipelago EnergyLink Bridge" energy_bridge_item.place_result = energy_bridge.name tint_icon(energy_bridge_item, energy_bridge_tint()) data.raw["item"]["ap-energy-bridge"] = energy_bridge_item @@ -35,7 +33,6 @@ energy_bridge_recipe.name = "ap-energy-bridge" energy_bridge_recipe.results = { {type = "item", name = energy_bridge_item.name, amount = 1} } energy_bridge_recipe.energy_required = 1 energy_bridge_recipe.enabled = {% if energy_link %}true{% else %}false{% endif %} -energy_bridge_recipe.localised_name = "Archipelago EnergyLink Bridge" data.raw["recipe"]["ap-energy-bridge"] = energy_bridge_recipe data.raw["map-gen-presets"].default["archipelago"] = {{ dict_to_lua({"default": False, "order": "a", "basic_settings": world_gen["basic"], "advanced_settings": world_gen["advanced"]}) }} diff --git a/worlds/factorio/data/mod_template/locale/en/locale.cfg b/worlds/factorio/data/mod_template/locale/en/locale.cfg deleted file mode 100644 index 59dcffcd63..0000000000 --- a/worlds/factorio/data/mod_template/locale/en/locale.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[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 location, item in locations %} -{%- if location.revealed %} -ap-{{ location.address }}-={{ player_names[item.player] }}'s {{ item.name }} ({{ location.name }}) -{%- else %} -ap-{{ location.address }}-= {{location.name}} -{%- endif -%} -{% endfor %} - -[technology-description] -{% for location, item in locations %} -{%- if location.revealed %} -ap-{{ location.address }}-=Researching this technology sends {{ item.name }} to {{ player_names[item.player] }}{% if item.advancement %}, which is considered a logical advancement{% elif item.useful %}, which is considered useful{% elif item.trap %}, which is considered fun{% endif %}. -{%- elif tech_tree_information == 1 and item.advancement %} -ap-{{ location.address }}-=Researching this technology sends something to someone, which is considered a logical advancement. -{%- else %} -ap-{{ location.address }}-=Researching this technology sends something to someone. -{%- endif -%} -{% endfor %} - -[mod-setting-name] -archipelago-death-link-{{ slot_player }}-{{ seed_name }}=Death Link - -[mod-setting-description] -archipelago-death-link-{{ slot_player }}-{{ seed_name }}=Kill other players in the same Archipelago Multiworld that also have Death Link turned on, when you die. \ No newline at end of file diff --git a/worlds/factorio/data/mod_template/settings.lua b/worlds/factorio/data/mod_template/settings.lua index 41d30e58d5..c88c432563 100644 --- a/worlds/factorio/data/mod_template/settings.lua +++ b/worlds/factorio/data/mod_template/settings.lua @@ -21,6 +21,8 @@ data:extend({ type = "bool-setting", name = "archipelago-death-link-{{ slot_player }}-{{ seed_name }}", setting_type = "runtime-global", + localised_name = {"mod-setting-name.archipelago-death-link"}, + localised_description = {"mod-setting-description.archipelago-death-link"}, {% if death_link %} default_value = true {% else %}