From 27dfab04eba180c1cc6594237cd19c41d15b2380 Mon Sep 17 00:00:00 2001 From: PartingGlass <45202681+TobyThorne@users.noreply.github.com> Date: Fri, 31 May 2024 21:07:31 +0500 Subject: [PATCH] fix(move): fixes recursion in non-carbon bump() --- code/modules/mob/living/bot/bot.dm | 2 +- code/modules/mob/living/bot/mulebot.dm | 4 ++-- code/modules/mob/living/carbon/carbon.dm | 8 ++++---- .../carbon/xenobiological/xenobiological.dm | 19 ++++++++++--------- code/modules/mob/living/living.dm | 7 +++++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm index a612eee4641..a8151978a0d 100644 --- a/code/modules/mob/living/bot/bot.dm +++ b/code/modules/mob/living/bot/bot.dm @@ -227,7 +227,7 @@ if(!istype(D, /obj/machinery/door/firedoor) && !istype(D, /obj/machinery/door/blast) && D.check_access(botcard)) D.open() else - ..() + return ..() /mob/living/bot/emag_act(remaining_charges, mob/user) return 0 diff --git a/code/modules/mob/living/bot/mulebot.dm b/code/modules/mob/living/bot/mulebot.dm index 2601d2acb4a..579b5f2f96c 100644 --- a/code/modules/mob/living/bot/mulebot.dm +++ b/code/modules/mob/living/bot/mulebot.dm @@ -200,11 +200,11 @@ ..() /mob/living/bot/mulebot/Bump(mob/living/carbon/human/M) - if(!safety && istype(M)) + . = ..() + if(. && !safety && istype(M)) visible_message("[src] knocks over [M]!") M.Stun(8) M.Weaken(5) - ..() /mob/living/bot/mulebot/proc/runOver(mob/living/carbon/human/H) if(istype(H)) // No safety checks - WILL run over lying humans. Stop ERPing in the maint! diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c4776df9f55..851baa9b4b6 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -402,10 +402,10 @@ /mob/living/carbon/Bump(atom/movable/AM, yes) if(now_pushing || !yes) - return - ..() - if(istype(AM, /mob/living/carbon) && prob(10)) - src.spread_disease_to(AM, "Contact") + return FALSE + . = ..() + if(. && istype(AM, /mob/living/carbon) && prob(10)) + spread_disease_to(AM, "Contact") /mob/living/carbon/slip(slipped_on, stun_duration = 8) var/area/A = get_area(src) diff --git a/code/modules/mob/living/carbon/xenobiological/xenobiological.dm b/code/modules/mob/living/carbon/xenobiological/xenobiological.dm index 8149291e47b..af5eafc22a5 100644 --- a/code/modules/mob/living/carbon/xenobiological/xenobiological.dm +++ b/code/modules/mob/living/carbon/xenobiological/xenobiological.dm @@ -104,9 +104,10 @@ return tally + config.movement.metroid_delay /mob/living/carbon/metroid/Bump(atom/movable/AM as mob|obj, yes) - if ((!(yes) || now_pushing)) - return - now_pushing = 1 + if((!(yes) || now_pushing)) + return FALSE + + now_pushing = TRUE if(isobj(AM) && !client && powerlevel > 0) var/probab = 10 @@ -129,16 +130,16 @@ if(is_adult) if(istype(tmob, /mob/living/carbon/human)) if(prob(90)) - now_pushing = 0 - return + now_pushing = FALSE + return TRUE else if(istype(tmob, /mob/living/carbon/human)) - now_pushing = 0 - return + now_pushing = FALSE + return TRUE - now_pushing = 0 + now_pushing = FALSE - ..() + return ..() /mob/living/carbon/metroid/Allow_Spacemove() return 1 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index af93fb4b8e3..abe7dcf945f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -78,9 +78,10 @@ return ..() /mob/living/Bump(atom/movable/AM, yes) + if(now_pushing || !yes || !loc) + return FALSE + spawn(0) - if ((!( yes ) || now_pushing) || !loc) - return if(!istype(AM, /mob/living/bot/mulebot)) now_pushing = 1 if (istype(AM, /mob/living)) @@ -212,6 +213,8 @@ now_pushing = 0 + return TRUE + /proc/swap_density_check(mob/swapper, mob/swapee) var/turf/T = get_turf(swapper) if(T)