diff --git a/autofish.lua b/autofish.lua index aa11d72fe4..d5ce23d43c 100644 --- a/autofish.lua +++ b/autofish.lua @@ -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 @@ -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