[MIRROR] Fix various issues with browser statpanel (#580)

* Fix various issues with browser statpanel

* a

Co-authored-by: Tad Hardesty <tad@platymuus.com>
Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
SkyratBot
2020-09-02 02:42:40 +02:00
committed by GitHub
co-authored by Tad Hardesty Azarak
parent 582c843bbf
commit c4c9dfabf6
15 changed files with 85 additions and 72 deletions
+15 -7
View File
@@ -181,7 +181,7 @@
stack_trace("Borg MMI lacked a brainmob")
mmi = null
if(connected_ai)
connected_ai.connected_robots -= src
set_connected_ai(null)
if(shell)
GLOB.available_ai_shells -= src
else
@@ -461,9 +461,7 @@
gib()
/mob/living/silicon/robot/proc/UnlinkSelf()
if(src.connected_ai)
connected_ai.connected_robots -= src
src.connected_ai = null
set_connected_ai(null)
lawupdate = FALSE
set_lockcharge(FALSE)
scrambledcodes = TRUE
@@ -956,7 +954,7 @@
builtInCamera.c_tag = real_name //update the camera name too
mainframe = AI
deployed = TRUE
connected_ai = mainframe
set_connected_ai(mainframe)
mainframe.connected_robots |= src
lawupdate = TRUE
lawsync()
@@ -1069,9 +1067,8 @@
/mob/living/silicon/robot/proc/TryConnectToAI()
connected_ai = select_active_ai_with_fewest_borgs(z)
set_connected_ai(select_active_ai_with_fewest_borgs(z))
if(connected_ai)
connected_ai.connected_robots += src
lawsync()
lawupdate = TRUE
return TRUE
@@ -1092,3 +1089,14 @@
cell.charge = min(cell.charge + amount, cell.maxcharge)
if(repairs)
heal_bodypart_damage(repairs, repairs - 1)
/mob/living/silicon/robot/proc/set_connected_ai(new_ai)
if(connected_ai == new_ai)
return
. = connected_ai
connected_ai = new_ai
if(.)
var/mob/living/silicon/ai/old_ai = .
old_ai.connected_robots -= src
if(connected_ai)
connected_ai.connected_robots |= src
@@ -341,7 +341,7 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real
SetEmagged(1)
SetStun(60) //Borgs were getting into trouble because they would attack the emagger before the new laws were shown
lawupdate = FALSE
connected_ai = null
set_connected_ai(null)
message_admins("[ADMIN_LOOKUPFLW(user)] emagged cyborg [ADMIN_LOOKUPFLW(src)]. Laws overridden.")
log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
var/time = time2text(world.realtime,"hh:mm:ss")