Skip to content

Commit

Permalink
fix(move): fixes recursion in non-carbon bump()
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyThorne authored May 31, 2024
1 parent af5eb6f commit 27dfab0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/living/bot/bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/bot/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@
..()

/mob/living/bot/mulebot/Bump(mob/living/carbon/human/M)
if(!safety && istype(M))
. = ..()
if(. && !safety && istype(M))
visible_message("<span class='warning'>[src] knocks over [M]!</span>")
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!
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 10 additions & 9 deletions code/modules/mob/living/carbon/xenobiological/xenobiological.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 27dfab0

Please sign in to comment.