smooth movement twaeks
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
var/datum/preferences/prefs = null
|
||||
var/last_turn = 0
|
||||
var/move_delay = 0
|
||||
var/last_move = 0
|
||||
var/area = null
|
||||
|
||||
/// Last time we Click()ed. No clicking twice in one tick!
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
real_name = "Unknown"
|
||||
icon = 'icons/mob/human.dmi'
|
||||
icon_state = "caucasian_m"
|
||||
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE
|
||||
SET_APPEARANCE_FLAGS(KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE)
|
||||
|
||||
/mob/living/carbon/human/Initialize()
|
||||
add_verb(src, /mob/living/proc/mob_sleep)
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
attack_hand_unwieldlyness = CLICK_CD_MELEE
|
||||
attack_hand_speed = 0
|
||||
|
||||
/// Was our last move diagonal
|
||||
var/last_move_diagonal = FALSE
|
||||
|
||||
/// What receives our keyboard input. src by default.
|
||||
var/datum/focus
|
||||
|
||||
|
||||
@@ -96,9 +96,6 @@
|
||||
|
||||
if((direction & (direction - 1)) && mob.loc == n) //moved diagonally successfully
|
||||
add_delay *= 2
|
||||
mob.last_move_diagonal = TRUE
|
||||
else
|
||||
mob.last_move_diagonal = FALSE
|
||||
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay), FALSE)
|
||||
move_delay += add_delay
|
||||
if(.) // If mob is null here, we deserve the runtime
|
||||
@@ -109,6 +106,8 @@
|
||||
if(AM && AM.density && !SEND_SIGNAL(L, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE) && !ismob(AM))
|
||||
L.setDir(turn(L.dir, 180))
|
||||
|
||||
last_move = world.time
|
||||
|
||||
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOVE, src, direction, n, oldloc, add_delay)
|
||||
|
||||
/// Process_Grab(): checks for grab, attempts to break if so. Return TRUE to prevent movement.
|
||||
|
||||
@@ -224,6 +224,18 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache)
|
||||
if((diff > 0) && client)
|
||||
if(client.move_delay > world.time + 1.5)
|
||||
client.move_delay -= diff
|
||||
var/timeleft = world.time - client.move_delay
|
||||
var/elapsed = world.time - client.last_move
|
||||
var/glide_size_current = glide_size
|
||||
if((timeleft <= 0) || (elapsed > 20))
|
||||
set_glide_size(16, TRUE)
|
||||
return
|
||||
var/pixels_moved = glide_size_current * elapsed * (1 / world.tick_lag)
|
||||
// calculate glidesize needed to move to the next tile within timeleft deciseconds
|
||||
var/ticks_allowed = timeleft / world.tick_lag
|
||||
var/pixels_per_tick = pixels_moved / ticks_allowed
|
||||
set_glide_size(pixels_per_tick * GLOB.glide_size_multiplier, TRUE)
|
||||
|
||||
|
||||
/// Get the move speed modifiers list of the mob
|
||||
/mob/proc/get_movespeed_modifiers()
|
||||
|
||||
Reference in New Issue
Block a user