Skip to content

Commit

Permalink
Lua Cave Mapgen: Support [chamber]chance=
Browse files Browse the repository at this point in the history
The older cave generator supported it, so the new one should too.
  • Loading branch information
CelticMinstrel committed Oct 27, 2016
1 parent 46e31cb commit 7c71513
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/lua/cave_map_generator.lua
Expand Up @@ -41,9 +41,13 @@ function callbacks.generate_map(params)
local passages = {}

for chamber in helper.child_range(params, "chamber") do
local chance = tonumber(chamber.chance) or 100
local x = chamber.x
local y = chamber.y
local id = chamber.id
if chance == 0 or random(100) > chance then
goto continue
end
if type(x) == "string" then
local x_min, x_max = x:match("(%d+)-(%d+)")
x = random(tonumber(x_min), tonumber(x_max))
Expand Down Expand Up @@ -79,6 +83,7 @@ function callbacks.generate_map(params)
})
end
end
::continue::
end

for i,v in ipairs(chambers) do
Expand Down

0 comments on commit 7c71513

Please sign in to comment.