Lua: object timers
Expose object timers to lua scripts. For example:
local o = obj.new("cockatrice egg");
o:placeobj(5, 5);
o:start_timer("hatch-egg", 3);
Available methods are:
- obj.has_timer("rot-corpse")
returns true if object has attached timer, false otherwise.
- obj.peek_timer("hatch-egg")
returns an integer value, which is the turn when the timer
attached to the object would trigger. returns 0 if no such timer.
- obj.stop_timer("shrink-glob")
stops attached timer, or if no timer type is given, stops all
timers attached to the object.
- obj.start_timer("zombify-mon", 15)
starts a timer with a trigger time in that many turns in the future.
replaces any previous timer of the same type.
Valid timers are "rot-organic", "rot-corpse", "revive-mon",
"zombify-mon", "burn-obj", "hatch-egg", "fig-transform",
and "shrink-glob". Also "melt-ice" is recognized, but does nothing
to objects.
This commit is contained in:
@@ -1755,6 +1755,7 @@ extern void nhl_error(lua_State *, const char *) NORETURN;
|
||||
extern void lcheck_param_table(lua_State *);
|
||||
extern schar get_table_mapchr(lua_State *, const char *);
|
||||
extern schar get_table_mapchr_opt(lua_State *, const char *, schar);
|
||||
extern short nhl_get_timertype(lua_State *, int);
|
||||
extern void nhl_add_table_entry_int(lua_State *, const char *, int);
|
||||
extern void nhl_add_table_entry_char(lua_State *, const char *, char);
|
||||
extern void nhl_add_table_entry_str(lua_State *, const char *, const char *);
|
||||
|
||||
Reference in New Issue
Block a user