[MIRROR] Smooth Movement: Resurrection: Resurgence: Revengeance 4: The Return of Smooth Movement: Smooth Edition Director's Cut (#550)

* Smooth Movement: Resurrection: Resurgence: Revengeance 4: The Return of Smooth Movement: Smooth Edition Director's Cut (#52515)

Automatic glide size adjustment based on move delay.
Essentially a port of https://github.com/yogstation13/Yogstation/pull/8132 but that was mostly my code with some fixes.

Why again? well it turns out the recent byond fixes to glide size actually worked and solved the issues that were unsolvable.
https://file.house/0B3u.mp4
Glide size no longer incorrectly scales at fps, so it works as intended at any framerate with the only stuttering being normal byond suck stuttering.

* Smooth Movement: Resurrection: Resurgence: Revengeance 4: The Return of Smooth Movement: Smooth Edition Director's Cut

Co-authored-by: Rob Bailey <actioninja@gmail.com>
This commit is contained in:
SkyratBot
2020-08-29 20:27:18 +01:00
committed by GitHub
co-authored by Rob Bailey
parent f212762e84
commit 0a2d016002
23 changed files with 120 additions and 37 deletions
+3 -1
View File
@@ -320,11 +320,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return
ghostize(FALSE)
/mob/dead/observer/Move(NewLoc, direct)
/mob/dead/observer/Move(NewLoc, direct, glide_size_override = 32)
if(updatedir)
setDir(direct)//only update dir if we actually need it, so overlays won't spin on base sprites that don't have directions of their own
var/oldloc = loc
if(glide_size_override)
set_glide_size(glide_size_override)
if(NewLoc)
forceMove(NewLoc)
update_parallax_contents()
@@ -3,7 +3,7 @@
real_name = "Unknown"
icon = 'icons/mob/human.dmi'
icon_state = "human_basic"
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE|LONG_GLIDE
hud_possible = list(HEALTH_HUD,STATUS_HUD,ID_HUD,WANTED_HUD,IMPLOYAL_HUD,IMPCHEM_HUD,IMPTRACK_HUD, NANITE_HUD, DIAG_NANITE_FULL_HUD,ANTAG_HUD,GLAND_HUD,SENTIENT_DISEASE_HUD,FAN_HUD)
hud_type = /datum/hud/human
possible_a_intents = list(INTENT_HELP, INTENT_DISARM, INTENT_GRAB, INTENT_HARM)
+4 -4
View File
@@ -233,8 +233,8 @@
var/current_dir
if(isliving(AM))
current_dir = AM.dir
if(step(AM, t))
step(src, t)
if(AM.Move(get_step(AM.loc, t), t, glide_size))
Move(get_step(loc, t), t)
if(current_dir)
AM.setDir(current_dir)
now_pushing = FALSE
@@ -640,12 +640,12 @@
/mob/living/proc/update_damage_overlays()
return
/mob/living/Move(atom/newloc, direct)
/mob/living/Move(atom/newloc, direct, glide_size_override)
if(lying_angle != 0)
lying_angle_on_movement(direct)
if (buckled && buckled.loc != newloc) //not updating position
if (!buckled.anchored)
return buckled.Move(newloc, direct)
return buckled.Move(newloc, direct, glide_size)
else
return FALSE
@@ -24,7 +24,6 @@
health = 50
maxHealth = 50
speed = 10
glide_size = 2
held_state = "sloth"
pet_bonus = TRUE
pet_bonus_emote = "slowly smiles!"
@@ -48,7 +48,7 @@
vision_range = 13
wander = FALSE
elimination = TRUE
appearance_flags = 0
appearance_flags = LONG_GLIDE
mouse_opacity = MOUSE_OPACITY_ICON
attack_action_types = list(/datum/action/innate/megafauna_attack/create_skull,
/datum/action/innate/megafauna_attack/charge_target,
+5 -1
View File
@@ -18,6 +18,9 @@
throwforce = 10
blocks_emissive = EMISSIVE_BLOCK_GENERIC
///when this be added to vis_contents of something it inherit something.plane, important for visualisation of mob in openspace.
vis_flags = VIS_INHERIT_PLANE
var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
var/datum/mind/mind
var/static/next_mob_id = 0
@@ -216,4 +219,5 @@
/// Used for tracking last uses of emotes for cooldown purposes
var/list/emotes_used
vis_flags = VIS_INHERIT_PLANE //when this be added to vis_contents of something it inherit something.plane, important for visualisation of mob in openspace.
///Whether the mob is updating glide size when movespeed updates or not
var/updating_glide_size = TRUE
+2
View File
@@ -118,6 +118,7 @@
return FALSE
//We are now going to move
var/add_delay = mob.cached_multiplicative_slowdown
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? 2 : 1 ) )) // set it now in case of pulled objects
if(old_move_delay + (add_delay*MOVEMENT_DELAY_BUFFER_DELTA) + MOVEMENT_DELAY_BUFFER > world.time)
move_delay = old_move_delay
else
@@ -140,6 +141,7 @@
if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully
add_delay *= 2
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay))
move_delay += add_delay
if(.) // If mob is null here, we deserve the runtime
if(mob.throwing)