From 0015be8d742d74412883cfd5fb34041e7f382166 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Tue, 18 Mar 2014 22:25:07 -0600 Subject: [PATCH 1/7] AIs are notified when a cyborg is slaved to it Includes: -Roundstart cyborgs -New cyborgs -Reclassified cyborgs -Cyborgs when the AI wire is pulsed --- code/datums/wires/robot.dm | 5 ++++- code/game/objects/items/robot/robot_upgrades.dm | 4 ++++ code/modules/mob/living/silicon/robot/robot.dm | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 56c9e53e905..b33f2d29e67 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -55,7 +55,10 @@ var/const/BORG_WIRE_CAMERA = 16 switch(index) if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI if(!R.emagged) - R.connected_ai = select_active_ai() + var/new_ai = select_active_ai() + if(new_ai && (new_ai != R.connected_ai)) + R.connected_ai = new_ai + R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" if (BORG_WIRE_CAMERA) if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 8904cbbfc21..7e950271240 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -51,8 +51,10 @@ /obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) if(..()) return 0 + R.connected_ai << "

NOTICE - Cyborg connection change detected: [R.name] has been reclassified as [heldname].
" R.name = heldname R.real_name = heldname + R.custom_name = heldname //Required or else if the cyborg's module changes, their name is lost. return 1 @@ -74,6 +76,8 @@ R.key = ghost.key R.stat = CONSCIOUS + R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" + return 1 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 0d517a64c01..d3ee0598bc3 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -86,6 +86,7 @@ connected_ai.connected_robots += src lawsync() lawupdate = 1 + connected_ai << "

NOTICE - New cyborg connection detected: [name].
" else lawupdate = 0 From 87f85e707362d1ca748914da3a149cbaaf296f98 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Tue, 18 Mar 2014 22:57:14 -0600 Subject: [PATCH 2/7] Added tracking links to the notices --- code/datums/wires/robot.dm | 2 +- code/game/objects/items/robot/robot_upgrades.dm | 4 ++-- code/modules/mob/living/silicon/robot/robot.dm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index b33f2d29e67..1f8aeae66bf 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -58,7 +58,7 @@ var/const/BORG_WIRE_CAMERA = 16 var/new_ai = select_active_ai() if(new_ai && (new_ai != R.connected_ai)) R.connected_ai = new_ai - R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" + R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name]
" if (BORG_WIRE_CAMERA) if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 7e950271240..3d2e75cec5f 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -51,7 +51,7 @@ /obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) if(..()) return 0 - R.connected_ai << "

NOTICE - Cyborg connection change detected: [R.name] has been reclassified as [heldname].
" + R.connected_ai << "

NOTICE - Cyborg connection change detected: [R.name] has been reclassified as [heldname].
" R.name = heldname R.real_name = heldname R.custom_name = heldname //Required or else if the cyborg's module changes, their name is lost. @@ -76,7 +76,7 @@ R.key = ghost.key R.stat = CONSCIOUS - R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" + R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" return 1 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index d3ee0598bc3..026d0ad5036 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -86,7 +86,7 @@ connected_ai.connected_robots += src lawsync() lawupdate = 1 - connected_ai << "

NOTICE - New cyborg connection detected: [name].
" + connected_ai << "

NOTICE - New cyborg connection detected: [name]
" else lawupdate = 0 From c891362dd361d1ee991dd88193a340fba56ddbcd Mon Sep 17 00:00:00 2001 From: ikarrus Date: Tue, 18 Mar 2014 23:07:48 -0600 Subject: [PATCH 3/7] Included fixing cyborg camera names not updating when reclassed or renamed by admins --- code/__HELPERS/unsorted.dm | 5 +++++ code/game/objects/items/robot/robot_upgrades.dm | 1 + 2 files changed, 6 insertions(+) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c29a796a39a..1b10b05e1d0 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -249,6 +249,11 @@ Turf and target are seperate in case you want to teleport some distance from a t if(C.dna) C.dna.real_name = real_name + if(istype(src, /mob/living/silicon/robot)) + var/mob/living/silicon/robot/R = src + if(R.camera) + R.camera.c_tag = real_name + if(oldname) //update the datacore records! This is goig to be a bit costly. for(var/list/L in list(data_core.general,data_core.medical,data_core.security,data_core.locked)) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 3d2e75cec5f..6fc763f524a 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -54,6 +54,7 @@ R.connected_ai << "

