Fourth! Time's the Charm: Actually fixes jetpack race conditions this time around (#88492)

## About The Pull Request

A) Queue time can be null and it'll be valid for hotstarting loops
B) Pushoffs working even when you're moving feels much better
C) Jetpacks were having race issues with drift handlers because those
were also using comsigs which is a remnant of old code back when they
were components. Handlers should fire last, post-comsigs.
D) We should not be hard-blocking jetpack movement when doing final
slowdown step. Like really.

## Why It's Good For The Game

Jetpacks ACTUALLY don't suck this time around.

## Changelog
🆑
qol: Jetpacks should ACTUALLY feel better now
/🆑
This commit is contained in:
SmArtKar
2024-12-15 04:49:30 +01:00
committed by GitHub
parent 469f7dc14f
commit 92d224d48f
4 changed files with 44 additions and 28 deletions
+16 -17
View File
@@ -36,7 +36,6 @@
RegisterSignal(drifting_loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, PROC_REF(before_move))
RegisterSignal(drifting_loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(after_move))
RegisterSignal(drifting_loop, COMSIG_QDELETING, PROC_REF(loop_death))
RegisterSignal(parent, COMSIG_MOB_ATTEMPT_HALT_SPACEMOVE, PROC_REF(attempt_halt))
if(drifting_loop.status & MOVELOOP_STATUS_RUNNING)
drifting_start(drifting_loop) // There's a good chance it'll autostart, gotta catch that
@@ -208,28 +207,28 @@
if(world.time < block_inputs_until)
return COMSIG_MOB_CLIENT_BLOCK_PRE_MOVE
/datum/drift_handler/proc/attempt_halt(mob/source, movement_dir, continuous_move, atom/backup)
SIGNAL_HANDLER
if ((backup.density || !backup.CanPass(source, get_dir(backup, source))) && (get_dir(source, backup) == movement_dir || source.loc == backup.loc))
/datum/drift_handler/proc/attempt_halt(movement_dir, continuous_move, atom/backup)
if ((backup.density || !backup.CanPass(parent, get_dir(backup, parent))) && (get_dir(parent, backup) == movement_dir || parent.loc == backup.loc))
if (drift_force >= INERTIA_FORCE_THROW_FLOOR)
source.throw_at(backup, 1, floor(1 + (drift_force - INERTIA_FORCE_THROW_FLOOR) / INERTIA_FORCE_PER_THROW_FORCE), spin = FALSE)
return
parent.throw_at(backup, 1, floor(1 + (drift_force - INERTIA_FORCE_THROW_FLOOR) / INERTIA_FORCE_PER_THROW_FORCE), spin = FALSE)
return FALSE
if (drift_force < INERTIA_FORCE_SPACEMOVE_GRAB || isnull(drifting_loop))
return
return FALSE
if (!isnull(source.client) && source.client.intended_direction)
if ((source.client.intended_direction & movement_dir) && !(get_dir(source, backup) & movement_dir))
return
if (ismob(parent))
var/mob/source_user = parent
if (!isnull(source_user.client) && source_user.client.intended_direction)
if ((source_user.client.intended_direction & movement_dir) && !(get_dir(source_user, backup) & movement_dir))
return FALSE
if (drift_force <= INERTIA_FORCE_SPACEMOVE_REDUCTION / source.inertia_force_weight)
glide_to_halt(get_loop_delay(source))
return COMPONENT_PREVENT_SPACEMOVE_HALT
if (drift_force <= INERTIA_FORCE_SPACEMOVE_REDUCTION / parent.inertia_force_weight)
glide_to_halt(get_loop_delay(parent))
return TRUE
drift_force -= INERTIA_FORCE_SPACEMOVE_REDUCTION / source.inertia_force_weight
drifting_loop.set_delay(get_loop_delay(source))
return COMPONENT_PREVENT_SPACEMOVE_HALT
drift_force -= INERTIA_FORCE_SPACEMOVE_REDUCTION / parent.inertia_force_weight
drifting_loop.set_delay(get_loop_delay(parent))
return TRUE
/datum/drift_handler/proc/get_loop_delay(atom/movable/movable)
return (DEFAULT_INERTIA_SPEED / ((1 - INERTIA_SPEED_COEF) + drift_force * INERTIA_SPEED_COEF)) * movable.inertia_move_multiplier