Fixes stowing suit storage jetpacks when retracting modsuit chestplates (#75844)

## About The Pull Request

This is a bizare bug I discovered while trying to develop another
feature, so let's just get into the reproduction steps:
- Wear a modsuit and extend it's parts
- Put a jetpack in the suit storage slot and turn it on. Currently, the
only jetpack that fits in the storage slot on TG is the captain's
jetpack.
- While the jetpack is activated, deactivate your modsuit using the UI,
which stows the jetpack into your storage module automatically.
- This fails to unregister some signal thing because it can't find the
user.

My fix *could* be shitcode, so any feedback would be appreciated.

Jetpack activation and deactivation signals now pass a user.
`/datum/component/jetpack/proc/activate(datum/source, mob/user)`
`/datum/component/jetpack/proc/deactivate(datum/source, mob/user)`

Some jetpack `pre_move_react` thing now has a check to see if it's
argument is null.
```
if(!trail)
	return FALSE
```


## Why It's Good For The Game

Stops a crash/runtime.
## Changelog
🆑 stonetear
fix: jetpack signals now pass a user argument. This fixes an error when
automatically stowing a captain jetpack into your modsuit.
/🆑
This commit is contained in:
Stonetear
2023-06-17 09:28:18 +12:00
committed by GitHub
parent 9fdb9dae49
commit 07ac92015c
2 changed files with 18 additions and 18 deletions
+16 -16
View File
@@ -78,27 +78,25 @@
trail.auto_process = FALSE
trail.set_up(moving)
/datum/component/jetpack/proc/activate(datum/source)
/datum/component/jetpack/proc/activate(datum/source, mob/user)
SIGNAL_HANDLER
var/mob/moving = get_mover.Invoke()
if(!thrust(moving))
if(!thrust(user))
return return_flag
trail.start()
RegisterSignal(moving, COMSIG_MOVABLE_MOVED, PROC_REF(move_react))
RegisterSignal(moving, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(pre_move_react))
RegisterSignal(moving, COMSIG_MOVABLE_SPACEMOVE, PROC_REF(spacemove_react))
RegisterSignal(moving, COMSIG_MOVABLE_DRIFT_VISUAL_ATTEMPT, PROC_REF(block_starting_visuals))
RegisterSignal(moving, COMSIG_MOVABLE_DRIFT_BLOCK_INPUT, PROC_REF(ignore_ending_block))
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(move_react))
RegisterSignal(user, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(pre_move_react))
RegisterSignal(user, COMSIG_MOVABLE_SPACEMOVE, PROC_REF(spacemove_react))
RegisterSignal(user, COMSIG_MOVABLE_DRIFT_VISUAL_ATTEMPT, PROC_REF(block_starting_visuals))
RegisterSignal(user, COMSIG_MOVABLE_DRIFT_BLOCK_INPUT, PROC_REF(ignore_ending_block))
/datum/component/jetpack/proc/deactivate(datum/source)
/datum/component/jetpack/proc/deactivate(datum/source, mob/user)
SIGNAL_HANDLER
var/mob/moving = get_mover.Invoke()
if(moving)
UnregisterSignal(moving, COMSIG_MOVABLE_MOVED)
UnregisterSignal(moving, COMSIG_MOVABLE_PRE_MOVE)
UnregisterSignal(moving, COMSIG_MOVABLE_SPACEMOVE)
UnregisterSignal(moving, COMSIG_MOVABLE_DRIFT_VISUAL_ATTEMPT)
UnregisterSignal(moving, COMSIG_MOVABLE_DRIFT_BLOCK_INPUT)
if(user)
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
UnregisterSignal(user, COMSIG_MOVABLE_PRE_MOVE)
UnregisterSignal(user, COMSIG_MOVABLE_SPACEMOVE)
UnregisterSignal(user, COMSIG_MOVABLE_DRIFT_VISUAL_ATTEMPT)
UnregisterSignal(user, COMSIG_MOVABLE_DRIFT_BLOCK_INPUT)
QDEL_NULL(trail) //delete AFTER unregistering the mob, otherwise you'll get runtimes.
/datum/component/jetpack/proc/move_react(mob/user)
@@ -118,6 +116,8 @@
/datum/component/jetpack/proc/pre_move_react(mob/user)
SIGNAL_HANDLER
if(!trail)
return FALSE
trail.oldposition = get_turf(user)
/datum/component/jetpack/proc/spacemove_react(mob/user, movement_dir, continuous_move)