diff options
author | Ryan Riegel <rriegs@gmail.com> | 2011-05-13 18:18:33 -0400 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2011-08-03 20:32:41 +1000 |
commit | 4cc71b6cb0a60b39c938dffd5390925da03930b3 (patch) | |
tree | 5d1e82124a0d51fa6b22b0ef61c6bcebc00bd596 /crawl-ref/source/l_moninf.cc | |
parent | 380cb09ff0b716c97f064a4740248ceaf02698b6 (diff) | |
download | crawl-ref-4cc71b6cb0a60b39c938dffd5390925da03930b3.tar.gz crawl-ref-4cc71b6cb0a60b39c938dffd5390925da03930b3.zip |
Several user-callable Lua functions. (#3967)
Added several Lua-callable functions for enhanced reasoning about items,
monsters, and player state.
Signed-off-by: Jude Brown <bookofjude@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/l_moninf.cc')
-rw-r--r-- | crawl-ref/source/l_moninf.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/l_moninf.cc b/crawl-ref/source/l_moninf.cc index 21eac329a1..d8e1dedc6a 100644 --- a/crawl-ref/source/l_moninf.cc +++ b/crawl-ref/source/l_moninf.cc @@ -39,6 +39,8 @@ void lua_push_moninf(lua_State *ls, monster_info *mi) MIRET1(number, damage_level, dam) MIRET1(boolean, is_safe, is(MB_SAFE)) +MIRET1(number, holiness, holi) +MIRET1(number, attitude, attitude) MIRET1(string, mname, mname.c_str()) MIRET1(number, type, type) MIRET1(number, base_type, base_type) @@ -53,6 +55,17 @@ LUAFN(moninf_get_is) return (1); } +LUAFN(moninf_get_is_unique) { + MONINF(ls, 1, mi); + // XXX: A bit of a hack to prevent using this to determine which is fake. + if (mi->type == MONS_MARA_FAKE) + lua_pushboolean(ls, true); + else + lua_pushboolean(ls, mons_is_unique(mi->type)); + return (1); +} + + LUAFN(moninf_get_damage_desc) { MONINF(ls, 1, mi); @@ -80,6 +93,9 @@ static const struct luaL_reg moninf_lib[] = MIREG(mname), MIREG(is), MIREG(is_safe), + MIREG(holiness), + MIREG(attitude), + MIREG(is_unique), MIREG(damage_level), MIREG(damage_desc), MIREG(desc), |