Skip to content

Commit 767430e

Browse files
committed
rename script to nestboxes
1 parent f724412 commit 767430e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

eggwatch.lua renamed to nestboxes.lua

+12-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local argparse = require("argparse")
44
local eventful = require("plugins.eventful")
55
local utils = require("utils")
66

7-
local GLOBAL_KEY = "eggwatch"
7+
local GLOBAL_KEY = "nestboxes"
88
local default_table = {10, false, false}
99
local string_or_int_to_boolean = {["true"] = true, ["false"] = false, ["1"] = true, ["0"] = false, ["Y"] = true, ["N"] = false, [1] = true, [0] = false}
1010

@@ -91,7 +91,7 @@ local function read_persistent_config(key, index)
9191
return dfhack.internal.readPersistentSiteConfigInt(key, index)
9292
end
9393

94-
local function migrate_enabled_status_from_ccp_nestboxes()
94+
local function migrate_enabled_status_from_cpp_nestboxes()
9595
print_local("About to attempt migration from cpp to lua")
9696
local nestboxes_status = read_persistent_config("nestboxes/config", "0")
9797
print_local(("Migrating status %s from cpp nestboxes to lua"):format(string_or_int_to_boolean[nestboxes_status] and "enabled" or "disabled"))
@@ -122,7 +122,7 @@ local function load_state()
122122
utils.assign(state, processed_persisted_data)
123123

124124
if not state.migration_from_cpp_to_lua_done then
125-
migrate_enabled_status_from_ccp_nestboxes()
125+
migrate_enabled_status_from_cpp_nestboxes()
126126
end
127127

128128
print_details(("end load_state"))
@@ -168,10 +168,6 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
168168
update_event_listener()
169169
end
170170

171-
if dfhack_flags.module then
172-
return
173-
end
174-
175171
local function is_egg(item)
176172
return df.item_type.EGG == item:getType()
177173
end
@@ -501,6 +497,9 @@ end
501497

502498
load_state()
503499
local args, opts = {...}, {}
500+
if dfhack_flags and dfhack_flags.enable then
501+
args = {dfhack_flags.enable_state and "enable" or "disable"}
502+
end
504503
local positionals =
505504
argparse.processArgsGetopt(
506505
args,
@@ -515,18 +514,18 @@ local positionals =
515514
}
516515
)
517516

518-
if dfhack_flags.enable then
519-
if dfhack_flags.enable_state then
520-
do_enable()
521-
else
522-
do_disable()
523-
end
517+
if dfhack_flags.module then
518+
return
524519
end
525520

526521
local command = positionals[1]
527522

528523
if command == "help" or opts.help then
529524
print(dfhack.script_help())
525+
elseif command == "enable" then
526+
do_enable()
527+
elseif command == "disable" then
528+
do_disable()
530529
elseif command == "target" then
531530
set_target(positionals[2], positionals[3], positionals[4], positionals[5])
532531
print_status()

0 commit comments

Comments
 (0)