Trailing whitespace cleanup (#600)

* Trailing whitespace cleanup

* More
This commit is contained in:
kittenchilly authored and GitHub committed 2023-11-08 07:37:36 +01:00
1 parent 399c2a154e
commit e25d55d436
41 files changed
+637 -637

No files matched your search

+41 -41
View File
@@ -70,13 +70,13 @@ end
function EID:addGoldenTrinketMetadata(id, appendText, numbersToMultiply, maxMultiplier, language)
maxMultiplier = maxMultiplier or 3
language = language or "en_us"
if appendText == "" then appendText = nil
elseif type(appendText) == "string" then appendText = {appendText} end
if numbersToMultiply == 0 then numbersToMultiply = nil
elseif type(numbersToMultiply) == "number" then numbersToMultiply = {numbersToMultiply} end
EID.GoldenTrinketData[id] = {t = numbersToMultiply, mult = maxMultiplier, append = appendText and true}
if appendText then
EID.descriptions[language].goldenTrinketEffects[id] = { appendText[1], appendText[1], appendText[2] or appendText[1] }
@@ -124,7 +124,7 @@ function EID:addPillMetadata(id, mimicCharge, class)
EID.pillMetadata[id] = {
mimiccharge = type(mimicCharge) == "number" and mimicCharge or -1,
class = class or "0",
}
}
end
-- Adds a character specific description for the item "Birthright". Optional parameters: playerName, language
@@ -163,7 +163,7 @@ function EID:assignTransformation(targetType, targetIdentifier, transformationSt
EID:removeEntryFromString(EID.CustomTransformRemovals, entryID, transformationString)
end
-- Try to automatically assign vanilla transformations to the entity
-- Try to automatically assign vanilla transformations to the entity
function EID:tryAutodetectTransformationsCollectible(collectibleID)
if not EID.isRepentance then return end
local config = EID.itemConfig:GetCollectible(collectibleID)
@@ -217,7 +217,7 @@ function EID:removeEntryFromString(sourceTable, entryKey, entryValue)
addToList = false
end
end
if addToList then
if addToList then
newEntry = newEntry..","..str
end
end
@@ -293,7 +293,7 @@ function EID:getTableName(Type, Variant, SubType)
if idString == "5.100" then return "collectibles"
elseif idString == "5.350" then return "trinkets"
elseif idString == "5.300" then return "cards"
elseif idString == "5.70" then
elseif idString == "5.70" then
if SubType <2049 then
return "pills"
else
@@ -388,7 +388,7 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity, checkModifiers)
description.Description = tableEntry and tableEntry[3] or EID:getXMLDescription(Type, Variant, SubType)
description.Transformation = EID:getTransformation(Type, Variant, SubType)
description.ModName = tableEntry and tableEntry[4]
description.Quality = EID:getObjectQuality(description)
description.Icon = EID:getObjectIcon(description)
@@ -471,7 +471,7 @@ function EID:getObjectItemTypeAndCharge(descObj)
descObj.ChargeType = itemConfig.ChargeType or 0
descObj.Charges = itemConfig.MaxCharges or 0
-- Special handling for dynamic charge items
if EID.isRepentance and (descObj.ObjSubType == CollectibleType.COLLECTIBLE_BLANK_CARD or descObj.ObjSubType == CollectibleType.COLLECTIBLE_PLACEBO or
if EID.isRepentance and (descObj.ObjSubType == CollectibleType.COLLECTIBLE_BLANK_CARD or descObj.ObjSubType == CollectibleType.COLLECTIBLE_PLACEBO or
descObj.ObjSubType == CollectibleType.COLLECTIBLE_CLEAR_RUNE or descObj.ObjSubType == CollectibleType.COLLECTIBLE_D_INFINITY) then
descObj.ChargeType = ItemConfig.CHARGE_SPECIAL
end
@@ -506,7 +506,7 @@ function EID:getDescriptionData(Type, Variant, SubType)
local tableName = EID:getTableName(Type, Variant, SubType)
local legacyModdedDescription = EID:getLegacyModDescription(Type, Variant, adjustedID)
local defaultDesc = EID:getDescriptionEntry(tableName, adjustedID)
return moddedDesc or legacyModdedDescription or defaultDesc
end
@@ -570,7 +570,7 @@ function EID:getTransformationName(id)
local str = "Custom"
if tonumber(id) == nil then
-- get translated custom name
local customTransform = EID.CustomTransformations[id]
local customTransform = EID.CustomTransformations[id]
if customTransform ~= nil then
return customTransform[EID:getLanguage()] or customTransform["en_us"] or id
end
@@ -620,9 +620,9 @@ function EID:getPillName(pillID, isHorsepill)
local legacyModdedDescription = EID:getLegacyModDescription(5, 70, pillID)
local tableName = isHorsepill and "horsepills" or "pills"
local defaultDesc = EID:getDescriptionEntry(tableName, pillID)
local name = moddedDesc or legacyModdedDescription or defaultDesc
local vanillaName = ""
if pillID == 9999 then
vanillaName = "Golden Pill" -- only used for languages that haven't defined a Golden Pill name
@@ -824,10 +824,10 @@ function EID:filterIconMarkup(text)
local callback = EID._NextIconModifier
EID._NextIconModifier = nil
local lookup = EID:getIcon(word)
local preceedingTextWidth = EID:getStrWidth(string.sub(text, 0, textposition - 1)) * EID.Scale
table.insert(spriteTable, {lookup, preceedingTextWidth, callback})
text = string.gsub(text, word, EID:generatePlaceholderString(lookup[3]), 1)
end
@@ -860,7 +860,7 @@ function EID:renderIcon(spriteObj, posX, posY, callback, animName, animFrame)
if callback then
callback(spriteObj)
end
if EID.CachingDescription then
table.insert(EID.CachedIcons[#EID.CachedIcons], {spriteObj, posX, posY, callback, animName, animFrame})
end
@@ -984,13 +984,13 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
-- cond#1: we can break at the end of string
cursor == #str or
-- cond#2: we can break after space
cur == byte_space or
cur == byte_space or
-- handle utf8 characters
(breakUtf8Chars and(
-- cond#3: we can break if the next character is 0x11xxxxxx
((next & 0xC0) == 0xC0) or
((next & 0xC0) == 0xC0) or
-- cond#4: we can also break if the current is 0x10xxxxxx while the next is ascii but not space
(((cur & 0xC0) == 0x80) and (next~= byte_space and (next & 0x80) == 0x00))
(((cur & 0xC0) == 0x80) and (next~= byte_space and (next & 0x80) == 0x00))
))
then
--[[
@@ -1009,14 +1009,14 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
↑
cond#3
byte data of a word:
[0x11xxxxxx,0x10xxxxxx,0x10xxxxxx, (next is 0x11xxxxxx, cond#3)]
[0x11xxxxxx,0x10xxxxxx,0x10xxxxxx, (next is 0x11xxxxxx, cond#3)]
--------------------ascii->utf8------------
utf8 word must start with 0x11xxxxxx, so cond#3 split before it.
word|世|界
| ↑
↑ cond#3
cond#3
world |means |世|界
↑
cond#2
@@ -1036,7 +1036,7 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
local wordFiltered = EID:replaceAllMarkupWithSpaces(word, isBulletpoint)
isBulletpoint = false
local wordLength = EID:getStrWidth(wordFiltered)
if curLength + wordLength <= textboxWidth or curLength < 17 then
table.insert(text, word)
curLength = curLength + wordLength
@@ -1051,10 +1051,10 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
end
cursor = cursor + 1
end
-- fix this function applying crafting icon green tint to the start of the printed line
EID._NextIconModifier = nil
table.insert(formattedLines, table.concat(text))
return formattedLines
end
@@ -1226,7 +1226,7 @@ function EID:GetMaxCollectibleID()
step = step // 2
end
end
return id
end
@@ -1295,7 +1295,7 @@ function EID:isCollectibleAllowed(collectibleID)
end
-- Achievements Locked Check (do we have Cube of Meat or Book of Revelations unlocked?)
function EID:AreAchievementsAllowed()
function EID:AreAchievementsAllowed()
-- Tainted characters have definitely beaten Mom!
-- (Fixes Tainted Lost's item pools, and potentially modded character's mechanics, ruining this check)
if EID.player:GetPlayerType() < 21 then
@@ -1325,7 +1325,7 @@ function EID:GetDimension(level)
return i
end
end
return nil
end
@@ -1344,7 +1344,7 @@ function EID:tableToCraftingIconsFull(craftTable, indicateCompleteContent)
for _, nr in ipairs(sortedList) do
visitedItemCount[nr] = visitedItemCount[nr] + 1
local containsItemResult = EID:bagContainsItem(nr, visitedItemCount[nr])
local completedColoring = indicateCompleteContent and containsItemResult and containsItemResult >= 1 and "{{IconGreenTint}}" or ""
local completedColoring = indicateCompleteContent and containsItemResult and containsItemResult >= 1 and "{{IconGreenTint}}" or ""
iconString = iconString..completedColoring.."{{Crafting"..nr.."}}"
end
return iconString
@@ -1371,7 +1371,7 @@ function EID:tableToCraftingIconsMerged(craftTable, indicateCompleteContent)
coloring = "{{ColorBagOverfill}}"
end
end
iconString = iconString..coloring..count.."{{Crafting"..nr.."}}{{CR}}"
end
end
@@ -1450,7 +1450,7 @@ end
function EID:getScreenSize()
local room = game:GetRoom()
local pos = room:WorldToScreenPosition(Vector(0,0)) - room:GetRenderScrollOffset() - game.ScreenShakeOffset
local rx = pos.X + 60 * 26 / 40
local ry = pos.Y + 140 * (26 / 40)
@@ -1468,7 +1468,7 @@ end
function EID:fixDefinedFont(forceRefresh)
local curLang = EID:getLanguage()
local curFont = EID.Config["FontType"]
-- If our currently loaded font is still valid, we don't need to reset values
for _, v in ipairs(EID.descriptions[curLang].fonts) do
if curFont == v.name then
@@ -1569,7 +1569,7 @@ function EID:checkPlayersForMissingItems()
if not EID.SaveGame or EID.Config["SaveGameNumber"] == 0 or game:GetVictoryLap() > 0 or game:GetSeeds():IsCustomRun() then return end
if EID.GameUpdateCount % 5 ~= 0 then return end
for i = 0, game:GetNumPlayers() - 1 do
for i = 0, game:GetNumPlayers() - 1 do
local player = Isaac.GetPlayer(i)
if player.QueuedItem.Item and EID.SaveGame[EID.Config["SaveGameNumber"]].ItemNeedsPickup[player.QueuedItem.Item.ID] then
table.insert(EID.CollectedItems, player.QueuedItem.Item.ID)
@@ -1580,7 +1580,7 @@ end
function EID:getPlayerID(entityPlayer)
if not entityPlayer then return 0 end
for i = 0, game:GetNumPlayers() - 1 do
for i = 0, game:GetNumPlayers() - 1 do
local player = Isaac.GetPlayer(i)
if GetPtrHash(player) == GetPtrHash(entityPlayer) then
return i
@@ -1654,7 +1654,7 @@ function EID:replaceMarkupSize(description)
description = string.gsub(description, small, normal)
end
end
return description
end
@@ -1688,7 +1688,7 @@ function EID:alterTransformationLookup(entityString, transformString, addToList)
end
end
-- Given a transformation identifier, itterate over every player and count the number of items they have which count towards that transformation
-- Given a transformation identifier, itterate over every player and count the number of items they have which count towards that transformation
EID.TransformationProgress = {}
function EID:evaluateTransformationProgress(transformation)
for i = 0, game:GetNumPlayers() - 1 do
@@ -1696,7 +1696,7 @@ function EID:evaluateTransformationProgress(transformation)
EID.TransformationProgress[i] = {}
EID.TransformationProgress[i][transformation] = 0
local transformData = EID.TransformationData[transformation]
if not EID.TransformationLookup[transformation] then return end
if transformData and transformData.VanillaForm and player:HasPlayerForm(transformData.VanillaForm) then
@@ -1737,7 +1737,7 @@ function EID:evaluateTransformationProgress(transformation)
collCount = collCount - (EID.PlayerItemInteractions[i].rerollItems[tostring(eSubType)] or 0)
end
EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] + collCount
-- Undo the Book of Virtues active item getting counted here
if tonumber(eSubType) == 584 and player:GetActiveItem() == 584 then
EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] - 1
@@ -1803,7 +1803,7 @@ function EID:evaluateQueuedItems()
else
EID.PlayerItemInteractions[i].LastTouch = 0
end
if not player.QueuedItem.Touched and player.QueuedItem.Item then
EID.PlayerItemInteractions[i].LastTouch = game:GetFrameCount()
local itemIDStr = tostring(player.QueuedItem.Item.ID)
@@ -1815,7 +1815,7 @@ function EID:evaluateQueuedItems()
EID.PlayerItemInteractions[j].actives[itemIDStr] = EID.PlayerItemInteractions[j].actives[itemIDStr] or 0
EID.PlayerItemInteractions[j].altActives[itemIDStr] = EID.PlayerItemInteractions[j].altActives[itemIDStr] or 0
end
-- Dead Tainted Lazarus exceptions
local activesTable = EID.PlayerItemInteractions[i].actives
if player:GetPlayerType() == 38 then
@@ -1833,7 +1833,7 @@ function EID:evaluateQueuedItems()
if (#EID.RecentlyTouchedItems[i] > 8) then table.remove(EID.RecentlyTouchedItems[i], 1) end
end
end
end
end
end
end
@@ -1858,7 +1858,7 @@ function EID:getObjectQuality(descObj)
end
end
-- Returns the Inline Icon definition object for a given object.
-- Returns the Inline Icon definition object for a given object.
EID.ObjectIcon = {}
function EID:getObjectIcon(descObj)
-- custom object icon