From 5e156e7a07090784bd4441f018f06f81b6d6df3b Mon Sep 17 00:00:00 2001 From: AnturK Date: Thu, 21 Jun 2018 02:38:51 +0200 Subject: [PATCH 1/2] Fixes AI's being unable to call shuttle using comm console. (#38534) * Fixes AI's being unable to call shuttle using comm console. * Lets get rid of double negatives * viewvers for --- .../game/machinery/computer/communications.dm | 5 ++-- code/game/objects/objs.dm | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 445ed389b7..d1e3de1248 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -45,8 +45,9 @@ /obj/machinery/computer/communications/process() if(..()) - if(state != STATE_STATUSDISPLAY && state != STATE_CALLSHUTTLE && state != STATE_PURCHASE && state != STATE_VIEWMESSAGE) - updateDialog() + var/ai_autoupdate = aistate != STATE_STATUSDISPLAY && aistate != STATE_CALLSHUTTLE && aistate != STATE_PURCHASE && aistate != STATE_VIEWMESSAGE + var/machine_user_autoupdate = state != STATE_STATUSDISPLAY && state != STATE_CALLSHUTTLE && state != STATE_PURCHASE && state != STATE_VIEWMESSAGE + updateDialog(machine_user_autoupdate,ai_autoupdate) /obj/machinery/computer/communications/Topic(href, href_list) if(..()) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 02e1cc9bd0..664cdbf383 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -138,19 +138,22 @@ else obj_flags &= ~IN_USE -/obj/proc/updateDialog() +/obj/proc/updateDialog(update_viewers = TRUE,update_ais = TRUE) // Check that people are actually using the machine. If not, don't update anymore. if(obj_flags & IN_USE) - var/list/nearby = viewers(1, src) - var/is_in_use = 0 - for(var/mob/M in nearby) - if ((M.client && M.machine == src)) - is_in_use = 1 - src.interact(M) - var/ai_in_use = AutoUpdateAI(src) + var/is_in_use = FALSE + if(update_viewers) + for(var/mob/M in viewers(1, src)) + if ((M.client && M.machine == src)) + is_in_use = TRUE + src.interact(M) + var/ai_in_use = FALSE + if(update_ais) + ai_in_use = AutoUpdateAI(src) - if(!ai_in_use && !is_in_use) - obj_flags &= ~IN_USE + if(update_viewers && update_ais) //State change is sure only if we check both + if(!ai_in_use && !is_in_use) + obj_flags &= ~IN_USE /obj/attack_ghost(mob/user)