NOTICE - Cyborg connection change detected: [R.name] has been reclassified as [heldname].
" R.name = heldname R.real_name = heldname + R.camera.c_tag = heldname R.custom_name = heldname //Required or else if the cyborg's module changes, their name is lost. return 1 From 0fbafdb2db50fb635696341df62a0b3b53a44875 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Wed, 19 Mar 2014 09:07:43 -0600 Subject: [PATCH 4/7] Added a notice for module changes as well. --- code/game/objects/items/robot/robot_upgrades.dm | 5 +++-- code/modules/mob/living/silicon/robot/robot.dm | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 6fc763f524a..c9fa53d4692 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -35,6 +35,7 @@ R.modtype = "robot" R.updatename("Default") R.status_flags |= CANPUSH + R.connected_ai << "

NOTICE - Cyborg module change detected: [R.name] has been reset.
" R.updateicon() return 1 @@ -51,7 +52,7 @@ /obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) if(..()) return 0 - R.connected_ai << "

NOTICE - Cyborg connection change detected: [R.name] has been reclassified as [heldname].
" + R.connected_ai << "

NOTICE - Cyborg reclassification detected: [R.name] is now designated as [heldname].
" R.name = heldname R.real_name = heldname R.camera.c_tag = heldname @@ -77,7 +78,7 @@ R.key = ghost.key R.stat = CONSCIOUS - R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" + R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" return 1 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 026d0ad5036..574d11f236b 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -86,7 +86,7 @@ connected_ai.connected_robots += src lawsync() lawupdate = 1 - connected_ai << "

NOTICE - New cyborg connection detected: [name]
" + connected_ai << "

NOTICE - New cyborg connection detected: [name]
" else lawupdate = 0 @@ -215,6 +215,7 @@ overlays -= "eyes" //Takes off the eyes that it started with transform_animation(animation_length) + connected_ai << "

NOTICE - Cyborg module change detected: [name] has loaded the [mod] module.
" updateicon() /mob/living/silicon/robot/proc/transform_animation(animation_length) From a96a090c16cf4ad31ba50066b939b354d37a03ad Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Thu, 20 Mar 2014 09:39:07 -0600 Subject: [PATCH 5/7] typo --- config/game_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/game_options.txt b/config/game_options.txt index 794cb718798..e4560c5601f 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -20,7 +20,7 @@ REVIVAL_BRAIN_LIFE -1 ### RENAMING ### -#Uncommend to allow cyborgs to rename themselves at roundstart. Has no effect on roboticists renaming cyborgs the normal way. +#Uncomment to allow cyborgs to rename themselves at roundstart. Has no effect on roboticists renaming cyborgs the normal way. #RENAME_CYBORG ### MOB MOVEMENT ### From 8f99c9ac618bdec7584ae1e38cb21a5dca234c38 Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Thu, 20 Mar 2014 09:40:21 -0600 Subject: [PATCH 6/7] Update unsorted.dm --- code/__HELPERS/unsorted.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7c68118ea05..4994068adf4 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -337,6 +337,10 @@ Turf and target are seperate in case you want to teleport some distance from a t A.aiPDA.owner = newname A.aiPDA.name = newname + " (" + A.aiPDA.ownjob + ")" + if(cmptext("cyborg",role)) + if(isrobot(src)) + var/mob/living/silicon/robot/A = src + A.custom_name = newname fully_replace_character_name(oldname,newname) @@ -1293,4 +1297,4 @@ proc/check_target_facings(mob/living/initator, mob/living/target) if(initator.dir + 4 == target.dir || initator.dir - 4 == target.dir) //mobs are facing each other return 2 if(initator.dir + 2 == target.dir || initator.dir - 2 == target.dir || initator.dir + 6 == target.dir || initator.dir - 6 == target.dir) //Initating mob is looking at the target, while the target mob is looking in a direction perpendicular to the 1st - return 3 \ No newline at end of file + return 3 From f46cb302a489d1e6102d4ea3925a2e35c2b3f83c Mon Sep 17 00:00:00 2001 From: ikarrus Date: Wed, 2 Apr 2014 22:12:36 -0600 Subject: [PATCH 7/7] Updated to work with newer cyborg code. --- code/__HELPERS/unsorted.dm | 2 +- code/datums/wires/robot.dm | 2 +- code/game/machinery/transformer.dm | 1 + code/game/objects/items/robot/robot_parts.dm | 1 + code/game/objects/items/robot/robot_upgrades.dm | 7 ++++--- code/modules/mob/living/silicon/robot/robot.dm | 14 ++++++++++++-- code/modules/mob/transform_procs.dm | 1 + code/modules/projectiles/projectile/magic.dm | 1 + 8 files changed, 22 insertions(+), 7 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index b1d1bac4a89..bbfb029354e 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -252,7 +252,7 @@ Turf and target are seperate in case you want to teleport some distance from a t if(isrobot(src)) var/mob/living/silicon/robot/R = src if(oldname != real_name) - R.connected_ai << "

