From 41ad58a56c0f9d27ca61709141115981520fc9ea Mon Sep 17 00:00:00 2001 From: Fate Date: Sat, 29 Nov 2008 19:27:13 -0700 Subject: Added SLang function `is_dead' --- doc/spell-language | 4 ++++ src/map/magic-expr.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/spell-language b/doc/spell-language index 5b0e5bb..d5f99d8 100644 --- a/doc/spell-language +++ b/doc/spell-language @@ -550,6 +550,10 @@ The following functions are available: otherwise NE, SE, NW, SW will also be used. The two locations must be on the same map. + + is_dead : entity -> bool + Determines whether the specified entity is no longer alive. + + Operations: ----------- This section documents the operations API. diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index 0c5b9ce..7840941 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -722,6 +722,14 @@ fun_is_married(env_t *env, int args_nr, val_t *result, val_t *args) return 0; } +static int +fun_is_dead(env_t *env, int args_nr, val_t *result, val_t *args) +{ + RESULTINT = (ETY(0) == BL_PC + && pc_isdead(ARGPC(0))); + return 0; +} + static int fun_partner(env_t *env, int args_nr, val_t *result, val_t *args) { @@ -1164,6 +1172,7 @@ static fun_t functions[] = { { "map_level", "l", 'i', fun_map_level }, { "map_nr", "l", 'i', fun_map_nr }, { "dir_towards", "lli", 'd', fun_dir_towards }, + { "is_dead", "e", 'i', fun_is_dead }, { NULL, NULL, '.', NULL } }; -- cgit v1.2.3-70-g09d2