From eb68c1e51051b7bc6bcaede4c9fc2604b2fec528 Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Mon, 8 Oct 2012 03:52:25 +0000 Subject: [PATCH] -You can now only hear from headsets when it is on your ear slot. People around you won't be able to hear your headset anymore. -The firedoor wasn't updating the freelook camera. When I looked at it I couldn't figure out why it was using it's own "rebuild" code, supposedly it only updates the air that it set in the dir variable but the current map doesn't utilize it at all (firelocks with a dir of 8 which are lined horizontalally), and you would have to have two thick wide firelocks to make it effective. I've commented it out and I'll put it back in if we have problems. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4832 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/gamehelpers.dm | 8 +++++++- code/game/machinery/doors/firedoor.dm | 5 +++-- code/game/machinery/telecomms/broadcaster.dm | 8 ++++---- .../objects/items/devices/radio/headset.dm | 9 ++++++++- .../objects/items/devices/radio/intercom.dm | 10 +++++----- code/game/objects/items/devices/radio/radio.dm | 18 +++++++++--------- 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index c182249a242..4a1df42914f 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -193,6 +193,12 @@ // Returns a list of mobs who can hear any of the radios given in @radios var/list/speaker_coverage = list() for(var/obj/item/device/radio/R in radios) + // This is usually for headsets, which only the wearer can hear. + if(R.canhear_range == 0) + if(ismob(R.loc)) + . += R.loc + continue + var/turf/speaker = get_turf(R) if(speaker) for(var/turf/T in hear(R.canhear_range,speaker)) @@ -203,7 +209,7 @@ var/turf/ear = get_turf(M) if(ear && (level == 0 || level == ear.z)) if(ear in speaker_coverage) - . += M + . |= M return . diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 6a6ed984205..f4411c0deb7 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -99,7 +99,7 @@ return 0 return 1 - +/* update_nearby_tiles(need_rebuild) if(!air_master) return 0 @@ -120,4 +120,5 @@ else if(istype(source)) air_master.tiles_to_update += source if(istype(destination)) air_master.tiles_to_update += destination - return 1 \ No newline at end of file + return 1 +*/ \ No newline at end of file diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm index b25d68a20e7..54ac999e9f2 100644 --- a/code/game/machinery/telecomms/broadcaster.dm +++ b/code/game/machinery/telecomms/broadcaster.dm @@ -229,7 +229,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept if(data == 1) for (var/obj/item/device/radio/intercom/R in connection.devices["[RADIO_CHAT]"]) - if(R.receive_range(display_freq, level) > 0) + if(R.receive_range(display_freq, level) > -1) radios += R // --- Broadcast only to intercoms and station-bounced radios --- @@ -240,7 +240,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept if(istype(R, /obj/item/device/radio/headset)) continue - if(R.receive_range(display_freq, level) > 0) + if(R.receive_range(display_freq, level) > -1) radios += R // --- Broadcast to syndicate radio! --- @@ -250,14 +250,14 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept for (var/obj/item/device/radio/R in syndicateconnection.devices["[RADIO_CHAT]"]) - if(R.receive_range(SYND_FREQ, level) > 0) + if(R.receive_range(SYND_FREQ, level) > -1) radios += R // --- Broadcast to ALL radio devices --- else for (var/obj/item/device/radio/R in connection.devices["[RADIO_CHAT]"]) - if(R.receive_range(display_freq, level) > 0) + if(R.receive_range(display_freq, level) > -1) radios += R // Get a list of mobs who can hear from the radios we collected. diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index f9e32cc0e6b..46f68a0fdfd 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -6,7 +6,7 @@ g_amt = 0 m_amt = 75 subspace_transmission = 1 - canhear_range = 1 // can't hear headsets from very far away + canhear_range = 0 // can't hear headsets from very far away slot_flags = SLOT_EARS var/translate_binary = 0 @@ -20,6 +20,13 @@ keyslot1 = new /obj/item/device/encryptionkey/ recalculateChannels() +/obj/item/device/radio/headset/receive_range(freq, level) + if(ishuman(src.loc)) + var/mob/living/carbon/human/H = src.loc + if(H.ears == src) + return ..(freq, level) + return -1 + /obj/item/device/radio/headset/syndicate origin_tech = "syndicate=3" /obj/item/device/radio/headset/syndicate/New() diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 36826aecb57..05519ebfb68 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -30,18 +30,18 @@ /obj/item/device/radio/intercom/receive_range(freq, level) if (!on) - return 0 + return -1 if (!(src.wires & WIRE_RECEIVE)) - return 0 + return -1 if(level != 0) var/turf/position = get_turf(src) if(isnull(position) || position.z != level) - return 0 + return -1 if (!src.listening) - return 0 + return -1 if(freq == SYND_FREQ) if(!(src.syndie)) - return 0//Prevents broadcast of messages over devices lacking the encryption + return -1//Prevents broadcast of messages over devices lacking the encryption return canhear_range diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index c0816c356d0..0491028d091 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -595,24 +595,24 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use /obj/item/device/radio/proc/receive_range(freq, level) // check if this radio can receive on the given frequency, and if so, // what the range is in which mobs will hear the radio - // returns: 0 if can't receive, range otherwise + // returns: -1 if can't receive, range otherwise if (!(wires & WIRE_RECEIVE)) - return 0 + return -1 if(!listening) - return 0 + return -1 if(level != 0) var/turf/position = get_turf(src) if(isnull(position) || position.z != level) - return 0 + return -1 if(freq == SYND_FREQ) if(!(src.syndie))//Checks to see if it's allowed on that frequency, based on the encryption keys - return 0 + return -1 if (!on) - return 0 + return -1 if (!freq) //recieved on main frequency if (!listening) - return 0 + return -1 else var/accept = (freq==frequency && listening) if (!accept) @@ -622,14 +622,14 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use accept = 1 break if (!accept) - return 0 + return -1 return canhear_range /obj/item/device/radio/proc/send_hear(freq, level) var/range = receive_range(freq, level) - if(range > 0) + if(range > -1) return get_mobs_in_view(canhear_range, src)