Skip to content

Commit 3b59f47

Browse files
authored
Merge pull request #4987 from myk002/myk_autobutcher_startup
[autobutcher] don't run cycle on first fort tick
2 parents 53ae508 + 22d0b0e commit 3b59f47

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Template for new versions:
5858

5959
## Fixes
6060
- Fix mouse clicks bleeding through DFHack windows when clicking in the space between the frame and the window content in resizable windows
61+
- `autobutcher`: don't run a scanning and marking cycle on the first tick of a fortress to allow for all custom configuration to be set first
6162
- `logistics`: don't ignore rotten items when applying stockpile logistics operations (e.g. autodump, autoclaim, etc.)
6263

6364
## Misc Improvements

docs/plugins/autobutcher.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ autobutcher
77

88
This plugin monitors how many pets you have of each gender and age and assigns
99
excess livestock for slaughter. See `gui/autobutcher` for an in-game interface.
10+
Common configuration tweaks can be enabled in `gui/control-panel` in the
11+
Automation -> Autostart tab.
12+
1013
Units are protected from being automatically butchered if they are:
1114

1215
* Untamed
@@ -34,10 +37,7 @@ Usage
3437
-----
3538

3639
``enable autobutcher``
37-
Start processing livestock according to the configuration. Note that
38-
no races are watched by default. You have to add the ones you want to
39-
monitor with ``autobutcher watch``, ``autobutcher target`` or
40-
``autobutcher autowatch``.
40+
Start processing livestock according to the per-race targets.
4141
``autobutcher [list]``
4242
Print status and current settings, including the watchlist. This is the
4343
default command if autobutcher is run without parameters.
@@ -91,8 +91,8 @@ Though not all the races listed there are tameable/butcherable.
9191
savegame, you can export the commands required to recreate your settings.
9292

9393
To export, open an external terminal in the DF directory, and run
94-
``dfhack-run autobutcher list_export > filename.txt``. To import, load your
95-
new save and run ``script filename.txt`` in the DFHack terminal.
94+
``dfhack-run autobutcher list_export > autobutcher.txt``. To import, load
95+
your new save and run ``script autobutcher.txt`` in `gui/launcher`.
9696

9797
Examples
9898
--------

plugins/autobutcher.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "df/building_civzonest.h"
1818
#include "df/creature_raw.h"
1919
#include "df/general_ref.h"
20+
#include "df/plotinfost.h"
2021
#include "df/unit.h"
2122
#include "df/world.h"
2223

@@ -31,6 +32,7 @@ using namespace DFHack;
3132
DFHACK_PLUGIN("autobutcher");
3233
DFHACK_PLUGIN_IS_ENABLED(is_enabled);
3334

35+
REQUIRE_GLOBAL(plotinfo);
3436
REQUIRE_GLOBAL(world);
3537

3638
// logging levels can be dynamically controlled with the `debugfilter` command.
@@ -89,7 +91,9 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
8991
DEBUG(control,out).print("%s from the API; persisting\n",
9092
is_enabled ? "enabled" : "disabled");
9193
config.set_bool(CONFIG_IS_ENABLED, is_enabled);
92-
if (enable)
94+
// don't autorun cycle on first frame of fortress so we don't mark animals for butchering before
95+
// all initial configuration has been applied
96+
if (enable && plotinfo->fortress_age > 0)
9397
autobutcher_cycle(out);
9498
} else {
9599
DEBUG(control,out).print("%s from the API, but already %s; no action\n",

0 commit comments

Comments
 (0)