summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2016-09-05 09:30:15 -0400
committergumi <mekolat@users.noreply.github.com>2016-09-05 12:21:15 -0400
commitafe633e723eec6a856ef2c4675d2e1b69d1fa9f4 (patch)
tree490f2288958a4a00181d12ec44f59f89c44cb77d
parentf8f24eccf6562af825f298851710848c2212cf61 (diff)
downloadevol-hercules-afe633e723eec6a856ef2c4675d2e1b69d1fa9f4.tar.gz
evol-hercules-afe633e723eec6a856ef2c4675d2e1b69d1fa9f4.tar.bz2
evol-hercules-afe633e723eec6a856ef2c4675d2e1b69d1fa9f4.tar.xz
evol-hercules-afe633e723eec6a856ef2c4675d2e1b69d1fa9f4.zip
add slide buildin
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c24
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 2f54a75..d7b3415 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -185,6 +185,7 @@ HPExport void plugin_init (void)
addScriptCommand("getlabel", "l", getLabel);
addScriptCommand("tolabel", "i", toLabel);
addScriptCommand("input", "r??", input);
+ addScriptCommand("slide", "ii", slide);
do_init_langs();
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 75c3308..1acae6b 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -2175,3 +2175,27 @@ BUILDIN(input)
}
return true;
}
+
+BUILDIN(slide)
+{
+ getSDReturn(false);
+ const int x = script_getnum(st,2);
+ const int y = script_getnum(st,3);
+ const int16 m = sd->bl.m;
+
+ if (x < 0 || x >= map->list[m].xs || y < 0 || y >= map->list[m].ys)
+ {
+ ShowError("slide: attempt to place player %s (%d:%d) on invalid coordinates (%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, x, y);
+ script->reportsrc(st);
+ return false;
+ }
+
+ if (map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle->bc->gm_ignore_warpable_area)
+ {
+ return false;
+ }
+
+ clif->slide(&sd->bl, x, y);
+ unit->movepos(&sd->bl, x, y, 1, 0);
+ return true;
+}
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 51956bf..07c42b6 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -88,5 +88,6 @@ BUILDIN(setFakeCells);
BUILDIN(getLabel);
BUILDIN(toLabel);
BUILDIN(input);
+BUILDIN(slide);
#endif // EVOL_MAP_SCRIPT_BUILDINS