Made achievement checking function a bit less error prone

This commit is contained in:
Wofsauge committed 2021-10-31 00:45:06 +02:00
1 parent 80a51717ab
commit e9e9751913
1 file changed
+11 -8
+11 -8
View File
@@ -538,14 +538,17 @@ EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
local hasShownAchievementWarning = false local hasShownAchievementWarning = false
local function renderAchievementInfo() local function renderAchievementInfo()
if REPENTANCE and game:GetFrameCount() < 10*30 then if REPENTANCE and game:GetFrameCount() < 10*30 then
local hasCubeOfMeatUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_CUBE_OF_MEAT) local hasBookOfRevelationsUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS)
if not hasCubeOfMeatUnlocked then if not hasBookOfRevelationsUnlocked then
local demoDescObj = EID:getDescriptionObj(-999, -1, 1) local hasCubeOfMeatUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_CUBE_OF_MEAT)
demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" if not hasCubeOfMeatUnlocked then
demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or "" local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
EID:displayPermanentText(demoDescObj) demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or ""
hasShownAchievementWarning = true demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or ""
end EID:displayPermanentText(demoDescObj)
hasShownAchievementWarning = true
end
end
elseif hasShownAchievementWarning then elseif hasShownAchievementWarning then
EID:hidePermanentText() EID:hidePermanentText()
end end