Game is playable, and should compile on linux and Windows. Assumes you have a lua 5.3 library available. Removes level compiler and associated files. Replaces special level des-files with lua scripts. Exposes some NetHack internals to lua: - des-table with commands to create special levels - nh-table with NetHack core commands - nhc-table with some constants - u-table with some player-specific data (u-struct) - selection userdata Adds some rudimentary tests. Adds new extended command #wizloadlua to run a specific script, and #wizloaddes to run a specific level-creation script. nhlib.lua is loaded for every lua script. Download and untar lua: mkdir lib cd lib curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz tar zxf lua-5.3.5.tar.gz Then make nethack normally.
73 lines
2.5 KiB
Lua
73 lines
2.5 KiB
Lua
|
|
des.level_init({ style = "solidfill", fg = " " });
|
|
des.level_flags("mazelevel");
|
|
|
|
des.map([[
|
|
---------------------------------------------------------------------------
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
|.........................................................................|
|
|
---------------------------------------------------------------------------
|
|
]]);
|
|
|
|
|
|
if math.random(0,99) < 75 then
|
|
local terrains = { "-", "F", "L", "T", "C" };
|
|
local tidx = math.random(1, #terrains);
|
|
local choice = math.random(0, 4);
|
|
if choice == 0 then
|
|
des.terrain(selection.line(10,8, 65,8), terrains[tidx]);
|
|
elseif choice == 1 then
|
|
local sel = selection.new();
|
|
sel:line(15,4, 15, 13);
|
|
sel:line(59,4, 59, 13);
|
|
des.terrain(sel, terrains[tidx]);
|
|
elseif choice == 2 then
|
|
local sel = selection.new();
|
|
sel:line(10,8, 38, 8);
|
|
sel:line(37,8, 65, 8);
|
|
sel:line(37,3, 37, 8);
|
|
sel:line(37,8, 37,14);
|
|
des.terrain(sel, terrains[tidx]);
|
|
elseif choice == 3 then
|
|
des.terrain(selection.rect(4,4, 70,13), terrains[tidx]);
|
|
local sel = selection.new();
|
|
sel:line(25,4, 50,4);
|
|
sel:line(25,13, 50,13);
|
|
des.terrain(sel, '.');
|
|
else
|
|
end
|
|
end
|
|
|
|
des.region(selection.area(01,01, 73, 16), "lit");
|
|
|
|
des.stair("up");
|
|
des.stair("down");
|
|
|
|
des.non_diggable();
|
|
|
|
for i = 1,15 do
|
|
des.object();
|
|
end
|
|
|
|
for i = 1,6 do
|
|
des.trap();
|
|
end
|
|
|
|
for i = 1,28 do
|
|
des.monster();
|
|
end
|