Save fix
This commit is contained in:
parent
790ba2471b
commit
9d6b9f9c80
21
main.lua
21
main.lua
@ -19,7 +19,7 @@ function mod:isCurseBlind(pickupEntity)
|
||||
return mod.game:GetLevel():GetCurses() & LevelCurse.CURSE_OF_BLIND > 0
|
||||
end
|
||||
|
||||
function mod.isIdNotTakenAlready(id, ignorerepentogon)
|
||||
function mod.isIdNotTakenAlready(id)
|
||||
if id > 0 then
|
||||
-- Always returns seen if on a challenge
|
||||
if Isaac.GetChallenge() ~= 0 then return false end
|
||||
@ -33,14 +33,6 @@ function mod.isIdNotTakenAlready(id, ignorerepentogon)
|
||||
end
|
||||
end
|
||||
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]
|
||||
end
|
||||
else
|
||||
@ -51,7 +43,7 @@ end
|
||||
function mod.registerTouched(id)
|
||||
-- Only register when not on a challenge
|
||||
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 >= save.settings.maxid then
|
||||
-- Modded item, save them by name
|
||||
@ -65,7 +57,6 @@ function mod.registerTouched(id)
|
||||
|
||||
-- Save
|
||||
if shouldsave then -- Only save if there's a change
|
||||
print("Saved "..id)
|
||||
mod:save()
|
||||
end
|
||||
end
|
||||
@ -153,6 +144,14 @@ function mod:newrun()
|
||||
else
|
||||
save = savegen:new()
|
||||
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
|
||||
for _, v in ipairs(save.seen) do if v then c = c + 1 end end
|
||||
mod.print(modname .. " loaded, " .. c .. " vanilla items seen")
|
||||
|
Loading…
Reference in New Issue
Block a user