From 327d81f73d45074252610911253bd5416a92380a Mon Sep 17 00:00:00 2001 From: Buurazu Date: Wed, 19 Jan 2022 01:01:29 -0500 Subject: [PATCH 1/3] Improve restock machines / Diplopia flip interaction --- main.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 8dd1c69e..8733aafb 100644 --- a/main.lua +++ b/main.lua @@ -323,10 +323,15 @@ if REPENTANCE then EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE) function EID:CheckPedestalIndex(entity) - -- Only pedestals with indexes that were present at room load can be flip pedestals; fixes shop restock machines - if EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed] and entity.Index > EID.flipMaxIndex then - EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil - entity:GetData()["EID_FlipItemID"] = nil + -- Only pedestals with indexes that were present at room load can be flip pedestals + -- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room. + if entity:GetData()["EID_FlipItemID"] and entity.Index > EID.flipMaxIndex then + 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 EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE) From 9521913ea9f32d97c55eacf982a05f4a618e1379 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Wed, 19 Jan 2022 05:17:38 -0500 Subject: [PATCH 2/3] Move colors, optimize log checks --- eid_tmtrainer.lua | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/eid_tmtrainer.lua b/eid_tmtrainer.lua index eb81f2e1..383af69f 100644 --- a/eid_tmtrainer.lua +++ b/eid_tmtrainer.lua @@ -20,6 +20,18 @@ local logLocation = os.getenv("SYSTEMDRIVE") .. "/Users/" .. os.getenv("USERNAME local logFound = false 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 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 @@ -31,7 +43,7 @@ local function entityToName(e, plural) if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)") elseif plural then name = name .. localizedNames["pluralize"] end - return name + return "{{ColorGray}}" .. name .. "{{CR}}" end local function parseEffectLine(raw) @@ -77,7 +89,7 @@ local function parseEffectLine(raw) local localizedNames = EID:getDescriptionEntry("GlitchedItemText") 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 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 @@ -87,8 +99,11 @@ local function parseEffectLine(raw) end 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 itemScore = 0 local eidDesc = "" From 205da1237bfdee9e7c26ee5c49c7e76582a7851f Mon Sep 17 00:00:00 2001 From: Buurazu Date: Wed, 19 Jan 2022 05:17:58 -0500 Subject: [PATCH 3/3] Move glitched item color info --- descriptions/rep/en_us.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index c167926b..4b13572f 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -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", -- Attribute triggers - chain = "{{ColorCyan}}Then:{{CR}} ", - active = "{{ColorCyan}}On use:#", - pickup_collected = "{{ColorCyan}}When you collect a pickup:#", --chance to? - enemy_kill = "{{ColorCyan}}On kill, chance to:#", - damage_taken = "{{ColorCyan}}When you take damage:#", --chance to? - entity_spawned = "When a {{ColorCyan}}{T1}{{CR}} is spawned:#", - tear_fire = "{{ColorCyan}}When you fire a tear, chance to:#", - enemy_hit = "{{ColorCyan}}On hitting an enemy, chance to:#", - room_clear = "{{ColorCyan}}On room clear:#", --chance to? + chain = "Then:{{CR}} ", + active = "On use:#", + pickup_collected = "When you collect a pickup:#", --chance to? + enemy_kill = "On kill, chance to:#", + damage_taken = "When you take damage:#", --chance to? + entity_spawned = "When a {T1} is spawned:#", + tear_fire = "When you fire a tear, chance to:#", + enemy_hit = "On hitting an enemy, chance to:#", + room_clear = "On room clear:#", --chance to? -- Attribute effects area_damage = "Deal {1} damage in an area around you", 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}", - spawn_entity = "Spawn a {{ColorGray}}{1}{{CR}}", + spawn_entity = "Spawn a {1}", fart = "Fart with size {1}", -- Generic entity names not obtained from entities2.xml