From 37cfb1fdcd01e4a7dce1a2b759cc2655bd42cf03 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Fri, 13 Apr 2012 16:10:19 +0400 Subject: [PATCH] Add unit position and container api. --- LUA_API.rst | 10 +++++++++- Lua API.html | 8 +++++++- library/LuaApi.cpp | 13 ++++++++++++- library/include/modules/Units.h | 5 +++++ library/modules/Items.cpp | 8 +++++++- library/modules/Units.cpp | 29 +++++++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 4 deletions(-) diff --git a/LUA_API.rst b/LUA_API.rst index df997008c..673053189 100644 --- a/LUA_API.rst +++ b/LUA_API.rst @@ -663,6 +663,14 @@ Job module Units module ------------ +* ``dfhack.units.getPosition(unit)`` + + Returns true *x,y,z* of the unit; may be not equal to unit.pos if caged. + +* ``dfhack.units.getContainer(unit)`` + + Returns the container (cage) item or *nil*. + * ``dfhack.units.setNickname(unit,nick)`` Sets the unit's nickname properly. @@ -701,7 +709,7 @@ Items module * ``dfhack.items.getPosition(item)`` - Returns true *x,y,z* of the item. + Returns true *x,y,z* of the item; may be not equal to item.pos if in inventory. * ``dfhack.items.getOwner(item)`` diff --git a/Lua API.html b/Lua API.html index 4be1050fb..32a3b7f04 100644 --- a/Lua API.html +++ b/Lua API.html @@ -900,6 +900,12 @@ a lua list containing them.

Units module