Prevent a source of MC failures. (#28169)

This commit is contained in:
Charlie Nolan
2025-01-29 07:12:19 +00:00
committed by GitHub
parent 85d60b6c64
commit 73c94dbc83
4 changed files with 16 additions and 11 deletions
+2 -2
View File
@@ -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"
+4 -4
View File
@@ -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
+5 -1
View File
@@ -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)
+5 -4
View File
@@ -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