Pasi Kallinen
a6dfbfca2f
Lua: Add contents function to room and map
...
The function will get the map/room width and height as a parameter.
2020-03-04 20:05:15 +02:00
Pasi Kallinen
00be8be45a
Start of lua api docs
...
... in asciidoc format. Use "asciidoctor -b html5 lua.adoc"
to generate the HTML version.
2020-03-02 18:10:35 +02:00
Pasi Kallinen
c9b21e36a7
Add lua selection match method
...
Also improve the replace_terrain command parameters.
2020-03-02 16:17:53 +02:00
Pasi Kallinen
297863d4bc
Fix room tests
2020-03-01 10:28:19 +02:00
Pasi Kallinen
ce3b45944b
Fix Fort Ludios room type
...
... and add an impossible when lua tries to create unknown room type.
2020-03-01 10:13:53 +02:00
Pasi Kallinen
22528d31f5
Allow coord in place of x and y in special level lua script
2020-02-28 22:14:36 +02:00
Pasi Kallinen
d86b7e8e7c
Demon lords and princes suppress teleporting in Gehennom
...
Instead of having the demon lair levels unconditionally no-teleport,
grant demon lords and princes the ability to suppress teleportation
in Gehennom on the level they are on.
2020-02-26 20:03:00 +02:00
Pasi Kallinen
816079c8dd
Lua: accept different params for gold function
2020-02-26 17:57:47 +02:00
Pasi Kallinen
7a54edf91f
Implement lua selection iteration
...
... and showcase it by dehardcoding the Fort Ludios treasury.
2020-02-26 17:25:28 +02:00
Pasi Kallinen
ccb00f59bc
Add new level init type, swamp
...
Creates a "relaxed blockwise maze".
Make Juiblex's swamp use it.
2020-02-25 19:24:58 +02:00
Pasi Kallinen
e56d3414a0
More noflip special levels
2020-02-24 19:08:58 +02:00
Pasi Kallinen
509576a8b7
Minor tweaks to level flipping
2020-02-23 15:06:44 +02:00
Pasi Kallinen
dc70132da8
Change lua selection floodfill and add some tests
2020-02-22 18:35:41 +02:00
Pasi Kallinen
fe3dae85d5
Make lua selection filter_mapchar create a new selection
2020-02-22 17:51:29 +02:00
Pasi Kallinen
50eaf95c27
Make lua selection grow create a new selection
2020-02-22 16:58:45 +02:00
Pasi Kallinen
6648ecfe04
Make lua selection randline create a new selection
2020-02-22 16:34:50 +02:00
Pasi Kallinen
b3f337bdf6
Make lua selection rect and fillrect create a new selection
2020-02-22 15:23:30 +02:00
Pasi Kallinen
44f7d44e94
Make lua selection line create a new selection
...
... instead of modifying the one given as a parameter.
Also add some tests for it.
2020-02-22 14:23:36 +02:00
Pasi Kallinen
00a32c6039
Make lua selection percent filter create a new selection
...
... instead of modifying the one given as a parameter.
Also add some tests for it.
2020-02-22 13:31:47 +02:00
Pasi Kallinen
42a05e9595
Make lua selection boolean opers create a new selection
...
... instead of modifying one of the given selections.
Also add tests for the operations.
2020-02-22 12:17:03 +02:00
Pasi Kallinen
e8ee044468
Make lua selection negate return a new selection
...
... instead of modifying the one given as a parameter.
Also add tests for it.
2020-02-22 12:17:03 +02:00
Pasi Kallinen
d76ffe43b7
Don't bother flipping oracle level
2020-02-21 21:32:18 +02:00
Pasi Kallinen
88aa0793dc
Allow flipping levels horizontally or vertically
...
When a special level is created, there's a chance it gets flipped
horizontally and/or vertically.
Add new level flags "noflip", "noflipx", and "noflipy" to prevent
flipping the level. Add a wiz-mode command #wizlevelflip to test
the flipping on current level - although this doesn't flip everything,
as level flipping is meant to happen during level creation.
2020-02-21 18:16:14 +02:00
Pasi Kallinen
49069d6d62
Split bound_digging function to two
...
Also remove a DCC 3.0 specific bug define,
doubt anyone is using that anymore ...
2020-02-18 16:53:14 +02:00
Pasi Kallinen
c7ec28f4c7
Fix symset menu
...
Symset entry index numbers weren't initialized when the symsets were
read from file, making the menu behave erratically. This looks like
a merge mistake.
2020-02-16 21:49:13 +02:00
Pasi Kallinen
f76aba4d7f
Prevent segfault in can_blnd
2020-02-16 11:22:18 +02:00
Pasi Kallinen
5885962efd
Alloc sizeof struct instead of pointer-to-struct
2020-02-13 22:06:50 +02:00
Pasi Kallinen
6fd51c29ef
Unify Bag of Holding item loss chance
2020-02-09 18:39:46 +02:00
Pasi Kallinen
39032d2fac
Fix the selection param unify
2020-02-09 14:47:41 +02:00
Pasi Kallinen
e182ff428b
Unify lua setting wallprop
2020-02-09 14:30:11 +02:00
Pasi Kallinen
ced327fdf5
Unify some exported lua script params
2020-02-09 13:44:04 +02:00
Pasi Kallinen
1e915a9a52
Unify revealing hiding monsters for mvm attacks
...
Whether the monster-vs-monster hits or misses, hiders
are revealed the same way. Unify that part of the code.
Use git show --patience to have a better view of the changes.
2020-02-08 23:41:36 +02:00
Pasi Kallinen
df137029c0
Unify finding room pos for some features
2020-02-08 19:47:36 +02:00
Pasi Kallinen
0f16a48aaf
Unify (un)locking boxes in inventory
2020-02-08 18:56:40 +02:00
Pasi Kallinen
58677b9e95
Unify inventory letter value for sortloot
2020-02-08 18:42:06 +02:00
Pasi Kallinen
7eb20c9e7a
Unify multishot class bonus code
2020-02-08 18:04:54 +02:00
Pasi Kallinen
0323eecbfe
Unify finding a queen bee
2020-02-08 17:35:52 +02:00
Pasi Kallinen
c585c65042
Add some stair helper functions
2020-02-08 17:08:26 +02:00
Pasi Kallinen
9e4319824d
Fix digging through iron bars from adjacent pit
...
It was possible to create a pit on top of iron bars, by first creating
a pit next to the bars, going down into the pit, and then digging sideways
towards the bars. This did not destroy the iron bars.
2020-02-08 17:08:17 +02:00
Pasi Kallinen
c2e8703fe0
Unify breamm and breamu
...
Monster vs monster breath attacks were using nearly the same code
as monster vs hero - unify the code
2020-02-08 14:19:17 +02:00
Pasi Kallinen
7ca4ae7c4b
YAFM tweak
2020-02-07 23:44:06 +02:00
Pasi Kallinen
4943fe23b3
YAFM when sitting on a towel
...
(via xNetHack)
2020-02-07 23:16:23 +02:00
Pasi Kallinen
a9c41d2ae0
YAFM when restoring a game while hallu
...
(via xNetHack)
2020-02-07 23:08:18 +02:00
Pasi Kallinen
eed37c9a84
Allow #wizgenesis quantity in the prompt
...
The #wizgenesis command can also accept a quantity in the input prompt,
previously it only accepted a command repeat prefix.
(via UnNetHack, originally from NetHack4)
2020-02-07 19:11:18 +02:00
Pasi Kallinen
b12ea03d11
Allow monsters to rummage through containers
2020-02-02 11:05:43 +02:00
Pasi Kallinen
dcdb8d437b
Dehardcode sanctum temple secret door
2020-02-01 21:30:50 +02:00
Pasi Kallinen
bb1925a957
Dehardcode wizard1 morgue secret door
2020-02-01 20:20:25 +02:00
Pasi Kallinen
33cd6befe0
Dehardcode minefill
...
Instead of hardcoding the minefill levels in the core,
allow defining fill levels for a dungeon branch in the dungeon.lua
2020-02-01 18:31:39 +02:00
Pasi Kallinen
d44c83d45f
Allow applying royal jelly on an egg
...
Royal jelly applied on an egg will change a killer bee egg to
a queen bee egg. Cursed jelly will kill the egg, uncursed and blessed
will revive it. Blessed jelly will also make the creature think
you're the parent.
Original patch was by Kenneth Call
2020-01-31 10:39:40 +02:00
Pasi Kallinen
c03b6db884
Fix quest text mistake
2020-01-29 17:25:16 +02:00
Pasi Kallinen
0500f54742
Use nh_getenv just in case
2020-01-27 18:03:42 +02:00
Pasi Kallinen
4add2cdc54
Doc copypaste error
2020-01-27 10:20:31 +02:00
Pasi Kallinen
1783b9de3e
Doc and sample config for MSDOS video resolution
2020-01-27 10:13:48 +02:00
Pasi Kallinen
aa7f098af1
Cloud wish should block vision
2020-01-26 14:33:11 +02:00
Pasi Kallinen
ae843bc10a
Allow wizmode wishing for cloud terrain
2020-01-26 14:05:11 +02:00
Pasi Kallinen
2ba3fa9240
Fix warning on nonexistent quest.lua text
...
Cavemen don't have goal_alt message - before lua, that one
fell through into goal_next message, but now it tried to
load the "common" message. Add ability to define message fallbacks,
and make goal_next the fallback for goal_alt.
Also prevent issuing quest.lua errors twice.
2020-01-19 14:09:16 +02:00
Pasi Kallinen
f4ab235b81
Prevent accessing outside the mons array
...
Fix another out-of-bounds error
Monster trying to decide if a tin could cure stoning looking at
a special or empty tin would do acidic(&mons[-1])
2020-01-16 10:14:16 -05:00
Pasi Kallinen
5e307335c3
Add missing NULLs to lua function reg array
2020-01-07 08:44:36 +02:00
Pasi Kallinen
f83dede8e5
Fixes for degenerate RNG
...
Assume a degenerate RNG that always returns the same number.
With these fixes, the game starts and is almost playable.
There are still some places that will go into infinite loop, eg.
the mines level generation.
2020-01-06 11:48:19 +02:00
Pasi Kallinen
cedc757e16
Unify random light state for rooms or level
2020-01-05 13:31:24 +02:00
Pasi Kallinen
1db0a5dda0
Fix unused param warning
2020-01-04 17:26:53 +02:00
Pasi Kallinen
1d312ee3fe
Add some player lua methods
...
Adds u.clear_inventory() and u.giveobj(new.obj("rock")) and some other minor stuff.
2020-01-04 16:55:53 +02:00
Pasi Kallinen
a018930964
Update map glyph when placing obj on map via lua
2020-01-04 11:35:17 +02:00
Pasi Kallinen
7e07cef197
Lua struct obj improvements
...
If the core frees the obj struct referred by lua, don't free it,
just mark it as OBJ_LUAFREE - lua will free it in gc once all
the references to it are gone.
2020-01-01 13:25:59 +02:00
Pasi Kallinen
2dda1c43b2
Fix heap-use-after-free when rewielding partial stack
2019-12-29 17:28:15 +02:00
Pasi Kallinen
4c82594193
Fix another out-of-bounds error
...
Monster trying to decide if a tin could cure stoning looking at
a special or empty tin would do acidic(&mons[-1])
2019-12-29 16:36:54 +02:00
Pasi Kallinen
6d8d3a9557
Add lua object references
...
Whenever a lua script references a core struct obj, increment a counter
in the obj struct. Core code will not free the obj, if there are any
lua references pointing to it, just makes it free-floating.
When lua script ends, the lua gc will free the free-floating objects.
Also exposes u.inventory to lua.
Breaks save and bones compat.
2019-12-26 19:15:24 +02:00
Pasi Kallinen
fc0596d529
Fix Qt compile
2019-12-23 17:24:41 +02:00
Pasi Kallinen
370cfad85a
Fix X11 compile
2019-12-23 16:45:25 +02:00
Pasi Kallinen
2c3be8ebe1
Prevent accessing outside the mons array
2019-12-20 15:19:14 +02:00
Pasi Kallinen
98cb3ff161
Prevent fuzzer using wizloadlua and wizloaddes
...
Otherwise the fuzzer will enter a nonexistent file name, and stop.
2019-12-20 13:48:39 +02:00
Pasi Kallinen
b24f4c5929
Expose traps to lua
2019-12-15 18:16:41 +02:00
Pasi Kallinen
1d9ba3e212
Expose objects array to lua
2019-12-12 13:39:20 +02:00
Pasi Kallinen
027024d27f
More wish parser tests
2019-12-12 07:58:06 +02:00
Pasi Kallinen
7043e2134a
Lua NetHack obj bindings
2019-12-11 20:10:59 +02:00
Pasi Kallinen
2cb46c4153
Initialize object containment field
...
This is 3.7 bug caused by the lua implementation, so no fixes entry.
2019-12-08 11:53:01 +02:00
Pasi Kallinen
f8a1059a87
Read lua files more efficiently
...
... replacing horribly hacky loop.
2019-11-29 21:49:03 +02:00
Pasi Kallinen
ddd8b7d9a5
Remove vestiges of quest text data file
2019-11-25 16:30:54 +02:00
Pasi Kallinen
b66bcc2f5a
Fix lua quest data output types
...
...so the texts are given exactly the same way as they were given previously.
2019-11-25 09:21:37 +02:00
Pasi Kallinen
8b7aea7dee
Merge branch 'paxed-quest-lua' into NetHack-3.7
2019-11-25 07:30:51 +02:00
Pasi Kallinen
350371e030
Don't remove dungeon.lua with make spotless
2019-11-24 19:39:31 +02:00
Pasi Kallinen
8b87013fba
Move quest texts to lua
2019-11-24 17:41:39 +02:00
Pasi Kallinen
3afbcb76f5
Minor msdos cross compile improvements
2019-11-23 23:40:25 +02:00
Pasi Kallinen
acf48fa305
Fix the lua integration parts marked for review
...
Also, explicitly allow traps of type "random".
2019-11-23 17:42:14 +02:00
Pasi Kallinen
5cad6a15dc
More hallu monsters
2019-11-22 09:24:19 +02:00
Pasi Kallinen
cb4d350424
Fix unnecessary string copy
2019-11-20 21:20:35 +02:00
Pasi Kallinen
a338f8bd88
Fix wizmakemap calling mklev twice
2019-11-20 21:08:35 +02:00
Pasi Kallinen
791657f4e6
Fix memory leaks in lua integration
2019-11-20 20:09:16 +02:00
Pasi Kallinen
786a90415e
Fix some memory leaks
2019-11-19 17:31:50 +02:00
Pasi Kallinen
65ccd1d89e
Fix double DLB definition in linux hints file
2019-11-18 09:16:51 +02:00
Pasi Kallinen
c2f7fb7d84
Fix heap-use-after-free
...
bcsign was used on a freed obj
2019-11-11 18:46:19 +02:00
Pasi Kallinen
a6b752e6f1
Lua: Default dungeon and level chance is 100
2019-11-10 17:36:59 +02:00
Pasi Kallinen
32f2fdb135
Remove leftover level compiler header
2019-11-07 19:40:41 +02:00
Pasi Kallinen
6f5a50a538
Move and remove test files
2019-11-07 19:32:36 +02:00
Pasi Kallinen
4e438e0146
Use lua_tointeger instead of lua_tonumber
2019-11-07 19:28:58 +02:00
Pasi Kallinen
468ba1071d
Remove the hints file change for extra warnings
2019-11-07 18:45:42 +02:00
Pasi Kallinen
6dca5e0a49
Fix couple warnings
...
Alloc failure is already handled.
2019-11-07 18:13:48 +02:00
Pasi Kallinen
1908017e27
Fixes typo
2019-11-07 11:23:28 +02:00
Pasi Kallinen
9cd9280276
Lua: remove dgn_comp, use lua instead
2019-11-06 18:45:10 +02:00
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