Merge pull request #374 from Buurazu/master
MCM file rewrite + many bug fixes
This commit is contained in:
7 files changed
+324
-923
No files matched your search
@@ -88,7 +88,7 @@ local repCollectibles={
|
||||
[211] = {"211", "Spiderbaby", "Spawn 3-5 Blue Spiders upon taking damage"}, -- Spiderbaby
|
||||
[214] = {"214", "Anemic", "↑ +1.5 Range up#Leave a trail of damaging creep upon taking damage"}, -- Anemic
|
||||
[218] = {"218", "Placenta", "↑ +1 Health up#Heals 1 Red Heart#Chance to heal half a heart every minute"}, -- Placenta
|
||||
[222] = {"222", "Anti-Gravity", "Holding the fire buttons causes tears to hover in midair#When released, they will all shoot in the direction they were fired#↑ +2 Fire Rate up"}, -- Anti-Gravity
|
||||
[222] = {"222", "Anti-Gravity", "Holding the fire buttons causes tears to hover in midair#When released, they will all shoot in the direction they were fired#↑ +1 Fire Rate up"}, -- Anti-Gravity
|
||||
[224] = {"224", "Cricket's Body", "Tears split in 4 on hit#Split tears deal half your damage#↑ +0.5 Fire Rate up#↓ -20% Range down"}, -- Cricket's Body
|
||||
[228] = {"228", "Mom's Perfume", "15% chance to shoot Fear tears#↑ +0.5 Fire Rate up"}, -- Mom's Perfume
|
||||
[230] = {"230", "Abaddon", "↑ +1.5 Damage up#↑ +0.2 Speed up#Fear tears#Converts all Red Heart Containers into Black Hearts#+2 Black Hearts"}, -- Abaddon
|
||||
@@ -125,7 +125,7 @@ local repCollectibles={
|
||||
[307] = {"307", "Capricorn", "↑ +1 Health up#↑ +0.5 Damage up#↑ +0.1 Speed up#↑ +0.75 Range up#↑ +0.5 Fire Rate up#Gives one bomb, coin and key"}, -- Capricorn
|
||||
[308] = {"308", "Aquarius", "Leave a trail of creep#Creep deals 66% your damage per second#Creep synergizes with tear effects"}, -- Aquarius
|
||||
[309] = {"309", "Pisces", "↑ +0.5 Fire Rate up#Increases tear knockback"},
|
||||
[310] = {"310", "Eve's Mascara", "↑ 200% Damage up#↓ -33% Tears down#↓ -0.5 Shot Speed down"},
|
||||
[310] = {"310", "Eve's Mascara", "↑ +100% Damage up#↓ -33% Tears down#↓ -0.5 Shot Speed down"},
|
||||
[314] = {"314", "Thunder Thighs", "↑ +1 Health up#↓ -0.4 Speed down#Heals 1 Red Heart#Destroy rocks when walking over them"}, -- Thunder Thighs
|
||||
[315] = {"315", "Strange Attractor", "Magnetic tears#Affects enemies, pickups and trinkets#Items will be attracted to where the tear lands"}, -- Strange Attractor
|
||||
[320] = {"320", "???'s Only Friend", "Controllable Fly#Deals 3.5 contact damage per tick"}, -- ???'s Only Friend
|
||||
|
||||
+25
-4
@@ -199,7 +199,8 @@ function EID:addColor(shortcut, kColor, callback)
|
||||
end
|
||||
|
||||
-- Overrides all potentially displayed texts and permanently displays the given texts. Can be turned of again using the "EID:hidePermanentText()" function
|
||||
function EID:displayPermanentText(descriptionObject)
|
||||
function EID:displayPermanentText(descriptionObject, permName1, permName2)
|
||||
descriptionObject.PermanentTextEnglish = EID:getDescriptionEntryEnglish(permName1, permName2)
|
||||
EID.permanentDisplayTextObj = descriptionObject
|
||||
EID.isDisplayingPermanent = true
|
||||
end
|
||||
@@ -264,8 +265,11 @@ end
|
||||
-- returns the current text position
|
||||
function EID:getTextPosition()
|
||||
local posVector = Vector(EID.UsedPosition.X, EID.UsedPosition.Y)
|
||||
for _, modifier in pairs(EID.PositionModifiers) do
|
||||
posVector = posVector + modifier
|
||||
-- Only apply position modifiers when not in Local Mode
|
||||
if EID.CurrentScaleType == "Size" then
|
||||
for _, modifier in pairs(EID.PositionModifiers) do
|
||||
posVector = posVector + modifier
|
||||
end
|
||||
end
|
||||
return posVector
|
||||
end
|
||||
@@ -367,6 +371,13 @@ function EID:getDescriptionEntry(objTable, objID, noFallback)
|
||||
else return (translatedTable and translatedTable[objID]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID]) end
|
||||
end
|
||||
end
|
||||
function EID:getDescriptionEntryEnglish(objTable, objID)
|
||||
if not objID then
|
||||
return EID.descriptions["en_us"][objTable]
|
||||
else
|
||||
return EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID]
|
||||
end
|
||||
end
|
||||
|
||||
-- returns the description data table related to a given id, variant and subtype
|
||||
-- falls back to english if it doesnt exist
|
||||
@@ -915,7 +926,7 @@ function EID:CheckGlitchedItemConfig(id)
|
||||
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
||||
local item = EID.itemConfig:GetCollectible(id)
|
||||
if not item then return "" end
|
||||
local attributes = ""
|
||||
local attributes = "#"
|
||||
for _,v in ipairs(itemConfigItemAttributes) do
|
||||
local val = item[v]
|
||||
if val ~= 0 then
|
||||
@@ -1211,6 +1222,16 @@ function EID:fixDefinedFont()
|
||||
EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth or EID.DefaultConfig["TextboxWidth"]
|
||||
return true
|
||||
end
|
||||
-- Check if a given font name is valid for the currently selected language
|
||||
function EID:canUseFontType(fontType)
|
||||
local curLang = EID.Config["Language"]
|
||||
for _, v in ipairs(EID.descriptions[curLang].fonts) do
|
||||
if fontType == v.name then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Creates a copy of a KColor object. This prevents overwriting existing
|
||||
function EID:copyKColor(colorObj)
|
||||
|
||||
+23
-42
@@ -174,6 +174,7 @@ local componentShifts = {
|
||||
local poolToIcon = { [0]="{{TreasureRoom}}",[1]="{{Shop}}",[2]="{{BossRoom}}",[3]="{{DevilRoom}}",[4]="{{AngelRoom}}",
|
||||
[5]="{{SecretRoom}}",[7]="{{PoopRoomIcon}}",[8]="{{GoldenChestRoomIcon}}",[9]="{{RedChestRoomIcon}}",[12]="{{CursedRoom}}",[26]="{{Planetarium}}" }
|
||||
|
||||
-- local copies of our XML data in case it's slightly faster
|
||||
local CraftingMaxItemID = EID.XMLMaxItemID
|
||||
local CraftingFixedRecipes = EID.XMLRecipes
|
||||
local CraftingItemPools = EID.XMLItemPools
|
||||
@@ -208,7 +209,7 @@ local function sortAllItems()
|
||||
end
|
||||
end)
|
||||
end
|
||||
-- delay the initial sort until needed, as it's a tad slow
|
||||
-- delay the initial sort until needed, in case of modded items
|
||||
local sortNeeded = true
|
||||
local recheckPickups = false
|
||||
|
||||
@@ -350,28 +351,27 @@ function EID:simulateBagOfCrafting(componentsTable)
|
||||
end
|
||||
|
||||
-- The main function that takes 8 ingredients and tells you what collectible you will get in return
|
||||
-- Only pass in a table with 8 valid ingredients!!!
|
||||
function EID:calculateBagOfCrafting(componentsTable)
|
||||
-- ingredients must be sorted by ID for the RNG shifting to be accurate, so make a local copy
|
||||
local components = {table.unpack(componentsTable)}
|
||||
if components == nil or #components ~= 8 then
|
||||
return 0
|
||||
end
|
||||
|
||||
customRNGSeed = lastSeedUsed
|
||||
table.sort(components)
|
||||
local componentsAsString = table.concat(components, ",")
|
||||
|
||||
--Check the fixed recipes. Currently, the fixed recipes ignore item unlock status
|
||||
-- Check the fixed recipes. Currently, the fixed recipes ignore item unlock status
|
||||
local cacheResult = CraftingFixedRecipes[componentsAsString]
|
||||
if cacheResult ~= nil then
|
||||
return cacheResult, cacheResult
|
||||
end
|
||||
|
||||
-- Check the recipes already calculated for this seed
|
||||
cacheResult = calculatedRecipes[componentsAsString]
|
||||
local lockedResult = lockedRecipes[componentsAsString]
|
||||
|
||||
if cacheResult ~= nil then
|
||||
return cacheResult, lockedResult
|
||||
end
|
||||
|
||||
-- Count up the ingredients, and shift the RNG based on the components in the bag
|
||||
customRNGSeed = lastSeedUsed
|
||||
local compTotalWeight = 0
|
||||
local compCounts = {}
|
||||
for i = 1, #componentShifts do
|
||||
@@ -384,6 +384,7 @@ function EID:calculateBagOfCrafting(componentsTable)
|
||||
RNGNext()
|
||||
end
|
||||
customRNGShift = componentShifts[7]
|
||||
|
||||
local poolWeights = {
|
||||
{idx = 0, weight = 1},
|
||||
{idx = 1, weight = 2},
|
||||
@@ -401,11 +402,8 @@ function EID:calculateBagOfCrafting(componentsTable)
|
||||
end
|
||||
|
||||
local totalWeight = 0
|
||||
|
||||
local itemWeights = {}
|
||||
|
||||
local maxItemID = CraftingMaxItemID
|
||||
for i = 1, maxItemID do
|
||||
for i = 1, CraftingMaxItemID do
|
||||
itemWeights[i] = 0
|
||||
end
|
||||
|
||||
@@ -414,6 +412,7 @@ function EID:calculateBagOfCrafting(componentsTable)
|
||||
local qualityMin = 0
|
||||
local qualityMax = 1
|
||||
local n = compTotalWeight
|
||||
-- Devil, Angel, and Secret Room Pools have a 5 point penalty
|
||||
if (poolWeight.idx >= 3) and (poolWeight.idx <= 5) then
|
||||
n = n - 5
|
||||
end
|
||||
@@ -456,8 +455,8 @@ function EID:calculateBagOfCrafting(componentsTable)
|
||||
--That 2nd pick could also be achievement locked but we're ignoring that...
|
||||
local firstOption = nil
|
||||
while true do
|
||||
local t = nextFloat()
|
||||
local target = t * totalWeight
|
||||
local t = nextFloat() -- number between 0 and 1
|
||||
local target = t * totalWeight -- number between 0 and total weight of possible results
|
||||
for k,v in ipairs(itemWeights) do
|
||||
target = target - v
|
||||
if target < 0 then
|
||||
@@ -510,31 +509,14 @@ local function qualitySort(a, b)
|
||||
end
|
||||
end
|
||||
|
||||
-- simple table of tables copy function, for modded recipe support (to make a local copy of the XML data tables so we can then add on to them)
|
||||
local function deepcopy(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[deepcopy(orig_key)] = deepcopy(orig_value)
|
||||
end
|
||||
setmetatable(copy, deepcopy(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
local moddedCrafting = false
|
||||
-- Check for modded items past the known max item ID on game start (can also support game updates)
|
||||
-- Only works if the new items are at Weight 1.0 in their item pools, but better than nothing
|
||||
local function GameStartCrafting()
|
||||
if not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil then
|
||||
-- Items past max ID detected; copy our XML tables so we can add to them
|
||||
CraftingMaxItemID = EID.XMLMaxItemID
|
||||
CraftingItemPools = deepcopy(EID.XMLItemPools)
|
||||
CraftingItemQualities = deepcopy(EID.XMLItemQualities)
|
||||
if EID.Config["BagOfCraftingModdedRecipes"] and not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil then
|
||||
dofile("eid_xmldata")
|
||||
-- Items past max ID detected
|
||||
CraftingMaxItemID = EID.XMLMaxItemID -- XMLMaxItemID is never modified
|
||||
-- Add new item qualities
|
||||
local coll = EID.itemConfig:GetCollectible(CraftingMaxItemID+1)
|
||||
while coll ~= nil do
|
||||
@@ -559,9 +541,8 @@ local function GameStartCrafting()
|
||||
moddedCrafting = true
|
||||
sortNeeded = true
|
||||
elseif moddedCrafting then
|
||||
CraftingMaxItemID = EID.XMLMaxItemID
|
||||
CraftingItemPools = EID.XMLItemPools
|
||||
CraftingItemQualities = EID.XMLItemQualities
|
||||
-- we had modded items; they have since been disabled
|
||||
dofile("eid_xmldata")
|
||||
moddedCrafting = false
|
||||
sortNeeded = true
|
||||
end
|
||||
@@ -768,7 +749,7 @@ end
|
||||
local function getFloorItemsString(showPreviews, roomItems)
|
||||
local floorString = ""
|
||||
if #EID.BagItems >0 then
|
||||
if showPreviews and #EID.BagItems >= 8 then
|
||||
if showPreviews and #EID.BagItems == 8 then
|
||||
local recipe = EID:calculateBagOfCrafting(EID.BagItems)
|
||||
floorString = floorString .. "{{Collectible"..recipe.."}} "
|
||||
end
|
||||
@@ -916,7 +897,7 @@ function EID:handleBagOfCraftingRendering()
|
||||
end
|
||||
|
||||
-- Determine if we should display anything at all
|
||||
if EID.isHidden or craftingIsHidden or game.Challenge == Challenge.CHALLENGE_CANTRIPPED then
|
||||
if ((EID.isHidden or craftingIsHidden) and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting") or game.Challenge == Challenge.CHALLENGE_CANTRIPPED then
|
||||
return
|
||||
elseif EID.Config["BagOfCraftingHideInBattle"] then
|
||||
if Isaac.CountBosses() > 0 or Isaac.CountEnemies() > 0 then
|
||||
@@ -934,7 +915,7 @@ function EID:handleBagOfCraftingRendering()
|
||||
end
|
||||
|
||||
-- Display the result of the 8 items in our bag if applicable
|
||||
if (showCraftingResult or EID.Config["BagOfCraftingDisplayMode"] == "Preview Only") and #EID.BagItems >= 8 then
|
||||
if (showCraftingResult or EID.Config["BagOfCraftingDisplayMode"] == "Preview Only") and #EID.BagItems == 8 then
|
||||
local craftingResult, backupResult = EID:calculateBagOfCrafting(EID.BagItems)
|
||||
if (backupResult ~= craftingResult) then EID.TabPreviewID = backupResult end
|
||||
local descriptionObj = EID:getDescriptionObj(5, 100, craftingResult)
|
||||
|
||||
+10
-4
@@ -75,10 +75,10 @@ EID.UserConfig = {
|
||||
-- Toggle obstruction based hiding, when the player has flight
|
||||
-- Default = true
|
||||
["DisableObstructionOnFlight"] = true,
|
||||
-- If set to true, the mod will no longer display a warning if the save game doesn't have achievements unlocked
|
||||
-- This also disables warnings for using an outdated game version and for having potentially modded Bag of Crafting recipes
|
||||
-- If set to true, the mod will no longer display critical warnings during the start of a new game
|
||||
-- Current warnings are: Achievements are locked, outdated game version, and potentially having inaccurate modded Bag of Crafting recipes
|
||||
-- Default = false
|
||||
["DisableAchievementCheck"] = false,
|
||||
["DisableStartOfRunWarnings"] = false,
|
||||
|
||||
---------- Display Modes -----------
|
||||
|
||||
@@ -275,6 +275,11 @@ EID.UserConfig = {
|
||||
-- Display recipes as 8 icons instead of grouped ingredients
|
||||
-- Default = false
|
||||
["BagOfCraftingDisplayIcons"] = false,
|
||||
-- Enable or disable basic modded item support
|
||||
-- Only modded items with a weight of 1.0 in their item pools are supported, as we can't determine modded item pool weight
|
||||
-- If you have a lot of modded items, it will slow down game launch
|
||||
-- Default = true
|
||||
["BagOfCraftingModdedRecipes"] = true,
|
||||
-- Set the keybinding to toggle the crafting display, so you can see descriptions of items/pickups on the floor
|
||||
-- Look into the AB+ or Repentance documentation for the key names here: https://wofsauge.github.io/IsaacDocs/rep/enums/Keyboard.html
|
||||
-- Default = Keyboard.KEY_F3
|
||||
@@ -390,7 +395,7 @@ EID.DefaultConfig = {
|
||||
["InitiallyHidden"] = false,
|
||||
["HideInBattle"] = false,
|
||||
["DisableObstructionOnFlight"] = true,
|
||||
["DisableAchievementCheck"] = false,
|
||||
["DisableStartOfRunWarnings"] = false,
|
||||
["DisableOnCurse"] = true,
|
||||
["DisableOnAltPath"] = true,
|
||||
["DisableOnAprilFoolsChallenge"] = true,
|
||||
@@ -432,6 +437,7 @@ EID.DefaultConfig = {
|
||||
["BagOfCraftingDisplayIcons"] = false,
|
||||
["BagOfCraftingHideInBattle"] = true,
|
||||
["BagOfCraftingDisplayMode"] = "Recipe List",
|
||||
["BagOfCraftingModdedRecipes"] = true,
|
||||
["CraftingHideKey"] = Keyboard.KEY_F3,
|
||||
["CraftingHideButton"] = -1,
|
||||
["CraftingResultKey"] = Keyboard.KEY_F4,
|
||||
|
||||
+14
-11
@@ -120,6 +120,15 @@ local function BlackRuneCallback(descObj)
|
||||
return VoidCallback(descObj, true)
|
||||
end
|
||||
|
||||
-- Handle Item Collection description addition
|
||||
local function ItemCollectionPageCallback(descObj)
|
||||
descObj.Name = "{{"..EID.Config["ItemCollectionColor"].."}}"..descObj.Name
|
||||
local text = EID:getDescriptionEntry("CollectionPageInfo")
|
||||
|
||||
EID:appendToDescription(descObj, "#{{Warning}} "..text)
|
||||
return descObj
|
||||
end
|
||||
|
||||
|
||||
if REPENTANCE then
|
||||
-- Handle Birthright
|
||||
@@ -403,20 +412,13 @@ if REPENTANCE then
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Item Collection description addition
|
||||
local function ItemCollectionPageCallback(descObj)
|
||||
descObj.Name = "{{"..EID.Config["ItemCollectionColor"].."}}"..descObj.Name
|
||||
local text = EID:getDescriptionEntry("CollectionPageInfo")
|
||||
|
||||
EID:appendToDescription(descObj, "#{{Warning}} "..text)
|
||||
return descObj
|
||||
end
|
||||
--------------------------------
|
||||
-- Although individual conditions/callbacks work well for mods to be able to add through the API,
|
||||
-- As we kept adding callbacks for vanilla items, a lot of code got repeated over and over
|
||||
-- This one-condition setup fixes that and can only help performance
|
||||
-- It also allows us to pick the order that modifiers are appended to descriptions (stats/effects first, then reroll/flip/recharge info)
|
||||
|
||||
-- REPENTANCE-ONLY MODIFIERS
|
||||
local function EIDConditions(descObj)
|
||||
-- currently, only pickup descriptions have modifiers
|
||||
if descObj.ObjType ~= 5 then return false end
|
||||
@@ -430,8 +432,6 @@ if REPENTANCE then
|
||||
-- Using magic numbers here in case it's slightly faster, and because the callback names give context
|
||||
-- Check Birthright first because it overwrites the description instead of appending to it
|
||||
if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end
|
||||
|
||||
if EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end
|
||||
|
||||
if collectiblesOwned[664] then table.insert(callbacks, BingeEaterCallback) end
|
||||
if collectiblesOwned[59] then table.insert(callbacks, BookOfBelialCallback) end
|
||||
@@ -439,7 +439,7 @@ if REPENTANCE then
|
||||
if collectiblesOwned[706] or (EID.absorbedItems[706] and collectiblesOwned[477]) then table.insert(callbacks, AbyssCallback) end
|
||||
|
||||
if collectiblesOwned[711] and EID:getEntityData(descObj.Entity, "EID_FlipItemID") then table.insert(callbacks, FlipCallback) end
|
||||
if (collectiblesOwned[723] or (EID.absorbedItems[723] and collectiblesOwned[477])) and descObj.ObjSubType ~= 668 then table.insert(callbacks, SpindownDiceCallback) end
|
||||
if EID.Config["SpindownDiceResults"] > 0 and (collectiblesOwned[723] or (EID.absorbedItems[723] and collectiblesOwned[477])) and descObj.ObjSubType ~= 668 then table.insert(callbacks, SpindownDiceCallback) end
|
||||
|
||||
-- Card / Rune Callbacks
|
||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then
|
||||
@@ -466,6 +466,7 @@ if REPENTANCE then
|
||||
|
||||
end
|
||||
|
||||
-- AFTERBIRTH+ OR REPENTANCE MODIFIERS
|
||||
local function EIDConditionsAB(descObj)
|
||||
-- currently, only pickup descriptions have modifiers
|
||||
if descObj.ObjType ~= 5 then return false end
|
||||
@@ -476,6 +477,8 @@ local function EIDConditionsAB(descObj)
|
||||
|
||||
-- Collectible Pedestal Callbacks
|
||||
if descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE then
|
||||
if EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end
|
||||
|
||||
if EID.Config["DisplayVoidStatInfo"] then
|
||||
if collectiblesOwned[477] then table.insert(callbacks, VoidCallback) end
|
||||
if blackRuneOwned then table.insert(callbacks, BlackRuneCallback) end
|
||||
|
||||
@@ -384,6 +384,7 @@ local scaleMin = 0.1
|
||||
local scaleMax = 2
|
||||
local scaleSpeed = 0.01 -- scale size per frame
|
||||
local scaleToBigger = true
|
||||
EID.CurrentScaleType = "Size" -- Size or LocalModeSize; checked by EID:getTextPosition() to not apply modifiers in local mode
|
||||
local scaleHoldFrame = 0
|
||||
local function handleScaleKey()
|
||||
local scaleKey = EID.Config["SizeHotkey"]
|
||||
@@ -392,26 +393,20 @@ local function handleScaleKey()
|
||||
if Input.IsButtonPressed(scaleKey, 0) then
|
||||
if scaleHoldFrame > 60 then
|
||||
EID.MCM_OptionChanged = true
|
||||
local scaleConfigName = (EID.Config["DisplayMode"] == "local" and "LocalModeSize" or "Size")
|
||||
local newScale
|
||||
if scaleToBigger then
|
||||
local newScale = EID.Scale + scaleSpeed
|
||||
|
||||
EID.Scale = newScale
|
||||
EID.Config[scaleConfigName] = newScale
|
||||
|
||||
newScale = EID.Scale + scaleSpeed
|
||||
if newScale > scaleMax then
|
||||
scaleToBigger = false
|
||||
end
|
||||
else
|
||||
local newScale = EID.Scale - scaleSpeed
|
||||
|
||||
EID.Scale = newScale
|
||||
EID.Config[scaleConfigName] = newScale
|
||||
|
||||
newScale = EID.Scale - scaleSpeed
|
||||
if newScale < scaleMin then
|
||||
scaleToBigger = true
|
||||
end
|
||||
end
|
||||
EID.Scale = newScale
|
||||
EID.Config[EID.CurrentScaleType] = newScale
|
||||
else
|
||||
scaleHoldFrame = scaleHoldFrame + 1
|
||||
end
|
||||
@@ -420,24 +415,18 @@ local function handleScaleKey()
|
||||
if Input.IsButtonTriggered(scaleKey, 0) then
|
||||
EID.MCM_OptionChanged = true
|
||||
scaleHoldFrame = 0
|
||||
local scale
|
||||
local scaleConfigName = (EID.Config["DisplayMode"] == "local" and "LocalModeSize" or "Size")
|
||||
|
||||
scale = EID.Scale
|
||||
local scale = EID.Scale
|
||||
|
||||
-- switch between 1, 1.5 and 0.5
|
||||
|
||||
if math.abs(scale - 1) < 0.01 then
|
||||
scale = 1.5
|
||||
elseif math.abs(scale - 1.5) < 0.01 then
|
||||
scale = 0.5
|
||||
elseif math.abs(scale - 0.5) < 0.01 then
|
||||
scale = 1
|
||||
else
|
||||
scale = 1
|
||||
end
|
||||
|
||||
EID.Config[scaleConfigName] = scale
|
||||
EID.Config[EID.CurrentScaleType] = scale
|
||||
EID.Scale = scale
|
||||
end
|
||||
end
|
||||
@@ -551,11 +540,11 @@ function EID:printDescription(desc)
|
||||
local curLanguage = EID.Config["Language"]
|
||||
if curLanguage ~= "en_us" then
|
||||
EID.Config["Language"] = "en_us"
|
||||
local englishName = EID:getObjectName(desc.ObjType, desc.ObjVariant, desc.ObjSubType)
|
||||
local englishName = desc.PermanentTextEnglish or EID:getObjectName(desc.ObjType, desc.ObjVariant, desc.ObjSubType)
|
||||
EID.Config["Language"] = curLanguage
|
||||
if EID.Config["TranslateItemName"] == 1 then
|
||||
curName = englishName
|
||||
elseif EID.Config["TranslateItemName"] == 3 and curName ~= englishName and not EID.isDisplayingPermanent then
|
||||
elseif EID.Config["TranslateItemName"] == 3 and curName ~= englishName then
|
||||
curName = curName.." ("..englishName..")"
|
||||
end
|
||||
end
|
||||
@@ -738,40 +727,31 @@ function EID:renderIndicator(entity)
|
||||
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
|
||||
EID:renderEntity(entity, sprite, entityPos)
|
||||
end
|
||||
if REPENTANCE then
|
||||
if isMirrorRoom then
|
||||
sprite.FlipX = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EID:ScaleValue(entity)
|
||||
if entity.Variant == EffectVariant.DICE_FLOOR then
|
||||
EID.Scale = EID.Config["Size"]
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
elseif EID.Config["DisplayMode"] == "local" then
|
||||
EID.Scale = EID.Config["LocalModeSize"]
|
||||
if isMirrorRoom then
|
||||
sprite.FlipX = false
|
||||
end
|
||||
end
|
||||
|
||||
function EID:PositionLocalMode(entity)
|
||||
if EID.Config["DisplayMode"] == "local" then
|
||||
-- don't use Local Mode for descriptions without an entity (or dice floors)
|
||||
if EID.Config["DisplayMode"] == "local" and entity and entity.Variant ~= EffectVariant.DICE_FLOOR then
|
||||
EID.Scale = EID.Config["LocalModeSize"]
|
||||
EID.CurrentScaleType = "LocalModeSize"
|
||||
local textBoxWidth = EID.Config["LocalModeCentered"] and tonumber(EID.Config["TextboxWidth"])/2 * EID.Scale or -30
|
||||
local textPosOffset = Vector(-textBoxWidth, 20)
|
||||
EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset))
|
||||
if REPENTANCE then
|
||||
if isMirrorRoom then
|
||||
EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset * Vector(-1,0)))
|
||||
local screenCenter = EID:getScreenSize()/2
|
||||
EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2
|
||||
end
|
||||
if isMirrorRoom then
|
||||
EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset * Vector(-1,0)))
|
||||
local screenCenter = EID:getScreenSize()/2
|
||||
EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2
|
||||
end
|
||||
if entity:ToPickup() and entity:ToPickup():IsShopItem() then
|
||||
EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset))
|
||||
end
|
||||
else
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
EID.Scale = EID.Config["Size"]
|
||||
EID.CurrentScaleType = "Size"
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -803,7 +783,7 @@ local lastMousePos = Vector(0,0)
|
||||
local lastMouseMove = 0
|
||||
|
||||
function EID:handleHoverHUD()
|
||||
local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true))
|
||||
local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true)) * 2
|
||||
if mousePos:Distance(lastMousePos) > 2 then
|
||||
lastMousePos = mousePos
|
||||
lastMouseMove = game:GetFrameCount()
|
||||
@@ -812,12 +792,13 @@ function EID:handleHoverHUD()
|
||||
return nil
|
||||
end
|
||||
if EID.Config["ShowCursor"] then
|
||||
EID.CursorSprite:Render(Vector(mousePos.X, mousePos.Y), nullVector, nullVector)
|
||||
EID.CursorSprite:Render(Vector(mousePos.X / 2, mousePos.Y / 2), nullVector, nullVector)
|
||||
end
|
||||
for k, v in pairs(EID.HUDElements) do
|
||||
local hudElement = EID:handleHUDElement(v)
|
||||
if hudElement.x <= mousePos.X and (hudElement.x + hudElement.width) >= mousePos.X and hudElement.y <= mousePos.Y and (hudElement.y + hudElement.height) >= mousePos.Y then
|
||||
return hudElement.descriptionObj() or nil
|
||||
local result = hudElement.descriptionObj()
|
||||
if result then return result end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
@@ -904,28 +885,30 @@ local function attemptPathfind(entity)
|
||||
return success
|
||||
end
|
||||
|
||||
local hasShownAchievementWarning = false
|
||||
local function renderAchievementInfo()
|
||||
if REPENTANCE and not EID.Config.DisableAchievementCheck and game:GetFrameCount() < 10*30 then
|
||||
local hasShownStartWarning = false
|
||||
local function checkStartOfRunWarnings()
|
||||
if REPENTANCE and not EID.Config["DisableStartOfRunWarnings"] and game:GetFrameCount() < 10*30 then
|
||||
-- Old Repentance version check; update this to check for the existence of the newest mod API function EID uses
|
||||
-- 1.7.6 (Nov. 16, 2021): The Options object (to read the game's options like HUD Offset)
|
||||
if Options == nil then
|
||||
local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
|
||||
demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or ""
|
||||
demoDescObj.Description = EID:getDescriptionEntry("OldGameVersionWarningText") or ""
|
||||
EID:displayPermanentText(demoDescObj)
|
||||
hasShownAchievementWarning = true
|
||||
EID:displayPermanentText(demoDescObj, "AchievementWarningTitle")
|
||||
hasShownStartWarning = true
|
||||
-- Bag of Crafting modded items check
|
||||
elseif EID.player:HasCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and (EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then
|
||||
elseif EID:PlayersHaveCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and
|
||||
(EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then
|
||||
local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
|
||||
demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or ""
|
||||
demoDescObj.Description = EID:getDescriptionEntry("ModdedRecipesWarningText") or ""
|
||||
EID:displayPermanentText(demoDescObj)
|
||||
hasShownAchievementWarning = true
|
||||
EID:displayPermanentText(demoDescObj, "AchievementWarningTitle")
|
||||
hasShownStartWarning = true
|
||||
-- Achievements Locked Check (do we have Cube of Meat or Book of Revelations unlocked?)
|
||||
else
|
||||
local characterID = EID.player:GetPlayerType()
|
||||
--ID 21 = Tainted Isaac. Tainted characters have definitely beaten Mom! (Fixes Tainted Lost's item pools ruining this check)
|
||||
-- ID 21 = Tainted Isaac. Tainted characters have definitely beaten Mom!
|
||||
-- (Fixes Tainted Lost's item pools, and potentially modded character's mechanics, ruining this check)
|
||||
if characterID < 21 and game.Challenge == 0 and not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) then
|
||||
local hasBookOfRevelationsUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS)
|
||||
if not hasBookOfRevelationsUnlocked then
|
||||
@@ -934,13 +917,13 @@ local function renderAchievementInfo()
|
||||
local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
|
||||
demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or ""
|
||||
demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or ""
|
||||
EID:displayPermanentText(demoDescObj)
|
||||
hasShownAchievementWarning = true
|
||||
EID:displayPermanentText(demoDescObj, "AchievementWarningTitle")
|
||||
hasShownStartWarning = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif hasShownAchievementWarning then
|
||||
elseif hasShownStartWarning then
|
||||
EID:hidePermanentText()
|
||||
end
|
||||
end
|
||||
@@ -960,22 +943,26 @@ local function onRender(t)
|
||||
EID.OptionChanged = EID.MCM_OptionChanged
|
||||
EID.MCM_OptionChanged = false
|
||||
EID:resumeCoroutines()
|
||||
|
||||
|
||||
EID.isDisplaying = false
|
||||
EID:setPlayer()
|
||||
-- Do not check our hotkeys while a tab that can modify the hotkey is open
|
||||
if EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" then
|
||||
-- scale key must be handled before resetting to non-local mode
|
||||
handleScaleKey()
|
||||
if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then
|
||||
EID.isHidden = not EID.isHidden
|
||||
end
|
||||
end
|
||||
EID:PositionLocalMode() -- default to non-local mode to fix MCM / Bag errors
|
||||
EID.TabPreviewID = 0
|
||||
|
||||
if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then
|
||||
EID.isHidden = not EID.isHidden
|
||||
end
|
||||
|
||||
handleScaleKey()
|
||||
|
||||
if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then --if the mod config menu exists, is opened and Hide Hud is enabled, and ModConfigMenu isn't currently in the "Visuals" or "Crafting" tab of EID
|
||||
-- If MCM is open, don't show anything unless we're in a tab labeled as "Visuals" or "Crafting"
|
||||
if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then
|
||||
return
|
||||
end
|
||||
|
||||
renderAchievementInfo()
|
||||
checkStartOfRunWarnings()
|
||||
EID:renderMCMDummyDescription()
|
||||
|
||||
if EID.GameVersion == "ab+" then
|
||||
@@ -985,11 +972,18 @@ local function onRender(t)
|
||||
EID:removeTextPosModifier("Schoolbag")
|
||||
end
|
||||
else
|
||||
if EID.player.SubType == 21 or EID.player.SubType == 25 then -- T-Isaac, T-Blue Baby
|
||||
-- Tainted Isaac and Tainted ???
|
||||
if EID.player.SubType == 21 or EID.player.SubType == 25 then
|
||||
EID:addTextPosModifier("Tained HUD", Vector(0,30))
|
||||
else
|
||||
EID:removeTextPosModifier("Tained HUD")
|
||||
end
|
||||
-- Magdalene Birthright
|
||||
if EID.player.SubType == 1 and EID.player:HasCollectible(619) then
|
||||
EID:addTextPosModifier("18 Heart HUD", Vector(0,5))
|
||||
else
|
||||
EID:removeTextPosModifier("18 Heart HUD")
|
||||
end
|
||||
end
|
||||
|
||||
if EID.isHidden then
|
||||
@@ -1008,10 +1002,13 @@ local function onRender(t)
|
||||
|
||||
if REPENTANCE and EID.player:HasCollectible(710) then
|
||||
local success = EID:handleBagOfCraftingRendering()
|
||||
-- If the Bag of Crafting did rendering, don't display any other description
|
||||
if success then
|
||||
return
|
||||
end
|
||||
end
|
||||
-- If we're in the Crafting options tab, the only rendering we want to happen is the Bag of Crafting
|
||||
if EID.MCMCompat_isDisplayingEIDTab == "Crafting" then return end
|
||||
|
||||
EID.lastDescriptionEntity = nil
|
||||
EID.lastDist = 10000
|
||||
@@ -1049,15 +1046,14 @@ local function onRender(t)
|
||||
|
||||
|
||||
local closest = EID.lastDescriptionEntity
|
||||
|
||||
|
||||
-- if no entity in range, display Sacrifice Room information
|
||||
if EID.lastDist / 40 > tonumber(EID.Config["MaxDistance"]) then
|
||||
if game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
|
||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||
local curCounter = EID.sacrificeCounter[curRoomIndex] or 1
|
||||
local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter)
|
||||
sacrificeDesc.Name = sacrificeDesc.Name.." ("..curCounter.."/12)"
|
||||
EID:alterTextPos(Vector(EID.Config["XPosition"], EID.Config["YPosition"]))
|
||||
EID.Scale = EID.Config["Size"]
|
||||
EID:printDescription(sacrificeDesc)
|
||||
end
|
||||
return
|
||||
@@ -1072,11 +1068,9 @@ local function onRender(t)
|
||||
--Handle Indicators
|
||||
EID:renderIndicator(closest)
|
||||
|
||||
--Local Mode
|
||||
--Position the description under the entity in Local Mode
|
||||
EID:PositionLocalMode(closest)
|
||||
|
||||
--Scale Value
|
||||
EID:ScaleValue(closest)
|
||||
--Handle GetData Entities (specific)
|
||||
if EID.Config["EnableEntityDescriptions"] and EID:getEntityData(closest, "EID_Description") then
|
||||
local desc = EID:getEntityData(closest, "EID_Description")
|
||||
@@ -1100,9 +1094,10 @@ local function onRender(t)
|
||||
-- force the default glitchy description if option is off
|
||||
if not EID.Config["DisplayGlitchedItemInfo"] then
|
||||
glitchedObj.Description = glitchedDesc
|
||||
-- grab the Item Config info if eid_tmtrainer.lua hasn't taken care of it
|
||||
elseif not debug then
|
||||
glitchedObj.Description = EID:CheckGlitchedItemConfig(closest.SubType) .. glitchedDesc
|
||||
-- grab the Item Config info if eid_tmtrainer.lua hasn't taken care of it, and it hasn't been done before
|
||||
elseif not debug and glitchedObj.Description == glitchedDesc then
|
||||
EID:addCollectible(closest.SubType, EID:CheckGlitchedItemConfig(closest.SubType) .. glitchedDesc)
|
||||
glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)
|
||||
end
|
||||
|
||||
EID:printDescription(glitchedObj)
|
||||
@@ -1293,6 +1288,11 @@ if EID.MCMLoaded or REPENTANCE then
|
||||
end
|
||||
end
|
||||
end
|
||||
-- DisableAchievementCheck has been renamed, convert the setting to the new one (this can be removed in a few updates)
|
||||
if savedEIDConfig["DisableAchievementCheck"] then
|
||||
EID.Config["DisableStartOfRunWarnings"] = savedEIDConfig["DisableAchievementCheck"]
|
||||
end
|
||||
|
||||
EID.isHidden = EID.Config["InitiallyHidden"]
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
EID.Scale = EID.Config["Size"]
|
||||
|
||||
+174
-784
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user