Refactored EID:tryAutodetectTransformationsCollectible()

This commit is contained in:
Wofsauge committed 2025-09-10 17:25:23 +02:00
1 parent 09e2eb5abc
commit f5181025ad
2 files changed
+22 -32

No files matched your search

+7 -17
View File
@@ -358,25 +358,15 @@ end
---Try to automatically assign vanilla transformations to the entity
---@param collectibleID CollectibleType
function EID:tryAutodetectTransformationsCollectible(collectibleID) --?Should this be in API?
function EID:tryAutodetectTransformationsCollectible(collectibleID)
if not EID.isRepentance then return end
local config = EID.itemConfig:GetCollectible(collectibleID)
local transformations = {}
transformations[EID.TRANSFORMATION.ANGEL] = config:HasTags(ItemConfig.TAG_ANGEL) or nil
transformations[EID.TRANSFORMATION.BOB] = config:HasTags(ItemConfig.TAG_BOB) or nil
transformations[EID.TRANSFORMATION.BOOKWORM] = config:HasTags(ItemConfig.TAG_BOOK) or nil
transformations[EID.TRANSFORMATION.CONJOINED] = config:HasTags(ItemConfig.TAG_BABY) or nil
transformations[EID.TRANSFORMATION.GUPPY] = config:HasTags(ItemConfig.TAG_GUPPY) or nil
transformations[EID.TRANSFORMATION.LEVIATHAN] = config:HasTags(ItemConfig.TAG_DEVIL) or nil
transformations[EID.TRANSFORMATION.LORD_OF_THE_FLIES] = config:HasTags(ItemConfig.TAG_FLY) or nil
transformations[EID.TRANSFORMATION.MOM] = config:HasTags(ItemConfig.TAG_MOM) or nil
transformations[EID.TRANSFORMATION.MUSHROOM] = config:HasTags(ItemConfig.TAG_MUSHROOM) or nil
transformations[EID.TRANSFORMATION.POOP] = config:HasTags(ItemConfig.TAG_POOP) or nil
transformations[EID.TRANSFORMATION.SPIDERBABY] = config:HasTags(ItemConfig.TAG_SPIDER) or nil
transformations[EID.TRANSFORMATION.SPUN] = config:HasTags(ItemConfig.TAG_SYRINGE) or nil
-- these dont have a tag : ADULT, STOMPY, SUPERBUM
for k, _ in pairs(transformations) do
EID:assignTransformation("collectible", collectibleID, k)
-- evaulate all transformations that have an ItemTag field
for transformIDString, data in pairs(EID.TransformationData) do
if data.ItemTag ~= nil and config:HasTags(data.ItemTag) then
EID:assignTransformation("collectible", collectibleID, transformIDString)
end
end
end