summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat
diff options
context:
space:
mode:
authorinfiniplex <infiniplex@hotmail.com>2014-07-07 11:35:28 -0600
committerreaverb <reaverb.Crawl@gmail.com>2014-07-23 22:05:30 -0400
commitfe5354c7f8115e95b0eafd434cd1bb0979c3477e (patch)
tree4dae40524324b0bd66114d5ac8177779740e4f65 /crawl-ref/source/dat
parent4de20b8ffacd8c1241b4fe3b7afd7c169aa75123 (diff)
downloadcrawl-ref-fe5354c7f8115e95b0eafd434cd1bb0979c3477e.tar.gz
crawl-ref-fe5354c7f8115e95b0eafd434cd1bb0979c3477e.zip
Move Gehenna building generation to theme.lua
Diffstat (limited to 'crawl-ref/source/dat')
-rw-r--r--crawl-ref/source/dat/des/builder/layout_pools.des36
-rw-r--r--crawl-ref/source/dat/dlua/layout/theme.lua41
2 files changed, 42 insertions, 35 deletions
diff --git a/crawl-ref/source/dat/des/builder/layout_pools.des b/crawl-ref/source/dat/des/builder/layout_pools.des
index 3afdd4bb49..e7591e76a3 100644
--- a/crawl-ref/source/dat/des/builder/layout_pools.des
+++ b/crawl-ref/source/dat/des/builder/layout_pools.des
@@ -71,41 +71,7 @@
contents = pool_contents }
-- add some random rooms
- local border = 4
- local gxm, gym = dgn.max_bounds()
- local right = gxm - 1 - border
- local bottom = gym - 1 - border
- local size_max = 6 + 4 * depth_fraction
- local separation_min = crawl.random_range(1, border - depth_fraction*2)
-
- local room_count_min = (150 + depth_fraction * 850) / size_max
- local room_count_max = (300 + depth_fraction * 1700) / size_max
- for i = 1, crawl.random_range(room_count_min, room_count_max) do
- local size = crawl.random_range(4, size_max)
- local min_x = crawl.random_range(border, right - size)
- local min_y = crawl.random_range(border, bottom - size)
- local max_x = min_x + size
- local max_y = min_y + size
-
- local cell_count = size * size
- local wall_count = e.count_feature_in_box {x1 = min_x, x2 = max_x,
- y1 = min_y, y2 = max_y,
- feat = "xv" }
- local blocked = e.find_in_area {x1 = min_x - separation_min,
- x2 = max_x + separation_min,
- y1 = min_y - separation_min,
- y2 = max_y + separation_min,
- find = "c", find_vault = true }
- if not blocked and wall_count < cell_count
- and wall_count >= cell_count * 0.5 then
- local door_count = crawl.random_range(1, 3)
- e.make_round_box {x1 = min_x, x2 = max_x,
- y1 = min_y, y2 = max_y,
- floor = '.', wall = 'c',
- door_count = door_count, veto_gates=true,
- veto_if_no_doors=true }
- end
- end
+ theme.add_gehenna_buildings(e)
-- clean up the map
e.widen_paths { find = "v", percent = 90 }
diff --git a/crawl-ref/source/dat/dlua/layout/theme.lua b/crawl-ref/source/dat/dlua/layout/theme.lua
index 514b609229..5dd8d16a4f 100644
--- a/crawl-ref/source/dat/dlua/layout/theme.lua
+++ b/crawl-ref/source/dat/dlua/layout/theme.lua
@@ -82,3 +82,44 @@ function theme.room_material(wall_type)
}
end
+
+-- Get a random weighted material for rooms in room layouts
+function theme.add_gehenna_buildings(e)
+
+ local depth_fraction = you.depth_fraction()
+ local border = 4
+ local gxm, gym = dgn.max_bounds()
+ local right = gxm - 1 - border
+ local bottom = gym - 1 - border
+ local size_max = 6 + 4 * depth_fraction
+ local separation_min = crawl.random_range(1, border - depth_fraction*2)
+
+ local room_count_min = (150 + depth_fraction * 850) / size_max
+ local room_count_max = (300 + depth_fraction * 1700) / size_max
+ for i = 1, crawl.random_range(room_count_min, room_count_max) do
+ local size = crawl.random_range(4, size_max)
+ local min_x = crawl.random_range(border, right - size)
+ local min_y = crawl.random_range(border, bottom - size)
+ local max_x = min_x + size
+ local max_y = min_y + size
+
+ local cell_count = size * size
+ local wall_count = e.count_feature_in_box {x1 = min_x, x2 = max_x,
+ y1 = min_y, y2 = max_y,
+ feat = "xv" }
+ local blocked = e.find_in_area {x1 = min_x - separation_min,
+ x2 = max_x + separation_min,
+ y1 = min_y - separation_min,
+ y2 = max_y + separation_min,
+ find = "c", find_vault = true }
+ if not blocked and wall_count < cell_count
+ and wall_count >= cell_count * 0.5 then
+ local door_count = crawl.random_range(1, 3)
+ e.make_round_box {x1 = min_x, x2 = max_x,
+ y1 = min_y, y2 = max_y,
+ floor = '.', wall = 'c',
+ door_count = door_count, veto_gates=true,
+ veto_if_no_doors=true }
+ end
+ end
+end