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

88
dat/asmodeus.lua Normal file
View File

@@ -0,0 +1,88 @@
-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $
-- Copyright (c) 1989 by Jean-Christophe Collet
-- Copyright (c) 1992 by M. Stephenson and Izchak Miller
-- NetHack may be freely redistributed. See license for details.
--
des.level_init({ style="mazegrid", bg ="-" });
des.level_flags("mazelevel", "noteleport")
-- First part
des.map({ halign = "half-left", valign = "center", map = [[
---------------------
|.............|.....|
|.............S.....|
|---+------------...|
|.....|.........|-+--
|..---|.........|....
|..|..S.........|....
|..|..|.........|....
|..|..|.........|-+--
|..|..-----------...|
|..S..........|.....|
---------------------
]] });
des.levregion({ region={01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1, type="stair-up" });
-- des.stair(levregion(01,00,6,20),levregion(6,1,70,16),up)
des.levregion({ region={01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1, type="branch" });
-- des.branch(levregion(01,00,6,20),levregion(6,1,70,16))
des.teleport_region({ region = {01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1 })
-- Doors
des.door("closed",04,03)
des.door("locked",18,04)
des.door("closed",18,08)
--
des.stair("down", 13,07)
-- Non diggable walls
des.non_diggable(selection.area(00,00,20,11))
-- Entire main area
des.region(selection.area(01,01,20,10),"unlit")
-- The fellow in residence
des.monster("Asmodeus",12,07)
-- Some random weapons and armor.
des.object("[")
des.object("[")
des.object(")")
des.object(")")
des.object("*")
des.object("!")
des.object("!")
des.object("?")
des.object("?")
des.object("?")
-- Some traps.
des.trap("spiked pit", 05,02)
des.trap("fire", 08,06)
des.trap("sleep gas")
des.trap("anti magic")
des.trap("fire")
des.trap("magic")
des.trap("magic")
-- Random monsters.
des.monster("ghost",11,07)
des.monster("horned devil",10,05)
des.monster("L")
-- Some Vampires for good measure
des.monster("V")
des.monster("V")
des.monster("V")
-- Second part
des.map({ halign = "half-right", valign = "center", map = [[
---------------------------------
................................|
................................+
................................|
---------------------------------
]] });
des.mazewalk(32,02,"east")
-- Non diggable walls
des.non_diggable(selection.area(00,00,32,04))
des.door("closed",32,02)
des.monster("&")
des.monster("&")
des.monster("&")
des.trap("anti magic")
des.trap("fire")
des.trap("magic")