Use lua for special level files

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.
This commit is contained in:
Pasi Kallinen
2019-05-10 21:11:50 +03:00
parent 3e029d2900
commit fd55d9118e
189 changed files with 16653 additions and 27346 deletions

48
dat/bigrm-7.lua Normal file
View File

@@ -0,0 +1,48 @@
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel");
des.map([[
-----
---------...---
---------.........L...---
---------.......................---
---------.................................---
---------...........................................---
---------.....................................................---
|--------...............................................................--|
|.........................................................................|
|.L.....................................................................L.|
|.........................................................................|
|--...............................................................--------|
---.....................................................---------
---...........................................---------
---.................................---------
---.......................---------
---...L.........---------
---...---------
-----
]]);
local terrain = { "L", "T", "{", "." };
local tidx = math.random(1, #terrain);
des.replace_terrain({ region={00,00, 74,18}, fromterrain="L", toterrain=terrain[tidx] });
des.region(selection.area(01,01,73,17), "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