Fixed bug with transformation modification functions not working multiple times in a row
This commit is contained in:
1 parent
096a5a3f8f
commit
6c6a3e5de8
3 files changed
+33
-3
No files matched your search
+29
-1
@@ -101,7 +101,13 @@ function EID:assignTransformation(targetType, targetIdentifier, transformationSt
|
||||
else
|
||||
entryID = targetIdentifier
|
||||
end
|
||||
EID.CustomTransformAssignments[entryID] = transformationString
|
||||
if EID.CustomTransformAssignments[entryID] == nil then
|
||||
EID.CustomTransformAssignments[entryID] = transformationString
|
||||
else
|
||||
EID:removeEntryFromString(EID.CustomTransformAssignments, entryID, transformationString)
|
||||
EID.CustomTransformAssignments[entryID] = EID.CustomTransformAssignments[entryID]..","..transformationString
|
||||
end
|
||||
EID:removeEntryFromString(EID.CustomTransformRemovals, entryID, transformationString)
|
||||
end
|
||||
|
||||
-- Removes a transformation of an entity
|
||||
@@ -118,8 +124,30 @@ function EID:removeTransformation(targetType, targetIdentifier, transformationSt
|
||||
if EID.CustomTransformRemovals[entryID] == nil then
|
||||
EID.CustomTransformRemovals[entryID] = transformationString
|
||||
else
|
||||
EID:removeEntryFromString(EID.CustomTransformRemovals, entryID, transformationString)
|
||||
EID.CustomTransformRemovals[entryID] = EID.CustomTransformRemovals[entryID]..","..transformationString
|
||||
end
|
||||
EID:removeEntryFromString(EID.CustomTransformAssignments, entryID, transformationString)
|
||||
end
|
||||
|
||||
-- Removes a given value from the string inside a table. Example: "1,2,3", removing 2 will return "1,3"
|
||||
function EID:removeEntryFromString(sourceTable, entryKey, entryValue)
|
||||
if sourceTable[entryKey] == nil then return end
|
||||
local newEntry = ""
|
||||
for str in string.gmatch(sourceTable[entryKey], "([^,]+)") do
|
||||
local addToList = true
|
||||
for removeStr in string.gmatch(entryValue, "([^,]+)") do
|
||||
if removeStr == str then
|
||||
addToList = false
|
||||
end
|
||||
end
|
||||
if addToList then
|
||||
newEntry = newEntry..","..str
|
||||
end
|
||||
end
|
||||
newEntry = newEntry:sub(2)
|
||||
if newEntry == "" then newEntry = nil end
|
||||
sourceTable[entryKey] = newEntry
|
||||
end
|
||||
|
||||
-- Adds a description for a an Entity. Optional parameters: language, transformations
|
||||
|
||||
+3
-1
@@ -59,7 +59,9 @@ EID:createTransformation("NewTransform1", "New transformation") -- Transformatio
|
||||
EID:createTransformation("NewTransform1", "New russian transformation", "ru") -- add Transformation name in russian
|
||||
|
||||
EID:assignTransformation("collectible", 5, "NewTransform1,2,3") -- Add Transformation to My Reflection
|
||||
EID:removeTransformation("collectible", 5, "2") -- Removes a transformation
|
||||
EID:removeTransformation("collectible", 5, "2,3") -- Removes transformations
|
||||
EID:assignTransformation("collectible", 5, "2,3") -- add transformations again
|
||||
EID:removeTransformation("collectible", 5, "2,3") -- Removes transformations again
|
||||
|
||||
------ Test: Add all transformations + some customs ones to Inner Eye ------
|
||||
EID:assignTransformation("collectible", 2, "1,2,3,4,5,6,7,8,9,10,11,12,13,something Custom,NewTransform1")
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ https://moddingofisaac.com/mod/1079/external-item-descriptions
|
||||
- [url=https://steamcommunity.com/id/whytefang/]adc[/url] for creating an awesome new Languagepack and providing ideas for new functionalities
|
||||
|
||||
[img]https://i.imgur.com/P6a8043.png[/img] [url=https://github.com/wofsauge/External-Item-Descriptions]Any Problems? Visit this project on GitHub[/url]</description>
|
||||
<version>3.23</version>
|
||||
<version>3.26</version>
|
||||
<visibility>Public</visibility>
|
||||
<tag id="Lua"/>
|
||||
<tag id="Items"/>
|
||||
|
||||
Reference in new issue
Block a user