fix: always show synergy partner name, strip duplicated lead
Check Localization / Check Localization process (push) Canceled after 0s

This commit is contained in:
lzrdblzzrd committed 2026-09-22 15:00:20 +03:00
1 parent 7585979a0d
commit fdfc6d391e
1 file changed
+15 -3
+15 -3
View File
@@ -39,6 +39,16 @@ local function synergyCondition(desc)
return false
end
-- Removes leading "«Name»" chunks naming this very partner, so the line
-- does not read "Ladder: «Ladder» / ...". Leads naming other partners stay.
local function stripOwnNameLead(text, name)
local lead = "«" .. name .. "»"
while text:sub(1, #lead) == lead do
text = text:sub(#lead + 1):match("^%s*[/:—,–-]?%s*(.-)%s*$")
end
return text
end
local function synergyCallback(desc)
local list = synergyTableFor(desc)
if not list then return desc end
@@ -58,9 +68,11 @@ local function synergyCallback(desc)
-- (printBulletPoints advances one lineHeight per #-segment unconditionally)
desc.Description = desc.Description .. "#{{Blank}} #{{Blank}} Синергии:"
for i = 1, math.min(#lines, MAX_SYNERGY_LINES) do
-- NOTE: {{CollectibleID}} already renders the item's icon AND its name,
-- so no explicit name is added here
desc.Description = desc.Description .. "#{{Collectible" .. lines[i].partner .. "}}: " .. lines[i].text
-- NOTE: {{CollectibleID}} renders only the icon; the name is NOT
-- auto-appended by the engine, so prepend the official item name here
local partnerName = EID:getObjectName(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, lines[i].partner)
local body = stripOwnNameLead(lines[i].text, partnerName)
desc.Description = desc.Description .. "#{{Collectible" .. lines[i].partner .. "}} " .. partnerName .. ": " .. body
end
if #lines > MAX_SYNERGY_LINES then
desc.Description = desc.Description .. "#…и ещё синергий: " .. (#lines - MAX_SYNERGY_LINES)