summaryrefslogtreecommitdiff
path: root/library/LuaApi.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-05-20 21:57:45 +0400
committerAlexander Gavrilov2012-05-20 21:57:45 +0400
commitb992b04f0bb7ffef8e7fb152967d438f398543d7 (patch)
tree0b6dd0e193642d95df53ffb05f7fe9c3a63d0595 /library/LuaApi.cpp
parentd28d240dbdce9ef38081826c76dad4268259a380 (diff)
downloaddfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.gz
dfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.bz2
dfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.xz
Remove stuff that shouldn't be in the core, and expose to lua what's left.
Specifically, any "if (verbose) { Core::printerr("blah") }" kind of stuff definitely doesn't belong in the common API functions. Also, ref->getUnit() is very expensive. On the other hand, checks for crash-inducing conflicts with the ui should be in the core api, and not in client plugins.
Diffstat (limited to 'library/LuaApi.cpp')
-rw-r--r--library/LuaApi.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp
index 9dfb3975..6a550db8 100644
--- a/library/LuaApi.cpp
+++ b/library/LuaApi.cpp
@@ -764,15 +764,24 @@ static bool items_moveToBuilding(df::item *item, df::building_actual *building,
return Items::moveToBuilding(mc, item, building,use_mode);
}
+static bool items_moveToInventory
+ (df::item *item, df::unit *unit, df::unit_inventory_item::T_mode mode, int body_part)
+{
+ MapExtras::MapCache mc;
+ return Items::moveToInventory(mc, item, unit, mode, body_part);
+}
+
static const LuaWrapper::FunctionReg dfhack_items_module[] = {
WRAPM(Items, getGeneralRef),
WRAPM(Items, getSpecificRef),
WRAPM(Items, getOwner),
WRAPM(Items, setOwner),
WRAPM(Items, getContainer),
+ WRAPM(Items, getDescription),
WRAPN(moveToGround, items_moveToGround),
WRAPN(moveToContainer, items_moveToContainer),
WRAPN(moveToBuilding, items_moveToBuilding),
+ WRAPN(moveToInventory, items_moveToInventory),
{ NULL, NULL }
};