Fixed save loading
This commit is contained in:
parent
c10e09ef51
commit
dc2383ee08
28
main.lua
28
main.lua
@ -4,14 +4,6 @@ local math = require("math")
|
||||
mod.print = Isaac.ConsoleOutput
|
||||
mod.game = Game()
|
||||
local save = include("save"):new()
|
||||
if mod:HasData() then
|
||||
save:load(mod:LoadData())
|
||||
local c = 0
|
||||
for i,v in ipairs(save.seen) do
|
||||
if v then c = c+1 end
|
||||
end
|
||||
mod.print(modname.." Loaded, "..c.." items seen\n")
|
||||
end
|
||||
|
||||
mod.font = Font()
|
||||
mod.font:Load("font/terminus.fnt")
|
||||
@ -93,12 +85,25 @@ function mod:PickupDrawCallback(pickupEntity, _)
|
||||
end
|
||||
end
|
||||
|
||||
function mod:newrun()
|
||||
if mod:HasData() then
|
||||
local data = mod:LoadData()
|
||||
mod.print(data.."\n")
|
||||
save:load(data)
|
||||
local c = 0
|
||||
for _,v in ipairs(save.seen) do
|
||||
if v then c = c+1 end
|
||||
end
|
||||
mod.print(modname.." Loaded, "..c.." items seen\n")
|
||||
end
|
||||
end
|
||||
|
||||
function mod:preGameExit()
|
||||
mod:RemoveData()
|
||||
mod:SaveData(save:dump())
|
||||
end
|
||||
|
||||
mod:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, mod.preGameExit)
|
||||
mod:AddCallback(ModCallbacks.MC_POST_GAME_END, mod.preGameExit)
|
||||
mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, mod.newrun)
|
||||
|
||||
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, mod.update)
|
||||
mod:AddCallback(ModCallbacks.MC_POST_PICKUP_RENDER, mod.PickupDrawCallback)
|
||||
@ -125,6 +130,7 @@ if ModConfigMenu then
|
||||
end,
|
||||
OnChange = function(b)
|
||||
save.settings.eid = b
|
||||
mod:SaveData(save:dump())
|
||||
end,
|
||||
}
|
||||
)
|
||||
@ -141,6 +147,7 @@ if ModConfigMenu then
|
||||
end,
|
||||
OnChange = function(b)
|
||||
save.settings.visual = b
|
||||
mod:SaveData(save:dump())
|
||||
end,
|
||||
}
|
||||
)
|
||||
@ -158,6 +165,7 @@ if ModConfigMenu then
|
||||
end,
|
||||
OnChange = function(b)
|
||||
save.settings.showonblind = b
|
||||
mod:SaveData(save:dump())
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
17
metadata.xml
17
metadata.xml
@ -3,8 +3,21 @@
|
||||
<name>DeadGod Helper</name>
|
||||
<directory>deadgod helper</directory>
|
||||
<id>2985754961</id>
|
||||
<description></description>
|
||||
<version>1.4</version>
|
||||
<description>A small mod for The Binding Of Isaac: Repentance!
|
||||
|
||||
Easily spot items that were not previously picked up on this savefile. Very useful when you're trying to get a second or third Dead God.
|
||||
|
||||
I made it mainly for myself, because it was annoying to go back to the menu every time I encountered an item I was unsure about.
|
||||
|
||||
There's an integration with External Item Description.
|
||||
It is also compatible with Mod Config Menu, if you want to toggle things (such as displaying info when on Curse Of The Blind)
|
||||
|
||||
There's however a limitation: since (to my knowledge) there's no way to get information about seen items from the savefile, this mod takes it upon itself to track which item you picked up. (This means that when you install the mod for the first time, every item will be tagged as unseen)
|
||||
|
||||
Anyway, I hope that this mod will be useful to someone :)
|
||||
|
||||
(Source code is available at https://forge.chapril.org/ayte/DeadGodHelper)</description>
|
||||
<version>1.5</version>
|
||||
<visibility>Public</visibility>
|
||||
<tag id="Items"/>
|
||||
<tag id="Graphics"/>
|
||||
|
Loading…
Reference in New Issue
Block a user