Files
nethack/dat/Bar-strt.lua
Pasi Kallinen fd55d9118e 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.
2019-11-06 18:43:20 +02:00

104 lines
4.5 KiB
Lua

-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $
-- 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, Pelias,
-- and receive your quest assignment.
--
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel", "noteleport", "hardfloor")
des.map([[
..................................PP........................................
...................................PP.......................................
...................................PP.......................................
....................................PP......................................
........--------------......-----....PPP....................................
........|...S........|......+...|...PPP.....................................
........|----........|......|...|....PP.....................................
........|.\..........+......-----...........................................
........|----........|...............PP.....................................
........|...S........|...-----.......PPP....................................
........--------------...+...|......PPPPP...................................
.........................|...|.......PPP....................................
...-----......-----......-----........PP....................................
...|...+......|...+..--+--.............PP...................................
...|...|......|...|..|...|..............PP..................................
...-----......-----..|...|.............PPPP.................................
.....................-----............PP..PP................................
.....................................PP...PP................................
....................................PP...PP.................................
....................................PP....PP................................
]]);
-- the forest beyond the river
des.replace_terrain({ region={37,00, 59,19}, fromterrain=".", toterrain="T", chance=5 })
des.replace_terrain({ region={60,00, 64,19}, fromterrain=".", toterrain="T", chance=10 })
des.replace_terrain({ region={65,00, 75,19}, fromterrain=".", toterrain="T", chance=20 })
-- guarantee a path and free spot for the portal
des.terrain(selection.randline(selection.new(), 37,7, 62,02, 7), ".")
des.terrain({62,02}, ".")
-- Dungeon Description
des.region(selection.area(00,00,75,19), "lit")
des.region(selection.area(09,05,11,05), "unlit")
des.region(selection.area(09,07,11,07), "lit")
des.region(selection.area(09,09,11,09), "unlit")
des.region(selection.area(13,05,20,09), "lit")
des.region(selection.area(29,05,31,06), "lit")
des.region(selection.area(26,10,28,11), "lit")
des.region(selection.area(04,13,06,14), "lit")
des.region(selection.area(15,13,17,14), "lit")
des.region(selection.area(22,14,24,15), "lit")
-- Stairs
des.stair("down", 09,09)
-- Portal arrival point
des.levregion({ region = {62,02,62,02}, type="branch" })
-- Doors
des.door("locked",12,05)
des.door("locked",12,09)
des.door("closed",21,07)
des.door("open",07,13)
des.door("open",18,13)
des.door("open",23,13)
des.door("open",25,10)
des.door("open",28,05)
-- Elder
des.monster("Pelias", 10, 07)
-- The treasure of Pelias
des.object("chest", 09, 05)
-- chieftain guards for the audience chamber
des.monster("chieftain", 10, 05)
des.monster("chieftain", 10, 09)
des.monster("chieftain", 11, 05)
des.monster("chieftain", 11, 09)
des.monster("chieftain", 14, 05)
des.monster("chieftain", 14, 09)
des.monster("chieftain", 16, 05)
des.monster("chieftain", 16, 09)
-- Non diggable walls
des.non_diggable(selection.area(00,00,75,19))
-- One trap to keep the ogres at bay.
des.trap("spiked pit",37,07)
-- Eels in the river
des.monster("giant eel", 36, 01)
des.monster("giant eel", 37, 09)
des.monster("giant eel", 39, 15)
-- Monsters on siege duty.
des.monster({ id = "ogre", x=40, y=08, peaceful=0 })
des.monster({ id = "ogre", x=41, y=06, peaceful=0 })
des.monster({ id = "ogre", x=41, y=07, peaceful=0 })
des.monster({ id = "ogre", x=41, y=08, peaceful=0 })
des.monster({ id = "ogre", x=41, y=09, peaceful=0 })
des.monster({ id = "ogre", x=41, y=10, peaceful=0 })
des.monster({ id = "ogre", x=42, y=06, peaceful=0 })
des.monster({ id = "ogre", x=42, y=07, peaceful=0 })
des.monster({ id = "ogre", x=42, y=08, peaceful=0 })
des.monster({ id = "ogre", x=42, y=09, peaceful=0 })
des.monster({ id = "ogre", x=42, y=10, peaceful=0 })