Skip to content

Commit 09570d4

Browse files
committed
fix handling for new default values if added, add information about race being ignored to status
1 parent 18db95f commit 09570d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nestboxes.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ local function format_target_count_row(header, row)
6262
return header ..
6363
": " ..
6464
"target count: " ..
65-
row[1] .. "; count children: " .. tostring(row[2]) .. "; count adults: " .. tostring(row[3])
65+
row[1] .. "; count children: " .. tostring(row[2]) .. "; count adults: " .. tostring(row[3]) .. "; ignore race: " .. tostring(row[4])
6666
end
6767

6868
local function print_status()
@@ -93,9 +93,9 @@ local function persist_state()
9393
end
9494

9595
local function read_persistent_config(key, index)
96-
if dfhack.internal.readPersistentSiteConfigInt ~= nil then
97-
return dfhack.internal.readPersistentSiteConfigInt(key, index)
98-
else
96+
if dfhack.internal.readPersistentSiteConfigInt ~= nil then
97+
return dfhack.internal.readPersistentSiteConfigInt(key, index)
98+
else
9999
return nil
100100
end
101101
end
@@ -122,7 +122,8 @@ local function load_state()
122122
processed_persisted_data.target_eggs_count_per_race = {}
123123
if persisted_data.target_eggs_count_per_race ~= nil then
124124
for k, v in pairs(persisted_data.target_eggs_count_per_race) do
125-
processed_persisted_data.target_eggs_count_per_race[tonumber(k)] = v
125+
local default = utils.clone(default_table)
126+
processed_persisted_data.target_eggs_count_per_race[tonumber(k)] = utils.assign(default, v)
126127
end
127128
end
128129
end

0 commit comments

Comments
 (0)