diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 28 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index e19224a..d14f5b0 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -110,6 +110,7 @@ HPExport void plugin_init (void) addScriptCommand("getareadropitem", "siiiiv*", getAreaDropItem); addScriptCommand("setmount", "?", setMount); addScriptCommand("clientcommand", "s", clientCommand); + addScriptCommand("isunitwalking", "?", isUnitWalking); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index fe014dd..02e34a4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10,6 +10,7 @@ #include "../../../common/mmo.h" #include "../../../common/socket.h" #include "../../../common/strlib.h" +#include "../../../common/timer.h" #include "../../../map/chrif.h" #include "../../../map/clif.h" #include "../../../map/npc.h" @@ -1118,3 +1119,30 @@ BUILDIN(clientCommand) send_client_command(sd, command); return true; } + +BUILDIN(isUnitWalking) +{ + int id = 0; + if (script_hasdata(st, 2)) + id = script_getnum(st, 2); + else + id = st->oid; + struct block_list *bl = map->id2bl(id); + if (!bl) + { + ShowWarning("invalid unit id\n"); + script->reportsrc(st); + script_pushint(st, 0); + return false; + } + struct unit_data *ud = unit->bl2ud(bl); + if (!ud) + { + ShowWarning("invalid unit data\n"); + script->reportsrc(st); + script_pushint(st, 0); + return false; + } + script_pushint(st, ud->walktimer != INVALID_TIMER); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index 24210a1..41c96ee 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -41,5 +41,6 @@ BUILDIN(areaTimer); BUILDIN(getAreaDropItem); BUILDIN(setMount); BUILDIN(clientCommand); +BUILDIN(isUnitWalking); #endif // EVOL_MAP_SCRIPT |