Files
nethack/dat/knox.lua
copperwater 0fef8fce9f Unify all special level filling options
The existing system was a confusing mess of competing names (filled,
needfill, prefilled, etc) that had varying semantics, with prefilled
being the worst offender as it meant at least three different things in
various contexts. This commit unifies everything in the code under
"needfill", and everything in Lua under "filled", which defaults to 0
everywhere.

This also removes the second argument to fill_special_room; that
function now just checks the needfill of the room it's passed. As
before, a filled == 2 value is used for a special room to indicate that
the room should set the appropriate level flag, but shouldn't actually
be stocked with anything (for instance, King Arthur's throne room); the
difference is that this now comes directly from the lua script instead
of being manipulated within sp_lev.c.

The prefilled argument had one use case that is occasionally used in the
level files: if the level designer had specified an ordinary region with
prefilled = 1, it would become a room to control monster arrivals on a
level -- monsters that arrive within the bounds of a room are supposed
to stay there.
However, not all of the places where the comments indicated this was
being used were using it correctly; I tested this by letting a few
monsters fall through the knox portal (they're supposed to be
constrained to the entry room) and waiting a hundred turns, then going
through the portal; they were not constrained to the room and had
"wandered" through its walls.
Instead of trying to maintain this special case, I have added an
optional "arrival_room" boolean argument to des.region, which forces it
to create a room for the purposes of constraining monster arrival.

I have gone through and replaced occurrences of prefilled in lua files
with the appropriate filled option (or arrival, as needed). In some
cases, that resulted in questionable regions such as a filled ordinary
area in a non-themeroom (I just dropped the filled=1), or an area which
didn't do anything, not even lighting (which I deleted).
2020-09-27 18:54:15 +03:00

168 lines
6.7 KiB
Lua

-- NetHack 3.7 knox.des $NHDT-Date: 1547343821 2019/01/13 01:43:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.13 $
-- Copyright (c) 1989 by Jean-Christophe Collet
-- Copyright (c) 1992 by Izchak Miller
-- NetHack may be freely redistributed. See license for details.
--
--
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel", "noteleport")
-- Fort's entry is via a secret door rather than a drawbridge;
-- the moat must be manually circumvented.
des.map([[
----------------------------------------------------------------------------
| |........|...............................................................|
| |........|.................................................------------..|
| --S----S--.................................................|..........|..|
| # |........}}}}}}}....................}}}}}}}..........|..........|..|
| # |........}-----}....................}-----}..........--+--+--...|..|
| # ---........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..|
| # |..........}---S------------------------S---}.................|...|..|
| # |..........}}}|...............|..........|}}}.................+...|..|
| --S----..........}|...............S..........|}...................|...|..|
| |.....|..........}|...............|......\...S}...................|...|..|
| |.....+........}}}|...............|..........|}}}.................+...|..|
| |.....|........}---S------------------------S---}.................|...|..|
| |.....|........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..|
| |..-S----......}-----}....................}-----}..........--+--+--...|..|
| |..|....|......}}}}}}}....................}}}}}}}..........|..........|..|
| |..|....|..................................................|..........|..|
| -----------................................................------------..|
| |..............................................................|
----------------------------------------------------------------------------
]]);
-- Non diggable walls
des.non_diggable(selection.area(00,00,75,19))
-- Portal arrival point
des.levregion({ region = {08,16,08,16}, type="branch" });
-- accessible via ^V in wizard mode; arrive near the portal
des.teleport_region({ region = {06,15,09,16}, dir="up" })
des.teleport_region({ region = {06,15,09,16}, dir="down" })
-- Throne room, with Croesus on the throne
des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", filled=1 })
-- 50% chance each to move throne and/or fort's entry secret door up one row
if percent(50) then
des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 })
else
des.monster({ id = "Croesus", x=43, y=09, peaceful = 0 })
des.terrain(43,09, "\\")
des.terrain(43,10, ".")
end
if percent(50) then
des.terrain(47,09, "S")
des.terrain(47,10, "|")
end
-- The Vault
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="ordinary" })
local treasury = selection.area(21,08,35,11);
treasury:iterate(treasure_spot);
-- Vault entrance also varies
if percent(50) then
des.terrain(36,09, "|")
des.terrain(36,10, "S")
end
-- Corner towers
des.region(selection.area(19,06,21,06),"lit")
des.region(selection.area(46,06,48,06),"lit")
des.region(selection.area(19,13,21,13),"lit")
des.region(selection.area(46,13,48,13),"lit")
-- A welcoming committee
des.region({ region={03,10,07,13},lit=1,type="zoo",filled=1,irregular=1 })
-- arrival chamber; needs to be a real room to control migrating monsters,
-- and `unfilled' is a kludge to force an ordinary room to remain a room
des.region({ region={06,15,09,16},lit=0,type="ordinary",arrival_room=true })
-- 3.6.2: Entering level carrying a lit candle would show the whole entry
-- chamber except for its top right corner even though some of the revealed
-- spots are farther away than that is. This is because the lit treasure zoo
-- is forcing the walls around it to be lit too (see light_region(sp_lev.c)),
-- and lit walls show up when light reaches the spot next to them. The unlit
-- corner is beyond candle range and isn't flagged as lit so it doesn't show
-- up until light reaches it rather than when light gets next to it.
--
-- Force left and top walls of the arrival chamber to be unlit in order to
-- hide this lighting quirk.
des.region(selection.area(05,14,05,17),"unlit")
des.region(selection.area(05,14,09,14),"unlit")
-- (Entering the treasure zoo while blind and then regaining sight might
-- expose the new oddity of these walls not appearing when on the lit side
-- but that's even less likely to occur than the rare instance of entering
-- the level with a candle. They'll almost always be mapped from the arrival
-- side before entering the treasure zoo.
--
-- A prior workaround lit the top right corner wall and then jumped through
-- hoops to suppress the extra light in the 3x3 lit area that produced.
-- This is simpler and makes the short range candle light behave more like
-- it is expected to work.)
-- Barracks
des.region({ region={62,03,71,04},lit=1,type="barracks",filled=1,irregular=1 })
-- Doors
des.door("closed",06,14)
des.door("closed",09,03)
des.door("open",63,05)
des.door("open",66,05)
des.door("open",68,08)
des.door("locked",08,11)
des.door("open",68,11)
des.door("closed",63,14)
des.door("closed",66,14)
des.door("closed",04,03)
des.door("closed",04,09)
-- Soldiers guarding the fort
des.monster("soldier",12,14)
des.monster("soldier",12,13)
des.monster("soldier",11,10)
des.monster("soldier",13,02)
des.monster("soldier",14,03)
des.monster("soldier",20,02)
des.monster("soldier",30,02)
des.monster("soldier",40,02)
des.monster("soldier",30,16)
des.monster("soldier",32,16)
des.monster("soldier",40,16)
des.monster("soldier",54,16)
des.monster("soldier",54,14)
des.monster("soldier",54,13)
des.monster("soldier",57,10)
des.monster("soldier",57,09)
des.monster("lieutenant",15,08)
-- Possible source of a boulder
des.monster("stone giant",03,01)
-- Four dragons guarding each side
des.monster("D",18,09)
des.monster("D",49,10)
des.monster("D",33,05)
des.monster("D",33,14)
-- Eels in the moat
des.monster("giant eel",17,08)
des.monster("giant eel",17,11)
des.monster("giant eel",48,08)
des.monster("giant eel",48,11)
-- The corner rooms treasures
des.object("diamond",19,06)
des.object("diamond",20,06)
des.object("diamond",21,06)
des.object("emerald",19,13)
des.object("emerald",20,13)
des.object("emerald",21,13)
des.object("ruby",46,06)
des.object("ruby",47,06)
des.object("ruby",48,06)
des.object("amethyst",46,13)
des.object("amethyst",47,13)
des.object("amethyst",48,13)