mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-12-25 22:47:14 +00:00
Added ability to read seed from seed.txt in randomizer's home file
This commit is contained in:
parent
5c7e994c45
commit
bfd3ec0360
|
@ -29,6 +29,7 @@ function C:randomize(path)
|
|||
if not success then
|
||||
return "Could not find \"data\" subfolder.\n\nMaybe try dropping your Cave Story \"data\" folder in directly?"
|
||||
end
|
||||
|
||||
self:_seedRngesus()
|
||||
local tscFiles = self:_createTscFiles(dirStage)
|
||||
-- self:_writePlaintext(tscFiles)
|
||||
|
@ -71,8 +72,16 @@ function C:_mountDirectory(path)
|
|||
end
|
||||
|
||||
function C:_seedRngesus()
|
||||
local seed = tostring(os.time())
|
||||
local seedfile, bytes= lf.read(lf.getSourceBaseDirectory() + "seed.txt", 9);
|
||||
local seed = ""
|
||||
if seedfile == nil then
|
||||
logNotice('Okay, no seed file, generate new')
|
||||
seed = tostring(os.time())
|
||||
math.randomseed(seed)
|
||||
else
|
||||
logNotice('Gathered seed from file')
|
||||
seed = seedfile
|
||||
end
|
||||
logNotice(('Offering seed "%s" to RNGesus'):format(seed))
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue