summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-27 19:08:28 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-27 19:08:28 +0300
commit0b276d0c03962418d96b7112180ba852cdceaebd (patch)
treea7fe6e25ff947b795675026c78c3827f09c432bc /src/emap/script.c
parent9d55200e778ab9c98f051948083e4d7a4034a015 (diff)
downloadevol-hercules-0b276d0c03962418d96b7112180ba852cdceaebd.tar.gz
evol-hercules-0b276d0c03962418d96b7112180ba852cdceaebd.tar.bz2
evol-hercules-0b276d0c03962418d96b7112180ba852cdceaebd.tar.xz
evol-hercules-0b276d0c03962418d96b7112180ba852cdceaebd.zip
Allow get/set npc direction by variable '.dir'.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 39b3d87..e28270b 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -71,6 +71,19 @@ void escript_set_reg_npc_num(struct script_state* st, struct reg_db *n, int64 *n
getND();
nd->area_size = *val;
}
+ else if (!strcmp(name, ".dir"))
+ {
+ getND();
+ int newdir = *val;
+
+ if (newdir < 0)
+ newdir = 0;
+ else if (newdir > 7)
+ newdir = 7;
+
+ nd->dir = newdir;
+ npc->enable(nd->name, 1);
+ }
}
int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data)
@@ -95,6 +108,12 @@ int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, stru
hookStop();
return nd->area_size;
}
+ else if (!strcmp(name, ".dir"))
+ {
+ getNDReturn(0);
+ hookStop();
+ return nd->dir;
+ }
return 0;
}