summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-06-21 21:41:37 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:45:10 -0400
commitf0c8b228746f62123e2c4d53bcf0808f6c4e3c3a (patch)
tree9eea4567d20c2a58b2dec7f5cba7da50384314d6 /src/map/script-fun.cpp
parente8e5fb8831be2d549b0d2fa3a3353133b5dccf37 (diff)
downloadtmwa-f0c8b228746f62123e2c4d53bcf0808f6c4e3c3a.tar.gz
tmwa-f0c8b228746f62123e2c4d53bcf0808f6c4e3c3a.tar.bz2
tmwa-f0c8b228746f62123e2c4d53bcf0808f6c4e3c3a.tar.xz
tmwa-f0c8b228746f62123e2c4d53bcf0808f6c4e3c3a.zip
add getdir builtin, add addnpctimer builtin
allow npcs to have multiple timers
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r--src/map/script-fun.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index bef3619..6fe77bf 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -2156,6 +2156,20 @@ void builtin_addtimer(ScriptState *st)
}
/*==========================================
+ * NPCイベントタイマー追加
+ *------------------------------------------
+ */
+static
+void builtin_addnpctimer(ScriptState *st)
+{
+ interval_t tick = static_cast<interval_t>(conv_num(st, &AARG(0)));
+ ZString event_ = ZString(conv_str(st, &AARG(1)));
+ NpcEvent event;
+ extract(event_, &event);
+ npc_addeventtimer(map_id2bl(st->oid), tick, event);
+}
+
+/*==========================================
* NPCタイマー初期化
*------------------------------------------
*/
@@ -3925,6 +3939,18 @@ void builtin_gety(ScriptState *st)
push_int<ScriptDataInt>(st->stack, sd->bl_y);
}
+/*============================
+ * Gets the PC's direction
+ *----------------------------
+ */
+static
+void builtin_getdir(ScriptState *st)
+{
+ dumb_ptr<map_session_data> sd = script_rid2sd(st);
+
+ push_int<ScriptDataInt>(st->stack, static_cast<uint8_t>(sd->dir));
+}
+
/*
* Get the PC's current map's name
*/
@@ -4108,6 +4134,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(killmonster, "ME"_s, '\0'),
BUILTIN(donpcevent, "E"_s, '\0'),
BUILTIN(addtimer, "tE"_s, '\0'),
+ BUILTIN(addnpctimer, "tE"_s, '\0'),
BUILTIN(initnpctimer, "?"_s, '\0'),
BUILTIN(startnpctimer, "?"_s, '\0'),
BUILTIN(stopnpctimer, "?"_s, '\0'),
@@ -4183,6 +4210,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(destroy, "?"_s, '\0'),
BUILTIN(getx, ""_s, 'i'),
BUILTIN(gety, ""_s, 'i'),
+ BUILTIN(getdir, ""_s, 'i'),
BUILTIN(getnpcx, "?"_s, 'i'),
BUILTIN(getnpcy, "?"_s, 'i'),
BUILTIN(strnpcinfo, "i?"_s, 's'),