NOTICE - Cyborg reclassification detected: [oldname] is now designated as [real_name].
" + R.notify_ai(3, oldname, newname) if(R.camera) R.camera.c_tag = real_name diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 58f5d0647bb..3f0695d07ae 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -58,7 +58,7 @@ var/const/BORG_WIRE_CAMERA = 16 var/new_ai = select_active_ai(R) if(new_ai && (new_ai != R.connected_ai)) R.connected_ai = new_ai - R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name]
" + R.notify_ai(1) if (BORG_WIRE_CAMERA) if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 03660e68caa..5f00666e819 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -87,6 +87,7 @@ sleep(30) if(R) R.SetLockdown(0) + R.notify_ai(1) /obj/machinery/transformer/conveyor/New() ..() diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 3d411567b35..9d94318d2c4 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -213,6 +213,7 @@ if(!aisync) lawsync = 0 O.connected_ai = null + O.notify_ai(1) else if(forced_ai) O.connected_ai = forced_ai if(!lawsync) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index be8104de98b..295097b2464 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -35,7 +35,8 @@ R.modtype = "robot" R.updatename("Default") R.status_flags |= CANPUSH - R.connected_ai << "

NOTICE - Cyborg module change detected: [R.name] has been reset.
" + R.designation = "Default" + R.notify_ai(2) R.updateicon() return 1 @@ -52,7 +53,7 @@ /obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) if(..()) return 0 - R.connected_ai << "

NOTICE - Cyborg reclassification detected: [R.name] is now designated as [heldname].
" + R.notify_ai(3, R.name, heldname) R.name = heldname R.real_name = heldname R.camera.c_tag = heldname @@ -78,7 +79,7 @@ R.key = ghost.key R.stat = CONSCIOUS - R.connected_ai << "

NOTICE - New cyborg connection detected: [R.name].
" + R.notify_ai(1) return 1 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index bc80920dd1d..092907557fa 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -87,7 +87,6 @@ connected_ai.connected_robots += src lawsync() lawupdate = 1 - connected_ai << "

NOTICE - New cyborg connection detected: [name]
" else lawupdate = 0 @@ -211,7 +210,7 @@ overlays -= "eyes" //Takes off the eyes that it started with transform_animation(animation_length) - connected_ai << "

NOTICE - Cyborg module change detected: [name] has loaded the [mod] module.
" + notify_ai(2) updateicon() /mob/living/silicon/robot/proc/transform_animation(animation_length) @@ -1093,3 +1092,14 @@ radio = new /obj/item/device/radio/borg/syndicate(src) module = new /obj/item/weapon/robot_module/syndicate(src) laws = new /datum/ai_laws/syndicate_override() + +/mob/living/silicon/robot/proc/notify_ai(var/notifytype, var/oldname, var/newname) + if(!connected_ai) + return + switch(notifytype) + if(1) //New Cyborg + connected_ai << "

NOTICE - New cyborg connection detected: [name]
" + if(2) //New Module + connected_ai << "

NOTICE - Cyborg module change detected: [name] has loaded the [designation] module.
" + if(3) //New Name + connected_ai << "

NOTICE - Cyborg reclassification detected: [oldname] is now designated as [newname].
" \ No newline at end of file diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index bceb9ce2152..03fb40fb3a9 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -304,6 +304,7 @@ O.loc = loc O.job = "Cyborg" + O.notify_ai(1) O.mmi = new /obj/item/device/mmi(O) O.mmi.transfer_identity(src)//Does not transfer key/client. diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index f5accf497e1..e65431d7ad7 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -117,6 +117,7 @@ proc/wabbajack(mob/living/M) if(istype(M, /mob/living/silicon/robot)) var/mob/living/silicon/robot/Robot = M if(Robot.mmi) qdel(Robot.mmi) + Robot.notify_ai(1) else for(var/obj/item/W in M) if(istype(W, /obj/item/weapon/implant)) //TODO: Carn. give implants a dropped() or something