Source:NetHack 5.0.0/dat/bigrm-1.lua

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to bigrm-1.lua from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/dat/bigrm-1.lua#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. -- NetHack bigroom bigrm-1.lua	$NHDT-Date: 1652196021 2022/05/10 15:20:21 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $
2. --	Copyright (c) 1989 by Jean-Christophe Collet
3. --	Copyright (c) 1990 by M. Stephenson
4. -- NetHack may be freely redistributed.  See license for details.
5. --
6. des.level_init({ style = "solidfill", fg = " " });
7. des.level_flags("mazelevel", "noflip");
8. 
9. des.map([[
10. ---------------------------------------------------------------------------
11. |.........................................................................|
12. |.........................................................................|
13. |.........................................................................|
14. |.........................................................................|
15. |.........................................................................|
16. |.........................................................................|
17. |.........................................................................|
18. |.........................................................................|
19. |.........................................................................|
20. |.........................................................................|
21. |.........................................................................|
22. |.........................................................................|
23. |.........................................................................|
24. |.........................................................................|
25. |.........................................................................|
26. |.........................................................................|
27. ---------------------------------------------------------------------------
28. ]]);
29. 
30. 
31. if percent(80) then
32.    local terrains = { "-", "F", "L", "T", "C" };
33.    local tidx = math.random(1, #terrains);
34.    local choice = math.random(0, 5);
35.    if choice == 0 then
36.       -- one horizontal line
37.       des.terrain(selection.line(10,8, 65,8), terrains[tidx]);
38.    elseif choice == 1 then
39.       -- two vertical lines
40.       local sel = selection.line(15,4, 15, 13) | selection.line(59,4, 59, 13);
41.       des.terrain(sel, terrains[tidx]);
42.    elseif choice == 2 then
43.       -- plus sign
44.       local sel = selection.line(10,8, 64, 8) | selection.line(37,3, 37, 14);
45.       des.terrain(sel, terrains[tidx]);
46.    elseif choice == 3 then
47.       -- brackets:  [  ]
48.       des.terrain(selection.rect(4,4, 70,13), terrains[tidx]);
49.       local sel = selection.line(25,4, 50,4) | selection.line(25,13, 50,13);
50.       des.terrain(sel, '.');
51.    elseif choice == 4 then
52.       -- snake
53.       des.terrain(selection.fillrect(5,5, 69, 12), terrains[tidx]);
54.       for i = 0, 7 do
55.          local x = 6 + i*8;
56.          local y = 5 + (i%2);
57.          des.terrain(selection.fillrect(x, y, x+6, y+6), '.');
58.       end
59.    else
60.       -- nothing
61.    end
62. end
63. 
64. des.region(selection.area(01,01, 73, 16), "lit");
65. 
66. des.stair("up");
67. des.stair("down");
68. 
69. des.non_diggable();
70. 
71. for i = 1,15 do
72.    des.object();
73. end
74. 
75. for i = 1,6 do
76.    des.trap();
77. end
78. 
79. for i = 1,28 do
80.   des.monster();
81. end