From c8ec2347e6a95f20ebd17af968bb7d94338bc849 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Sat, 18 Feb 2017 17:38:19 -0800 Subject: [PATCH] Fixes the obvious optimization --- code/__DEFINES/mob.dm | 10 ++++++++++ code/game/machinery/telecomms/logbrowser.dm | 19 ++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/__DEFINES/mob.dm b/code/__DEFINES/mob.dm index 7ab8a19f86d..0e4a9f40ef1 100644 --- a/code/__DEFINES/mob.dm +++ b/code/__DEFINES/mob.dm @@ -129,11 +129,21 @@ #define isswarmer(A) (istype((A), /mob/living/simple_animal/hostile/swarmer)) #define isguardian(A) (istype((A), /mob/living/simple_animal/hostile/guardian)) + + #define issilicon(A) (istype((A), /mob/living/silicon)) #define isAI(A) (istype((A), /mob/living/silicon/ai)) #define isrobot(A) (istype((A), /mob/living/silicon/robot)) #define ispAI(A) (istype((A), /mob/living/silicon/pai)) +// For the tcomms monitor +#define ispathhuman(A) (ispath(A, /mob/living/carbon/human)) +#define ispathbrain(A) (ispath(A, /mob/living/carbon/brain)) +#define ispathslime(A) (ispath(A, /mob/living/carbon/slime)) +#define ispathbot(A) (ispath(A, /mob/living/simple_animal/bot)) +#define ispathsilicon(A) (ispath(A, /mob/living/silicon)) +#define ispathanimal(A) (ispath(A, /mob/living/simple_animal)) + #define isAutoAnnouncer(A) (istype((A), /mob/living/automatedannouncer)) #define isAIEye(A) (istype((A), /mob/camera/aiEye)) diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm index a77edd5cadc..49133b1cd43 100644 --- a/code/game/machinery/telecomms/logbrowser.dm +++ b/code/game/machinery/telecomms/logbrowser.dm @@ -76,28 +76,27 @@ var/race // The actual race of the mob var/language = "Human" // MMIs, pAIs, Cyborgs and humans all speak Human var/mobtype = C.parameters["mobtype"] - var/mob/M = new mobtype - if(ishuman(M) || isbrain(M)) - var/mob/living/carbon/human/H = M - race = "[H.species.name]" + if(ispathhuman(mobtype) || ispathbrain(mobtype)) + race = "Human" // The initializing thing wouldn't work anyways since it just kept the path, and kept no species data - else if(issmall(M)) + else if(ispath(mobtype, /mob/living/carbon/human/monkey)) // I am aware this will only work for always-monkeys, and not + // those made a monkey after first being a human. race = "Monkey" language = race - else if(issilicon(M) || C.parameters["job"] == "AI") // sometimes M gets deleted prematurely for AIs... just check the job + else if(ispathsilicon(mobtype) || C.parameters["job"] == "AI") // sometimes M gets deleted prematurely for AIs... just check the job race = "Artificial Life" - else if(isslime(M)) // NT knows a lot about slimes, but not aliens. Can identify slimes + else if(ispathslime(mobtype)) // NT knows a lot about slimes, but not aliens. Can identify slimes race = "Slime" language = race - else if(isbot(M)) + else if(ispathbot(mobtype)) race = "Bot" - else if(isanimal(M)) + else if(ispathanimal(mobtype)) race = "Domestic Animal" language = race @@ -105,8 +104,6 @@ race = "Unidentifiable" language = race - qdel(M) - // -- If the orator is a human, or universal translate is active, OR mob has universal speech on -- if(language == "Human" || universal_translate || C.parameters["uspeech"])