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

Function nhl_timer_has_at

src/nhlua.c:1527–1553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1525/* local has_melttimer = nh.has_timer_at(x,y, "melt-ice"); */
1526/* local has_melttimer = nh.has_timer_at({x=4,y=7}, "melt-ice"); */
1527staticfn int
1528nhl_timer_has_at(lua_State *L)
1529{
1530 boolean ret = FALSE;
1531 short timertype = nhl_get_timertype(L, -1);
1532 lua_Integer lx, ly;
1533 coordxy x, y;
1534 long when;
1535
1536 lua_pop(L, 1); /* remove timertype */
1537 if (!nhl_get_xy_params(L, &lx, &ly)) {
1538 nhl_error(L, "nhl_timer_has_at: Wrong args");
1539 /*NOTREACHED*/
1540 return 0;
1541 }
1542
1543 x = (coordxy) lx;
1544 y = (coordxy) ly;
1545 cvt_to_abscoord(&x, &y);
1546
1547 if (isok(x, y)) {
1548 when = spot_time_expires(x, y, timertype);
1549 ret = (when > 0L);
1550 }
1551 lua_pushboolean(L, ret);
1552 return 1;
1553}
1554
1555/* when does location at x,y timer trigger? */
1556/* local melttime = nh.peek_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