Skip to content

Commit

Permalink
Fixes mobs unable to move after being flung while buckled. (#5464)
Browse files Browse the repository at this point in the history
# About the pull request

Buckled mobs didn't have their `TRAIT_IMMOBILIZED` removed properly
since we return early from `launch_towards()` if `buckled`

https://github.com/cmss13-devs/cmss13/blob/939e283561d2446d5df4b60faba08097eaea1f79/code/modules/mob/living/living.dm#L401-L405

Therefore any callbacks in end_throw_callbacks are never invoked. In the
case of xeno throws we rely on end_throw_callbacks to remove our
immobilised trait

Fixes #5420

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: Fixed buckled mobs unable to move after being thrown by a xeno.
/:cl:
  • Loading branch information
Birdtalon authored Jan 17, 2024
1 parent d70b6a4 commit 07405df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@
/mob/living/launch_towards(datum/launch_metadata/LM)
if(src)
SEND_SIGNAL(src, COMSIG_MOB_MOVE_OR_LOOK, TRUE, dir, dir)
if(!istype(LM) || !LM.target || !src || buckled)
if(!istype(LM) || !LM.target || !src)
return
if(buckled)
LM.invoke_end_throw_callbacks(src)
return
if(pulling)
stop_pulling() //being thrown breaks pulls.
Expand Down
17 changes: 11 additions & 6 deletions code/modules/movement/launching/launching.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
matching_procs += collision_callbacks[path]
return matching_procs

/// Invoke end_throw_callbacks on this metadata.
/// Takes argument of type /atom/movable
/datum/launch_metadata/proc/invoke_end_throw_callbacks(atom/movable/movable_atom)
if(length(end_throw_callbacks))
for(var/datum/callback/callback as anything in end_throw_callbacks)
if(istype(callback, /datum/callback/dynamic))
callback.Invoke(movable_atom)
else
callback.Invoke()

/atom/movable/var/datum/launch_metadata/launch_metadata = null

//called when src is thrown into hit_atom
Expand Down Expand Up @@ -210,12 +220,7 @@
rebounding = FALSE
cur_speed = old_speed
remove_temp_pass_flags(pass_flags)
if(length(LM.end_throw_callbacks))
for(var/datum/callback/CB as anything in LM.end_throw_callbacks)
if(istype(CB, /datum/callback/dynamic))
CB.Invoke(src)
else
CB.Invoke()
LM.invoke_end_throw_callbacks(src)
QDEL_NULL(launch_metadata)

/atom/movable/proc/throw_random_direction(range, speed = 0, atom/thrower, spin, launch_type = NORMAL_LAUNCH, pass_flags = NO_FLAGS)
Expand Down

0 comments on commit 07405df

Please sign in to comment.