diff --git a/NEWS b/NEWS index e28067ca5..e3b438cab 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ DFHack Future dfhack.run_script should correctly find save-specific scripts now. Updated add-thought to properly affect stress. hfs-pit should work now + Autobutcher takes gelding into account New Plugins New Scripts New Tweaks diff --git a/Readme.rst b/Readme.rst index 27592955d..51b0074e3 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1888,6 +1888,9 @@ Creatures trained for war or hunting will be ignored as well. Creatures assigned to cages will be ignored if the cage is defined as a room (to avoid butchering unnamed zoo animals). +Creatures who will not reproduce (because they're not interested in the opposite +sex or have been gelded) have first priority for butchering. + Once you have too much adults, the oldest will be butchered first. Once you have too much kids, the youngest will be butchered first. If you don't set any target count the following default will be used: diff --git a/plugins/zone.cpp b/plugins/zone.cpp index f6a525581..be4404b7f 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -68,6 +68,7 @@ using namespace std; #include #include #include "df/unit_soul.h" +#include "df/unit_wound.h" #include "df/viewscreen_dwarfmodest.h" #include "modules/Translation.h" @@ -347,6 +348,7 @@ bool isOwnCiv(df::unit* unit); bool isMerchant(df::unit* unit); bool isForest(df::unit* unit); bool isGay(df::unit* unit); +bool isGelded(df::unit* unit); bool isActivityZone(df::building * building); bool isPenPasture(df::building * building); @@ -714,6 +716,21 @@ bool isGay(df::unit* unit) || ! isFemale(unit) && ! (orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female)); } +bool isGelded(df::unit* unit) +{ + auto wounds = unit->body.wounds; + for(auto wound = wounds.begin(); wound != wounds.end(); ++wound) + { + auto parts = (*wound)->parts; + for (auto part = parts.begin(); part != parts.end(); ++part) + { + if ((*part)->flags2.bits.gelded) + return true; + } + } + return false; +} + // dump some unit info void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false) { @@ -3481,7 +3498,8 @@ command_result autoButcher( color_ostream &out, bool verbose = false ) || isAvailableForAdoption(unit) || unit->name.has_name ) w->PushProtectedUnit(unit); - else if (isGay(unit)) + else if ( isGay(unit) + || isGelded(unit)) w->PushPriorityUnit(unit); else w->PushUnit(unit);