Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ca7997

Browse files
committed
update docs for autofarm
1 parent 25bc592 commit 3ca7997

2 files changed

Lines changed: 30 additions & 29 deletions

File tree

docs/plugins/autofarm.rst

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
autofarm
22
========
33

4-
Automatically handles crop selection in farm plots based on current plant
5-
stocks, and selects crops for planting if current stock is below a threshold.
6-
Selected crops are dispatched on all farmplots. (Note that this plugin replaces
7-
an older Ruby script of the same name.)
8-
9-
Use the `enable` or `disable <disable>` commands to change whether this plugin is
10-
enabled.
4+
Automatically manage farm crop selection. This plugin periodically scans your
5+
plant stocks and assigns crops to your farm plots based on which plant stocks
6+
are low (as long as you have the appropriate seeds). The target threshold for
7+
each crop type is configurable.
118

129
Usage:
1310

14-
* ``autofarm runonce``:
15-
Updates all farm plots once, without enabling the plugin
16-
* ``autofarm status``:
17-
Prints status information, including any applied limits
18-
* ``autofarm default 30``:
19-
Sets the default threshold
20-
* ``autofarm threshold 150 helmet_plump tail_pig``:
21-
Sets thresholds of individual plants
11+
- ``enable autofarm``
12+
Enable the plugin and start managing crop assignment.
13+
* ``autofarm runonce``
14+
Updates all farm plots once, without enabling the plugin.
15+
* ``autofarm status``
16+
Prints status information, including any defined thresholds.
17+
* ``autofarm default <number>``
18+
Sets the default threshold.
19+
* ``autofarm threshold <number> <type> [<type> ...]``
20+
Sets thresholds of individual plant types.
21+
22+
You can find the identifiers for the crop types in your world by running the
23+
following command::
24+
25+
lua "for _,plant in ipairs(df.global.world.raws.plants.all) do if plant.flags.SEED then print(plant.id) end end"
26+
27+
Examples:
28+
29+
- ``autofarm default 30``
30+
Set the default threshold to 30.
31+
- ``autofarm threshold 150 MUSHROOM_HELMET_PLUMP GRASS_TAIL_PIG``
32+
Set the threshold for Plump Helmets and Pig Tails to 150

plugins/autofarm.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ DFHACK_PLUGIN("autofarm");
3838

3939
DFHACK_PLUGIN_IS_ENABLED(enabled);
4040

41-
const char* tagline = "Automatically handle crop selection in farm plots based on current plant stocks.";
42-
const char* usage = (
43-
"``enable autofarm``: Enables the plugin\n"
44-
"``autofarm runonce``: Updates farm plots (one-time only)\n"
45-
"``autofarm status``: Prints status information\n"
46-
"``autofarm default 30``: Sets the default threshold\n"
47-
"``autofarm threshold 150 helmet_plump tail_pig``: Sets thresholds\n"
48-
);
49-
5041
class AutoFarm {
5142
private:
5243
std::map<int, int> thresholds;
@@ -330,7 +321,7 @@ class AutoFarm {
330321

331322
void status(color_ostream& out)
332323
{
333-
out << (enabled ? "Running." : "Stopped.") << '\n';
324+
out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n';
334325
for (auto& lc : lastCounts)
335326
{
336327
auto plant = world->raws.plants.all[lc.first];
@@ -355,10 +346,9 @@ DFhackCExport command_result plugin_init(color_ostream& out, std::vector <Plugin
355346
{
356347
if (world && ui) {
357348
commands.push_back(
358-
PluginCommand("autofarm", tagline,
359-
autofarm, false, usage
360-
)
361-
);
349+
PluginCommand("autofarm",
350+
"Automatically manage farm crop selection.",
351+
autofarm));
362352
}
363353
autofarmInstance = std::move(dts::make_unique<AutoFarm>());
364354
return CR_OK;

0 commit comments

Comments
 (0)