summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_moninf.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-04-04 22:21:24 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-04-04 22:21:24 +0200
commit620290a1e09036ae0081441c1145b10d1bada795 (patch)
tree93b8c614e71a89719154a7475a1df2b85d5926c8 /crawl-ref/source/l_moninf.cc
parent625c816a69e6f19d535184ed69739ffcdc2fa14c (diff)
downloadcrawl-ref-620290a1e09036ae0081441c1145b10d1bada795.tar.gz
crawl-ref-620290a1e09036ae0081441c1145b10d1bada795.zip
Add monster.is_constricting_you() to lua.
If there are two hostile nagas, one constricting you and another a summon of yours, it was impossible to tell which one is which. And sadly, lua has currently no way to pass "you".
Diffstat (limited to 'crawl-ref/source/l_moninf.cc')
-rw-r--r--crawl-ref/source/l_moninf.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/l_moninf.cc b/crawl-ref/source/l_moninf.cc
index 026e0fd241..6e6a63a587 100644
--- a/crawl-ref/source/l_moninf.cc
+++ b/crawl-ref/source/l_moninf.cc
@@ -117,6 +117,24 @@ LUAFN(moninf_get_is_constricting)
return (1);
}
+LUAFN(moninf_get_is_constricting_you)
+{
+ MONINF(ls, 1, mi);
+ if (!you.is_constricted())
+ {
+ lua_pushboolean(ls, false);
+ return (1);
+ }
+ for (int i = 0; i < MAX_CONSTRICT; i++)
+ if (mi->constricting_name[i] == "you") // yay the interface
+ {
+ lua_pushboolean(ls, true);
+ return (1);
+ }
+ lua_pushboolean(ls, false);
+ return (1);
+}
+
LUAFN(moninf_get_is_unique)
{
MONINF(ls, 1, mi);
@@ -163,6 +181,7 @@ static const struct luaL_reg moninf_lib[] =
MIREG(threat),
MIREG(is_constricted),
MIREG(is_constricting),
+ MIREG(is_constricting_you),
MIREG(is_unique),
MIREG(damage_level),
MIREG(damage_desc),