diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Runner.dm b/code/modules/mob/living/carbon/xenomorph/castes/Runner.dm index 06148a7fce..a3b5158121 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Runner.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Runner.dm @@ -100,6 +100,9 @@ return if(pulling) + if(!current_target || get_dist(src, current_target) > 10) + INVOKE_ASYNC(src, PROC_REF(stop_pulling)) + return ..() if(can_move_and_apply_move_delay()) if(!Move(get_step(loc, pull_direction), pull_direction)) pull_direction = turn(pull_direction, pick(45, -45)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 85a56aefbf..8014cdae05 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -513,6 +513,34 @@ return do_pull(AM, lunge, no_msg) +/mob/proc/stop_pulling() + if(!pulling) + return + + var/mob/M = pulling + pulling.pulledby = null + pulling = null + + grab_level = 0 + if(client) + client.recalculate_move_delay() + // When you stop pulling a mob after you move a tile with it your next movement will still include + // the grab delay so we have to fix it here (we love code) + client.next_movement = world.time + client.move_delay + if(hud_used && hud_used.pull_icon) + hud_used.pull_icon.icon_state = "pull0" + if(istype(r_hand, /obj/item/grab)) + temp_drop_inv_item(r_hand) + else if(istype(l_hand, /obj/item/grab)) + temp_drop_inv_item(l_hand) + if(istype(M)) + if(M.client) + //resist_grab uses long movement cooldown durations to prevent message spam + //so we must undo it here so the victim can move right away + M.client.next_movement = world.time + M.update_transform(TRUE) + M.update_canmove() + /mob/living/vv_get_header() . = ..() var/refid = REF(src) diff --git a/code/modules/mob/mob_verbs.dm b/code/modules/mob/mob_verbs.dm index 19296ba90b..f5410a603f 100644 --- a/code/modules/mob/mob_verbs.dm +++ b/code/modules/mob/mob_verbs.dm @@ -216,32 +216,9 @@ -/mob/verb/stop_pulling() +/mob/verb/stop_pulling_verb() set name = "Stop Pulling" set category = "IC" - if(pulling) - var/mob/M = pulling - pulling.pulledby = null - pulling = null - - grab_level = 0 - if(client) - client.recalculate_move_delay() - // When you stop pulling a mob after you move a tile with it your next movement will still include - // the grab delay so we have to fix it here (we love code) - client.next_movement = world.time + client.move_delay - if(hud_used && hud_used.pull_icon) - hud_used.pull_icon.icon_state = "pull0" - if(istype(r_hand, /obj/item/grab)) - temp_drop_inv_item(r_hand) - else if(istype(l_hand, /obj/item/grab)) - temp_drop_inv_item(l_hand) - if(istype(M)) - if(M.client) - //resist_grab uses long movement cooldown durations to prevent message spam - //so we must undo it here so the victim can move right away - M.client.next_movement = world.time - M.update_transform(TRUE) - M.update_canmove() + stop_pulling()