Merge branch 'units_dead' into develop

Closes #1297
develop
lethosor 2018-06-13 15:38:35 -04:00
commit 10e6016989
3 changed files with 29 additions and 2 deletions

@ -1633,6 +1633,9 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = {
WRAPM(Units, isGay),
WRAPM(Units, isNaked),
WRAPM(Units, isUndead),
WRAPM(Units, isGhost),
WRAPM(Units, isActive),
WRAPM(Units, isKilled),
WRAPM(Units, isGelded),
WRAPM(Units, isDomesticated),
WRAPM(Units, getMainSocialActivity),

@ -146,6 +146,9 @@ DFHACK_EXPORT bool isTrained(df::unit* unit);
DFHACK_EXPORT bool isGay(df::unit* unit);
DFHACK_EXPORT bool isNaked(df::unit* unit);
DFHACK_EXPORT bool isUndead(df::unit* unit);
DFHACK_EXPORT bool isGhost(df::unit *unit);
DFHACK_EXPORT bool isActive(df::unit *unit);
DFHACK_EXPORT bool isKilled(df::unit *unit);
DFHACK_EXPORT bool isGelded(df::unit* unit);
DFHACK_EXPORT bool isDomesticated(df::unit* unit);

@ -388,7 +388,7 @@ bool Units::isDead(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
return unit->flags1.bits.dead ||
return unit->flags2.bits.killed ||
unit->flags3.bits.ghostly;
}
@ -396,7 +396,7 @@ bool Units::isAlive(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
return !unit->flags1.bits.dead &&
return !unit->flags2.bits.killed &&
!unit->flags3.bits.ghostly &&
!unit->curse.add_tags1.bits.NOT_LIVING;
}
@ -1568,6 +1568,27 @@ bool Units::isUndead(df::unit* unit)
&& !unit->curse.add_tags1.bits.BLOODSUCKER ));
}
bool Units::isGhost(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
return unit->flags3.bits.ghostly;
}
bool Units::isActive(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
return !unit->flags1.bits.dead;
}
bool Units::isKilled(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
return unit->flags2.bits.killed;
}
bool Units::isGelded(df::unit* unit)
{
CHECK_NULL_POINTER(unit);