Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game", "moveloop_turn", and "game_exit" which when defined, will be called from core code at the appropriate time. Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves, u.uhave_amulet, and u.depth.
This commit is contained in:
@@ -201,6 +201,8 @@ moveloop(boolean resuming)
|
||||
/* once-per-turn things go here */
|
||||
/********************************/
|
||||
|
||||
l_nhcore_call(NHCORE_MOVELOOP_TURN);
|
||||
|
||||
if (Glib)
|
||||
glibr();
|
||||
nh_timeout();
|
||||
@@ -633,6 +635,8 @@ newgame(void)
|
||||
* any artifacts */
|
||||
u_init();
|
||||
|
||||
l_nhcore_init();
|
||||
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||
#endif
|
||||
@@ -709,6 +713,8 @@ welcome(boolean new_game) /* false => restoring an old game */
|
||||
: "%s %s, the%s %s %s, welcome back to NetHack!",
|
||||
Hello((struct monst *) 0), g.plname, buf, g.urace.adj,
|
||||
(currentgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
|
||||
|
||||
l_nhcore_call(new_game ? NHCORE_START_NEW_GAME : NHCORE_RESTORE_OLD_GAME);
|
||||
}
|
||||
|
||||
#ifdef POSITIONBAR
|
||||
|
||||
Reference in New Issue
Block a user