fix: Add fallback for donation machine description for required amount <= 0

This commit is contained in:
Wofsauge committed 2026-02-01 21:55:28 +01:00
1 parent 64a9dc3ac9
commit e913ae13d0
1 file changed
+11 -1
+11 -1
View File
@@ -231,9 +231,19 @@ local function DonationMachineCallback(descObj)
end end
end end
descObj.Icon = EID.InlineIcons["DonationMachine"]
if coinsNeeded - totalDonations <= 0 then
-- All rewards unlocked, remove description part with required coin amount
local linebreakPos = string.find(descObj.Description, "#")
if linebreakPos then
descObj.Description = string.sub(descObj.Description, linebreakPos + 1)
end
return descObj
end
-- Replace variables in description with values
descObj.Description = EID:ReplaceVariableStr(descObj.Description, 1, coinsNeeded) descObj.Description = EID:ReplaceVariableStr(descObj.Description, 1, coinsNeeded)
descObj.Description = EID:ReplaceVariableStr(descObj.Description, 2, coinsNeeded - totalDonations) descObj.Description = EID:ReplaceVariableStr(descObj.Description, 2, coinsNeeded - totalDonations)
descObj.Icon = EID.InlineIcons["DonationMachine"]
return descObj return descObj
end end