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

50
dat/minefill.lua Normal file
View File

@@ -0,0 +1,50 @@
-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $
-- Copyright (c) 1989-95 by Jean-Christophe Collet
-- Copyright (c) 1991-95 by M. Stephenson
-- NetHack may be freely redistributed. See license for details.
--
--
-- The "fill" level for the mines.
--
-- This level is used to fill out any levels not occupied by
-- specific levels.
--
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel");
des.level_init({ style="mines", fg=".", bg=" ", smoothed=true ,joined=true, lit="random", walled=true })
--
des.stair("up")
des.stair("down")
--
des.object("*")
des.object("*")
des.object("*")
des.object("(")
des.object()
des.object()
des.object()
--
des.monster("gnome")
des.monster("gnome")
des.monster("gnome")
des.monster("gnome")
des.monster("gnome")
des.monster("gnome")
des.monster("gnome")
des.monster("gnome lord")
des.monster("dwarf")
des.monster("dwarf")
des.monster("G")
des.monster("G")
des.monster("h")
--
des.trap()
des.trap()
des.trap()
des.trap()
des.trap()
des.trap()