mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
Mtn v3 - minor bug fixes
This commit is contained in:
parent
9f2233727a
commit
b3b939b902
@ -43,7 +43,8 @@ end
|
||||
|
||||
local function write_additional_stats(key)
|
||||
local current_date = Server.get_current_date(true)
|
||||
if not current_date then
|
||||
if current_date == nil then
|
||||
log('Failed to get current date.')
|
||||
return
|
||||
end
|
||||
|
||||
@ -53,7 +54,8 @@ local function write_additional_stats(key)
|
||||
local previous_raw_date = Public.get_stateful('current_date')
|
||||
|
||||
local previous_date = Server.get_current_date(true, false, previous_raw_date)
|
||||
if not previous_date then
|
||||
if previous_date == nil then
|
||||
log('Failed to get previous date.')
|
||||
return
|
||||
end
|
||||
|
||||
@ -67,6 +69,8 @@ local function write_additional_stats(key)
|
||||
|
||||
if key then
|
||||
set_data(score_dataset, key, this.seasons)
|
||||
else
|
||||
log('Failed to write additional stats.')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1013,10 +1013,7 @@ local function apply_startup_settings(settings)
|
||||
this.time_to_reset = this.reset_after - time_to_reset
|
||||
|
||||
if time_to_reset and time_to_reset >= this.reset_after then
|
||||
if server_name_matches then
|
||||
Server.set_data(dataset, dataset_key_previous, settings)
|
||||
end
|
||||
|
||||
Public.save_settings_before_reset()
|
||||
Public.set_season_scores()
|
||||
|
||||
local s = this.season or 1
|
||||
@ -1229,6 +1226,23 @@ function Public.save_settings()
|
||||
return granted_buff
|
||||
end
|
||||
|
||||
function Public.save_settings_before_reset()
|
||||
local settings = {
|
||||
rounds_survived = this.rounds_survived,
|
||||
season = this.season,
|
||||
test_mode = this.test_mode,
|
||||
buffs = this.buffs,
|
||||
current_date = this.current_date
|
||||
}
|
||||
|
||||
local server_name_matches = Server.check_server_name('Mtn Fortress')
|
||||
if server_name_matches then
|
||||
Server.set_data(dataset, dataset_key_previous, settings)
|
||||
else
|
||||
Server.set_data(dataset, dataset_key_previous, settings)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.reset_stateful(refresh_gui, clear_buffs)
|
||||
this.test_mode = false
|
||||
|
||||
|
@ -1403,9 +1403,9 @@ function Public.get_current_date(pretty, as_table, current_time)
|
||||
if as_table then
|
||||
return {year = date.year, month = date.month, day = date.day}
|
||||
elseif pretty then
|
||||
return tonumber(date.year .. '-' .. date.month .. '-' .. date.day)
|
||||
return date.year .. '-' .. date.month .. '-' .. date.day
|
||||
else
|
||||
return tonumber(date.year .. date.month .. date.day)
|
||||
return date.year .. date.month .. date.day
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user