diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 6043a7d3055..8349f93e1be 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -312,7 +312,10 @@ user << "Controls are now [locked ? "locked" : "unlocked"]." else user << "Access denied." - + else if(istype(I,/obj/item/device/multitool) && !locked) + var/obj/item/device/multitool/M = I + M.buffer = src + user << "You add [src] to multitool buffer." else //if the turret was attacked with the intention of harming it: user.changeNext_move(CLICK_CD_MELEE) @@ -924,7 +927,10 @@ updateUsrDialog() else user << "Access denied." - + else if(istype(I,/obj/item/device/multitool) && !Parent_Turret.locked) + var/obj/item/device/multitool/M = I + M.buffer = Parent_Turret + user << "You add [Parent_Turret] to multitool buffer." else user.changeNext_move(CLICK_CD_MELEE) Parent_Turret.health -= I.force * 0.5 @@ -992,38 +998,52 @@ var/enabled = 1 var/lethal = 0 var/locked = 1 - var/control_area //can be area name, path or nothing. + var/control_area = null //can be area name, path or nothing. var/ailock = 0 // AI cannot use this req_access = list(access_ai_upload) + var/list/obj/machinery/porta_turret/turrets = list() /obj/machinery/turretid/New(loc, ndir = 0, built = 0) ..() - if(!control_area) - var/area/CA = get_area(src) - if(CA.master && CA.master != CA) - control_area = CA.master - else - control_area = CA - else if(istext(control_area)) - for(var/area/A in world) - if(A.name && A.name==control_area) - control_area = A - break if(built) dir = ndir locked = 0 pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 power_change() //Checks power and initial settings - //don't have to check if control_area is path, since get_area_all_atoms can take path. return -/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user, params) +/obj/machinery/turretid/initialize() //map-placed turrets autolink turrets + if(control_area && istext(control_area)) + for(var/area/A in world) + if(A.name && A.name==control_area) + control_area = A + break + + if(!control_area) + var/area/CA = get_area(src) + if(CA.master && CA.master != CA) + control_area = CA.master + else + control_area = CA + + for(var/obj/machinery/porta_turret/T in get_area_all_atoms(control_area)) + turrets |= T + +/obj/machinery/turretid/attackby(obj/item/I, mob/user, params) if(stat & BROKEN) return + + if (istype(I,/obj/item/device/multitool)) + var/obj/item/device/multitool/M = I + if(M.buffer && istype(M.buffer,/obj/machinery/porta_turret)) + turrets |= M.buffer + user << "You link [M.buffer] with [src]" + return + if (istype(user, /mob/living/silicon)) return src.attack_hand(user) - else if( get_dist(src, user) == 0 ) // trying to unlock the interface + if( get_dist(src, user) == 0 ) // trying to unlock the interface if (src.allowed(usr)) if(emagged) user << "The turret control is unresponsive." @@ -1110,9 +1130,8 @@ updateTurrets() /obj/machinery/turretid/proc/updateTurrets() - if(control_area) - for (var/obj/machinery/porta_turret/aTurret in get_area_all_atoms(control_area)) - aTurret.setState(enabled, lethal) + for (var/obj/machinery/porta_turret/aTurret in turrets) + aTurret.setState(enabled, lethal) src.update_icon() /obj/machinery/turretid/power_change() diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 4dd96c01c8c..bb394d55184 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -94,8 +94,9 @@ dat += "
" if(P) - if(P.buffer) - dat += "

MULTITOOL BUFFER: [P.buffer] ([P.buffer.id]) \[Link\] \[Flush\]" + var/obj/machinery/telecomms/T = P.buffer + if(T && istype(T)) + dat += "

MULTITOOL BUFFER: [T] ([T.id])
\[Link\] \[Flush\]" else dat += "

MULTITOOL BUFFER:
\[Add Machine\]" @@ -284,14 +285,15 @@ if(href_list["link"]) if(P) - if(P.buffer && P.buffer != src) - if(!(src in P.buffer.links)) - P.buffer.links.Add(src) + var/obj/machinery/telecomms/T = P.buffer + if(T && istype(T) && T != src) + if(!(src in T.links)) + T.links.Add(src) - if(!(P.buffer in src.links)) - src.links.Add(P.buffer) + if(!(T in src.links)) + src.links.Add(T) - temp = "-% Successfully linked with \ref[P.buffer] [P.buffer.name] %-" + temp = "-% Successfully linked with \ref[T] [T.name] %-" else temp = "-% Unable to acquire buffer %-" diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm index bd2ae7268f6..39a8afa9ff8 100644 --- a/code/game/objects/items/devices/multitool.dm +++ b/code/game/objects/items/devices/multitool.dm @@ -15,7 +15,7 @@ throw_speed = 3 materials = list(MAT_METAL=50, MAT_GLASS=20) origin_tech = "magnets=1;engineering=1" - var/obj/machinery/telecomms/buffer // simple machine buffer for device linkage + var/obj/machinery/buffer // simple machine buffer for device linkage hitsound = 'sound/weapons/tap.ogg'