| 460 | } |
| 461 | |
| 462 | staticfn boolean |
| 463 | can_do_extcmd(const struct ext_func_tab *extcmd) |
| 464 | { |
| 465 | int ecflags = extcmd->flags; |
| 466 | |
| 467 | if (gl.luacore && nhcb_counts[NHCB_CMD_BEFORE]) { |
| 468 | lua_getglobal(gl.luacore, "nh_callback_run"); |
| 469 | lua_pushstring(gl.luacore, nhcb_name[NHCB_CMD_BEFORE]); |
| 470 | lua_pushstring(gl.luacore, extcmd->ef_txt); |
| 471 | nhl_pcall_handle(gl.luacore, 2, 1, "can_do_extcmd", NHLpa_panic); |
| 472 | if (!lua_toboolean(gl.luacore, -1)) { |
| 473 | lua_settop(gl.luacore, 0); |
| 474 | return FALSE; |
| 475 | } |
| 476 | lua_settop(gl.luacore, 0); |
| 477 | } |
| 478 | |
| 479 | if (!wizard && (ecflags & WIZMODECMD)) { |
| 480 | pline(unavailcmd, extcmd->ef_txt); |
| 481 | return FALSE; |
| 482 | } else if (u.uburied && !(ecflags & IFBURIED)) { |
| 483 | You_cant("do that while you are buried!"); |
| 484 | return FALSE; |
| 485 | } else if (iflags.debug_fuzzer && (ecflags & NOFUZZERCMD)) { |
| 486 | return FALSE; |
| 487 | } |
| 488 | return TRUE; |
| 489 | } |
| 490 | |
| 491 | /* here after # - now read a full-word command */ |
| 492 | int |
no test coverage detected