From c89e3ac1eba9f9d493e53ee9c3f57ed155cbf83e Mon Sep 17 00:00:00 2001 From: Markolie Date: Fri, 20 Feb 2015 17:59:07 +0100 Subject: [PATCH] Revert "Revert "Emergency communications hotfix"" This reverts commit 3ea36839a8ecf6cd5c614e158d0ca4a256d2927d. --- code/controllers/communications.dm | 290 ++++++++---------- code/datums/wires/airlock.dm | 18 +- code/game/gamemodes/nuclear/nuclearbomb.dm | 1 - code/game/machinery/alarm.dm | 2 - code/game/machinery/bots/mulebot.dm | 2 +- code/game/machinery/doors/airlock.dm | 13 +- code/game/machinery/doors/airlock_control.dm | 35 +-- .../embedded_controller/airlock_program.dm | 2 +- .../embedded_controller_base.dm | 12 +- code/game/objects/items/devices/PDA/radio.dm | 2 + .../objects/items/devices/radio/headset.dm | 2 +- .../objects/items/devices/radio/intercom.dm | 14 +- code/game/objects/objs.dm | 5 + code/modules/assembly/signaler.dm | 13 +- code/modules/client/preferences_toggles.dm | 2 +- code/modules/mob/living/silicon/pai/pai.dm | 2 +- code/setup.dm | 2 +- 17 files changed, 185 insertions(+), 232 deletions(-) diff --git a/code/controllers/communications.dm b/code/controllers/communications.dm index 523cc7055b9..6fc3faab894 100644 --- a/code/controllers/communications.dm +++ b/code/controllers/communications.dm @@ -40,7 +40,7 @@ obj/proc/receive_signal(datum/signal/signal, var/receive_method as num, var/receive_param) Handler from received signals. By default does nothing. Define your own for your object. - Avoid of sending signals directly from this proc, use spawn(-1). Do not use sleep() here please. + Avoid of sending signals directly from this proc, use spawn(-1). DO NOT use sleep() here or call procs that sleep please. If you must, use spawn() parameters: signal - see description below. Extract all needed data from the signal before doing sleep(), spawn() or return! receive_method - may be TRANSMISSION_WIRE or TRANSMISSION_RADIO. @@ -61,33 +61,6 @@ */ -/* the radio controller is a confusing piece of shit and didnt work - so i made radios not use the radio controller. -*/ -var/list/all_radios = list() - -/proc/add_radio(var/obj/item/radio, freq) - if(!freq || !radio) - return - if(!all_radios["[freq]"]) - all_radios["[freq]"] = list(radio) - return freq - - all_radios["[freq]"] |= radio - return freq - -/proc/remove_radio(var/obj/item/radio, freq) - if(!freq || !radio) - return - if(!all_radios["[freq]"]) - return - - all_radios["[freq]"] -= radio - -/proc/remove_radio_all(var/obj/item/radio) - for(var/freq in all_radios) - all_radios["[freq]"] -= radio - /* Frequency range: 1200 to 1600 Radiochat range: 1441 to 1489 (most devices refuse to be tune to other frequency, even during mapmaking) @@ -99,10 +72,10 @@ Radio: 1355 - Medical 1357 - Engineering 1359 - Security -1441 - death squad +1341 - death squad 1443 - Confession Intercom 1347 - Cargo techs -1349 - Service +1349 - Service people Devices: 1451 - tracking implant @@ -112,7 +85,7 @@ On the map: 1311 for prison shuttle console (in fact, it is not used) 1435 for status displays 1437 for atmospherics/fire alerts -1439 for engine components +1438 for engine components 1439 for air pumps, air scrubbers, atmo control 1441 for atmospherics - supply tanks 1443 for atmospherics - distribution loop/mixed air tank @@ -160,7 +133,7 @@ var/list/CENT_FREQS = list(ERT_FREQ, DTH_FREQ) // Antag channels, i.e. Syndicate var/list/ANTAG_FREQS = list(SYND_FREQ) -//depending helpers +//depenging helpers var/list/DEPT_FREQS = list(SCI_FREQ, MED_FREQ, ENG_FREQ, SEC_FREQ, SUP_FREQ, SRV_FREQ, ERT_FREQ, SYND_FREQ, DTH_FREQ) #define TRANSMISSION_WIRE 0 @@ -199,18 +172,25 @@ var/list/DEPT_FREQS = list(SCI_FREQ, MED_FREQ, ENG_FREQ, SEC_FREQ, SUP_FREQ, SRV return "radio" /* filters */ -var/const/RADIO_TO_AIRALARM = "1" -var/const/RADIO_FROM_AIRALARM = "2" -var/const/RADIO_CHAT = "3" -var/const/RADIO_ATMOSIA = "4" -var/const/RADIO_NAVBEACONS = "5" -var/const/RADIO_AIRLOCK = "6" -var/const/RADIO_SECBOT = "7" -var/const/RADIO_MULEBOT = "8" -var/const/RADIO_MAGNETS = "9" +//When devices register with the radio controller, they might register under a certain filter. +//Other devices can then choose to send signals to only those devices that belong to a particular filter. +//This is done for performance, so we don't send signals to lots of machines unnecessarily. + +//This filter is special because devices belonging to default also recieve signals sent to any other filter. +var/const/RADIO_DEFAULT = "radio_default" + +var/const/RADIO_TO_AIRALARM = "radio_airalarm" //air alarms +var/const/RADIO_FROM_AIRALARM = "radio_airalarm_rcvr" //devices interested in recieving signals from air alarms +var/const/RADIO_CHAT = "radio_telecoms" +var/const/RADIO_ATMOSIA = "radio_atmos" +var/const/RADIO_NAVBEACONS = "radio_navbeacon" +var/const/RADIO_AIRLOCK = "radio_airlock" +var/const/RADIO_SECBOT = "radio_secbot" +var/const/RADIO_MULEBOT = "radio_mulebot" var/const/RADIO_CLEANBOT = "10" var/const/RADIO_FLOORBOT = "11" var/const/RADIO_MEDBOT = "12" +var/const/RADIO_MAGNETS = "radio_magnet" var/global/datum/controller/radio/radio_controller @@ -218,164 +198,138 @@ var/global/datum/controller/radio/radio_controller radio_controller = new /datum/controller/radio() return 1 -datum/controller/radio +//callback used by objects to react to incoming radio signals +/obj/proc/receive_signal(datum/signal/signal, receive_method, receive_param) + return null + +//The global radio controller +/datum/controller/radio var/list/datum/radio_frequency/frequencies = list() - proc/add_object(obj/device as obj, var/new_frequency as num, var/filter = null as text|null) - var/f_text = num2text(new_frequency) - var/datum/radio_frequency/frequency = frequencies[f_text] +/datum/controller/radio/proc/add_object(obj/device as obj, var/new_frequency as num, var/filter = null as text|null) + var/f_text = num2text(new_frequency) + var/datum/radio_frequency/frequency = frequencies[f_text] - if(!frequency) - frequency = new - frequency.frequency = new_frequency - frequencies[f_text] = frequency + if(!frequency) + frequency = new + frequency.frequency = new_frequency + frequencies[f_text] = frequency - frequency.add_listener(device, filter) - return frequency + frequency.add_listener(device, filter) + return frequency - proc/remove_object(obj/device, old_frequency) - var/f_text = num2text(old_frequency) - var/datum/radio_frequency/frequency = frequencies[f_text] +/datum/controller/radio/proc/remove_object(obj/device, old_frequency) + var/f_text = num2text(old_frequency) + var/datum/radio_frequency/frequency = frequencies[f_text] - if(frequency) - frequency.remove_listener(device) + if(frequency) + frequency.remove_listener(device) - if(frequency.devices.len == 0) - del(frequency) - frequencies -= f_text + if(frequency.devices.len == 0) + del(frequency) + frequencies -= f_text - return 1 + return 1 - proc/return_frequency(var/new_frequency as num) - var/f_text = num2text(new_frequency) - var/datum/radio_frequency/frequency = frequencies[f_text] +/datum/controller/radio/proc/return_frequency(var/new_frequency as num) + var/f_text = num2text(new_frequency) + var/datum/radio_frequency/frequency = frequencies[f_text] - if(!frequency) - frequency = new - frequency.frequency = new_frequency - frequencies[f_text] = frequency + if(!frequency) + frequency = new + frequency.frequency = new_frequency + frequencies[f_text] = frequency - return frequency + return frequency -datum/radio_frequency +/datum/radio_frequency var/frequency as num var/list/list/obj/devices = list() - proc - post_signal(obj/source as obj|null, datum/signal/signal, var/filter = null as text|null, var/range = null as num|null) - //log_admin("DEBUG \[[world.timeofday]\]: post_signal {source=\"[source]\", [signal.debug_print()], filter=[filter]}") -// var/N_f=0 -// var/N_nf=0 -// var/Nt=0 - var/turf/start_point - if(range) - start_point = get_turf(source) - if(!start_point) - del(signal) - return 0 - if (filter) //here goes some copypasta. It is for optimisation. -rastaf0 - for(var/obj/device in devices[filter]) - if(device == source) - continue - if(range) - var/turf/end_point = get_turf(device) - if(!end_point) - continue - //if(max(abs(start_point.x-end_point.x), abs(start_point.y-end_point.y)) <= range) - if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range) - continue - device.receive_signal(signal, TRANSMISSION_RADIO, frequency) - for(var/obj/device in devices["_default"]) - if(device == source) - continue - if(range) - var/turf/end_point = get_turf(device) - if(!end_point) - continue - //if(max(abs(start_point.x-end_point.x), abs(start_point.y-end_point.y)) <= range) - if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range) - continue - device.receive_signal(signal, TRANSMISSION_RADIO, frequency) -// N_f++ - else - for (var/next_filter in devices) -// var/list/obj/DDD = devices[next_filter] -// Nt+=DDD.len - for(var/obj/device in devices[next_filter]) - if(device == source) - continue - if(range) - var/turf/end_point = get_turf(device) - if(!end_point) - continue - //if(max(abs(start_point.x-end_point.x), abs(start_point.y-end_point.y)) <= range) - if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range) - continue - device.receive_signal(signal, TRANSMISSION_RADIO, frequency) -// N_nf++ +/datum/radio_frequency/proc/post_signal(obj/source as obj|null, datum/signal/signal, var/filter = null as text|null, var/range = null as num|null) + var/turf/start_point + if(range) + start_point = get_turf(source) + if(!start_point) + del(signal) + return 0 + if (filter) + send_to_filter(source, signal, filter, start_point, range) + send_to_filter(source, signal, RADIO_DEFAULT, start_point, range) + else + //Broadcast the signal to everyone! + for (var/next_filter in devices) + send_to_filter(source, signal, next_filter, start_point, range) -// log_admin("DEBUG: post_signal(source=[source] ([source.x], [source.y], [source.z]),filter=[filter]) frequency=[frequency], N_f=[N_f], N_nf=[N_nf]") +//Sends a signal to all machines belonging to a given filter. Should be called by post_signal() +/datum/radio_frequency/proc/send_to_filter(obj/source, datum/signal/signal, var/filter, var/turf/start_point = null, var/range = null) + if (range && !start_point) + return + for(var/obj/device in devices[filter]) + if(device == source) + continue + if(range) + var/turf/end_point = get_turf(device) + if(!end_point) + continue + if(start_point.z!=end_point.z || get_dist(start_point, end_point) > range) + continue -// del(signal) + device.receive_signal(signal, TRANSMISSION_RADIO, frequency) - add_listener(obj/device as obj, var/filter as text|null) - if (!filter) - filter = "_default" - //log_admin("add_listener(device=[device],filter=[filter]) frequency=[frequency]") - var/list/obj/devices_line = devices[filter] - if (!devices_line) - devices_line = new - devices[filter] = devices_line - devices_line+=device +/datum/radio_frequency/proc/add_listener(obj/device as obj, var/filter as text|null) + if (!filter) + filter = RADIO_DEFAULT + //log_admin("add_listener(device=[device],filter=[filter]) frequency=[frequency]") + var/list/obj/devices_line = devices[filter] + if (!devices_line) + devices_line = new + devices[filter] = devices_line + devices_line+=device // var/list/obj/devices_line___ = devices[filter_str] // var/l = devices_line___.len - //log_admin("DEBUG: devices_line.len=[devices_line.len]") - //log_admin("DEBUG: devices(filter_str).len=[l]") + //log_admin("DEBUG: devices_line.len=[devices_line.len]") + //log_admin("DEBUG: devices(filter_str).len=[l]") - remove_listener(obj/device) - for (var/devices_filter in devices) - var/list/devices_line = devices[devices_filter] - devices_line-=device - while (null in devices_line) - devices_line -= null - if (devices_line.len==0) - devices -= devices_filter - del(devices_line) +/datum/radio_frequency/proc/remove_listener(obj/device) + for (var/devices_filter in devices) + var/list/devices_line = devices[devices_filter] + devices_line-=device + while (null in devices_line) + devices_line -= null + if (devices_line.len==0) + devices -= devices_filter + del(devices_line) - -obj/proc - receive_signal(datum/signal/signal, receive_method, receive_param) - return null - -datum/signal +/datum/signal var/obj/source - var/transmission_method = 0 + var/transmission_method = 0 //unused at the moment //0 = wire //1 = radio transmission //2 = subspace transmission - var/data = list() + var/list/data = list() var/encryption var/frequency = 0 - proc/copy_from(datum/signal/model) - source = model.source - transmission_method = model.transmission_method - data = model.data - encryption = model.encryption - frequency = model.frequency +/datum/signal/proc/copy_from(datum/signal/model) + source = model.source + transmission_method = model.transmission_method + data = model.data + encryption = model.encryption + frequency = model.frequency - proc/debug_print() - if (source) - . = "signal = {source = '[source]' ([source:x],[source:y],[source:z])\n" - else - . = "signal = {source = '[source]' ()\n" - for (var/i in data) - . += "data\[\"[i]\"\] = \"[data[i]]\"\n" - if(islist(data[i])) - var/list/L = data[i] - for(var/t in L) - . += "data\[\"[i]\"\] list has: [t]" +/datum/signal/proc/debug_print() + if (source) + . = "signal = {source = '[source]' ([source:x],[source:y],[source:z])\n" + else + . = "signal = {source = '[source]' ()\n" + for (var/i in data) + . += "data\[\"[i]\"\] = \"[data[i]]\"\n" + if(islist(data[i])) + var/list/L = data[i] + for(var/t in L) + . += "data\[\"[i]\"\] list has: [t]" diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 3b6d009a5ff..211e82d4394 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -33,14 +33,16 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 /datum/wires/airlock/GetInteractWindow() var/obj/machinery/door/airlock/A = holder + var/haspower = A.arePowerSystemsOn() . += ..() - . += text("
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]", (A.locked ? "The door bolts have fallen!" : "The door bolts look up."), - (A.lights ? "The door bolt lights are on." : "The door bolt lights are off!"), - ((A.arePowerSystemsOn() && !(A.stat & NOPOWER)) ? "The test light is on." : "The test light is off!"), - (A.aiControlDisabled==0 ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), - (A.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), - (A.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."), - (A.emergency==0 ? "The emergency lights are off." : "The emergency lights are on.")) + . += text("
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]", + (A.locked ? "The door bolts have fallen!" : "The door bolts look up."), + ((A.lights && haspower) ? "The door bolt lights are on." : "The door bolt lights are off!"), + ((haspower) ? "The test light is on." : "The test light is off!"), + ((A.aiControlDisabled==0 && !A.emagged && haspower) ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), + ((A.safe==0 && haspower) ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), + ((A.normalspeed==0 && haspower) ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."), + ((A.emergency==0 && haspower) ? "The emergency lights are off." : "The emergency lights are on.")) /datum/wires/airlock/UpdateCut(var/index, var/mended) @@ -125,7 +127,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 switch(index) if(AIRLOCK_WIRE_IDSCAN) //Sending a pulse through this disables emergency access and flashes the red light on the door (if the door has power). - if((A.arePowerSystemsOn()) && (!(A.stat & NOPOWER))) + if((A.arePowerSystemsOn()) && A.density) A.door_animate("deny") if(A.emergency) A.emergency = 0 diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index fe3062a194c..8d4686148b1 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -23,7 +23,6 @@ var/bomb_set var/timing_wire var/removal_stage = 0 // 0 is no removal, 1 is covers removed, 2 is covers open, 3 is sealant open, 4 is unwrenched, 5 is removed from bolts. var/lastentered - flags = FPRINT use_power = 0 unacidable = 1 diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 257069a0248..96b3de5fc45 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -142,8 +142,6 @@ pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 update_icon() - if(ticker && ticker.current_state == 3)//if the game is running - src.initialize() return first_run() diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm index ac28b903947..4e15b07fe01 100644 --- a/code/game/machinery/bots/mulebot.dm +++ b/code/game/machinery/bots/mulebot.dm @@ -71,7 +71,7 @@ var/global/mulebot_count = 0 cell.charge = 2000 cell.maxcharge = 2000 - spawn(50) // must wait for map loading to finish + spawn(5) // must wait for map loading to finish add_to_beacons(bot_filter) mulebot_count += 1 diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 19980597308..daa81985978 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -358,7 +358,7 @@ About the new airlock wires panel: return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerLoss())); /obj/machinery/door/airlock/proc/arePowerSystemsOn() - if (stat & NOPOWER) + if (stat & (NOPOWER|BROKEN)) return 0 return (src.secondsMainPowerLost==0 || src.secondsBackupPowerLost==0) @@ -473,7 +473,8 @@ About the new airlock wires panel: if("spark") flick("door_spark", src) if("deny") - flick("door_deny", src) + if(density && src.arePowerSystemsOn()) + flick("door_deny", src) return /obj/machinery/door/airlock/attack_ai(mob/user as mob) @@ -1028,19 +1029,19 @@ About the new airlock wires panel: if(density) if(beingcrowbarred == 0) //being fireaxe'd var/obj/item/weapon/twohanded/fireaxe/F = C - if(F:wielded) + if(F.wielded) spawn(0) open(1) else - user << "\red You need to be wielding the Fire axe to do that." + user << "\red You need to be wielding \the [C] to do that." else spawn(0) open(1) else if(beingcrowbarred == 0) var/obj/item/weapon/twohanded/fireaxe/F = C - if(F:wielded) + if(F.wielded) spawn(0) close(1) else - user << "\red You need to be wielding the Fire axe to do that." + user << "\red You need to be wielding \the [C] to do that." else spawn(0) close(1) else diff --git a/code/game/machinery/doors/airlock_control.dm b/code/game/machinery/doors/airlock_control.dm index 498d7449a36..ad9d9910365 100644 --- a/code/game/machinery/doors/airlock_control.dm +++ b/code/game/machinery/doors/airlock_control.dm @@ -8,11 +8,6 @@ obj/machinery/door/airlock var/datum/radio_frequency/radio_connection var/cur_command = null //the command the door is currently attempting to complete -obj/machinery/door/airlock/proc/can_radio() - if(!arePowerSystemsOn()) - return 0 - return 1 - obj/machinery/door/airlock/process() ..() if (arePowerSystemsOn()) @@ -21,14 +16,13 @@ obj/machinery/door/airlock/process() obj/machinery/door/airlock/receive_signal(datum/signal/signal) if (!arePowerSystemsOn()) return //no power - if (!can_radio()) return //no radio - if(!signal || signal.encryption) return if(id_tag != signal.data["tag"] || !signal.data["command"]) return cur_command = signal.data["command"] - execute_current_command() + spawn() + execute_current_command() obj/machinery/door/airlock/proc/execute_current_command() if(operating) @@ -94,7 +88,7 @@ obj/machinery/door/airlock/proc/command_completed(var/command) return 1 //Unknown command. Just assume it's completed. -obj/machinery/door/airlock/proc/send_status() +obj/machinery/door/airlock/proc/send_status(var/bumped = 0) if(radio_connection) var/datum/signal/signal = new signal.transmission_method = 1 //radio signal @@ -103,6 +97,9 @@ obj/machinery/door/airlock/proc/send_status() signal.data["door_status"] = density?("closed"):("open") signal.data["lock_status"] = locked?("locked"):("unlocked") + + if (bumped) + signal.data["bumped_with_access"] = 1 radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) @@ -122,17 +119,7 @@ obj/machinery/door/airlock/Bumped(atom/AM) if(istype(AM, /obj/mecha)) var/obj/mecha/mecha = AM if(density && radio_connection && mecha.occupant && (src.allowed(mecha.occupant) || src.check_access_list(mecha.operation_req_access))) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = id_tag - signal.data["timestamp"] = world.time - - signal.data["door_status"] = density?("closed"):("open") - signal.data["lock_status"] = locked?("locked"):("unlocked") - - signal.data["bumped_with_access"] = 1 - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + send_status(1) return obj/machinery/door/airlock/proc/set_frequency(new_frequency) @@ -258,6 +245,12 @@ obj/machinery/access_button/update_icon() else icon_state = "access_button_off" +obj/machinery/access_button/attackby(obj/item/I as obj, mob/user as mob) + //Swiping ID on the access button + if (istype(I, /obj/item/weapon/card/id) || istype(I, /obj/item/device/pda)) + attack_hand(user) + return + ..() obj/machinery/access_button/attack_hand(mob/user) add_fingerprint(usr) @@ -296,4 +289,4 @@ obj/machinery/access_button/airlock_interior obj/machinery/access_button/airlock_exterior frequency = 1379 - command = "cycle_exterior" + command = "cycle_exterior" \ No newline at end of file diff --git a/code/game/machinery/embedded_controller/airlock_program.dm b/code/game/machinery/embedded_controller/airlock_program.dm index 90a2ca57206..24c49f9fa55 100644 --- a/code/game/machinery/embedded_controller/airlock_program.dm +++ b/code/game/machinery/embedded_controller/airlock_program.dm @@ -265,7 +265,7 @@ var/datum/signal/signal = new signal.data["tag"] = tag signal.data["command"] = command - post_signal(signal) + post_signal(signal, RADIO_AIRLOCK) /datum/computer/file/embedded_program/airlock/proc/signalPump(var/tag, var/power, var/direction, var/pressure) var/datum/signal/signal = new diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index a9a8b40ed58..ec411753803 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -3,6 +3,9 @@ name = "Embedded Controller" anchored = 1 + + use_power = 1 + idle_power_usage = 10 var/on = 1 @@ -43,8 +46,10 @@ density = 0 var/id_tag + //var/radio_power_use = 50 //power used to xmit signals var/frequency = 1379 + var/radio_filter = null var/datum/radio_frequency/radio_connection unacidable = 1 @@ -60,14 +65,15 @@ else icon_state = "airlock_control_off" -/obj/machinery/embedded_controller/radio/post_signal(datum/signal/signal) +/obj/machinery/embedded_controller/radio/post_signal(datum/signal/signal, var/filter = null) signal.transmission_method = TRANSMISSION_RADIO if(radio_connection) - return radio_connection.post_signal(src, signal) + //use_power(radio_power_use) //neat idea, but causes way too much lag. + return radio_connection.post_signal(src, signal, filter) else del(signal) /obj/machinery/embedded_controller/radio/proc/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency) \ No newline at end of file + radio_connection = radio_controller.add_object(src, frequency, radio_filter) \ No newline at end of file diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index 63f1082884f..e3ea25af4e4 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -48,6 +48,8 @@ signal.data[key4] = value4 frequency.post_signal(src, signal, filter = s_filter) + + return /obj/item/radio/integrated/receive_signal(datum/signal/signal) /*var/obj/item/device/pda/P = src.loc diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 29854facc67..6cb551ceac3 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -127,7 +127,7 @@ /obj/item/device/radio/headset/heads/captain/alt name = "\proper the captain's bowman headset" - desc = "The headset of the boss. Protects ears from flashbangs. \nChannels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :zz - service, :m - medical, :n - science." + desc = "The headset of the boss. Protects ears from flashbangs. \nChannels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :z - service, :m - medical, :n - science." flags = EARBANGPROTECT icon_state = "com_headset_alt" item_state = "com_headset_alt" diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 0f5f9f64ac1..567dc49bf4f 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -4,7 +4,7 @@ icon_state = "intercom" anchored = 1 w_class = 4.0 - canhear_range = 5 + canhear_range = 2 flags = CONDUCT | NOBLOODY var/number = 0 var/anyai = 1 @@ -15,7 +15,7 @@ ..() processing_objects += src -/obj/item/device/radio/intercom/Destroy() +/obj/item/device/radio/intercom/Del() processing_objects -= src ..() @@ -24,10 +24,6 @@ spawn (0) attack_self(user) -/obj/item/device/radio/intercom/attack_paw(mob/user as mob) - return src.attack_hand(user) - - /obj/item/device/radio/intercom/attack_hand(mob/user as mob) src.add_fingerprint(user) spawn (0) @@ -36,15 +32,13 @@ /obj/item/device/radio/intercom/receive_range(freq, level) if (!on) return -1 - if (isWireCut(WIRE_RECEIVE)) - return -1 if(!(0 in level)) var/turf/position = get_turf(src) if(isnull(position) || !(position.z in level)) return -1 if (!src.listening) return -1 - if(freq == SYND_FREQ) + if(freq in ANTAG_FREQS) if(!(src.syndie)) return -1//Prevents broadcast of messages over devices lacking the encryption @@ -72,4 +66,4 @@ if(!on) icon_state = "intercom-p" else - icon_state = "intercom" \ No newline at end of file + icon_state = "intercom" diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 6049d30bd51..a1b04e09896 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -21,6 +21,11 @@ // Reagent ID => friendly name var/list/reagents_to_log=list() +/obj/New() + ..() + if(ticker && ticker.current_state == GAME_STATE_PLAYING) + initialize() + /obj/Topic(href, href_list, var/nowindow = 0, var/checkrange = 1) // Calling Topic without a corresponding window open causes runtime errors if(!nowindow && ..()) diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 4d24559ef0c..a46b683ca45 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -144,14 +144,13 @@ proc/set_frequency(new_frequency) - if(!radio_controller) - sleep(20) - if(!radio_controller) + spawn(20) + if(!radio_controller) + return + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) return - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) - return // Embedded signaller used in anomalies. /obj/item/device/assembly/signaler/anomaly diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 2960f159546..06c82bfc529 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -33,7 +33,7 @@ if(!holder) return prefs.toggles ^= CHAT_RADIO prefs.save_preferences(src) - usr << "You will [(prefs.toggles & CHAT_RADIO) ? "no longer" : "now"] see radio chatter from radios or speakers" + usr << "You will [(prefs.toggles & CHAT_RADIO) ? "now" : "no longer"] see radio chatter from radios or speakers" feedback_add_details("admin_verb","THR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/verb/toggleadminhelpsound() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index d62c5f544d4..85c15c7989a 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -342,7 +342,7 @@ //I'm not sure how much of this is necessary, but I would rather avoid issues. if(istype(card.loc,/mob)) var/mob/holder = card.loc - holder.drop_from_inventory(card) + holder.unEquip(card) else if(istype(card.loc,/obj/item/clothing/suit/space/space_ninja)) var/obj/item/clothing/suit/space/space_ninja/holder = card.loc holder.pai = null diff --git a/code/setup.dm b/code/setup.dm index c2981325856..2d05f300323 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -725,7 +725,7 @@ var/list/TAGGERLOCATIONS = list("Disposals", #define SOUND_STREAMING 16 #define SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_STREAMING) -#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_ATTACKLOGS|CHAT_LOOC) +#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC) #define BE_TRAITOR 1 #define BE_OPERATIVE 2