Created
April 11, 2024 03:39
-
-
Save n4ru/4ab14a6c9fd13e79e2f3bc8715e1a079 to your computer and use it in GitHub Desktop.
Seed Persistence - Restart current seeded run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- STEAMODDED HEADER | |
--- MOD_NAME: Seed Persistence | |
--- MOD_ID: seed_persistence | |
--- MOD_AUTHOR: [thirk] | |
--- MOD_DESCRIPTION: Persist seeds between quick restarts. | |
---------------------------------------------- | |
------------MOD CODE ------------------------- | |
local start_run = Game.start_run | |
local start_setup_run = G.FUNCS.start_setup_run | |
local saved_seed = nil | |
-- Save the seed when starting a seeded run | |
function Game:start_run(args) | |
start_run(self, args) | |
local saveTable = args.savetext or nil | |
if not (saveTable) and args.seed and G.GAME.seeded then | |
saved_seed = args.seed | |
else | |
saved_seed = nil | |
end | |
end | |
-- Modify to NOT reset the seed IF seeded | |
function G.FUNCS.start_setup_run() | |
if saved_seed and not G.OVERLAY_MENU then | |
G.forced_seed = saved_seed | |
else | |
G.forced_seed = nil | |
end | |
start_setup_run() | |
end | |
---------------------------------------------- | |
------------MOD CODE END---------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment