MCPcopy Index your code
hub / github.com/NetHack/NetHack / nhl_timer_peek_at

Function nhl_timer_peek_at

src/nhlua.c:1558–1581  ·  view source on GitHub ↗

when does location at x,y timer trigger? */ local melttime = nh.peek_timer_at(x,y, "melt-ice"); */ local melttime = nh.peek_timer_at({x=5,y=6}, "melt-ice"); */

Source from the content-addressed store, hash-verified

1556/* local melttime = nh.peek_timer_at(x,y, "melt-ice"); */
1557/* local melttime = nh.peek_timer_at({x=5,y=6}, "melt-ice"); */
1558staticfn int
1559nhl_timer_peek_at(lua_State *L)
1560{
1561 long when = 0L;
1562 short timertype = nhl_get_timertype(L, -1);
1563 lua_Integer lx, ly;
1564 coordxy x, y;
1565
1566 lua_pop(L, 1); /* remove timertype */
1567 if (!nhl_get_xy_params(L, &lx, &ly)) {
1568 nhl_error(L, "nhl_timer_peek_at: Wrong args");
1569 /*NOTREACHED*/
1570 return 0;
1571 }
1572
1573 x = (coordxy) lx;
1574 y = (coordxy) ly;
1575 cvt_to_abscoord(&x, &y);
1576
1577 if (timer_is_pos(timertype) && isok(x, y))
1578 when = spot_time_expires(x, y, timertype);
1579 lua_pushinteger(L, when);
1580 return 1;
1581}
1582
1583/* stop timer at location x,y */
1584/* nh.stop_timer_at(x,y, "melt-ice"); */

Callers

nothing calls this directly

Calls 6

nhl_get_timertypeFunction · 0.85
nhl_get_xy_paramsFunction · 0.85
nhl_errorFunction · 0.85
cvt_to_abscoordFunction · 0.85
isokFunction · 0.85
spot_time_expiresFunction · 0.85

Tested by

no test coverage detected