Skip to content

Commit

Permalink
rename script to nestboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkow committed Sep 11, 2024
1 parent f724412 commit 904f9a6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions eggwatch.lua → nestboxes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local argparse = require("argparse")
local eventful = require("plugins.eventful")
local utils = require("utils")

local GLOBAL_KEY = "eggwatch"
local GLOBAL_KEY = "nestboxes"
local default_table = {10, false, false}
local string_or_int_to_boolean = {["true"] = true, ["false"] = false, ["1"] = true, ["0"] = false, ["Y"] = true, ["N"] = false, [1] = true, [0] = false}

Expand Down Expand Up @@ -168,10 +168,6 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
update_event_listener()
end

if dfhack_flags.module then
return
end

local function is_egg(item)
return df.item_type.EGG == item:getType()
end
Expand Down Expand Up @@ -501,6 +497,9 @@ end

load_state()
local args, opts = {...}, {}
if dfhack_flags and dfhack_flags.enable then
args = {dfhack_flags.enable_state and "enable" or "disable"}
end
local positionals =
argparse.processArgsGetopt(
args,
Expand All @@ -515,18 +514,18 @@ local positionals =
}
)

if dfhack_flags.enable then
if dfhack_flags.enable_state then
do_enable()
else
do_disable()
end
if dfhack_flags.module then
return
end

local command = positionals[1]

if command == "help" or opts.help then
print(dfhack.script_help())
elseif command == "enable" then
do_enable()
elseif command == "disable" then
do_disable()
elseif command == "target" then
set_target(positionals[2], positionals[3], positionals[4], positionals[5])
print_status()
Expand Down

0 comments on commit 904f9a6

Please sign in to comment.