update docs

develop
myk002 2022-08-02 01:54:21 -07:00
parent fe2212db96
commit 3983b4d75b
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
3 changed files with 72 additions and 59 deletions

@ -34,63 +34,86 @@ DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
const string autobutcher_help = const string autobutcher_help =
"Assigns your lifestock for slaughter once it reaches a specific count. Requires\n" "Automatically butcher excess livestock. This plugin monitors how many pets\n"
"you have of each gender and age and assigns excess lifestock for slaughter\n"
"once they reach a specific count. Requires\n"
"that you add the target race(s) to a watch list. Only tame units will be\n" "that you add the target race(s) to a watch list. Only tame units will be\n"
"processed. Named units will be completely ignored (you can give animals\n" "processed. Named units will be completely ignored (you can give animals\n"
"nicknames with the tool 'rename unit' to protect them from getting slaughtered\n" "nicknames with the tool 'rename unit' to protect them from getting slaughtered\n"
"automatically. Trained war or hunting pets will be ignored.\n" "automatically). Trained war or hunting pets will be ignored.\n"
"Once you have too much adults, the oldest will be butchered first.\n" "Once you have too many adults, the oldest will be butchered first.\n"
"Once you have too much kids, the youngest will be butchered first.\n" "Once you have too many kids, the youngest will be butchered first.\n"
"If you don't set a target count the following default will be used:\n" "If you don't set a target count the following default will be used:\n"
"1 male kid, 5 female kids, 1 male adult, 5 female adults.\n" "1 male kid, 5 female kids, 1 male adult, 5 female adults.\n"
"Options:\n" "\n"
" start - run every X frames (df simulation ticks)\n" "Usage:\n"
" default: X=6000 (~60 seconds at 100fps)\n" "\n"
" stop - stop running automatically\n" "enable autobutcher\n"
" sleep X - change timer to sleep X frames between runs.\n" " Start processing livestock according to the configuration. Note that\n"
" watch R - start watching race(s)\n" " no races are watched by default. You have to add the ones you want to\n"
" R = valid race RAW id (ALPACA, BIRD_TURKEY, etc)\n" " monitor (or use autowatch)\n"
" or a list of RAW ids seperated by spaces\n" "autobutcher autowatch\n"
" or the keyword 'all' which affects your whole current watchlist.\n" " Automatically add all new races (animals you buy\n"
" unwatch R - stop watching race(s)\n" " from merchants, tame yourself, or get from migrants)\n"
" the current target settings will be remembered\n" " to the watch list using the default target counts.\n"
" forget R - unwatch race(s) and forget target settings for it/them\n" "autobutcher noautowatch\n"
" autowatch - automatically adds all new races (animals you buy\n" " Stop auto-adding new races to the watch list.\n"
" from merchants, tame yourself or get from migrants)\n" "autobutcher target <fk> <mk> <fa> <ma> all|new|<race> [<race> ...] \n"
" to the watch list using default target count\n" " Set target counts for the specified races:\n"
" noautowatch - stop auto-adding new races to the watch list\n" " fk = number of female kids\n"
" list - print status and watchlist\n" " mk = number of male kids\n"
" list_export - print status and watchlist in batchfile format\n" " fa = number of female adults\n"
" can be used to copy settings into another savegame\n" " ma = number of female adults\n"
" usage: 'dfhack-run autobutcher list_export > xyz.bat' \n" " If you specify 'all', then this command will set the counts for all races\n"
" target fk mk fa ma R\n" " on your current watchlist (including the races which are currenly set to\n"
" - set target count for specified race:\n" " 'unwatched') and sets the new default for future watch commands. If you\n"
" fk = number of female kids\n" " specify 'new', then this command just sets the new default counts for\n"
" mk = number of male kids\n" " future watch commands without changing your current watchlist. Otherwise,\n"
" fa = number of female adults\n" " all space separated races listed will be modified (or added to the watchlist\n"
" ma = number of female adults\n" " if they aren't there already).\n"
" R = 'all' sets count for all races on the current watchlist\n" "autobutcher ticks <ticks>\n"
" including the races which are currenly set to 'unwatched'\n" " Change the number of ticks between scanning cycles when the plugin is\n"
" and sets the new default for future watch commands\n" " enabled. By default, a cycle happens every 6000 ticks (about 8 game days).\n"
" R = 'new' sets the new default for future watch commands\n" "autobutcher watch all|<race> [<race> ...]\n"
" without changing your current watchlist\n" " Start watching the listed races. If they aren't already in your watchlist, then\n"
" example - print some usage examples\n"; " they will be added with the default target counts. If you specify the keyword 'all',\n"
" then all races in your watchlist that are currently marked as unwatched will become\n"
const string autobutcher_help_example = " watched.\n"
"autobutcher unwatch all|<race> [<race> ...]\n"
" Stop watching the specified race(s) (or all races on your watchlist if 'all' is\n"
" given). The current target settings will be remembered.\n"
"autobutcher forget all|<race> [<race> ...]\n"
" Unwatch the specified race(s) (or all races on your watchlist if 'all' is given)\n"
" and forget target settings for it/them.\n"
"autobutcher [list]\n"
" Print status and current settings, including the watchlist.\n"
"autobutcher list_export\n"
" Print commands required to set the current settings in another fort.\n"
" Useful to run form dfhack-run like: 'dfhack-run autobutcher list_export > autobutcher.script'\n"
"\n"
"To see a list of all races, run this command:\n"
"\n"
" devel/query --table df.global.world.raws.creatures.all --search ^creature_id --maxdepth 1'\n"
"\n"
"Though not all the races listed there are tameable/butcherable\n"
"\n"
"Examples:\n" "Examples:\n"
" autobutcher target 4 3 2 1 ALPACA BIRD_TURKEY\n" "\n"
" autobutcher watch ALPACA BIRD_TURKEY\n" "autobutcher target 4 3 2 1 BIRD_TURKEY\n"
" autobutcher start\n" " This means you want to have at most 7 kids (4 female, 3 male) and at most 3 adults\n"
" This means you want to have max 7 kids (4 female, 3 male) and max 3 adults\n" " (2 female, 1 male) for turkeys. Once the kids grow up, the\n"
" (2 female, 1 male) of the races alpaca and turkey. Once the kids grow up the\n"
" oldest adults will get slaughtered. Excess kids will get slaughtered starting\n" " oldest adults will get slaughtered. Excess kids will get slaughtered starting\n"
" the the youngest to allow that the older ones grow into adults.\n" " the the youngest to allow that the older ones grow into adults.\n"
" autobutcher target 0 0 0 0 new\n" "autobutcher target 2 2 2 2 DOG\n"
" autobutcher autowatch\n" "autobutcher target 1 1 2 2 CAT\n"
" autobutcher start\n" "autobutcher target 50 50 14 2 BIRD_GOOSE\n"
" This tells autobutcher to automatically put all new races onto the watchlist\n" "autobutcher target 2 2 4 2 ALPACA SHEEP LLAMA\n"
" and mark unnamed tame units for slaughter as soon as they arrive in your\n" "autobutcher target 5 5 6 2 PIG\n"
" fortress. Settings already made for some races will be left untouched.\n"; "autobutcher target 0 0 0 0 new\n"
"autobutcher autowatch\n"
" Configure useful limits for dogs, cats, geese (for eggs, leather, and bones), alpacas, sheep,\n"
" and llamas (for wool), and pigs (for milk and meat). All other unnamed tame units will be marked\n"
" for slaughter as soon as they arrive in your fortress.\n";
namespace DFHack { namespace DFHack {
DBG_DECLARE(autobutcher, status); DBG_DECLARE(autobutcher, status);

@ -37,7 +37,6 @@ static const string autonestbox_help =
"If the pen is bigger than 1x1 the nestbox must be in the top left corner.\n" "If the pen is bigger than 1x1 the nestbox must be in the top left corner.\n"
"Only 1 unit will be assigned per pen, regardless of the size.\n" "Only 1 unit will be assigned per pen, regardless of the size.\n"
"The age of the units is currently not checked, most birds grow up quite fast.\n" "The age of the units is currently not checked, most birds grow up quite fast.\n"
"When called without options autonestbox will instantly run once.\n"
"Usage:\n" "Usage:\n"
"\n" "\n"
"enable autonestbox\n" "enable autonestbox\n"

@ -1,14 +1,5 @@
local _ENV = mkmodule('plugins.autobutcher') local _ENV = mkmodule('plugins.autobutcher')
--[[
Native functions:
* autobutcher_isEnabled()
* autowatch_isEnabled()
--]]
local argparse = require('argparse') local argparse = require('argparse')
local function is_int(val) local function is_int(val)