Merge pull request #273 from kittenchilly/master

Support items inside Crane Game
This commit is contained in:
wofsauge authored and GitHub committed 2021-12-16 20:21:08 +01:00
commit f90d836bb2
4 files changed
+84 -1

No files matched your search

+3
View File
@@ -491,6 +491,9 @@ function EID:hasDescription(entity)
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EID.Config["DisplayPillInfo"])
return isAllowed and entity.SubType > 0
end
if entity.Type == 6 and entity.Variant == 16 and EID.Config["DisplayCraneInfo"] and REPENTANCE then
isAllowed = not entity:GetSprite():IsPlaying("Broken") and not entity:GetSprite():IsPlaying("Prize")
end
isAllowed = isAllowed or (entity.Type == 1000 and entity.Variant == EffectVariant.DICE_FLOOR and EID.Config["DisplayDiceInfo"])
return isAllowed
end
+8
View File
@@ -195,6 +195,13 @@ EID.UserConfig = {
-- Default = true
["DisplayDiceInfo"] = true,
--------Crane Game---------
-- REPENTANCE ONLY!!!
-- Toggle Display for items inside of a Crane Game
-- Default = true
["DisplayCraneInfo"] = true,
---------Bag of Crafting-----------
-- REPENTANCE ONLY!!!
@@ -355,6 +362,7 @@ EID.DefaultConfig = {
["DisplaySacrificeInfo"] = true,
["DisplayDiceInfo"] = true,
["DisplayBagOfCrafting"] = "always",
["DisplayCraneInfo"] = true,
["BagOfCraftingResults"] = 7,
["BagOfCraftingCombinationMax"] = 12,
["BagOfCraftingRandomResults"] = 400,
+49 -1
View File
@@ -28,6 +28,7 @@ EID.sacrificeCounter = {}
EID.itemConfig = Isaac.GetItemConfig()
EID.effectList = {["76"] = true}
EID.itemUnlockStates = {}
EID.CraneItemType = {}
-- Sprite inits
EID.IconSprite = Sprite()
@@ -137,6 +138,7 @@ function EID:onNewFloor()
if REPENTANCE then
EID.bagOfCraftingRoomQueries = {}
EID.bagOfCraftingFloorQuery = {}
EID.CraneItemType = {}
end
end
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
@@ -213,6 +215,22 @@ function EID:IsAltChoice(pickup)
return true
end
---------------------------------------------------------------------------
-------------------------Handle Crane Game-----------------------------
function EID:postGetCollectible(selectedCollectible, itemPoolType, decrease, seed)
if itemPoolType == ItemPoolType.POOL_CRANE_GAME then
for _, crane in ipairs(Isaac.FindByType(6, 16, -1, true, false)) do
if not crane:GetSprite():IsPlaying("Broken") then
if not EID.CraneItemType[tostring(crane.InitSeed)] then
EID.CraneItemType[tostring(crane.InitSeed)] = selectedCollectible
end
end
end
end
end
EID:AddCallback(ModCallbacks.MC_POST_GET_COLLECTIBLE, EID.postGetCollectible)
---------------------------------------------------------------------------
---------------------------Printing Functions------------------------------
@@ -542,6 +560,7 @@ EID.hasValidWalkingpath = true
function EID:onGameUpdate()
EID:setPlayer()
--Fix Overlapping Pedestals
local curPositions = {}
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
@@ -556,6 +575,14 @@ function EID:onGameUpdate()
table.insert(curPositions, {entity, entity.Position})
end
for _, crane in ipairs(Isaac.FindByType(6, 16, -1, true, false)) do
if EID.CraneItemType[tostring(crane.InitSeed)] then
if crane:GetSprite():IsPlaying("Prize") then
EID.CraneItemType[tostring(crane.InitSeed)] = nil
end
end
end
if not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedPillInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"] then
if EID.lastDescriptionEntity == nil or (EID.Config["DisableObstructionOnFlight"] and EID.player.CanFly) then
if EID.pathCheckerEntity ~= nil then
@@ -755,12 +782,30 @@ local function onRender(t)
EID:printDescription(origDesc)
return
end
if closest.Type == 1000 and closest.Variant == 76 then
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1))
return
end
if closest.Type == 6 and closest.Variant == 16 then
--Handle Crane Game
if EID.CraneItemType[tostring(closest.InitSeed)] then
if EID:getEntityData(closest, "EID_DontHide") ~= true then
if (EID:hasCurseBlind() and EID.Config["DisableOnCurse"]) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then
EID:renderQuestionMark()
return
end
end
local collectibleID = EID.CraneItemType[tostring(closest.InitSeed)]
local descriptionObj = EID:getDescriptionObj(5, 100, collectibleID)
EID:printDescription(descriptionObj)
return
end
end
if closest.Variant == PickupVariant.PICKUP_TRINKET then
--Handle Trinkets
local trinketID = closest.SubType
@@ -851,8 +896,10 @@ if EID.MCMLoaded or REPENTANCE then
if REPENTANCE and isSave then
EID.BagItems = savedEIDConfig["BagContent"]
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"]
EID.CraneItemType = savedEIDConfig["CraneItemType"]
savedEIDConfig["BagContent"] = nil
savedEIDConfig["BagFloorContent"] = nil
savedEIDConfig["CraneItemType"] = nil
else
EID.BagItems = {}
end
@@ -896,6 +943,7 @@ if EID.MCMLoaded or REPENTANCE then
if REPENTANCE then
EID.Config["BagContent"] = EID.BagItems or {}
EID.Config["BagFloorContent"] = EID.bagOfCraftingRoomQueries or {}
EID.Config["CraneItemType"] = EID.CraneItemType or {}
end
EID.SaveData(EID, json.encode(EID.Config))
EID:hidePermanentText()
+24
View File
@@ -619,9 +619,33 @@ if MCMLoaded then
}
)
local diceSteps = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
if REPENTANCE then
--------Crane Game---------
MCM.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function()
return EID.Config["DisplayCraneInfo"]
end,
Display = function()
local onOff = "False"
if EID.Config["DisplayCraneInfo"] then
onOff = "True"
end
return "Crane Game Infos: " .. onOff
end,
OnChange = function(currentBool)
EID.Config["DisplayCraneInfo"] = currentBool
end
}
)
MCM.AddSpace("EID", "Display")
-- Spindown Dice results