From 8bdf83cc72fdba92dee58fef051bdbbb19311a61 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 22 Jan 2018 19:46:19 -0200 Subject: [PATCH] Merge pull request #34727 from ShizCalev/simpleanimal-godmode Stops simple_animals from attacking mobs in godmode --- .../mob/living/simple_animal/hostile/hostile.dm | 5 +++++ .../mob/living/simple_animal/simple_animal.dm | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index e976efd288..15186d63a8 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -170,6 +170,11 @@ if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids return FALSE + if(ismob(the_target)) //Target is in godmode, ignore it. + var/mob/M = the_target + if(M.status_flags & GODMODE) + return FALSE + if(see_invisible < the_target.invisibility)//Target's invisible to us, forget it return FALSE if(search_objects < 2) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 371f19f033..73bab3468b 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -315,16 +315,20 @@ /mob/living/simple_animal/proc/CanAttack(atom/the_target) if(see_invisible < the_target.invisibility) - return 0 + return FALSE + if(ismob(the_target)) + var/mob/M = the_target + if(M.status_flags & GODMODE) + return FALSE if (isliving(the_target)) var/mob/living/L = the_target if(L.stat != CONSCIOUS) - return 0 + return FALSE if (ismecha(the_target)) var/obj/mecha/M = the_target if (M.occupant) - return 0 - return 1 + return FALSE + return TRUE /mob/living/simple_animal/handle_fire() return