From 72a8d47b7a8343ab85d0d87bbec5b090ba5461a2 Mon Sep 17 00:00:00 2001 From: Alberyk Date: Thu, 8 Nov 2018 18:53:03 -0200 Subject: [PATCH] Fixes being able to upload ai/borgs laws while in non-station z-levels (#5574) What the title says, you can now only upload borgs and ai laws if you are on a station z-level. --- code/game/machinery/computer/law.dm | 117 ++++++++++++++-------------- html/changelogs/alberyk-aifix.yml | 6 ++ 2 files changed, 66 insertions(+), 57 deletions(-) create mode 100644 html/changelogs/alberyk-aifix.yml diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 7cf08d61fcd..cbaed036d30 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -11,50 +11,50 @@ var/opened = 0 - verb/AccessInternals() - set category = "Object" - set name = "Access Computer's Internals" - set src in oview(1) - if(get_dist(src, usr) > 1 || usr.restrained() || usr.lying || usr.stat || istype(usr, /mob/living/silicon)) - return - - opened = !opened - if(opened) - usr << "The access panel is now open." - else - usr << "The access panel is now closed." +/obj/machinery/computer/aiupload/verb/AccessInternals() + set category = "Object" + set name = "Access Computer's Internals" + set src in oview(1) + if(get_dist(src, usr) > 1 || usr.restrained() || usr.lying || usr.stat || istype(usr, /mob/living/silicon)) return - - attackby(obj/item/weapon/O as obj, mob/user as mob) - if (user.z > 6) - user << "Unable to establish a connection: You're too far away from the station!" - return - if(istype(O, /obj/item/weapon/aiModule)) - var/obj/item/weapon/aiModule/M = O - M.install(src) - else - ..() + opened = !opened + if(opened) + usr << "The access panel is now open." + else + usr << "The access panel is now closed." + return - attack_hand(var/mob/user as mob) - if(src.stat & NOPOWER) - usr << "The upload computer has no power!" - return - if(src.stat & BROKEN) - usr << "The upload computer is broken!" - return +/obj/machinery/computer/aiupload/attackby(obj/item/weapon/O as obj, mob/user as mob) + if (!src.z in current_map.station_levels) + user << "Unable to establish a connection:" + return + if(istype(O, /obj/item/weapon/aiModule)) + var/obj/item/weapon/aiModule/M = O + M.install(src) + else + ..() - src.current = select_active_ai(user) - if (!src.current) - usr << "No active AIs detected." - else - usr << "[src.current.name] selected for law changes." +/obj/machinery/computer/aiupload/attack_hand(var/mob/user as mob) + if(src.stat & NOPOWER) + user << "The upload computer has no power!" + return + if(src.stat & BROKEN) + user << "The upload computer is broken!" return - attack_ghost(user as mob) - return 1 + src.current = select_active_ai(user) + + if (!src.current) + user << "No active AIs detected." + else + user << "[src.current.name] selected for law changes." + return + +/obj/machinery/computer/aiupload/attack_ghost(user as mob) + return 1 /obj/machinery/computer/borgupload @@ -67,28 +67,31 @@ var/mob/living/silicon/robot/current = null - attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob) - if(istype(module, /obj/item/weapon/aiModule)) - module.install(src) - else - return ..() +/obj/machinery/computer/borgupload/attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob) + if (!src.z in current_map.station_levels) + user << "Unable to establish a connection:" + return + if(istype(module, /obj/item/weapon/aiModule)) + module.install(src) + else + return ..() - attack_hand(var/mob/user as mob) - if(src.stat & NOPOWER) - usr << "The upload computer has no power!" - return - if(src.stat & BROKEN) - usr << "The upload computer is broken!" - return - - src.current = freeborg() - - if (!src.current) - usr << "No free cyborgs detected." - else - usr << "[src.current.name] selected for law changes." +/obj/machinery/computer/borgupload/attack_hand(var/mob/user as mob) + if(src.stat & NOPOWER) + user << "The upload computer has no power!" + return + if(src.stat & BROKEN) + user << "The upload computer is broken!" return - attack_ghost(user as mob) - return 1 + src.current = freeborg() + + if (!src.current) + user << "No free cyborgs detected." + else + user << "[src.current.name] selected for law changes." + return + +/obj/machinery/computer/borgupload/attack_ghost(user as mob) + return 1 diff --git a/html/changelogs/alberyk-aifix.yml b/html/changelogs/alberyk-aifix.yml new file mode 100644 index 00000000000..6bd527b8dea --- /dev/null +++ b/html/changelogs/alberyk-aifix.yml @@ -0,0 +1,6 @@ +author: Alberyk + +delete-after: True + +changes: + - tweak: "You can now only upload AI and cyborgs laws if the console is located at a station's z-level."