Merge pull request #2545 from myk002/myk_autobutcher

update autobutcher to work with v50
develop
Myk 2023-01-02 20:43:21 -08:00 committed by GitHub
commit f72b3524ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

@ -12,7 +12,7 @@ watch list. Units will be ignored if they are:
* Untamed * Untamed
* Nicknamed (for custom protection; you can use the `rename` ``unit`` tool * Nicknamed (for custom protection; you can use the `rename` ``unit`` tool
individually, or `zone` ``nick`` for groups) individually, or `zone` ``nick`` for groups)
* Caged, if and only if the cage is defined as a room (to protect zoos) * Caged, if and only if the cage is in a zone (to protect zoos)
* Trained for war or hunting * Trained for war or hunting
Creatures who will not reproduce (because they're not interested in the Creatures who will not reproduce (because they're not interested in the

@ -80,7 +80,7 @@ set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
#dfhack_plugin(3dveins 3dveins.cpp) #dfhack_plugin(3dveins 3dveins.cpp)
#dfhack_plugin(add-spatter add-spatter.cpp) #dfhack_plugin(add-spatter add-spatter.cpp)
#dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua) dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua)
#dfhack_plugin(autochop autochop.cpp) #dfhack_plugin(autochop autochop.cpp)
#dfhack_plugin(autoclothing autoclothing.cpp) #dfhack_plugin(autoclothing autoclothing.cpp)
#dfhack_plugin(autodump autodump.cpp) #dfhack_plugin(autodump autodump.cpp)

@ -712,13 +712,20 @@ static bool hasValidMapPos(df::unit *unit) {
&& unit->pos.z < world->map.z_count; && unit->pos.z < world->map.z_count;
} }
// built cage defined as room (supposed to detect zoo cages) // built cage in a zone (supposed to detect zoo cages)
static bool isInBuiltCageRoom(df::unit *unit) { static bool isInBuiltCageRoom(df::unit *unit) {
for (auto building : world->buildings.all) { for (auto building : world->buildings.all) {
// !!! building->isRoom() returns true if the building can be made a room but currently isn't if (building->getType() != df::building_type::Cage)
// !!! except for coffins/tombs which always return false continue;
// !!! using the bool is_room however gives the correct state/value
if (!building->is_room || building->getType() != df::building_type::Cage) bool in_zone = false;
for (auto relation : building->relations) {
if (relation->getType() == df::building_type::Civzone) {
in_zone = true;
break;
}
}
if (!in_zone)
continue; continue;
df::building_cagest* cage = (df::building_cagest*)building; df::building_cagest* cage = (df::building_cagest*)building;