Skip to content

Commit

Permalink
Merge pull request #855 from AndrielChaoti/master
Browse files Browse the repository at this point in the history
misc updates to autofish
  • Loading branch information
myk002 authored Oct 7, 2023
2 parents e190bb4 + 47b0576 commit 7406837
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions autofish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ end
function toggle_fishing_labour(state)
-- pass true to state to turn on, otherwise disable
-- find all work details that have fishing enabled:
local work_details = df.global.plotinfo.hauling.work_details
local work_details = df.global.plotinfo.hauling.labor_info.work_details
for _,v in pairs(work_details) do
if v.allowed_labors.FISH then
-- set limited to true just in case a custom work detail is being
Expand Down Expand Up @@ -206,23 +206,17 @@ if dfhack_flags and dfhack_flags.enable then
args = {dfhack_flags.enable_state and "enable" or "disable"}
end

-- lookup to convert arguments to bool values.
local toBool={["true"]=true,["yes"]=true,["y"]=true,["on"]=true,["1"]=true,
["false"]=false,["no"]=false,["n"]=false,["off"]=false,["0"]=false}

-- handle options flags
local positionals = argparse.processArgsGetopt(args,
{{"r", "raw", hasArg=true,
handler=function(optArg)
optArg=string.lower(optArg)
if toBool[optArg] ~= nil then
set_useRaw(toBool[optArg])
else
qerror("Invalid argument to --raw \"".. optArg .."\". expected boolean")
end
local val = argparse.boolean(optArg, "raw")
set_useRaw(val)
end}
})

load_state()
-- handle the rest of the arguments
if positionals[1] == "enable" then
enabled = true

Expand Down

0 comments on commit 7406837

Please sign in to comment.