@ -1188,150 +1188,301 @@ Job module
Units module
------------
* `` dfhack.units. getPosition(unit )``
* `` dfhack.units. isUnitInBox(unit,x1,y1,z1,x2,y2,z2 )``
Returns true *x,y,z* of the unit, or *nil* if invalid; may be not equal to unit.pos if caged .
The unit is within the specified coordinates .
* `` dfhack.units.is UnitInBox(unit,x1,y1,z1,x2,y2,z2 )``
* `` dfhack.units.is Active(unit )``
Returns true if the unit is within the specified coordinates .
The unit is active (alive and on the map) .
* `` dfhack.units. getUnitsInBox(x1,y1,z1,x2,y2,z2[,filter] )``
* `` dfhack.units. isVisible(unit )``
Returns a table of all units within the specified coordinates. If the `` filter ``
argument is given, only units where `` filter(unit) `` returns true will be included.
Note that `` pos2xyz() `` cannot currently be used to convert coordinate objects to
the arguments required by this function.
The unit is visible on the map.
* `` dfhack.units. teleport(unit, pos )``
* `` dfhack.units.isCitizen(unit[,ignore_sanity]) ``
Moves the specified unit and any riders to the target coordinates, setting
tile occupancy flags appropriately. Returns true if successful.
The unit is an alive sane citizen of the fortress; wraps the
same checks the game uses to decide game-over by extinction,
with an additional sanity check. You can identify citizens,
regardless of their sanity, by passing `` true `` as the optional
second parameter.
* `` dfhack.units.getGeneralRef(unit, type) ``
* `` dfhack.units. isFortControlled(unit )``
Searches for a general_ref with the given type.
Similar to `` dfhack.units.isCitizen(unit) `` , but is based on checks
for units hidden in ambush, and includes tame animals. Returns *false*
if not in fort mode.
* `` dfhack.units.getSpecificRef(unit, type) ``
* `` dfhack.units. isOwnCiv(unit )``
Searches for a specific_ref with the given type .
The unit belongs to the player's civilization .
* `` dfhack.units. getContainer (unit)``
* `` dfhack.units. isOwnGroup (unit)``
Returns the container (cage) item or *nil* .
The unit belongs to the player's group .
* `` dfhack.units. setNickname(unit,nick )``
* `` dfhack.units. isOwnRace(unit )``
Sets the unit's nickname properly .
The unit belongs to the player's race .
* `` dfhack.units. getOuterContainerRef (unit)``
* `` dfhack.units. isAlive (unit)``
Returns a table (in the style of a `` specific_ref `` struct) of the outermost object that contains the unit (or one of the unit itself.)
The `` type `` field contains a `` specific_ref_type `` of `` UNIT `` , `` ITEM_GENERAL `` , or `` VERMIN_EVENT `` .
The `` object `` field contains a pointer to a unit, item, or vermin, respectively.
The unit isn't dead or undead.
* `` dfhack.units. getVisibleName (unit)``
* `` dfhack.units.isDead(unit) ``
Returns the language_name object visible in game, accounting for false identities.
The unit is completely dead and passive, or a ghost. Equivalent to
`` dfhack.units.isKilled(unit) or dfhack.units.isGhost(unit) `` .
* `` dfhack.units. getIdentity (unit)``
* `` dfhack.units. isKilled (unit)``
Returns the false identity of the unit if it has one, or *nil* .
The unit has been killed .
* `` dfhack.units. getNemes is(unit)``
* `` dfhack.units. isSane (unit)``
Returns the nemesis record of the unit if it has one, or *nil* .
The unit is capable of rational action, i.e. not dead, insane, zombie, or active werewolf.
* `` dfhack.units.isCrazed ``
The unit is berserk and will attack all other creatures except members of its own species
that are also crazed. (can be modified by curses)
* `` dfhack.units.isGhost(unit) ``
The unit is a ghost.
* `` dfhack.units.isHidden(unit) ``
The unit is hidden to the player, accounting for sneaking. Works for any game mode.
* `` dfhack.units.isHidingCurse(unit) ``
Checks if the unit hides improved attributes from its curse.
The unit is hiding a curse.
* `` dfhack.units.getPhysicalAttrValue(unit, attr_type) ``
* `` dfhack.units.getMentalAttrValue(unit, attr_type) ``
Computes the effective attribute value, including curse effect.
* `` dfhack.units.isMale(unit) ``
* `` dfhack.units.isCrazed(unit) ``
* `` dfhack.units.isOpposedToLife(unit) ``
* `` dfhack.units.hasExtravision(unit) ``
* `` dfhack.units.isBloodsucker(unit) ``
The unit is male.
Simple checks of caste attributes that can be modified by curses.
* `` dfhack.units.isFemale(unit) ``
* `` dfhack.units.getMiscTrait(unit, type[, create]) ``
The unit is female.
Finds (or creates if requested) a misc trait object with the given id.
* `` dfhack.units.isBaby(unit) ``
* `` dfhack.units.isActive(unit) ``
The unit is a baby.
The unit is active (alive and on the map).
* `` dfhack.units.isChild(unit) ``
* `` dfhack.units.isAlive(unit) ``
The unit is a child.
The unit isn't dead or undead.
* `` dfhack.units.isAdult(unit) ``
* `` dfhack.units.isDead(unit) ``
The unit is an adult.
The unit is completely dead and passive, or a ghost. Equivalent to
`` dfhack.units.isKilled(unit) or dfhack.units.isGhost(unit) `` .
* `` dfhack.units.isGay(unit) ``
* `` dfhack.units.isKilled(unit) ``
The unit is gay.
The unit has been killed.
* `` dfhack.units.isNake(unit) ``
* `` dfhack.units.isGhost(unit) ``
The unit is naked.
The unit is a ghost.
* `` dfhack.units.isVisiting(unit) ``
* `` dfhack.units.isSane(unit) ``
The unit is visiting. eg. Merchants, Diplomatics, travelers.
* `` dfhack.units.isTrainableHunting(unit) ``
The unit is trainable for hunting.
* `` dfhack.units.isTrainableWar(unit) ``
The unit is trainable for war.
* `` dfhack.units.isTrained(unit) ``
The unit is trained.
* `` dfhack.units.isHunter(unit) ``
The unit is a trained hunter.
* `` dfhack.units.isWar(unit) ``
The unit is trained for war.
* `` dfhack.units.isTame(unit) ``
The unit is tame.
* `` dfhack.units.isTamable(unit) ``
The unit is tamable.
* `` dfhack.units.isDomesticated(unit) ``
The unit is domesticated.
* `` dfhack.units.isMarkedForSlaughter(unit) ``
The unit is marked for slaughter.
* `` dfhack.units.isGelded(unit) ``
The unit is gelded.
* `` dfhack.units.isEggLayer(unit) ``
The unit is an egg layer.
* `` dfhack.units.isGrazer(unit) ``
The unit is a grazer.
* `` dfhack.units.isMilkable(unit) ``
The unit is milkable.
* `` dfhack.units.isForest(unit) ``
The unit is of the forest.
* `` dfhack.units.isMischievous(unit) ``
The unit is mischievous.
* `` dfhack.units.isAvailableForAdoption(unit) ``
The unit is available for adoption.
* `` dfhack.units.isOpposedToLife(unit) ``
* `` dfhack.units.hasExtravision(unit) ``
* `` dfhack.units.isBloodsucker(unit) ``
Simple checks of caste attributes that can be modified by curses.
The unit is capable of rational action, i.e. not dead, insane, zombie, or active werewolf.
* `` dfhack.units.isDwarf(unit) ``
The unit is of the correct race of the fortress.
The unit is of the correct race for the fortress.
* `` dfhack.units.isCitizen(unit[,ignore_sanity]) ``
* `` dfhack.units.is Animal(unit )``
The unit is an alive sane citizen of the fortress; wraps the
same checks the game uses to decide game-over by extinction
(except for the sanity check).
The unit is an animal.
* `` dfhack.units.isInvader(unit) ``
* `` dfhack.units.isMerchant(unit) ``
The unit is an active invader or marauder.
The unit is a merchant .
* `` dfhack.units.isVisiting(unit) ``
* `` dfhack.units.is Diplomat (unit)``
The unit is either a merchant, diplomat, or plain visitor.
The unit is a diplomat.
* `` dfhack.units.isVisitor(unit) ``
The unit is strictly a visitor. Merchants and diplomats do not count here.
The unit is a regular visitor with no special purpose (eg. merchant).
* `` dfhack.units.isInvader(unit) ``
The unit is an active invader or marauder.
* `` dfhack.units.isUndead(unit[,include_vamps]) ``
The unit is undead, but not a vampire.
* `` dfhack.units.isNightCreature(unit) ``
The unit is undead, but not a vampire.
* `` dfhack.units.isSemiMegabeast(unit) ``
The unit is undead, but not a vampire.
* `` dfhack.units.isMegabeast(unit) ``
The unit is a megabeast.
* `` dfhack.units.isTitan(unit) ``
The unit is a titan.
* `` dfhack.units.isDemon(unit) ``
The unit is a demon.
* `` dfhack.units.isDanger(unit) ``
The unit is dangerous, and probably hostile. This includes
Great Dangers (see below), semi-megabeasts, night creatures,
undead, invaders, and crazed units.
* `` dfhack.units.isGreatDanger(unit) ``
The unit is of Great Danger. This include demons, titans, and megabeasts.
* `` dfhack.units.isDanger(unit) ``
The unit is dangerous, and probably hostile. This includes Great Dangers, semi-megabeasts, night creatures, undead, and invaders.
* `` dfhack.units.getPosition(unit) ``
* `` dfhack.units.isFortControlled(unit) ``
Returns true *x,y,z* of the unit, or *nil* if invalid; may be not equal to unit.pos if caged.
Similar to `` dfhack.units.isCitizen(unit) `` , but is based on checks for units hidden in ambush, and includes tame animals. Returns *false* if not in fort mode.
* `` dfhack.units.getUnitsInBox(x1,y1,z1,x2,y2,z2[,filter]) ``
* `` dfhack.units.isVisible(unit) ``
Returns a table of all units within the specified coordinates. If the `` filter ``
argument is given, only units where `` filter(unit) `` returns true will be included.
Note that `` pos2xyz() `` cannot currently be used to convert coordinate objects to
the arguments required by this function.
The unit is visible on the map.
* `` dfhack.units.teleport(unit, pos) ``
* `` dfhack.units.isHidden(unit) ``
Moves the specified unit and any riders to the target coordinates, setting
tile occupancy flags appropriately. Returns true if successful.
The unit is hidden to the player, accounting for sneaking. Works for any game mode.
* `` dfhack.units.getGeneralRef(unit, type) ``
Searches for a general_ref with the given type.
* `` dfhack.units.getSpecificRef(unit, type) ``
Searches for a specific_ref with the given type.
* `` dfhack.units.getContainer(unit) ``
Returns the container (cage) item or *nil* .
* `` dfhack.units.setNickname(unit,nick) ``
Sets the unit's nickname properly.
* `` dfhack.units.getOuterContainerRef(unit) ``
Returns a table (in the style of a `` specific_ref `` struct) of the outermost object that contains the unit (or one of the unit itself.)
The `` type `` field contains a `` specific_ref_type `` of `` UNIT `` , `` ITEM_GENERAL `` , or `` VERMIN_EVENT `` .
The `` object `` field contains a pointer to a unit, item, or vermin, respectively.
* `` dfhack.units.getVisibleName(unit) ``
Returns the language_name object visible in game, accounting for false identities.
* `` dfhack.units.getIdentity(unit) ``
Returns the false identity of the unit if it has one, or *nil* .
* `` dfhack.units.getNemesis(unit) ``
Returns the nemesis record of the unit if it has one, or *nil* .
* `` dfhack.units.getPhysicalAttrValue(unit, attr_type) ``
* `` dfhack.units.getMentalAttrValue(unit, attr_type) ``
Computes the effective attribute value, including curse effect.
* `` dfhack.units.getMiscTrait(unit, type[, create]) ``
Finds (or creates if requested) a misc trait object with the given id.
* `` dfhack.units.getAge(unit[,true_age]) ``