mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-10 00:45:15 +00:00
adds support for alphanumeric seeds!
This commit is contained in:
parent
cec5cc5199
commit
366acf3de8
|
@ -93,27 +93,17 @@ function C:_mountDirectory(path)
|
|||
end
|
||||
|
||||
function C:_seedRngesus()
|
||||
local seed = self.customseed or tostring(os.time())
|
||||
--[[
|
||||
local seed = io.open(lf.getSourceBaseDirectory() .. "/seed.txt")
|
||||
local seed = self.customseed or os.time()
|
||||
seed = tonumber(seed) or tonumber(seed, 36) -- convert alphanumeric strings to numbers
|
||||
local seedstring = self.customseed or tostring(seed)
|
||||
if seed == nil then
|
||||
logNotice('Seed from file doesnt exists, generate a new')
|
||||
seed = tostring(os.time())
|
||||
else
|
||||
logNotice('Gathering the seed from file "seed.txt"')
|
||||
seed = seed:read('*n')
|
||||
seed = os.time()
|
||||
seedstring = ('%d ("%s" was invalid)'):format(seed, self.customseed)
|
||||
end
|
||||
if seed == nil then
|
||||
logWarning('Seed from file is invalid, generate a new')
|
||||
seed = tostring(os.time())
|
||||
elseif string.len(seed) < 10 then
|
||||
logWarning('Seed is too short, generate a new')
|
||||
seed = tostring(os.time())
|
||||
end
|
||||
]]
|
||||
love.math.setRandomSeed(seed)
|
||||
logNotice(('Offering seed "%s" to RNGesus' ):format(seed))
|
||||
return seed
|
||||
|
||||
logNotice(('Offering seed "%s" to RNGesus' ):format(seedstring))
|
||||
return seedstring
|
||||
end
|
||||
|
||||
function C:_createTscFiles(dirStage)
|
||||
|
@ -238,7 +228,7 @@ function C:_getStatusMessage(seed)
|
|||
local warnings, errors = countLogWarningsAndErrors()
|
||||
local line1
|
||||
if warnings == 0 and errors == 0 then
|
||||
line1 = ("Randomized data successfully created!\nSeed: %d"):format(seed)
|
||||
line1 = ("Randomized data successfully created!\nSeed: %s"):format(seed)
|
||||
elseif warnings ~= 0 and errors == 0 then
|
||||
line1 = ("Randomized data was created with %d warning(s)."):format(warnings)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue