From b366f5e598a0d47d9378b0133aa9557cf3842629 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Fri, 4 Aug 2017 23:37:17 -0400 Subject: [PATCH] Makes has_brain_worms cheaper --- code/game/data_huds.dm | 2 +- code/game/gamemodes/changeling/powers/panacea.dm | 2 -- code/game/gamemodes/miniantags/borer/borer.dm | 14 +++++++++----- code/modules/mob/living/carbon/carbon.dm | 4 ++++ code/modules/mob/living/carbon/carbon_defines.dm | 2 ++ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 7052b62e97f..bddb7b59bc6 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -148,7 +148,7 @@ holder.icon_state = "hudxeno" else if(check_virus()) holder.icon_state = "hudill" - else if(has_brain_worms() && B != null && B.controlling) + else if(B && B.controlling) holder.icon_state = "hudbrainworm" else holder.icon_state = "hudhealthy" diff --git a/code/game/gamemodes/changeling/powers/panacea.dm b/code/game/gamemodes/changeling/powers/panacea.dm index 5b11d2ba656..5274854c682 100644 --- a/code/game/gamemodes/changeling/powers/panacea.dm +++ b/code/game/gamemodes/changeling/powers/panacea.dm @@ -13,8 +13,6 @@ var/mob/living/simple_animal/borer/B = user.has_brain_worms() if(B) - if(B.controlling) - B.detach() B.leave_host() if(iscarbon(user)) var/mob/living/carbon/C = user diff --git a/code/game/gamemodes/miniantags/borer/borer.dm b/code/game/gamemodes/miniantags/borer/borer.dm index a98090d186a..245da95e23a 100644 --- a/code/game/gamemodes/miniantags/borer/borer.dm +++ b/code/game/gamemodes/miniantags/borer/borer.dm @@ -351,7 +351,7 @@ to_chat(src, "They are no longer in range!") return -/mob/living/simple_animal/borer/proc/perform_infestation(var/mob/living/carbon/M) +/mob/living/simple_animal/borer/proc/perform_infestation(mob/living/carbon/M) if(!M) return @@ -359,6 +359,7 @@ to_chat(src, "[M] is already infested!") return host = M + M.borer = src forceMove(M) host.status_flags |= PASSEMOTES @@ -564,7 +565,8 @@ host.reset_perspective(null) host.machine = null - var/mob/living/H = host + var/mob/living/carbon/H = host + H.borer = null H.verbs -= /mob/living/proc/borer_comm talk_to_borer_action.Remove(host) H.status_flags &= ~PASSEMOTES @@ -704,10 +706,12 @@ //Check for brain worms in head. /mob/proc/has_brain_worms() + return FALSE - for(var/I in contents) - if(istype(I,/mob/living/simple_animal/borer)) - return I +/mob/living/carbon/has_brain_worms() + + if(borer) + return borer return FALSE diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index dbe0ac426b6..512bd475b83 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -19,6 +19,10 @@ /mob/living/carbon/Destroy() QDEL_LIST(internal_organs) QDEL_LIST(stomach_contents) + var/mob/living/simple_animal/borer/B = has_brain_worms() + if(B) + B.leave_host() + qdel(B) remove_from_all_data_huds() return ..() diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index c8171bcc47c..67a8fb7fa20 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -14,6 +14,8 @@ var/obj/item/head = null var/obj/item/clothing/suit/wear_suit = null //TODO: necessary? Are they even used? ~Carn + var/mob/living/simple_animal/borer/borer = null + //Active emote/pose var/pose = null