Adding getStockpileContents to the Lua API.

develop
Eric Wald 2014-09-07 14:52:08 -06:00
parent 8631da7e4e
commit 74e709ec19
3 changed files with 18 additions and 0 deletions

@ -1586,6 +1586,10 @@ are removed from extents. If <tt class="docutils literal">allow_occupied</tt>, t
<p>Checks if a bridge constructed at specified position would have
support from terrain, and thus won't collapse if retracted.</p>
</li>
<li><p class="first"><tt class="docutils literal">dfhack.buildings.getStockpileContents(stockpile)</tt></p>
<p>Returns a list of items stored on the given stockpile.
Ignores empty bins, barrels, and wheelbarrows assigned as storage and transport for that stockpile.</p>
</li>
</ul>
<p>Low-level building creation functions;</p>
<ul>

@ -1394,6 +1394,11 @@ Buildings module
Checks if a bridge constructed at specified position would have
support from terrain, and thus won't collapse if retracted.
* ``dfhack.buildings.getStockpileContents(stockpile)``
Returns a list of items stored on the given stockpile.
Ignores empty bins, barrels, and wheelbarrows assigned as storage and transport for that stockpile.
Low-level building creation functions;
* ``dfhack.buildings.allocInstance(pos, type, subtype, custom)``

@ -1744,11 +1744,20 @@ int buildings_setSize(lua_State *state)
}
static int buildings_getStockpileContents(lua_State *state)
{
std::vector<df::item*> pvec;
Buildings::getStockpileContents(Lua::CheckDFObject<df::building_stockpilest>(state,1),&pvec);
Lua::PushVector(state, pvec);
return 1;
}
static const luaL_Reg dfhack_buildings_funcs[] = {
{ "findAtTile", buildings_findAtTile },
{ "findCivzonesAt", buildings_findCivzonesAt },
{ "getCorrectSize", buildings_getCorrectSize },
{ "setSize", &Lua::CallWithCatchWrapper<buildings_setSize> },
{ "getStockpileContents", buildings_getStockpileContents},
{ NULL, NULL }
};