Added Multiplayer and multi character support for Transformation progress
This commit is contained in:
1 parent
266867cecc
commit
a13ee770c3
2 files changed
+36
-13
No files matched your search
+23
-8
@@ -417,9 +417,8 @@ function EID:getTransformation(id, variant, subType)
|
|||||||
local default = EID.EntityTransformations[entityString]
|
local default = EID.EntityTransformations[entityString]
|
||||||
if default~= nil then listToTest = default end
|
if default~= nil then listToTest = default end
|
||||||
|
|
||||||
local customLegacy = nil
|
|
||||||
if id == 5 and variant == 100 then
|
if id == 5 and variant == 100 then
|
||||||
customLegacy = __eidItemTransformations[adjustedSubtype]
|
local customLegacy = __eidItemTransformations[adjustedSubtype]
|
||||||
if customLegacy~= nil then listToTest = listToTest..","..customLegacy end
|
if customLegacy~= nil then listToTest = listToTest..","..customLegacy end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1418,12 +1417,28 @@ EID.TransformationLookup = {}
|
|||||||
function EID:buildTransformationTables()
|
function EID:buildTransformationTables()
|
||||||
EID.TransformationLookup = {}
|
EID.TransformationLookup = {}
|
||||||
for entityString, transformationData in pairs(EID.EntityTransformations) do
|
for entityString, transformationData in pairs(EID.EntityTransformations) do
|
||||||
for transformation in string.gmatch(transformationData, '([^,]+)') do
|
EID:alterTransformationLookup(entityString, transformationData, true)
|
||||||
if EID.TransformationLookup[transformation] == nil then
|
end
|
||||||
EID.TransformationLookup[transformation] = {}
|
-- legacy
|
||||||
end
|
for subType, transformationData in pairs(__eidItemTransformations) do
|
||||||
EID.TransformationLookup[transformation][entityString] = true
|
EID:alterTransformationLookup("5.100."..subType, transformationData, true)
|
||||||
|
end
|
||||||
|
-- add custom
|
||||||
|
for entityString, transformationData in pairs(EID.CustomTransformAssignments) do
|
||||||
|
EID:alterTransformationLookup(entityString, transformationData, true)
|
||||||
|
end
|
||||||
|
-- custom remove
|
||||||
|
for entityString, transformationData in pairs(EID.CustomTransformRemovals) do
|
||||||
|
EID:alterTransformationLookup(entityString, transformationData, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EID:alterTransformationLookup(entityString, transformString, addToList)
|
||||||
|
for transformation in string.gmatch(transformString, '([^,]+)') do
|
||||||
|
if EID.TransformationLookup[transformation] == nil then
|
||||||
|
EID.TransformationLookup[transformation] = {}
|
||||||
end
|
end
|
||||||
|
EID.TransformationLookup[transformation][entityString] = addToList
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1442,7 +1457,7 @@ function EID:evaluateTransformationProgress(transformation)
|
|||||||
EID.TransformationProgress[i][transformation] = transformData.NumNeeded or 3
|
EID.TransformationProgress[i][transformation] = transformData.NumNeeded or 3
|
||||||
else
|
else
|
||||||
for entityString, _ in pairs(EID.TransformationLookup[transformation]) do
|
for entityString, _ in pairs(EID.TransformationLookup[transformation]) do
|
||||||
eType, eVariant, eSubType = entityString:match("([^.]+).([^.]+).([^.]+)")
|
local eType, eVariant, eSubType = entityString:match("([^.]+).([^.]+).([^.]+)")
|
||||||
if tonumber(eType) == EntityType.ENTITY_PICKUP then
|
if tonumber(eType) == EntityType.ENTITY_PICKUP then
|
||||||
if tonumber(eVariant) == PickupVariant.PICKUP_COLLECTIBLE then
|
if tonumber(eVariant) == PickupVariant.PICKUP_COLLECTIBLE then
|
||||||
if EID.TouchedActiveItems[i][tonumber(eSubType)] then
|
if EID.TouchedActiveItems[i][tonumber(eSubType)] then
|
||||||
|
|||||||
@@ -664,14 +664,22 @@ function EID:printDescription(desc, cachedID)
|
|||||||
if EID.Config["TransformationText"] or EID.Config["TransformationProgress"] then
|
if EID.Config["TransformationText"] or EID.Config["TransformationProgress"] then
|
||||||
local transformationName = ""
|
local transformationName = ""
|
||||||
if EID.Config["TransformationText"] then
|
if EID.Config["TransformationText"] then
|
||||||
transformationName = EID:getTransformationName(transform).." "
|
transformationName = EID:getTransformationName(transform)
|
||||||
end
|
end
|
||||||
if EID.Config["TransformationProgress"] then
|
if EID.Config["TransformationProgress"] then
|
||||||
-- TODO: call evaluate only when ItemQueue of player changes to save performance
|
|
||||||
EID:evaluateTransformationProgress(transform)
|
EID:evaluateTransformationProgress(transform)
|
||||||
local numCollected = EID.TransformationProgress[EID:getPlayerID(EID.player)][transform]
|
transformationName = transformationName .. " "
|
||||||
local numMax = EID.TransformationData[transform] and EID.TransformationData[transform].NumNeeded or 3
|
for _, player in ipairs(EID.players) do
|
||||||
transformationName = transformationName.."("..numCollected.."/"..numMax..")"
|
if player:GetPlayerType() ~= PlayerType.PLAYER_THESOUL_B then
|
||||||
|
if #EID.players > 1 then
|
||||||
|
local playerIcon = EID:getIcon("Player"..player.SubType) ~= EID.InlineIcons["ERROR"] and "{{Player"..player.SubType.."}}" or "{{CustomTransformation}}"
|
||||||
|
transformationName = transformationName .. playerIcon
|
||||||
|
end
|
||||||
|
local numCollected = EID.TransformationProgress[EID:getPlayerID(player)][transform]
|
||||||
|
local numMax = EID.TransformationData[transform] and EID.TransformationData[transform].NumNeeded or 3
|
||||||
|
transformationName = transformationName.."("..numCollected.."/"..numMax..") "
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local iconWidth = transformSprite[3] or -1
|
local iconWidth = transformSprite[3] or -1
|
||||||
local iconHeight = transformSprite[4] or -1
|
local iconHeight = transformSprite[4] or -1
|
||||||
|
|||||||
Reference in new issue
Block a user