update docs for autofarm

develop
myk002 2022-07-18 13:49:51 -07:00
parent 25bc59297b
commit 3ca7997d3e
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 30 additions and 29 deletions

@ -1,21 +1,32 @@
autofarm autofarm
======== ========
Automatically handles crop selection in farm plots based on current plant Automatically manage farm crop selection. This plugin periodically scans your
stocks, and selects crops for planting if current stock is below a threshold. plant stocks and assigns crops to your farm plots based on which plant stocks
Selected crops are dispatched on all farmplots. (Note that this plugin replaces are low (as long as you have the appropriate seeds). The target threshold for
an older Ruby script of the same name.) each crop type is configurable.
Use the `enable` or `disable <disable>` commands to change whether this plugin is
enabled.
Usage: Usage:
* ``autofarm runonce``: - ``enable autofarm``
Updates all farm plots once, without enabling the plugin Enable the plugin and start managing crop assignment.
* ``autofarm status``: * ``autofarm runonce``
Prints status information, including any applied limits Updates all farm plots once, without enabling the plugin.
* ``autofarm default 30``: * ``autofarm status``
Sets the default threshold Prints status information, including any defined thresholds.
* ``autofarm threshold 150 helmet_plump tail_pig``: * ``autofarm default <number>``
Sets thresholds of individual plants Sets the default threshold.
* ``autofarm threshold <number> <type> [<type> ...]``
Sets thresholds of individual plant types.
You can find the identifiers for the crop types in your world by running the
following command::
lua "for _,plant in ipairs(df.global.world.raws.plants.all) do if plant.flags.SEED then print(plant.id) end end"
Examples:
- ``autofarm default 30``
Set the default threshold to 30.
- ``autofarm threshold 150 MUSHROOM_HELMET_PLUMP GRASS_TAIL_PIG``
Set the threshold for Plump Helmets and Pig Tails to 150

@ -38,15 +38,6 @@ DFHACK_PLUGIN("autofarm");
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);
const char* tagline = "Automatically handle crop selection in farm plots based on current plant stocks.";
const char* usage = (
"``enable autofarm``: Enables the plugin\n"
"``autofarm runonce``: Updates farm plots (one-time only)\n"
"``autofarm status``: Prints status information\n"
"``autofarm default 30``: Sets the default threshold\n"
"``autofarm threshold 150 helmet_plump tail_pig``: Sets thresholds\n"
);
class AutoFarm { class AutoFarm {
private: private:
std::map<int, int> thresholds; std::map<int, int> thresholds;
@ -330,7 +321,7 @@ public:
void status(color_ostream& out) void status(color_ostream& out)
{ {
out << (enabled ? "Running." : "Stopped.") << '\n'; out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n';
for (auto& lc : lastCounts) for (auto& lc : lastCounts)
{ {
auto plant = world->raws.plants.all[lc.first]; auto plant = world->raws.plants.all[lc.first];
@ -355,10 +346,9 @@ DFhackCExport command_result plugin_init(color_ostream& out, std::vector <Plugin
{ {
if (world && ui) { if (world && ui) {
commands.push_back( commands.push_back(
PluginCommand("autofarm", tagline, PluginCommand("autofarm",
autofarm, false, usage "Automatically manage farm crop selection.",
) autofarm));
);
} }
autofarmInstance = std::move(dts::make_unique<AutoFarm>()); autofarmInstance = std::move(dts::make_unique<AutoFarm>());
return CR_OK; return CR_OK;