diff --git a/code/defines/mob/living/silicon/robot.dm b/code/defines/mob/living/silicon/robot.dm index a9cd5d52382..d3bcfa6d020 100644 --- a/code/defines/mob/living/silicon/robot.dm +++ b/code/defines/mob/living/silicon/robot.dm @@ -40,7 +40,7 @@ var/jetpack = 0 var/datum/effects/system/ion_trail_follow/ion_trail = null var/jeton = 0 - + var/borgwires = 15 var/killswitch = 0 var/killswitch_time = 60 var/weapon_lock = 0 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 1528c3a1860..88d64ba6ede 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -23,6 +23,103 @@ flagIndex+=1 return Borgwires +/mob/living/silicon/robot/proc/isWireColorCut(var/wireColor) + var/wireFlag = BorgWireColorToFlag[wireColor] + return ((src.borgwires & wireFlag) == 0) + +/mob/living/silicon/robot/proc/isWireCut(var/wireIndex) + var/wireFlag = BorgIndexToFlag[wireIndex] + return ((src.borgwires & wireFlag) == 0) + +/mob/living/silicon/robot/proc/cut(var/wireColor) + var/wireFlag = BorgWireColorToFlag[wireColor] + var/wireIndex = BorgWireColorToIndex[wireColor] + borgwires &= ~wireFlag + switch(wireIndex) + if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI + if (src.lawupdate == 1) + src << "LawSync protocol engaged." + src.show_laws() + if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control + if (src.connected_ai) + src.connected_ai = null + src.interact(usr) + +/mob/living/silicon/robot/proc/mend(var/wireColor) + var/wireFlag = BorgWireColorToFlag[wireColor] + var/wireIndex = BorgWireColorToIndex[wireColor] + borgwires |= wireFlag + switch(wireIndex) + if(BORG_WIRE_LAWCHECK) //turns law updates back on assuming the borg hasn't been emagged + if (src.lawupdate == 0 && !src.emagged) + src.lawupdate = 1 + src.interact(usr) + + +/mob/living/silicon/robot/proc/pulse(var/wireColor) + var/wireIndex = BorgWireColorToIndex[wireColor] + switch(wireIndex) + if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh + if (src.lawupdate) + src.lawsync() + + if (BORG_WIRE_AI_CONTROL) //pule the AI wire to make the borg reselect an AI + if(!src.emagged) + src.connected_ai = activeais() + src.interact(usr) + +/mob/living/silicon/robot/proc/interact(mob/user) + if(wiresexposed && (!istype(user, /mob/living/silicon))) + user.machine = src + var/t1 = text("Access Panel
\n") + var/list/Borgwires = list( + "Orange" = 1, + "Dark red" = 2, + "White" = 3, + "Yellow" = 4, + ) + for(var/wiredesc in Borgwires) + var/is_uncut = src.borgwires & BorgWireColorToFlag[Borgwires[wiredesc]] + t1 += "[wiredesc] wire: " + if(!is_uncut) + t1 += "Mend" + else + t1 += "Cut " + t1 += "Pulse " + t1 += "
" + t1 += text("
\n[(src.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]
\n[(src.connected_ai ? "The AI link light is on." : "The AI link light is off.")]") + t1 += text("

Close

\n") + user << browse(t1, "window=borgwires") + onclose(user, "borgwires") + +/mob/living/silicon/robot/Topic(href, href_list) + ..() + if (((in_range(src, usr) && istype(src.loc, /turf))) && !istype(usr, /mob/living/silicon)) + usr.machine = src + if (href_list["borgwires"]) + var/t1 = text2num(href_list["borgwires"]) + if (!( istype(usr.equipped(), /obj/item/weapon/wirecutters) )) + usr << "You need wirecutters!" + return + if (src.isWireColorCut(t1)) + src.mend(t1) + else + src.cut(t1) + else if (href_list["pulse"]) + var/t1 = text2num(href_list["pulse"]) + if (!istype(usr.equipped(), /obj/item/device/multitool)) + usr << "You need a multitool!" + return + if (src.isWireColorCut(t1)) + usr << "You can't pulse a cut wire." + return + else + src.pulse(t1) + else if (href_list["close2"]) + usr << browse(null, "window=borgwires") + usr.machine = null + return + /mob/living/silicon/robot/New(loc,var/syndie = 0) spawn (1) @@ -400,6 +497,12 @@ // chargecount = 0 updateicon() + else if (istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/multitool)) + if (wiresexposed) + interact(user) + else + user << "You can't reach the wiring." + else if (istype(W, /obj/item/weapon/screwdriver) && opened) // haxing wiresexposed = !wiresexposed user << "The wires have been [wiresexposed ? "exposed" : "unexposed"]"