Skip to content
Merged
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
26 changes: 26 additions & 0 deletions lib/data-stage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ py.empty_image = function()
}
end

---Returns a localised name with the respective properties of this item/entity/recipe, generalized to make localisation easier
---@param base_name string
---@param tier string?
---@param wrapper string?
---@return LocalisedString
py.generate_localised_name = function(base_name, tier, wrapper)
local localised_name = not tier and base_name or tier {
"?",
type(base_name) == "string" and (base_name .. "mk0" .. tier) or base_name,
{"py.tier.mk0" .. tier, {base_name}}
}
return wrapper and {wrapper, {localised_name}} or localised_name
end

---Returns a localised description with the respective properties of this item/entity/recipe, generalized to make localisation easier
---@param base_name string
---@param tier string?
---@return LocalisedString
py.generate_localised_description = function(base_name, tier)
return not tier and base_name or tier {
"?",
type(base_name) == "string" and (base_name .. "mk0" .. tier) or base_name,
{"py.tier.mk0" .. tier, {base_name}}
}
end

---Adds a localised string to the prototype's description.
---@param type string
---@param prototype data.AnyPrototype
Expand Down