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:
@@ -95,6 +95,5 @@ des.monster("giant eel", 39, 15)
|
||||
-- Monsters on siege duty.
|
||||
local ogrelocs = selection.floodfill(37,7) & selection.area(40,03, 45,20)
|
||||
for i = 0, 11 do
|
||||
local x,y = ogrelocs:rndcoord(1);
|
||||
des.monster({ id = "ogre", coord={x,y}, peaceful=0 })
|
||||
des.monster({ id = "ogre", coord = ogrelocs:rndcoord(1), peaceful = 0 })
|
||||
end
|
||||
|
||||
@@ -88,8 +88,7 @@ des.monster("abbot", 33, 12)
|
||||
des.non_diggable(selection.area(18,03,55,16))
|
||||
-- Random traps
|
||||
for i = 1, 2 do
|
||||
local x,y = spacelocs:rndcoord(1);
|
||||
des.trap("dart",x,y)
|
||||
des.trap("dart", spacelocs:rndcoord(1))
|
||||
end
|
||||
des.trap()
|
||||
des.trap()
|
||||
@@ -97,10 +96,8 @@ des.trap()
|
||||
des.trap()
|
||||
-- Monsters on siege duty.
|
||||
for i = 1, 8 do
|
||||
local x,y = spacelocs:rndcoord(1);
|
||||
des.monster("earth elemental", x, y)
|
||||
des.monster("earth elemental", spacelocs:rndcoord(1))
|
||||
end
|
||||
for i = 1, 4 do
|
||||
local x,y = spacelocs:rndcoord(1);
|
||||
des.monster("xorn", x, y)
|
||||
des.monster("xorn", spacelocs:rndcoord(1))
|
||||
end
|
||||
|
||||
@@ -90,8 +90,7 @@ des.monster("acolyte", 33, 12)
|
||||
des.non_diggable(selection.area(18,03,55,16))
|
||||
-- Random traps
|
||||
for i = 1, 2 do
|
||||
local x,y = spacelocs:rndcoord(1);
|
||||
des.trap("dart",x,y)
|
||||
des.trap("dart", spacelocs:rndcoord(1))
|
||||
end
|
||||
des.trap()
|
||||
des.trap()
|
||||
@@ -99,6 +98,5 @@ des.trap()
|
||||
des.trap()
|
||||
-- Monsters on siege duty.
|
||||
for i = 1, 12 do
|
||||
local x,y = spacelocs:rndcoord(1);
|
||||
des.monster("human zombie", x, y);
|
||||
des.monster("human zombie", spacelocs:rndcoord(1));
|
||||
end
|
||||
|
||||
@@ -158,9 +158,9 @@ des.monster({ id = "leprechaun", x=25, y=19, peaceful=0 })
|
||||
des.monster({ id = "water nymph", x=25, y=18, peaceful=0 })
|
||||
-- Wandering the streets.
|
||||
for i=1,4 + math.random(1 - 1,1*3) do
|
||||
des.monster({ id = "water nymph", coord = {streets:rndcoord(1)}, peaceful=0 })
|
||||
des.monster({ id = "leprechaun", coord = {streets:rndcoord(1)}, peaceful=0 })
|
||||
des.monster({ id = "water nymph", coord = streets:rndcoord(1), peaceful=0 })
|
||||
des.monster({ id = "leprechaun", coord = streets:rndcoord(1), peaceful=0 })
|
||||
end
|
||||
for i=1,7 + math.random(1 - 1,1*3) do
|
||||
des.monster({ id = "chameleon", coord = {streets:rndcoord(1)}, peaceful=0 })
|
||||
des.monster({ id = "chameleon", coord = streets:rndcoord(1), peaceful=0 })
|
||||
end
|
||||
|
||||
@@ -59,9 +59,9 @@ for i=1,2 do
|
||||
end
|
||||
-- extra monsters; was [6 + 3d4] when both wings were opened up at once
|
||||
for i=1,3 + math.random(2 - 1,2*3) do
|
||||
des.monster({ id="Angel", coord = { hall:rndcoord(1) }, align="noalign", peaceful=0 })
|
||||
des.monster({ id="Angel", coord = hall:rndcoord(1), align="noalign", peaceful=0 })
|
||||
if percent(50) then
|
||||
des.monster({ coord = { hall:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ coord = hall:rndcoord(1), peaceful=0 })
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -110,7 +110,7 @@ des.monster({ id = "aligned cleric",x=19,y=09,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "aligned cleric",x=19,y=10,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=20,y=09,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=20,y=10,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Pestilence", coord = { place:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ id = "Pestilence", coord = place:rndcoord(1), peaceful=0 })
|
||||
-- South-central round room
|
||||
des.monster({ id = "aligned cleric",x=36,y=12,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "aligned cleric",x=37,y=12,align="noalign", peaceful=0 })
|
||||
@@ -118,7 +118,7 @@ des.monster({ id = "aligned cleric",x=38,y=12,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "aligned cleric",x=36,y=13,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=38,y=13,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=37,y=13,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Death", coord = { place:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ id = "Death", coord = place:rndcoord(1), peaceful=0 })
|
||||
-- East round room
|
||||
des.monster({ id = "aligned cleric",x=56,y=09,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "aligned cleric",x=55,y=08,align="noalign", peaceful=0 })
|
||||
@@ -126,7 +126,7 @@ des.monster({ id = "aligned cleric",x=55,y=09,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "aligned cleric",x=55,y=10,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=54,y=09,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Angel",x=54,y=10,align="noalign", peaceful=0 })
|
||||
des.monster({ id = "Famine", coord = { place:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ id = "Famine", coord = place:rndcoord(1), peaceful=0 })
|
||||
--
|
||||
-- The aligned horde
|
||||
--
|
||||
|
||||
@@ -140,8 +140,7 @@ des.object(object[4],53,11)
|
||||
des.object(object[4],54,11)
|
||||
des.object(object[4],55,11)
|
||||
-- THE WAND OF WISHING in 1 of the 4 towers
|
||||
local px, py = place:rndcoord(1);
|
||||
des.object({ id = "chest", trapped = 0, locked = 1, x = px, y = py,
|
||||
des.object({ id = "chest", trapped = 0, locked = 1, coord = place:rndcoord(1),
|
||||
contents = function()
|
||||
des.object("wishing");
|
||||
end
|
||||
|
||||
@@ -63,9 +63,9 @@ des.levregion({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17}, typ
|
||||
des.teleport_region({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17},dir="up" })
|
||||
des.teleport_region({ region = {69,00,79,20}, region_islev=1, exclude={0,0,50,17},dir="down" })
|
||||
des.feature("fountain", place:rndcoord(1))
|
||||
des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" })
|
||||
des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" })
|
||||
des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" })
|
||||
des.monster({ id = "giant mimic", coord = place:rndcoord(1), appear_as = "ter:fountain" })
|
||||
des.monster({ id = "giant mimic", coord = place:rndcoord(1), appear_as = "ter:fountain" })
|
||||
des.monster({ id = "giant mimic", coord = place:rndcoord(1), appear_as = "ter:fountain" })
|
||||
-- The demon of the swamp
|
||||
des.monster("Juiblex",25,08)
|
||||
-- And a couple demons
|
||||
|
||||
@@ -53,18 +53,16 @@ des.non_diggable(selection.area(44,13,48,17))
|
||||
-- restricting the placement when teleporting from levels below this.
|
||||
des.teleport_region({ region = {33,02,38,07}, dir="down" })
|
||||
des.levregion({ region = {32,01,39,07}, type="stair-up" });
|
||||
local mx, my = place:rndcoord(1);
|
||||
des.stair("down", mx, my)
|
||||
|
||||
des.stair("down", place:rndcoord(1))
|
||||
des.door("locked",08,08)
|
||||
des.door("locked",64,05)
|
||||
des.door("random",50,13)
|
||||
des.door("locked",48,15)
|
||||
--
|
||||
local px, py = place:rndcoord(1);
|
||||
des.feature("fountain", px,py);
|
||||
des.feature("fountain", place:rndcoord(1));
|
||||
--
|
||||
local px, py = place:rndcoord(1);
|
||||
des.object({ id="statue",x=px, y=py, buc="uncursed",
|
||||
des.object({ id="statue", coord=place:rndcoord(1), buc = "uncursed",
|
||||
montype="knight", historic=1, male=1,name="Perseus",
|
||||
contents = function()
|
||||
if percent(75) then
|
||||
|
||||
@@ -49,8 +49,8 @@ des.teleport_region({ region = {64,01,74,17}, dir="down" });
|
||||
des.teleport_region({ region = {02,02,18,13}, dir="up" });
|
||||
--
|
||||
des.levregion({ region = {67,01,74,20}, type="stair-up" });
|
||||
local mx, my = place:rndcoord(1);
|
||||
des.stair("down", mx, my)
|
||||
|
||||
des.stair("down", place:rndcoord(1))
|
||||
--
|
||||
des.door("locked",04,06)
|
||||
des.door("locked",04,10)
|
||||
@@ -66,8 +66,7 @@ des.non_diggable(selection.area(01,01,22,14));
|
||||
--
|
||||
des.object("crystal ball", 07,08)
|
||||
--
|
||||
local px, py = place:rndcoord(1);
|
||||
des.object({ id="statue",x=px, y=py, buc="uncursed",
|
||||
des.object({ id="statue",coord=place:rndcoord(1), buc="uncursed",
|
||||
montype="knight", historic=1, male=1,name="Perseus",
|
||||
contents = function()
|
||||
if percent(75) then
|
||||
|
||||
@@ -120,18 +120,18 @@ local near_temple = selection.area(17,8, 23,14) & inside
|
||||
|
||||
for i=1,5 + math.random(1 - 1,1*10) do
|
||||
if percent(50) then
|
||||
des.monster({ id = "orc-captain", coord = { inside:rndcoord(1) }, peaceful=0 });
|
||||
des.monster({ id = "orc-captain", coord = inside:rndcoord(1), peaceful=0 });
|
||||
else
|
||||
if percent(80) then
|
||||
des.monster({ id = "Uruk-hai", coord = { inside:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ id = "Uruk-hai", coord = inside:rndcoord(1), peaceful=0 })
|
||||
else
|
||||
des.monster({ id = "Mordor orc", coord = { inside:rndcoord(1) }, peaceful=0 })
|
||||
des.monster({ id = "Mordor orc", coord = inside:rndcoord(1), peaceful=0 })
|
||||
end
|
||||
end
|
||||
end
|
||||
-- shamans can be hanging out in/near the temple
|
||||
for i=1,math.random(2 - 1,2*3) do
|
||||
des.monster({ id = "orc shaman", coord = { near_temple:rndcoord(0) }, peaceful=0 });
|
||||
des.monster({ id = "orc shaman", coord = near_temple:rndcoord(0), peaceful=0 });
|
||||
end
|
||||
-- these are not such a big deal
|
||||
-- to run into outside the bars
|
||||
|
||||
@@ -96,14 +96,14 @@ des.door("closed", 17, 15);
|
||||
|
||||
des.region({ region={18,10, 22,16}, lit = 1, type = "zoo", filled = 1, irregular = 1 });
|
||||
|
||||
px, py = selection.rndcoord(place);
|
||||
local pt = selection.rndcoord(place);
|
||||
if percent(75) 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" });
|
||||
|
||||
|
||||
@@ -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" });
|
||||
|
||||
Reference in New Issue
Block a user