Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Version: 3.1.4
Date: ????
Changes:
- Changed py.add_to_description to use custom_tooltip_fields
- Fixed that recipes without a main product or without a localised name would not have recipe signals generated for them. Resolves https://github.com/pyanodon/pybugreports/issues/1494, resolves https://github.com/pyanodon/pybugreports/issues/1528
---------------------------------------------------------------------------------------------------
Version: 3.1.3
Expand Down
2 changes: 1 addition & 1 deletion data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ end
if mods.pycoalprocessing and not mods["extended-descriptions"] then
for _, recipe in pairs(data.raw.recipe) do
if recipe.allow_productivity then
py.add_to_description("recipe", recipe, {"recipe-description.affected-by-productivity"})
py.add_to_description("recipe", recipe, nil, {"recipe-description.affected-by-productivity"})
end
end
end
Expand Down
47 changes: 10 additions & 37 deletions lib/data-stage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,44 +49,17 @@ py.generate_localised_description = function(base_name, tier)
end

---Adds a localised string to the prototype's description.
---@param type string
---@param prototype data.AnyPrototype
---@param localised_string LocalisedString
py.add_to_description = function(type, prototype, localised_string)
--[[@cast localised_string string]] -- can also be a nested table but it hides warnings at least
if prototype.localised_description and prototype.localised_description ~= "" then
prototype.localised_description = {"", prototype.localised_description, "\n", localised_string}
return
end

local place_result = prototype.place_result or prototype.place_as_equipment_result
if type == "item" and place_result then
for _, machine in pairs(data.raw) do
machine = machine[place_result]
if machine and machine.localised_description then
prototype.localised_description = {
"?",
{"", machine.localised_description, "\n", localised_string},
localised_string
}
return
end
end

local entity_type = prototype.place_result and "entity" or "equipment"
prototype.localised_description = {
"?",
{"", {entity_type .. "-description." .. place_result}, "\n", localised_string},
{"", {type .. "-description." .. prototype.name}, "\n", localised_string},
localised_string
}
else
prototype.localised_description = {
"?",
{"", {type .. "-description." .. prototype.name}, "\n", localised_string},
localised_string
}
end
---@param name? LocalisedString|string filled with an empty string if not added
---@param value LocalisedString|string
py.add_to_description = function(prototype, name, value)
---@cast name LocalisedString?
---@cast value LocalisedString?
prototype.custom_tooltip_fields = prototype.custom_tooltip_fields or {}
prototype.custom_tooltip_fields[#prototype.custom_tooltip_fields + 1] = {
name = name or "",
value = value
}
end

---adds a glow layer to any item prototype.
Expand Down
2 changes: 1 addition & 1 deletion locale/de/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ consistency-check-complete=Technologieüberprüfung abgeschlossen. Einen schöne
yarm-remote-viewer=Charakter

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Beeinflusst durch Produktivität[/color][/font]
affected-by-productivity=Beeinflusst durch Produktivität

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ update-note=[color=yellow]__1__ update note:[/color] __2__
yarm-remote-viewer=Character

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Affected by productivity[/color][/font]
affected-by-productivity=Affected by productivity

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/es-ES/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ update-note=[color=yellow]__1__ Notas de la actualización:[/color] __2__
yarm-remote-viewer=Personaje

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Afectado por la productividad[/color][/font]
affected-by-productivity=Afectado por la productividad

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/fr/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ consistency-check-complete=Vérification de la technologie terminée, bonne jour
yarm-remote-viewer=Personnage

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Affecté par la productivité[/color][/font]
affected-by-productivity=Affecté par la productivité

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/nl/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ consistency-check-complete=Technologieverificatie klaar, fijne dag.
yarm-remote-viewer=Karakter

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Beïnvloed door productiviteit[/color][/font]
affected-by-productivity=Beïnvloed door productiviteit

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/pl/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ update-note=[color=yellow]__1__ informacja o aktualizacji:[/color] __2__
yarm-remote-viewer=Postać

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Wpływ na produktywność[/color][/font]
affected-by-productivity=Wpływ na produktywność

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down
2 changes: 1 addition & 1 deletion locale/ru/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yarm-remote-viewer=Персонаж
recipe-amount=(__1__ ×) __2__

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]На рецепт влияет продуктивность[/color][/font]
affected-by-productivity=На рецепт влияет продуктивность

[modifier-description]
change-recipe-productivity=Продуктивность "__1__": __2__
2 changes: 1 addition & 1 deletion locale/uk/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ consistency-check-complete=Перевірку технології заверш
yarm-remote-viewer=Персонаж

[recipe-description]
affected-by-productivity=[font=default-semibold][color=255,230,192]Впливає на продуктивність[/color][/font]
affected-by-productivity=Впливає на продуктивність

[recipe-name]
recipe-amount=(__1__ ×) __2__
Expand Down