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

View File

@@ -80,18 +80,19 @@ VARDAT = $(VARDATD) $(VARDATND)
DATHELP = help hh cmdhelp keyhelp history opthelp wizhelp
SPEC_LEVS = asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev \
juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \
minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \
tower?.lev valley.lev wizard?.lev \
astral.lev air.lev earth.lev fire.lev water.lev
QUEST_LEVS = ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev
SPEC_LEVS = asmodeus.lua baalz.lua bigrm-*.lua castle.lua fakewiz?.lua \
juiblex.lua knox.lua medusa-?.lua minend-?.lua minefill.lua \
minetn-?.lua oracle.lua orcus.lua sanctum.lua soko?-?.lua \
tower?.lua valley.lua wizard?.lua nhlib.lua \
astral.lua air.lua earth.lua fire.lua water.lua
QUEST_LEVS = ???-goal.lua ???-fil?.lua ???-loca.lua ???-strt.lua
DATNODLB = $(VARDATND) license symbols
DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
DAT = $(DATNODLB) $(DATDLB)
$(GAME):
( cd lib/lua-5.3.5/src && make a && cp liblua.a ../../../src/ )
( cd src ; $(MAKE) )
all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
@@ -133,7 +134,6 @@ quest.dat: $(GAME)
( cd dat ; $(MAKE) quest.dat )
spec_levs: dungeon
( cd util ; $(MAKE) lev_comp )
( cd dat ; $(MAKE) spec_levs )
( cd dat ; $(MAKE) quest_levs )
@@ -288,6 +288,7 @@ clean:
( cd src ; $(MAKE) clean )
( cd util ; $(MAKE) clean )
( cd doc ; $(MAKE) clean )
( cd lib/lua-5.3.5/src && $(MAKE) clean )
# 'make spotless' returns the source tree to near-distribution condition.
# it removes .o files, executables, and compiled data files