diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-06 19:22:32 +0000 |
---|---|---|
committer | Micksha <ms-shaman@gmx.de> | 2019-03-06 19:22:32 +0000 |
commit | 0497c00460a6d6b6a7066e801a9a755fbbb18b6f (patch) | |
tree | 05007879cfe76d4858d2510e937b1656c20beb0e /npc | |
parent | 8885ac72ad393f428b25c4b0e4c1f12825eee9ad (diff) | |
download | serverdata-0497c00460a6d6b6a7066e801a9a755fbbb18b6f.tar.gz serverdata-0497c00460a6d6b6a7066e801a9a755fbbb18b6f.tar.bz2 serverdata-0497c00460a6d6b6a7066e801a9a755fbbb18b6f.tar.xz serverdata-0497c00460a6d6b6a7066e801a9a755fbbb18b6f.zip |
Implements @resync
Diffstat (limited to 'npc')
-rw-r--r-- | npc/commands/resync.txt | 40 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/npc/commands/resync.txt b/npc/commands/resync.txt new file mode 100644 index 00000000..63b2d290 --- /dev/null +++ b/npc/commands/resync.txt @@ -0,0 +1,40 @@ +// Evol script +// Author: Jesusalva <admin@tmw2.org> +// +// Introduces @resync +// +// It'll cast slide to your own position +// Hopefully making client update your real position without causing server warning + +- script @resync 32767,{ + end; + +// Soft Resync +OnCall: + // Sliding a dead player have undesired side effects + if (ispcdead()) { + dispbottom l("Impossible to resync: You are dead."); + end; + } + // I add a small delay in case slide() trigger some invincibility timer or something + if (@rsync_delay > gettimetick(2)) { + dispbottom l("Not resync'ing to prevent flood."); + end; + } + + // This is a hack + getmapxy(.@m$, .@x, .@y, 0); + slide .@x, .@y; + @rsync_delay=gettimetick(2)+rand(4,6); + + // Uncomment this line to cause server to resend every packet to ManaPlus + // and get rid of latency effect (like dead mobs still being shown) + //atcommand("@refresh"); + end; + +// Anyone can call @resync, but only support and upwards for other players. +// ie. GMs can try to fix lag for other people. +OnInit: + bindatcmd "resync", "@resync::OnCall", 0, 2, 0; + end; +} diff --git a/npc/scripts.conf b/npc/scripts.conf index ba1a5196..8185ef56 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -116,6 +116,7 @@ "npc/commands/debug-preset.txt", "npc/commands/debug.txt", "npc/commands/super-menu.txt", +"npc/commands/resync.txt", // config script "npc/config/hairstyle_config.txt", |