When using Flip, the Flip-item is now updated correctly
This commit is contained in:
1 parent
5c1a6a14ef
commit
7ae9823614
2 files changed
+20
-4
No files matched your search
+3
-3
@@ -409,14 +409,14 @@ local game = Game()
|
|||||||
local function FlipCallback(descObj)
|
local function FlipCallback(descObj)
|
||||||
local flipItemID = EID:getEntityData(descObj.Entity, "EID_FlipItemID")
|
local flipItemID = EID:getEntityData(descObj.Entity, "EID_FlipItemID")
|
||||||
if Input.IsActionPressed(ButtonAction.ACTION_MAP, EID.player.ControllerIndex) then
|
if Input.IsActionPressed(ButtonAction.ACTION_MAP, EID.player.ControllerIndex) then
|
||||||
local descEntry = EID:getDescriptionObj(5, 100, flipItemID)
|
local descEntry = EID:getDescriptionObj(5, 100, flipItemID[2])
|
||||||
return descEntry
|
return descEntry
|
||||||
end
|
end
|
||||||
|
|
||||||
local infoText = EID:getDescriptionEntry("FlipItemToggleInfo")
|
local infoText = EID:getDescriptionEntry("FlipItemToggleInfo")
|
||||||
if flipItemID ~= nil or infoText ~= nil then
|
if flipItemID ~= nil or infoText ~= nil then
|
||||||
local itemName = EID:getObjectName(5, 100, flipItemID)
|
local itemName = EID:getObjectName(5, 100, flipItemID[2])
|
||||||
local appendText = "#{{Collectible711}} -> {{Collectible"..flipItemID.."}} "..itemName
|
local appendText = "#{{Collectible711}} -> {{Collectible"..flipItemID[2].."}} "..itemName
|
||||||
appendText = appendText .. "#{{Blank}} "..infoText
|
appendText = appendText .. "#{{Blank}} "..infoText
|
||||||
EID:appendToDescription(descObj, appendText)
|
EID:appendToDescription(descObj, appendText)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ if REPENTANCE then
|
|||||||
local curFrame = Isaac.GetFrameCount()
|
local curFrame = Isaac.GetFrameCount()
|
||||||
if not decrease and curFrame == lastGetItemResult[2] and lastGetItemResult[1] ~= nil then
|
if not decrease and curFrame == lastGetItemResult[2] and lastGetItemResult[1] ~= nil then
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||||
EID.flipItemPositions[curRoomIndex][lastGetItemResult[3]] = selectedCollectible
|
EID.flipItemPositions[curRoomIndex][lastGetItemResult[3]] = {lastGetItemResult[1], selectedCollectible}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Handle crane game
|
-- Handle crane game
|
||||||
@@ -288,6 +288,22 @@ if REPENTANCE then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit)
|
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit)
|
||||||
|
|
||||||
|
-- Handle Flip Item usage
|
||||||
|
function EID:onFlipUse(_)
|
||||||
|
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||||
|
if EID.flipItemPositions[curRoomIndex] ~= nil then
|
||||||
|
for _,collectible in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
|
||||||
|
local gridPos = game:GetRoom():GetGridIndex(collectible.Position)
|
||||||
|
local entry = EID.flipItemPositions[curRoomIndex][gridPos]
|
||||||
|
if entry then
|
||||||
|
EID.flipItemPositions[curRoomIndex][gridPos] = {entry[2], entry[1]}
|
||||||
|
collectible:GetData()["EID_FlipItemID"] = {entry[2], entry[1]}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EID:AddCallback(ModCallbacks.MC_USE_ITEM, EID.onFlipUse, CollectibleType.COLLECTIBLE_FLIP)
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in new issue
Block a user