Support creating rollers and stops with dfhack.buildings.constructBuilding.

develop
Alexander Gavrilov 2012-05-17 00:19:29 +04:00
parent 68c5d9b86c
commit efdb709284
3 changed files with 33 additions and 4 deletions

@ -178,7 +178,20 @@ local building_inputs = {
}, },
[df.building_type.Slab] = { { item_type=df.item_type.SLAB } }, [df.building_type.Slab] = { { item_type=df.item_type.SLAB } },
[df.building_type.NestBox] = { { has_tool_use=df.tool_uses.NEST_BOX, item_type=df.item_type.TOOL } }, [df.building_type.NestBox] = { { has_tool_use=df.tool_uses.NEST_BOX, item_type=df.item_type.TOOL } },
[df.building_type.Hive] = { { has_tool_use=df.tool_uses.HIVE, item_type=df.item_type.TOOL } } [df.building_type.Hive] = { { has_tool_use=df.tool_uses.HIVE, item_type=df.item_type.TOOL } },
[df.building_type.Rollers] = {
{
name='mechanism',
item_type=df.item_type.TRAPPARTS,
quantity=-1,
vector_id=df.job_item_vector_id.TRAPPARTS
},
{
name='chain',
item_type=df.item_type.CHAIN,
vector_id=df.job_item_vector_id.CHAIN
}
}
} }
--[[ Furnace building input material table. ]] --[[ Furnace building input material table. ]]
@ -318,7 +331,8 @@ local trap_inputs = {
item_type=df.item_type.TRAPPARTS, item_type=df.item_type.TRAPPARTS,
vector_id=df.job_item_vector_id.TRAPPARTS vector_id=df.job_item_vector_id.TRAPPARTS
} }
} },
[df.trap_type.TrackStop] = { { flags2={ building_material=true, non_economic=true } } }
} }
--[[ Functions for lookup in tables. ]] --[[ Functions for lookup in tables. ]]

@ -66,6 +66,7 @@ using namespace DFHack;
#include "df/building_screw_pumpst.h" #include "df/building_screw_pumpst.h"
#include "df/building_water_wheelst.h" #include "df/building_water_wheelst.h"
#include "df/building_wellst.h" #include "df/building_wellst.h"
#include "df/building_rollersst.h"
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::ui;
@ -289,6 +290,10 @@ bool Buildings::getCorrectSize(df::coord2d &size, df::coord2d &center,
makeOneDim(size, center, direction); makeOneDim(size, center, direction);
return true; return true;
case Rollers:
makeOneDim(size, center, (direction&1) == 0);
return true;
case WaterWheel: case WaterWheel:
size = df::coord2d(3,3); size = df::coord2d(3,3);
makeOneDim(size, center, direction); makeOneDim(size, center, direction);
@ -592,6 +597,12 @@ bool Buildings::setSize(df::building *bld, df::coord2d size, int direction)
obj->direction = (df::screw_pump_direction)direction; obj->direction = (df::screw_pump_direction)direction;
break; break;
} }
case Rollers:
{
auto obj = (df::building_rollersst*)bld;
obj->direction = (df::screw_pump_direction)direction;
break;
}
case Bridge: case Bridge:
{ {
auto obj = (df::building_bridgest*)bld; auto obj = (df::building_bridgest*)bld;
@ -881,7 +892,11 @@ bool Buildings::constructWithFilters(df::building *bld, std::vector<df::job_item
if (items[i]->quantity < 0) if (items[i]->quantity < 0)
items[i]->quantity = computeMaterialAmount(bld); items[i]->quantity = computeMaterialAmount(bld);
job->job_items.push_back(items[i]); /* The game picks up explicitly listed items in reverse
* order, but processes filters straight. This reverses
* the order of filters so as to produce the same final
* contained_items ordering as the normal ui way. */
vector_insert_at(job->job_items, 0, items[i]);
if (items[i]->item_type == item_type::BOULDER) if (items[i]->item_type == item_type::BOULDER)
rough = true; rough = true;

@ -1 +1 @@
Subproject commit 92dbeb6267a24a35babe3d5326801f2e8cfd22e1 Subproject commit b0d8e71dc9f6e697409bd999801097acdc57fcd8