mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-12-26 15:07:56 +00:00
Fixed weird situations with seed.txt
This commit is contained in:
parent
dfa31bc999
commit
9250d162c8
|
@ -74,12 +74,13 @@ end
|
||||||
function C:_seedRngesus()
|
function C:_seedRngesus()
|
||||||
local seedfile, bytes= lf.read(lf.getSourceBaseDirectory() + "seed.txt",10);
|
local seedfile, bytes= lf.read(lf.getSourceBaseDirectory() + "seed.txt",10);
|
||||||
local seed = ""
|
local seed = ""
|
||||||
if seedfile == nil then
|
seedfile = tonumber(seedfile)
|
||||||
logNotice('Okay, no seed file, generate new')
|
if seedfile == nil or bytes < 10 then
|
||||||
|
logWarning('Seed from file doesn' t exists or seems to be invalid, generate a new')
|
||||||
seed = tostring(os.time())
|
seed = tostring(os.time())
|
||||||
math.randomseed(seed)
|
math.randomseed(seed)
|
||||||
else
|
else
|
||||||
logNotice('Gathered seed from file')
|
logNotice('Gathered the seed from file "seed.txt"')
|
||||||
seed = seedfile
|
seed = seedfile
|
||||||
end
|
end
|
||||||
logNotice(('Offering seed "%s" to RNGesus'):format(seed))
|
logNotice(('Offering seed "%s" to RNGesus'):format(seed))
|
||||||
|
|
Loading…
Reference in a new issue