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);
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"
"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"
"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 much kids, the youngest will be butchered first.\n"
"automatically). Trained war or hunting pets will be ignored.\n"
"Once you have too many adults, the oldest 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"
"1 male kid, 5 female kids, 1 male adult, 5 female adults.\n"
"Options:\n"
" start - run every X frames (df simulation ticks)\n"
" default: X=6000 (~60 seconds at 100fps)\n"
" stop - stop running automatically\n"
" sleep X - change timer to sleep X frames between runs.\n"
" watch R - start watching race(s)\n"
" R = valid race RAW id (ALPACA, BIRD_TURKEY, etc)\n"
" or a list of RAW ids seperated by spaces\n"
" or the keyword 'all' which affects your whole current watchlist.\n"
" unwatch R - stop watching race(s)\n"
" the current target settings will be remembered\n"
" forget R - unwatch race(s) and forget target settings for it/them\n"
" autowatch - automatically adds all new races (animals you buy\n"
" from merchants, tame yourself or get from migrants)\n"
" to the watch list using default target count\n"
" noautowatch - stop auto-adding new races to the watch list\n"
" list - print status and watchlist\n"
" list_export - print status and watchlist in batchfile format\n"
" can be used to copy settings into another savegame\n"
" usage: 'dfhack-run autobutcher list_export > xyz.bat' \n"
" target fk mk fa ma R\n"
" - set target count for specified race:\n"
" fk = number of female kids\n"
" mk = number of male kids\n"
" fa = number of female adults\n"
" ma = number of female adults\n"
" R = 'all' sets count for all races on the current watchlist\n"
" including the races which are currenly set to 'unwatched'\n"
" and sets the new default for future watch commands\n"
" R = 'new' sets the new default for future watch commands\n"
" without changing your current watchlist\n"
" example - print some usage examples\n";
const string autobutcher_help_example =
"\n"
"Usage:\n"
"\n"
"enable autobutcher\n"
" Start processing livestock according to the configuration. Note that\n"
" no races are watched by default. You have to add the ones you want to\n"
" monitor (or use autowatch)\n"
"autobutcher autowatch\n"
" Automatically add all new races (animals you buy\n"
" from merchants, tame yourself, or get from migrants)\n"
" to the watch list using the default target counts.\n"
"autobutcher noautowatch\n"
" Stop auto-adding new races to the watch list.\n"
"autobutcher target <fk> <mk> <fa> <ma> all|new|<race> [<race> ...] \n"
" Set target counts for the specified races:\n"
" fk = number of female kids\n"
" mk = number of male kids\n"
" fa = number of female adults\n"
" ma = number of female adults\n"
" If you specify 'all', then this command will set the counts for all races\n"
" on your current watchlist (including the races which are currenly set to\n"
" 'unwatched') and sets the new default for future watch commands. If you\n"
" specify 'new', then this command just sets the new default counts for\n"
" future watch commands without changing your current watchlist. Otherwise,\n"
" all space separated races listed will be modified (or added to the watchlist\n"
" if they aren't there already).\n"
"autobutcher ticks <ticks>\n"
" Change the number of ticks between scanning cycles when the plugin is\n"
" enabled. By default, a cycle happens every 6000 ticks (about 8 game days).\n"
"autobutcher watch all|<race> [<race> ...]\n"
" Start watching the listed races. If they aren't already in your watchlist, then\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"
" 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"
" autobutcher target 4 3 2 1 ALPACA BIRD_TURKEY\n"
" autobutcher watch ALPACA BIRD_TURKEY\n"
" autobutcher start\n"
" This means you want to have max 7 kids (4 female, 3 male) and max 3 adults\n"
" (2 female, 1 male) of the races alpaca and turkey. Once the kids grow up the\n"
"\n"
"autobutcher target 4 3 2 1 BIRD_TURKEY\n"
" This means you want to have at most 7 kids (4 female, 3 male) and at most 3 adults\n"
" (2 female, 1 male) for turkeys. Once the kids grow up, the\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"
" autobutcher target 0 0 0 0 new\n"
" autobutcher autowatch\n"
" autobutcher start\n"
" This tells autobutcher to automatically put all new races onto the watchlist\n"
" and mark unnamed tame units for slaughter as soon as they arrive in your\n"
" fortress. Settings already made for some races will be left untouched.\n";
"autobutcher target 2 2 2 2 DOG\n"
"autobutcher target 1 1 2 2 CAT\n"
"autobutcher target 50 50 14 2 BIRD_GOOSE\n"
"autobutcher target 2 2 4 2 ALPACA SHEEP LLAMA\n"
"autobutcher target 5 5 6 2 PIG\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 {
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"
"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"
"When called without options autonestbox will instantly run once.\n"
"Usage:\n"
"\n"
"enable autonestbox\n"

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