MCPcopy Create free account
hub / github.com/NetHack/NetHack / l_obj_timer_start

Function l_obj_timer_start

src/nhlobj.c:578–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576/* start an object timer. */
577/* o:start_timer("hatch-egg", 10); */
578staticfn int
579l_obj_timer_start(lua_State *L)
580{
581 int argc = lua_gettop(L);
582
583 if (argc == 3) {
584 struct _lua_obj *lo = l_obj_check(L, 1);
585 short timertype = nhl_get_timertype(L, 2);
586 long when = luaL_checkinteger(L, 3);
587
588 if (timer_is_obj(timertype) && lo && lo->obj && when > 0) {
589 if (obj_has_timer(lo->obj, timertype))
590 stop_timer(timertype, obj_to_any(lo->obj));
591 start_timer(when, TIMER_OBJECT, timertype, obj_to_any(lo->obj));
592 }
593 } else
594 nhl_error(L, "l_obj_timer_start: Wrong args");
595 return 0;
596}
597
598/* bury an obj. returns true if object is gone (merged with ground),
599 false otherwise. */

Callers

nothing calls this directly

Calls 7

l_obj_checkFunction · 0.85
nhl_get_timertypeFunction · 0.85
obj_has_timerFunction · 0.85
stop_timerFunction · 0.85
obj_to_anyFunction · 0.85
start_timerFunction · 0.85
nhl_errorFunction · 0.85

Tested by

no test coverage detected