| 576 | /* start an object timer. */ |
| 577 | /* o:start_timer("hatch-egg", 10); */ |
| 578 | staticfn int |
| 579 | l_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. */ |
nothing calls this directly
no test coverage detected