Skip to content

Commit 7039c41

Browse files
authored
fix: Personal equipment names were not localized properly. (Yafc-CE#485)
In 2.0, Factorio decided to be cute and rename "placed_as_..." to "place_as_...", causing ![image](https://github.com/user-attachments/assets/aceba78e-9d1b-4065-b633-28a32796e7ac) This was fine, except that I also decided to be cute and make it painful for developers when the localization fails. So now it's fixed. As a bonus, the fallback description string is now "A recipe to create exoskeleton-equipment" instead of just "A recipe to create".
2 parents b5fd98b + dbc0d05 commit 7039c41

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

Yafc.Model/Data/DataClasses.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public void FallbackLocalization(FactorioObject? other, LocalizableString1 descr
5555
}
5656
else {
5757
locName = other.locName;
58-
locDescr = description.L(locName);
58+
// locName could still be null at this point. Use name instead, since we have nothing better.
59+
locDescr = description.L(locName ?? name);
5960
}
6061
}
6162

Yafc.Parser/Data/FactorioDataDeserializer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ void readTrigger(LuaTable table) {
425425

426426
item.stackSize = table.Get("stack_size", 1);
427427

428-
if (item.locName == null && table.Get("placed_as_equipment_result", out string? result)) {
428+
// place_as for 2.0, placed_as for 1.1
429+
if (item.locName == null && (table.Get("place_as_equipment_result", out string? result) || table.Get("placed_as_equipment_result", out result))) {
429430
item.locName = LocalisedStringParser.ParseKey("equipment-name." + result, [])!;
430431
}
431432
if (table.Get("fuel_value", out string? fuelValue)) {

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Version:
1919
Date:
2020
Features:
2121
Fixes:
22+
- Personal equipment names are localized again.
2223
----------------------------------------------------------------------------------------------------------------------
2324
Version: 2.13.0
2425
Date: May 14th 2025

0 commit comments

Comments
 (0)