From e9e9751913e0f291908f8c3cf00abe8c66043b36 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sun, 31 Oct 2021 00:45:06 +0200 Subject: [PATCH] Made achievement checking function a bit less error prone --- main.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/main.lua b/main.lua index 03836f36..34186b77 100644 --- a/main.lua +++ b/main.lua @@ -538,14 +538,17 @@ EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate) local hasShownAchievementWarning = false local function renderAchievementInfo() if REPENTANCE and game:GetFrameCount() < 10*30 then - local hasCubeOfMeatUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_CUBE_OF_MEAT) - if not hasCubeOfMeatUnlocked then - local demoDescObj = EID:getDescriptionObj(-999, -1, 1) - demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" - demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or "" - EID:displayPermanentText(demoDescObj) - hasShownAchievementWarning = true - end + local hasBookOfRevelationsUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS) + if not hasBookOfRevelationsUnlocked then + local hasCubeOfMeatUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_CUBE_OF_MEAT) + if not hasCubeOfMeatUnlocked then + local demoDescObj = EID:getDescriptionObj(-999, -1, 1) + demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" + demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or "" + EID:displayPermanentText(demoDescObj) + hasShownAchievementWarning = true + end + end elseif hasShownAchievementWarning then EID:hidePermanentText() end