Implement lua selection iteration

... and showcase it by dehardcoding the Fort Ludios treasury.
This commit is contained in:
Pasi Kallinen
2020-02-26 17:25:25 +02:00
parent 1003a8142e
commit 7a54edf91f
3 changed files with 45 additions and 18 deletions

View File

@@ -52,10 +52,23 @@ if math.random(0, 99) < 50 then
des.terrain(47,09, "S")
des.terrain(47,10, "|")
end
-- The Vault
-- Using unfilled morgue for
-- identification in mkmaze.c
des.region({ region={21,08,35,11}, lit=1, type="morgue", prefilled=1 })
function treasure_spot(x,y)
des.gold({ x = x, y = y, amount = 600 + math.random(0, 300) });
if (math.random(0,2) == 0) then
if (math.random(0,2) == 0) then
des.trap("spiked pit", x,y);
else
des.trap("land mine", x,y);
end
end
end
des.region({ region={21,08,35,11}, lit=1, type="orginary" })
local treasury = selection.area(21,08,35,11);
treasury:iterate(treasure_spot);
-- Vault entrance also varies
if math.random(0, 99) < 50 then
des.terrain(36,09, "|")