diff --git a/eid_api.lua b/eid_api.lua
index 733225be..e582c490 100644
--- a/eid_api.lua
+++ b/eid_api.lua
@@ -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
diff --git a/eid_debugging.lua b/eid_debugging.lua
index c2b8c20a..d1c63ab5 100644
--- a/eid_debugging.lua
+++ b/eid_debugging.lua
@@ -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")
diff --git a/metadata.xml b/metadata.xml
index 7402f6a7..2af742cc 100644
--- a/metadata.xml
+++ b/metadata.xml
@@ -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]
- 3.23
+ 3.26
Public