Lua: coordinate tweaking

Make selection rndcoord return a table with x and y keys.
Allow (most) coordinate parameters accept such a table.
Fix selection and des lua tests broken by the above changes and
an earlier change, because selections tried to set terrain
at column 0, and it now causes a complaint.
This commit is contained in:
Pasi Kallinen
2022-03-22 09:16:15 +02:00
parent 6fb0c8a82e
commit 27898340b9
19 changed files with 240 additions and 173 deletions

View File

@@ -98,13 +98,13 @@ des.door("closed",17,12)
des.door("closed",17,14)
des.region({ region={18,09, 22,15}, lit = 1, type = "zoo", filled = 1, irregular = 1 });
px, py = selection.rndcoord(place);
local pt = selection.rndcoord(place);
if percent(25) then
des.object({ id="bag of holding", x=px, y=py,
des.object({ id="bag of holding", coord=pt,
buc="not-cursed", achievement=1 });
else
des.object({ id="amulet of reflection", x=px, y=py,
des.object({ id="amulet of reflection", coord=pt,
buc="not-cursed", achievement=1 });
end
des.engraving({ x = px, y = py, type = "burn", text = "Elbereth" });
des.object({ id = "scare monster", x = px, y = py, buc = "cursed" });
des.engraving({ coord = pt, type = "burn", text = "Elbereth" });
des.object({ id = "scare monster", coord = pt, buc = "cursed" });