From a8ddd45690ca76cfa694483d6b6d37d62c799c63 Mon Sep 17 00:00:00 2001 From: AnturK Date: Sat, 17 Jan 2015 18:08:55 +0100 Subject: [PATCH] Makes assembly parts work with wires --- code/datums/wires/wires.dm | 20 +++++++++++--------- code/game/machinery/doors/airlock.dm | 7 ++++++- code/modules/assembly/assembly.dm | 5 +++++ code/modules/assembly/proximity.dm | 1 + code/modules/assembly/signaler.dm | 10 +--------- code/modules/assembly/timer.dm | 1 + code/modules/assembly/voice.dm | 1 + 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index e03e9e3fa0c..6081eaa8e28 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -132,11 +132,13 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", // Attach else - if(istype(I, /obj/item/device/assembly/signaler)) - L.drop_item() - Attach(colour, I) - else - L << "You need a remote signaller!" + if(istype(I, /obj/item/device/assembly)) + var/obj/item/device/assembly/A = I; + if(A.attachable) + L.drop_item() + Attach(colour, A) + else + L << "You need a attachable assembly!" @@ -229,8 +231,8 @@ var/const/POWER = 8 return signallers[colour] return null -/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S) - if(colour && S) +/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/S) + if(colour && S && S.attachable) if(!IsAttached(colour)) signallers[colour] = S S.loc = holder @@ -239,7 +241,7 @@ var/const/POWER = 8 /datum/wires/proc/Detach(var/colour) if(colour) - var/obj/item/device/assembly/signaler/S = GetAttached(colour) + var/obj/item/device/assembly/S = GetAttached(colour) if(S) signallers -= colour S.connected = null @@ -247,7 +249,7 @@ var/const/POWER = 8 return S -/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S) +/datum/wires/proc/Pulse(var/obj/item/device/assembly/S) for(var/colour in signallers) if(S == signallers[colour]) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index a536e5a485e..f4626671333 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1197,4 +1197,9 @@ About the new airlock wires panel: /obj/machinery/door/airlock/CanAStarPass(var/obj/item/weapon/card/id/ID) //Airlock is passable if it is open (!density), bot has access, and is not bolted shut) - return !density || (check_access(ID) && !locked) \ No newline at end of file + return !density || (check_access(ID) && !locked) + +/obj/machinery/door/airlock/HasProximity(atom/movable/AM as mob|obj) + for (var/obj/A in contents) + A.HasProximity(AM) + return \ No newline at end of file diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 0fbda14756b..b1d0325970a 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -17,6 +17,8 @@ var/obj/item/device/assembly_holder/holder = null var/cooldown = 0//To prevent spam var/wires = WIRE_RECEIVE | WIRE_PULSE + var/attachable = 0 // can this be attached to wires + var/datum/wires/connected = null var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate() var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder @@ -59,6 +61,9 @@ //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct /obj/item/device/assembly/proc/pulse(var/radio = 0) + if(src.connected && src.wires) + connected.Pulse(src) + return 1 if(holder && (wires & WIRE_PULSE)) holder.process_activation(src, 1, 0) if(holder && (wires & WIRE_PULSE_SPECIAL)) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index e74d95c1efd..792b47d805e 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -5,6 +5,7 @@ m_amt = 800 g_amt = 200 origin_tech = "magnets=1" + attachable = 1 var/scanning = 0 var/timing = 0 diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index ef245f1c0b1..c85e9eb5222 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -7,11 +7,11 @@ g_amt = 120 origin_tech = "magnets=1" wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE + attachable = 1 var/code = 30 var/frequency = 1457 var/delay = 0 - var/datum/wires/connected = null var/datum/radio_frequency/radio_connection /obj/item/device/assembly/signaler/New() @@ -126,14 +126,6 @@ Code: if(S) S.pulse(0) return 0*/ - -/obj/item/device/assembly/signaler/pulse(var/radio = 0) - if(src.connected && src.wires) - connected.Pulse(src) - else - return ..(radio) - - /obj/item/device/assembly/signaler/receive_signal(datum/signal/signal) if(!signal) return 0 if(signal.encryption != code) return 0 diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 3fe26476392..be64fb8b057 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -5,6 +5,7 @@ m_amt = 500 g_amt = 50 origin_tech = "magnets=1" + attachable = 1 var/timing = 0 var/time = 5 diff --git a/code/modules/assembly/voice.dm b/code/modules/assembly/voice.dm index dd77a4a9f08..3706dd5fdf9 100644 --- a/code/modules/assembly/voice.dm +++ b/code/modules/assembly/voice.dm @@ -6,6 +6,7 @@ g_amt = 50 origin_tech = "magnets=1" flags = HEAR + attachable = 1 var/listening = 0 var/recorded = "" //the activation message