Improve restock machines / Diplopia flip interaction
This commit is contained in:
1 parent
71c24398f5
commit
327d81f73d
1 file changed
+8
-3
@@ -323,9 +323,14 @@ 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
|
||||||
|
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
|
entity:GetData()["EID_FlipItemID"] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user