From 5d5502ae341030c58478dae2d04ba31ab2bfb93e Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 11 Apr 2012 20:10:31 +0400 Subject: [PATCH] Update the item owner modification api and export it to lua. --- LUA_API.rst | 13 ++++++ Lua API.html | 17 ++++++- library/LuaApi.cpp | 8 ++++ library/include/DataDefs.h | 3 ++ library/include/modules/Items.h | 11 ++--- library/include/modules/Units.h | 6 --- library/modules/Items.cpp | 78 +++++++++++++++++++-------------- library/modules/Units.cpp | 31 ------------- plugins/cleanowned.cpp | 7 ++- 9 files changed, 93 insertions(+), 81 deletions(-) diff --git a/LUA_API.rst b/LUA_API.rst index 8698e1b23..fc86070c3 100644 --- a/LUA_API.rst +++ b/LUA_API.rst @@ -696,6 +696,19 @@ Units module Adds or removes the unit from the burrow. +Items module +------------ + +* ``dfhack.items.getOwner(item)`` + + Returns the owner unit or *nil*. + +* ``dfhack.items.setOwner(item,unit)`` + + Replaces the owner of the item. If unit is *nil*, removes ownership. + Returns *false* in case of error. + + Maps module ----------- diff --git a/Lua API.html b/Lua API.html index 0ca88966c..7c3eeddb9 100644 --- a/Lua API.html +++ b/Lua API.html @@ -340,7 +340,8 @@ ul.auto-toc {
  • Gui module
  • Job module
  • Units module
  • -
  • Maps module
  • +
  • Items module
  • +
  • Maps module
  • @@ -925,8 +926,20 @@ a lua list containing them.

    +
    +

    Items module

    + +
    -

    Maps module

    +

    Maps module