Robot code clean up and fixes.

Fixes runtime when a borg is reset.
Fixes issue where /proc/select_active_ai_with_fewest_borgs() would not always return the intended AI.
Fixes issues with new borgs spamming the master AI with creation messages under some circumstances.
This commit is contained in:
PsiOmega
2015-03-10 13:37:20 +01:00
parent d3d9e0b2ed
commit 533ccef0ab
11 changed files with 43 additions and 37 deletions
+3 -8
View File
@@ -34,8 +34,7 @@ var/const/BORG_WIRE_CAMERA = 16
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
if(!mended)
if (R.connected_ai)
R.connected_ai = null
R.disconnect_from_ai()
if (BORG_WIRE_CAMERA)
if(!isnull(R.camera) && !R.scrambledcodes)
@@ -56,12 +55,8 @@ var/const/BORG_WIRE_CAMERA = 16
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
if(!R.emagged)
var/mob/living/silicon/ai/new_ai = select_active_ai(R)
if(new_ai && (new_ai != R.connected_ai))
R.connected_ai.connected_robots -= src
R.connected_ai = new_ai
new_ai.connected_robots += src
R.notify_ai(1)
R.sync()
R.connect_to_ai(new_ai)
if (BORG_WIRE_CAMERA)
if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes)
R.camera.kick_viewers() // Kick anyone watching the Cyborg's camera