Merge pull request #329 from Buurazu/master

Corrupted Data support, fix Diplopia + Flip
This commit is contained in:
wofsauge authored and GitHub committed 2022-01-19 15:36:02 +01:00
commit ccded450f6
3 files changed
+39 -19

No files matched your search

+11 -11
View File
@@ -971,22 +971,22 @@ EID.descriptions[languageCode].GlitchedItemText = {
[0] = "Damage", "Fire Rate", "Shot Speed", "Range", "Speed", "Tear Effects", "Tear Color", "Flight", "Attack Type", "Familiars", "Luck", "Size", "Color", "Chest Contents", [16] = "All Stats", [0] = "Damage", "Fire Rate", "Shot Speed", "Range", "Speed", "Tear Effects", "Tear Color", "Flight", "Attack Type", "Familiars", "Luck", "Size", "Color", "Chest Contents", [16] = "All Stats",
-- Attribute triggers -- Attribute triggers
chain = "{{ColorCyan}}Then:{{CR}} ", chain = "Then:{{CR}} ",
active = "{{ColorCyan}}On use:#", active = "On use:#",
pickup_collected = "{{ColorCyan}}When you collect a pickup:#", --chance to? pickup_collected = "When you collect a pickup:#", --chance to?
enemy_kill = "{{ColorCyan}}On kill, chance to:#", enemy_kill = "On kill, chance to:#",
damage_taken = "{{ColorCyan}}When you take damage:#", --chance to? damage_taken = "When you take damage:#", --chance to?
entity_spawned = "When a {{ColorCyan}}{T1}{{CR}} is spawned:#", entity_spawned = "When a {T1} is spawned:#",
tear_fire = "{{ColorCyan}}When you fire a tear, chance to:#", tear_fire = "When you fire a tear, chance to:#",
enemy_hit = "{{ColorCyan}}On hitting an enemy, chance to:#", enemy_hit = "On hitting an enemy, chance to:#",
room_clear = "{{ColorCyan}}On room clear:#", --chance to? room_clear = "On room clear:#", --chance to?
-- Attribute effects -- Attribute effects
area_damage = "Deal {1} damage in an area around you", area_damage = "Deal {1} damage in an area around you",
add_temporary_effect = "Gain {1} for the room", add_temporary_effect = "Gain {1} for the room",
convert_entities = "Convert all {{ColorGray}}{1}{{CR}} in the room to {{ColorGray}}{2}{{CR}}", convert_entities = "Convert all {1} in the room to {2}",
use_active_item = "Use {1}", use_active_item = "Use {1}",
spawn_entity = "Spawn a {{ColorGray}}{1}{{CR}}", spawn_entity = "Spawn a {1}",
fart = "Fart with size {1}", fart = "Fart with size {1}",
-- Generic entity names not obtained from entities2.xml -- Generic entity names not obtained from entities2.xml
+19 -4
View File
@@ -20,6 +20,18 @@ local logLocation = os.getenv("SYSTEMDRIVE") .. "/Users/" .. os.getenv("USERNAME
local logFound = false local logFound = false
local logCursor = 0 local logCursor = 0
local triggerColors = {
chain = "{{ColorSilver}}",
active = "{{ColorLime}}",
pickup_collected = "{{ColorYellow}}",
enemy_kill = "{{ColorRed}}",
damage_taken = "{{ColorRed}}",
entity_spawned = "",
tear_fire = "{{ColorCyan}}",
enemy_hit = "{{ColorEIDError}}",
room_clear = "{{ColorOrange}}",
}
local function entityToName(e, plural) local function entityToName(e, plural)
local localizedNames = EID:getDescriptionEntry("GlitchedItemText") local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
-- -1 is often used as an "any of this type", even if there's only one of that type, so converting it to 0 can help find names -- -1 is often used as an "any of this type", even if there's only one of that type, so converting it to 0 can help find names
@@ -31,7 +43,7 @@ local function entityToName(e, plural)
if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)") if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)")
elseif plural then name = name .. localizedNames["pluralize"] end elseif plural then name = name .. localizedNames["pluralize"] end
return name return "{{ColorGray}}" .. name .. "{{CR}}"
end end
local function parseEffectLine(raw) local function parseEffectLine(raw)
@@ -77,7 +89,7 @@ local function parseEffectLine(raw)
local localizedNames = EID:getDescriptionEntry("GlitchedItemText") local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
local eidString = "" local eidString = ""
if effectTrigger ~= lastEffectTrigger then eidString = eidString .. (localizedNames[effectTrigger] or (effectTrigger .. "#")) end if effectTrigger ~= lastEffectTrigger then eidString = eidString .. triggerColors[effectTrigger] .. (localizedNames[effectTrigger] or (effectTrigger .. "#")) end
if printEffect then eidString = eidString .. (localizedNames[effectType] or fullEffect) .. "#" end if printEffect then eidString = eidString .. (localizedNames[effectType] or fullEffect) .. "#" end
for k,v in ipairs(triggerReplacements) do eidString = string.gsub(eidString, "{T" .. k .. "}", v) end for k,v in ipairs(triggerReplacements) do eidString = string.gsub(eidString, "{T" .. k .. "}", v) end
for k,v in ipairs(replacements) do eidString = string.gsub(eidString, "{" .. k .. "}", v) end for k,v in ipairs(replacements) do eidString = string.gsub(eidString, "{" .. k .. "}", v) end
@@ -87,8 +99,11 @@ local function parseEffectLine(raw)
end end
local function CheckLogForItems(_) local function CheckLogForItems(_)
if not EID.Config["DisplayGlitchedItemInfo"] or not logFound or game:GetFrameCount() % 5 ~= 0 or not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) then return end -- Check log.txt every 5 frames if there's a collectible we haven't read the data for yet
-- (Should work well for Corrupted Data)
if game:GetFrameCount() % 5 ~= 0 or not EID.Config["DisplayGlitchedItemInfo"] or not logFound or
Isaac.GetItemConfig():GetCollectible(maxNumber - spawnedItems - 1) == nil then return end
local numEffects = 0 local numEffects = 0
local itemScore = 0 local itemScore = 0
local eidDesc = "" local eidDesc = ""
+9 -4
View File
@@ -323,10 +323,15 @@ if REPENTANCE then
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE) EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE)
function EID:CheckPedestalIndex(entity) function EID:CheckPedestalIndex(entity)
-- Only pedestals with indexes that were present at room load can be flip pedestals; fixes shop restock machines -- Only pedestals with indexes that were present at room load can be flip pedestals
if EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed] and entity.Index > EID.flipMaxIndex then -- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room.
EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil if entity:GetData()["EID_FlipItemID"] and entity.Index > EID.flipMaxIndex then
entity:GetData()["EID_FlipItemID"] = nil local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local gridPos = game:GetRoom():GetGridIndex(entity.Position)
local flipEntry = EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed]
-- only wipe the data if the grid index matches (so Diplopia pedestals don't)
if flipEntry and gridPos == flipEntry[2] then EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil end
entity:GetData()["EID_FlipItemID"] = nil
end end
end end
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE) EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE)