This commit is contained in:
theo@manjaro 2024-01-09 17:57:54 +01:00
parent 790ba2471b
commit 9d6b9f9c80
1 changed files with 13 additions and 14 deletions

View File

@ -19,7 +19,7 @@ function mod:isCurseBlind(pickupEntity)
return mod.game:GetLevel():GetCurses() & LevelCurse.CURSE_OF_BLIND > 0 return mod.game:GetLevel():GetCurses() & LevelCurse.CURSE_OF_BLIND > 0
end end
function mod.isIdNotTakenAlready(id, ignorerepentogon) function mod.isIdNotTakenAlready(id)
if id > 0 then if id > 0 then
-- Always returns seen if on a challenge -- Always returns seen if on a challenge
if Isaac.GetChallenge() ~= 0 then return false end if Isaac.GetChallenge() ~= 0 then return false end
@ -33,14 +33,6 @@ function mod.isIdNotTakenAlready(id, ignorerepentogon)
end end
end end
else else
-- Check using REPENTOGON
if isrepentogon and not ignorerepentogon then
if getgamedata():IsItemInCollection(id) then
mod.registerTouched(id)
return false
end
end
return not save.seen[id] return not save.seen[id]
end end
else else
@ -51,7 +43,7 @@ end
function mod.registerTouched(id) function mod.registerTouched(id)
-- Only register when not on a challenge -- Only register when not on a challenge
if Isaac.GetChallenge() == 0 then if Isaac.GetChallenge() == 0 then
local shouldsave = mod.isIdNotTakenAlready(id, true) local shouldsave = mod.isIdNotTakenAlready(id)
if id >= 1 and id <= save.settings.maxid then save:touchid(id) end if id >= 1 and id <= save.settings.maxid then save:touchid(id) end
if id >= save.settings.maxid then if id >= save.settings.maxid then
-- Modded item, save them by name -- Modded item, save them by name
@ -64,10 +56,9 @@ function mod.registerTouched(id)
end end
-- Save -- Save
if shouldsave then -- Only save if there's a change if shouldsave then -- Only save if there's a change
print("Saved "..id) mod:save()
mod:save() end
end
end end
end end
@ -153,6 +144,14 @@ function mod:newrun()
else else
save = savegen:new() save = savegen:new()
end end
-- Load info from repentogon if available
if isrepentogon then
for i = 1, save.settings.maxid do
if getgamedata():IsItemInCollection(i) then
mod.registerTouched(i)
end
end
end
local c = 0 local c = 0
for _, v in ipairs(save.seen) do if v then c = c + 1 end end for _, v in ipairs(save.seen) do if v then c = c + 1 end end
mod.print(modname .. " loaded, " .. c .. " vanilla items seen") mod.print(modname .. " loaded, " .. c .. " vanilla items seen")