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

91
dat/Cav-strt.lua Normal file
View File

@@ -0,0 +1,91 @@
-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $
-- Copyright (c) 1989 by Jean-Christophe Collet
-- Copyright (c) 1991 by M. Stephenson
-- NetHack may be freely redistributed. See license for details.
--
--
-- The "start" level for the quest.
--
-- Here you meet your (besieged) class leader, Shaman Karnov
-- and receive your quest assignment.
--
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel", "noteleport", "hardfloor")
des.map([[
...... .......................... ... .... ......
...... .......................... ........ .... .....
..BB ............................. ......... .... ..
.. ...................... ....... .. .... ..
.. .................... .. ....... .. ...
.. S BB ..... ....... .... ....
.. ... . .. ........ .. .. .. ...
.. ...... .. ............ .. ...
. .... .. ........ .. ...........
... .. .. ............. ...................
..... ..... ............................... ...........
.....B................ ... ...
..... . .......... .... . ... .......... ...
... .. ............. .. ................... ....
BB .. ......... BB ... .......... .. ... ...
...... ..... B ........ .. .. .... ...
.......... .......... ..... ... ..... ........
.. ... . ..... .... .. ... ..
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "unlit")
des.region({ region={13,01, 40,05}, lit=1, type="temple", prefilled=0, irregular=1 })
-- The occupied rooms.
des.region({ region={02,01, 08,03}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={01,11, 06,14}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={13,08, 18,10}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={05,17, 14,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={17,16, 23,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={35,16, 44,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
-- Stairs
des.stair("down", 02,03)
-- Portal arrival point
des.levregion({ region = {71,09,71,09}, type="branch" })
-- Doors
des.door("locked",19,06)
-- The temple altar (this will force a priest(ess) to be created)
des.altar({ x=36,y=02, align="coaligned", type="shrine" })
-- Shaman Karnov
des.monster("Shaman Karnov", 35, 02)
-- The treasure of Shaman Karnov
des.object("chest", 34, 02)
-- neanderthal guards for the audience chamber
des.monster("neanderthal", 20, 03)
des.monster("neanderthal", 20, 02)
des.monster("neanderthal", 20, 01)
des.monster("neanderthal", 21, 03)
des.monster("neanderthal", 21, 02)
des.monster("neanderthal", 21, 01)
des.monster("neanderthal", 22, 01)
des.monster("neanderthal", 26, 09)
-- Non diggable walls
des.non_diggable(selection.area(00,00,75,19))
-- Random traps
des.trap("pit",47,11)
des.trap("pit",57,10)
des.trap()
des.trap()
des.trap()
des.trap()
-- Monsters on siege duty (in the outer caves).
des.monster({ id ="bugbear", x=47, y=02, peaceful=0 })
des.monster({ id ="bugbear", x=48, y=03, peaceful=0 })
des.monster({ id ="bugbear", x=49, y=04, peaceful=0 })
des.monster({ id ="bugbear", x=67, y=03, peaceful=0 })
des.monster({ id ="bugbear", x=69, y=04, peaceful=0 })
des.monster({ id ="bugbear", x=51, y=13, peaceful=0 })
des.monster({ id ="bugbear", x=53, y=14, peaceful=0 })
des.monster({ id ="bugbear", x=55, y=15, peaceful=0 })
des.monster({ id ="bugbear", x=63, y=10, peaceful=0 })
des.monster({ id ="bugbear", x=65, y=09, peaceful=0 })
des.monster({ id ="bugbear", x=67, y=10, peaceful=0 })
des.monster({ id ="bugbear", x=69, y=11, peaceful=0 })
des.wallify()