From e99ab0ae68857653d38f3024a3133104d23ace74 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Sat, 11 Feb 2017 07:36:02 -0600 Subject: [PATCH] Movement smoothness tweaks (#1736) This PR ports /tg/'s movement verbs, which allow for smoother movement that's less dependent on server tick rate. Also ports /tg/'s Stat() limiter, which reduces how often Stat() updates to reduce pointless server load. --- code/modules/client/client procs.dm | 12 +++++ code/modules/mob/mob_movement.dm | 24 +++++++++ html/changelogs/lohikar-movement.yml | 4 ++ interface/skin.dmf | 80 ++++++++++++++-------------- 4 files changed, 80 insertions(+), 40 deletions(-) create mode 100644 html/changelogs/lohikar-movement.yml diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 08bcb180119..72cad917ada 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -610,3 +610,15 @@ server_greeting.find_outdated_info(src, 1) server_greeting.display_to_client(src) + +// Byond seemingly calls stat, each tick. +// Calling things each tick can get expensive real quick. +// So we slow this down a little. +// See: http://www.byond.com/docs/ref/info.html#/client/proc/Stat +/client/Stat() + . = ..() + if (holder) + sleep(1) + else + sleep(5) + stoplag() diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index acd83da6644..c3ebd74b882 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -514,3 +514,27 @@ if(Check_Shoegrip()) return 0 return prob_slip + +// /tg/ movement procs + +//The byond version of these verbs wait for the next tick before acting. +// instant verbs however can run mid tick or even during the time between ticks. +/client/verb/moveup() + set name = ".moveup" + set instant = 1 + Move(get_step(mob, NORTH), NORTH) + +/client/verb/movedown() + set name = ".movedown" + set instant = 1 + Move(get_step(mob, SOUTH), SOUTH) + +/client/verb/moveright() + set name = ".moveright" + set instant = 1 + Move(get_step(mob, EAST), EAST) + +/client/verb/moveleft() + set name = ".moveleft" + set instant = 1 + Move(get_step(mob, WEST), WEST) diff --git a/html/changelogs/lohikar-movement.yml b/html/changelogs/lohikar-movement.yml new file mode 100644 index 00000000000..42ed0c8c43d --- /dev/null +++ b/html/changelogs/lohikar-movement.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - experiment: "Tweaked how movement is handled in an effort to improve responsiveness." diff --git a/interface/skin.dmf b/interface/skin.dmf index 685a96689d9..2d5c635b721 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -33,7 +33,7 @@ macro "borghotkeymode" is-disabled = false elem name = "WEST+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "ALT+NORTH" @@ -45,7 +45,7 @@ macro "borghotkeymode" is-disabled = false elem name = "NORTH+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "ALT+EAST" @@ -57,7 +57,7 @@ macro "borghotkeymode" is-disabled = false elem name = "EAST+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "ALT+SOUTH" @@ -69,7 +69,7 @@ macro "borghotkeymode" is-disabled = false elem name = "SOUTH+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "INSERT" @@ -117,19 +117,19 @@ macro "borghotkeymode" is-disabled = false elem name = "A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "CTRL+A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "CTRL+D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "F" @@ -173,11 +173,11 @@ macro "borghotkeymode" is-disabled = false elem "s_key" name = "S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "CTRL+S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "T" @@ -185,11 +185,11 @@ macro "borghotkeymode" is-disabled = false elem "w_key" name = "W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "CTRL+W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "X" @@ -299,7 +299,7 @@ macro "macro" is-disabled = false elem name = "WEST+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "ALT+NORTH" @@ -311,7 +311,7 @@ macro "macro" is-disabled = false elem name = "NORTH+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "ALT+EAST" @@ -323,7 +323,7 @@ macro "macro" is-disabled = false elem name = "EAST+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "ALT+SOUTH" @@ -335,7 +335,7 @@ macro "macro" is-disabled = false elem name = "SOUTH+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "INSERT" @@ -363,11 +363,11 @@ macro "macro" is-disabled = false elem name = "CTRL+A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "CTRL+D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "CTRL+E" @@ -395,11 +395,11 @@ macro "macro" is-disabled = false elem name = "CTRL+S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "CTRL+W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "CTRL+X" @@ -505,7 +505,7 @@ macro "hotkeymode" is-disabled = false elem name = "WEST+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "ALT+NORTH" @@ -517,7 +517,7 @@ macro "hotkeymode" is-disabled = false elem name = "NORTH+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "ALT+EAST" @@ -529,7 +529,7 @@ macro "hotkeymode" is-disabled = false elem name = "EAST+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "ALT+SOUTH" @@ -541,7 +541,7 @@ macro "hotkeymode" is-disabled = false elem name = "SOUTH+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "INSERT" @@ -589,19 +589,19 @@ macro "hotkeymode" is-disabled = false elem name = "A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "CTRL+A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "CTRL+D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "E" @@ -661,11 +661,11 @@ macro "hotkeymode" is-disabled = false elem "s_key" name = "S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "CTRL+S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "T" @@ -673,11 +673,11 @@ macro "hotkeymode" is-disabled = false elem "w_key" name = "W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "CTRL+W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "X" @@ -787,7 +787,7 @@ macro "borgmacro" is-disabled = false elem name = "WEST+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "ALT+NORTH" @@ -799,7 +799,7 @@ macro "borgmacro" is-disabled = false elem name = "NORTH+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "ALT+EAST" @@ -811,7 +811,7 @@ macro "borgmacro" is-disabled = false elem name = "EAST+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "ALT+SOUTH" @@ -823,7 +823,7 @@ macro "borgmacro" is-disabled = false elem name = "SOUTH+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "INSERT" @@ -851,11 +851,11 @@ macro "borgmacro" is-disabled = false elem name = "CTRL+A+REP" - command = ".west" + command = ".moveleft" is-disabled = false elem name = "CTRL+D+REP" - command = ".east" + command = ".moveright" is-disabled = false elem name = "CTRL+F" @@ -875,11 +875,11 @@ macro "borgmacro" is-disabled = false elem name = "CTRL+S+REP" - command = ".south" + command = ".movedown" is-disabled = false elem name = "CTRL+W+REP" - command = ".north" + command = ".moveup" is-disabled = false elem name = "CTRL+X"