From 9250d162c878bb957773d758ec885326f821f985 Mon Sep 17 00:00:00 2001 From: Trashbox Bobylev Date: Mon, 25 Mar 2019 10:20:51 +0700 Subject: [PATCH] Fixed weird situations with seed.txt --- src/randomizer.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/randomizer.lua b/src/randomizer.lua index 866b50c..56ce7cb 100644 --- a/src/randomizer.lua +++ b/src/randomizer.lua @@ -74,12 +74,13 @@ end function C:_seedRngesus() local seedfile, bytes= lf.read(lf.getSourceBaseDirectory() + "seed.txt",10); local seed = "" - if seedfile == nil then - logNotice('Okay, no seed file, generate new') + seedfile = tonumber(seedfile) + 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()) math.randomseed(seed) else - logNotice('Gathered seed from file') + logNotice('Gathered the seed from file "seed.txt"') seed = seedfile end logNotice(('Offering seed "%s" to RNGesus'):format(seed))