@ -1597,12 +1597,6 @@ static bool items_moveToContainer(df::item *item, df::item *container)
return Items : : moveToContainer ( mc , item , container ) ;
return Items : : moveToContainer ( mc , item , container ) ;
}
}
static bool items_moveToBuilding ( df : : item * item , df : : building_actual * building , int use_mode )
{
MapExtras : : MapCache mc ;
return Items : : moveToBuilding ( mc , item , building , use_mode ) ;
}
static bool items_moveToInventory
static bool items_moveToInventory
( df : : item * item , df : : unit * unit , df : : unit_inventory_item : : T_mode mode , int body_part )
( df : : item * item , df : : unit * unit , df : : unit_inventory_item : : T_mode mode , int body_part )
{
{
@ -1653,7 +1647,6 @@ static const LuaWrapper::FunctionReg dfhack_items_module[] = {
WRAPM ( Items , createItem ) ,
WRAPM ( Items , createItem ) ,
WRAPN ( moveToGround , items_moveToGround ) ,
WRAPN ( moveToGround , items_moveToGround ) ,
WRAPN ( moveToContainer , items_moveToContainer ) ,
WRAPN ( moveToContainer , items_moveToContainer ) ,
WRAPN ( moveToBuilding , items_moveToBuilding ) ,
WRAPN ( moveToInventory , items_moveToInventory ) ,
WRAPN ( moveToInventory , items_moveToInventory ) ,
WRAPN ( makeProjectile , items_makeProjectile ) ,
WRAPN ( makeProjectile , items_makeProjectile ) ,
WRAPN ( remove , items_remove ) ,
WRAPN ( remove , items_remove ) ,
@ -1675,9 +1668,22 @@ static int items_getContainedItems(lua_State *state)
return 1 ;
return 1 ;
}
}
static int items_moveToBuilding ( lua_State * state )
{
MapExtras : : MapCache mc ;
auto item = Lua : : CheckDFObject < df : : item > ( state , 1 ) ;
auto building = Lua : : CheckDFObject < df : : building_actual > ( state , 2 ) ;
int use_mode = luaL_optint ( state , 3 , 0 ) ;
bool force_in_building = lua_toboolean ( state , 4 ) ;
lua_pushboolean ( state , Items : : moveToBuilding ( mc , item , building , use_mode , force_in_building ) ) ;
return 1 ;
}
static const luaL_Reg dfhack_items_funcs [ ] = {
static const luaL_Reg dfhack_items_funcs [ ] = {
{ " getPosition " , items_getPosition } ,
{ " getPosition " , items_getPosition } ,
{ " getContainedItems " , items_getContainedItems } ,
{ " getContainedItems " , items_getContainedItems } ,
{ " moveToBuilding " , items_moveToBuilding } ,
{ NULL , NULL }
{ NULL , NULL }
} ;
} ;