git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7619 c06c8d41-db1a-0410-9941-cceddc491573
DUFJKFM5KBCM4272ZKLBPGKHLMDLK6RABUNTDEWRZULTKDTHHSBAC
local function monster_creator_fn(arg)
local atyp = type(arg)
if atyp == "string" then
local _, _, branch = string.find(arg, "^place:(%w+):")
return function (x, y, nth)
if branch then
set_floor_colour(dgn.br_floorcol(branch))
end
return dgn.create_monster(x, y, arg)
end
elseif atyp == "table" then
if arg.cond() then
return monster_creator_fn(arg.spec)
end
else
return arg
end
end
local function set_floor_colour(colour)
if not zig().level.floor_colour then
zig().level.floor_colour = colour
dgn.change_floor_colour(colour, false)
end
end
local function set_random_floor_colour()
set_floor_colour( random_floor_colour() )
end
local function monster_creator_fn(arg)
local atyp = type(arg)
if atyp == "string" then
local _, _, branch = string.find(arg, "^place:(%w+):")
return function (x, y, nth)
if branch then
set_floor_colour(dgn.br_floorcol(branch))
end
return dgn.create_monster(x, y, arg)
end
elseif atyp == "table" then
if arg.cond() then
return monster_creator_fn(arg.spec)
end
else
return arg
end
end