MCPcopy Create free account
hub / github.com/DFHack/dfhack / isInappropriateUnit

Function isInappropriateUnit

plugins/autobutcher.cpp:652–659  ·  view source on GitHub ↗

This can be used to identify completely inappropriate units (dead, undead, not belonging to the fort, ...) that autobutcher should be ignoring.

Source from the content-addressed store, hash-verified

650// This can be used to identify completely inappropriate units (dead, undead, not belonging to the fort, ...)
651// that autobutcher should be ignoring.
652static bool isInappropriateUnit(df::unit *unit) {
653 return !Units::isActive(unit)
654 || Units::isUndead(unit)
655 || Units::isMerchant(unit) // ignore merchants' draft animals
656 || Units::isForest(unit) // ignore merchants' caged animals
657 || !Units::isOwnCiv(unit)
658 || (!isContainedInItem(unit) && !hasValidMapPos(unit));
659}
660
661// This can be used to identify protected units that should be counted towards fort totals, but not scheduled
662// for butchering. This way they count towards target quota, so if you order that you want 1 female adult cat

Callers 7

autobutcher_cycleFunction · 0.85
checkRaceStocksTotalFunction · 0.85
checkRaceStocksProtectedFunction · 0.85
autobutcher_butcherRaceFunction · 0.85

Calls 2

hasValidMapPosFunction · 0.85
isContainedInItemFunction · 0.70

Tested by

no test coverage detected