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.
183 lines
6.6 KiB
Lua
183 lines
6.6 KiB
Lua
-- 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.
|
|
--
|
|
-- Minetown variant 2
|
|
-- "Town Square"
|
|
|
|
des.room({ type = "ordinary", lit=1, x=3, y=3,
|
|
xalign="center", yalign="center", w=31, h=15,
|
|
contents = function()
|
|
des.feature("fountain", 17, 5)
|
|
des.feature("fountain", 13, 8)
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", x=2,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="west" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=0, x=5,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="south" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", x=8,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="east" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=1, x=16,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="west" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=0, x=19,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="south" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", x=22,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="south" })
|
|
des.monster("gnome")
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=0, x=25,y=0, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="east" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=1, x=2,y=5, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="north" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=1, x=5,y=5, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="closed", wall="south" })
|
|
end
|
|
})
|
|
end
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", x=8,y=5, w=2,h=2,
|
|
contents = function()
|
|
des.door({ state="locked", wall="north" })
|
|
des.monster("gnome")
|
|
end
|
|
})
|
|
end
|
|
|
|
des.room({ type="shop", chance=90, lit=1, x=2,y=10, w=4,h=3,
|
|
contents = function()
|
|
des.door({ state="closed", wall="west" })
|
|
end
|
|
});
|
|
|
|
des.room({ type = "tool shop", chance=90, lit=1, x=23,y=10, w=4,h=3,
|
|
contents = function()
|
|
des.door({ state="closed", wall="east" })
|
|
end
|
|
});
|
|
|
|
des.room({ type = "food shop", chance=90, lit=1, x=24,y=5, w=3,h=4,
|
|
contents = function()
|
|
des.door({ state="closed", wall="north" })
|
|
end
|
|
});
|
|
|
|
des.room({ type = "candle shop", lit=1, x=11,y=10, w=4,h=3,
|
|
contents = function()
|
|
des.door({ state="closed", wall="east" })
|
|
end
|
|
});
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=0, x=7,y=10, w=3,h=3,
|
|
contents = function()
|
|
des.door({ state="locked", wall="north" })
|
|
des.monster("gnome")
|
|
end
|
|
});
|
|
end
|
|
|
|
des.room({ type = "temple", lit=1, x=19,y=5, w=4,h=4,
|
|
contents = function()
|
|
des.door({ state="closed", wall="north" })
|
|
des.altar({ x=02, y=02, align=align[1],type="shrine" })
|
|
des.monster("gnomish wizard")
|
|
des.monster("gnomish wizard")
|
|
end
|
|
});
|
|
|
|
if math.random(0,99) < 75 then
|
|
des.room({ type = "ordinary", lit=1, x=18,y=10, w=4,h=3,
|
|
contents = function()
|
|
des.door({ state="locked", wall="west" })
|
|
des.monster("gnome lord")
|
|
end
|
|
});
|
|
end
|
|
|
|
-- The Town Watch
|
|
des.monster({ id = "watchman", peaceful = 1 })
|
|
des.monster({ id = "watchman", peaceful = 1 })
|
|
des.monster({ id = "watchman", peaceful = 1 })
|
|
des.monster({ id = "watchman", peaceful = 1 })
|
|
des.monster({ id = "watch captain", peaceful = 1 })
|
|
end
|
|
});
|
|
|
|
des.room({ contents = function()
|
|
des.stair("up")
|
|
end
|
|
});
|
|
|
|
des.room({ contents = function()
|
|
des.stair("down")
|
|
des.trap()
|
|
des.monster("gnome")
|
|
des.monster("gnome")
|
|
end
|
|
});
|
|
|
|
des.room({ contents = function()
|
|
des.monster("dwarf")
|
|
end
|
|
});
|
|
|
|
des.room({ contents = function()
|
|
des.trap()
|
|
des.monster("gnome")
|
|
end
|
|
});
|
|
|
|
des.random_corridors()
|
|
|