Helltweaks: improve lava river

The lava river will now draw another river, until a certain
amount of map locations have been turned into lava, so you don't
get a teensy "river" made out of 2 lava pools.

Add a lua selection method to count the number of locations
in the selection.
This commit is contained in:
Pasi Kallinen
2023-01-30 17:07:40 +02:00
parent c7464e8aa5
commit 744d64487b
4 changed files with 91 additions and 15 deletions

View File

@@ -495,6 +495,34 @@ function test_sel_map()
sel_are_equal(sela, selb, __func__);
end
function test_sel_numpoints()
local __func__ = "test_sel_numpoints";
des.reset_level();
des.level_init({ style = "solidfill", fg = " " });
local sela = selection.new();
local npts = sela:numpoints();
if (npts ~= 0) then
error(string.format("numpoints reported %i, should have been 0", npts));
end
des.terrain(5,5, ".");
local selb = selection.match(".");
local npts = selb:numpoints();
if (npts ~= 1) then
error(string.format("numpoints reported %i, should have been 1", npts));
end
des.terrain(6,5, ".");
local selc = selection.match(".");
local npts = selc:numpoints();
if (npts ~= 2) then
error(string.format("numpoints reported %i, should have been 2", npts));
end
end
nh.debug_flags({mongen = false, hunger = false, overwrite_stairs = true });
test_selection_params();
test_sel_negate();
@@ -515,3 +543,4 @@ test_sel_match();
test_sel_iterate();
test_sel_bounds();
test_sel_map();
test_sel_numpoints();