From 3ca7997d3e87b45858098419a7ea50eefb337c8f Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 18 Jul 2022 13:49:51 -0700 Subject: [PATCH] update docs for autofarm --- docs/plugins/autofarm.rst | 41 +++++++++++++++++++++++++-------------- plugins/autofarm.cpp | 18 ++++------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/docs/plugins/autofarm.rst b/docs/plugins/autofarm.rst index b330517d0..d5bb12e41 100644 --- a/docs/plugins/autofarm.rst +++ b/docs/plugins/autofarm.rst @@ -1,21 +1,32 @@ autofarm ======== -Automatically handles crop selection in farm plots based on current plant -stocks, and selects crops for planting if current stock is below a threshold. -Selected crops are dispatched on all farmplots. (Note that this plugin replaces -an older Ruby script of the same name.) - -Use the `enable` or `disable ` commands to change whether this plugin is -enabled. +Automatically manage farm crop selection. This plugin periodically scans your +plant stocks and assigns crops to your farm plots based on which plant stocks +are low (as long as you have the appropriate seeds). The target threshold for +each crop type is configurable. Usage: -* ``autofarm runonce``: - Updates all farm plots once, without enabling the plugin -* ``autofarm status``: - Prints status information, including any applied limits -* ``autofarm default 30``: - Sets the default threshold -* ``autofarm threshold 150 helmet_plump tail_pig``: - Sets thresholds of individual plants +- ``enable autofarm`` + Enable the plugin and start managing crop assignment. +* ``autofarm runonce`` + Updates all farm plots once, without enabling the plugin. +* ``autofarm status`` + Prints status information, including any defined thresholds. +* ``autofarm default `` + Sets the default threshold. +* ``autofarm threshold [ ...]`` + 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 diff --git a/plugins/autofarm.cpp b/plugins/autofarm.cpp index 2dafdee49..1a02b6a06 100644 --- a/plugins/autofarm.cpp +++ b/plugins/autofarm.cpp @@ -38,15 +38,6 @@ DFHACK_PLUGIN("autofarm"); 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 { private: std::map thresholds; @@ -330,7 +321,7 @@ public: void status(color_ostream& out) { - out << (enabled ? "Running." : "Stopped.") << '\n'; + out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n'; for (auto& lc : lastCounts) { auto plant = world->raws.plants.all[lc.first]; @@ -355,10 +346,9 @@ DFhackCExport command_result plugin_init(color_ostream& out, std::vector ()); return CR_OK;