fix: always show synergy partner name, strip duplicated lead
Check Localization / Check Localization process (push) Canceled after 0s
Check Localization / Check Localization process (push) Canceled after 0s
This commit is contained in:
1 parent
7585979a0d
commit
fdfc6d391e
1 file changed
+15
-3
@@ -39,6 +39,16 @@ local function synergyCondition(desc)
|
|||||||
return false
|
return false
|
||||||
end
|
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 function synergyCallback(desc)
|
||||||
local list = synergyTableFor(desc)
|
local list = synergyTableFor(desc)
|
||||||
if not list then return desc end
|
if not list then return desc end
|
||||||
@@ -58,9 +68,11 @@ local function synergyCallback(desc)
|
|||||||
-- (printBulletPoints advances one lineHeight per #-segment unconditionally)
|
-- (printBulletPoints advances one lineHeight per #-segment unconditionally)
|
||||||
desc.Description = desc.Description .. "#{{Blank}} #{{Blank}} Синергии:"
|
desc.Description = desc.Description .. "#{{Blank}} #{{Blank}} Синергии:"
|
||||||
for i = 1, math.min(#lines, MAX_SYNERGY_LINES) do
|
for i = 1, math.min(#lines, MAX_SYNERGY_LINES) do
|
||||||
-- NOTE: {{CollectibleID}} already renders the item's icon AND its name,
|
-- NOTE: {{CollectibleID}} renders only the icon; the name is NOT
|
||||||
-- so no explicit name is added here
|
-- auto-appended by the engine, so prepend the official item name here
|
||||||
desc.Description = desc.Description .. "#{{Collectible" .. lines[i].partner .. "}}: " .. lines[i].text
|
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
|
end
|
||||||
if #lines > MAX_SYNERGY_LINES then
|
if #lines > MAX_SYNERGY_LINES then
|
||||||
desc.Description = desc.Description .. "#…и ещё синергий: " .. (#lines - MAX_SYNERGY_LINES)
|
desc.Description = desc.Description .. "#…и ещё синергий: " .. (#lines - MAX_SYNERGY_LINES)
|
||||||
|
|||||||
Reference in new issue
Block a user