diff --git a/code/__DEFINES/dcs/movable_signals.dm b/code/__DEFINES/dcs/movable_signals.dm index 59152fb0664..55df1faf213 100644 --- a/code/__DEFINES/dcs/movable_signals.dm +++ b/code/__DEFINES/dcs/movable_signals.dm @@ -81,8 +81,8 @@ #define COMSIG_MOVABLE_DRIFT_BLOCK_INPUT "movable_drift_block_input" #define DRIFT_ALLOW_INPUT (1<<0) -///called when the movable's glide size is updated: (new_glide_size) -#define COMSIG_MOVABLE_UPDATE_GLIDE_SIZE "movable_glide_size" +///called after the movable's glide size is updated: (old_glide_size) +#define COMSIG_MOVABLE_UPDATED_GLIDE_SIZE "movable_glide_size" ///signal sent out by an atom when it is no longer pulling something : (atom/pulling) #define COMSIG_ATOM_NO_LONGER_PULLING "movable_no_longer_pulling" diff --git a/code/datums/components/drift.dm b/code/datums/components/drift.dm index 6d6945ba28d..f4e22b9fe94 100644 --- a/code/datums/components/drift.dm +++ b/code/datums/components/drift.dm @@ -90,7 +90,7 @@ RegisterSignal(movable_parent, COMSIG_MOVABLE_MOVED, PROC_REF(handle_move)) // We will use glide size to intuit how long to delay our loop's next move for // This way you can't ride two movements at once while drifting, since that'd be dumb as fuck - RegisterSignal(movable_parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, PROC_REF(handle_glidesize_update)) + RegisterSignal(movable_parent, COMSIG_MOVABLE_UPDATED_GLIDE_SIZE, PROC_REF(handle_glidesize_update)) // If you stop pulling something mid drift, I want it to retain that momentum RegisterSignal(movable_parent, COMSIG_ATOM_NO_LONGER_PULLING, PROC_REF(stopped_pulling)) @@ -99,7 +99,7 @@ var/atom/movable/movable_parent = parent movable_parent.inertia_moving = FALSE ignore_next_glide = FALSE - UnregisterSignal(movable_parent, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, COMSIG_ATOM_NO_LONGER_PULLING)) + UnregisterSignal(movable_parent, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UPDATED_GLIDE_SIZE, COMSIG_ATOM_NO_LONGER_PULLING)) /datum/component/drift/proc/before_move(datum/source) SIGNAL_HANDLER @@ -147,7 +147,7 @@ /// We're going to take the passed in glide size /// and use it to manually delay our loop for that period /// to allow the other movement to complete -/datum/component/drift/proc/handle_glidesize_update(datum/source, glide_size) +/datum/component/drift/proc/handle_glidesize_update(datum/source, old_glide_size) SIGNAL_HANDLER // If we aren't drifting, or this is us, fuck off var/atom/movable/movable_parent = parent @@ -158,7 +158,7 @@ if(ignore_next_glide) ignore_next_glide = FALSE return - var/glide_delay = round(world.icon_size / glide_size, 1) * world.tick_lag + var/glide_delay = round(world.icon_size / movable_parent.glide_size, 1) * world.tick_lag drifting_loop.pause_for(glide_delay) delayed = TRUE diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index d9f72df023c..7e072dc5898 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -743,8 +743,12 @@ /// This proc is recursive, and calls itself to constantly set the glide size of an atom/movable /atom/movable/proc/set_glide_size(target = 8) - SEND_SIGNAL(src, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, target) + if(glide_size == target) + return + + var/old_value = glide_size glide_size = target + SEND_SIGNAL(src, COMSIG_MOVABLE_UPDATED_GLIDE_SIZE, old_value) for(var/mob/buckled_mob as anything in buckled_mobs) buckled_mob.set_glide_size(target) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 31632e82cf6..b831fce5fc6 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -47,7 +47,7 @@ affecting.grabbed_by += src RegisterSignal(affecting, COMSIG_MOVABLE_MOVED, PROC_REF(grab_moved)) RegisterSignal(assailant, COMSIG_MOVABLE_MOVED, PROC_REF(pull_grabbed)) - RegisterSignal(assailant, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, PROC_REF(on_update_glide_size)) + RegisterSignal(assailant, COMSIG_MOVABLE_UPDATED_GLIDE_SIZE, PROC_REF(on_updated_glide_size)) hud = new /atom/movable/screen/grab(src) hud.icon_state = "reinforce" @@ -77,7 +77,7 @@ if(assailant) UnregisterSignal(assailant, list( COMSIG_MOVABLE_MOVED, - COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, + COMSIG_MOVABLE_UPDATED_GLIDE_SIZE, )) if(assailant.client) assailant.client.screen -= hud @@ -86,9 +86,10 @@ QDEL_NULL(hud) return ..() -/obj/item/grab/proc/on_update_glide_size(mob/living/grabber, new_size) +/obj/item/grab/proc/on_updated_glide_size(mob/living/grabber, old_size) + SIGNAL_HANDLER // COMSIG_MOVABLE_UPDATED_GLIDE_SIZE if(affecting && grabber == assailant && affecting != assailant) - affecting.set_glide_size(new_size) + affecting.set_glide_size(grabber.glide_size) /obj/item/grab/proc/pull_grabbed(mob/user, turf/old_turf, direct, forced) SIGNAL_HANDLER