diff options
| author | Alexander Gavrilov | 2012-05-06 19:09:11 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-06 19:09:11 +0400 |
| commit | 9ad8d767b4fcf0946444469d2c4072d46997b7e6 (patch) | |
| tree | f49a082895fe73d400e64359e859806c173d00ef /library/lua | |
| parent | b70130cf3684d8adbf36023b27aec0f10b213cc7 (diff) | |
| download | dfhack-9ad8d767b4fcf0946444469d2c4072d46997b7e6.tar.gz dfhack-9ad8d767b4fcf0946444469d2c4072d46997b7e6.tar.bz2 dfhack-9ad8d767b4fcf0946444469d2c4072d46997b7e6.tar.xz | |
Add code for adding abstract buildings and removing constructions.
Diffstat (limited to 'library/lua')
| -rw-r--r-- | library/lua/dfhack/buildings.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/lua/dfhack/buildings.lua b/library/lua/dfhack/buildings.lua index 57427e9f..9650dc4c 100644 --- a/library/lua/dfhack/buildings.lua +++ b/library/lua/dfhack/buildings.lua @@ -28,6 +28,8 @@ local buildings = dfhack.buildings items = { item, item ... }, -- OR filter = { { ... }, { ... }... } + -- OR + abstract = true } Returns: the created building, or 'nil, error' @@ -41,8 +43,8 @@ function buildings.constructBuilding(info) if not (info.pos or info.x) then error('position is required') end - if not (info.items or info.filters) then - error('either items or filters are required') + if not (info.abstract or info.items or info.filters) then + error('one of items, filters or abstract are required') elseif info.filters then for _,v in ipairs(info.filters) do v.new = true @@ -77,7 +79,9 @@ function buildings.constructBuilding(info) if info.full_rectangle and area ~= r_area then return nil, "not all tiles can be used" end - if info.items then + if info.abstract then + ok = buildings.constructAbstract(instance) + elseif info.items then ok = buildings.constructWithItems(instance, info.items) else ok = buildings.constructWithFilters(instance, info.filters) |
