Change lua selection floodfill and add some tests

This commit is contained in:
Pasi Kallinen
2020-02-22 18:35:33 +02:00
parent fe3dae85d5
commit dc70132da8
5 changed files with 27 additions and 16 deletions

View File

@@ -40,8 +40,7 @@ des.map([[
-- Dungeon Description
--REGION:(00,00,75,20),lit,"ordinary"
local streets = selection.floodfill(selection.new(), 0,12)
local streets = selection.floodfill(0,12)
-- The down stairs is at one of the 4 "exits". The others are mimics,
-- mimicing stairwells.

View File

@@ -39,7 +39,7 @@ for i=1,2 do
-- 3.6.[01]: 75% chance that both sides opened up, 25% that neither did;
-- 3.6.2: 60% twice == 36% chance that both sides open up, 24% left side
-- only, 24% right side only, 16% that neither side opens up
local hall = selection.new()
local hall;
if math.random(0, 99) < 60 then
if i == 1 then
des.terrain(selection.area(17,14, 30,18),".")
@@ -47,14 +47,14 @@ for i=1,2 do
-- temporarily close off the area to be filled so that it doesn't cover
-- the entire entry area
des.terrain(33,18, "|")
hall:floodfill(30,16)
hall = selection.floodfill(30,16)
-- re-connect the opened wing with the rest of the map
des.terrain(33,18, ".")
else
des.terrain(selection.area(44,14, 57,18),".")
des.wallify()
des.terrain(41,18, "|")
hall:floodfill(44,16)
hall = selection.floodfill(44,16)
des.terrain(41,18, ".")
end
-- extra monsters; was [6 + 3d4] when both wings were opened up at once

View File

@@ -115,8 +115,8 @@ des.object({ id = "magic missile", coord = place[5], buc="uncursed", spe=0 })
-- the Orcish Army
local inside = selection.floodfill(selection.new(), 18,8)
local near_temple = selection.area(selection.new(), 17,8, 23,14) & inside
local inside = selection.floodfill(18,8)
local near_temple = selection.area(17,8, 23,14) & inside
for i=1,5 + math.random(1 - 1,1*10) do
if math.random(0, 99) < 50 then