mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Announcement refactor
This commit is contained in:
@@ -63,18 +63,16 @@
|
||||
return RADIO_CONNECTION_FAIL
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/headset/receive_range(freq, level, aiOverride = 0)
|
||||
if(aiOverride)
|
||||
return ..(freq, level)
|
||||
|
||||
/obj/item/device/radio/headset/is_listening()
|
||||
if(ishuman(loc))
|
||||
var/mob/living/carbon/human/H = loc
|
||||
if(H.l_ear == src || H.r_ear == src)
|
||||
return ..(freq, level)
|
||||
else if(isanimal(loc))
|
||||
// frankly, all the ones with inventory are small enough to not warrant snowflaking the slot check somehow
|
||||
return ..(freq, level)
|
||||
return -1
|
||||
return ..()
|
||||
else if(isanimal(loc) || isAI(loc))
|
||||
return ..()
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/item/device/radio/headset/alt
|
||||
name = "bowman headset"
|
||||
@@ -304,10 +302,10 @@
|
||||
var/myAi = null // Atlantis: Reference back to the AI which has this radio.
|
||||
var/disabledAi = 0 // Atlantis: Used to manually disable AI's integrated radio via intellicard menu.
|
||||
|
||||
/obj/item/device/radio/headset/heads/ai_integrated/receive_range(freq, level)
|
||||
/obj/item/device/radio/headset/heads/ai_integrated/is_listening()
|
||||
if(disabledAi)
|
||||
return -1 //Transciever Disabled.
|
||||
return ..(freq, level, 1)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/headset/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
@@ -120,15 +120,13 @@
|
||||
attack_self(user)
|
||||
|
||||
/obj/item/device/radio/intercom/receive_range(freq, level)
|
||||
if(!on)
|
||||
if(!is_listening())
|
||||
return -1
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
// TODO: Integrate radio with the space manager
|
||||
if(isnull(position) || !(position.z in level))
|
||||
return -1
|
||||
if(!src.listening)
|
||||
return -1
|
||||
if(freq in ANTAG_FREQS)
|
||||
if(!(src.syndie))
|
||||
return -1//Prevents broadcast of messages over devices lacking the encryption
|
||||
|
||||
@@ -71,6 +71,7 @@ var/global/list/default_medbay_channels = list(
|
||||
initialize()
|
||||
|
||||
internal_channels = default_internal_channels.Copy()
|
||||
global_radios |= src
|
||||
|
||||
/obj/item/device/radio/Destroy()
|
||||
qdel(wires)
|
||||
@@ -80,6 +81,7 @@ var/global/list/default_medbay_channels = list(
|
||||
for(var/ch_name in channels)
|
||||
radio_controller.remove_object(src, radiochannels[ch_name])
|
||||
patch_link = null
|
||||
global_radios -= src
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -530,19 +532,15 @@ var/global/list/default_medbay_channels = list(
|
||||
// what the range is in which mobs will hear the radio
|
||||
// returns: -1 if can't receive, range otherwise
|
||||
|
||||
if(!wires || wires.IsIndexCut(WIRE_RECEIVE))
|
||||
return -1
|
||||
if(!listening)
|
||||
if(!is_listening())
|
||||
return -1
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(!position || !(position.z in level))
|
||||
return -1
|
||||
if(freq in ANTAG_FREQS)
|
||||
if(!(src.syndie))//Checks to see if it's allowed on that frequency, based on the encryption keys
|
||||
if(!(syndie))//Checks to see if it's allowed on that frequency, based on the encryption keys
|
||||
return -1
|
||||
if(!on)
|
||||
return -1
|
||||
if(!freq) //recieved on main frequency
|
||||
if(!listening)
|
||||
return -1
|
||||
@@ -559,11 +557,26 @@ var/global/list/default_medbay_channels = list(
|
||||
return canhear_range
|
||||
|
||||
/obj/item/device/radio/proc/send_hear(freq, level)
|
||||
|
||||
var/range = receive_range(freq, level)
|
||||
if(range > -1)
|
||||
return get_mobs_in_view(canhear_range, src)
|
||||
|
||||
/obj/item/device/radio/proc/is_listening()
|
||||
var/is_listening = TRUE
|
||||
if(!on)
|
||||
is_listening = FALSE
|
||||
if(!wires || wires.IsIndexCut(WIRE_RECEIVE))
|
||||
is_listening = FALSE
|
||||
if(!listening)
|
||||
is_listening = FALSE
|
||||
|
||||
return is_listening
|
||||
|
||||
/obj/item/device/radio/proc/send_announcement()
|
||||
if(is_listening())
|
||||
return get_mobs_in_view(canhear_range, src)
|
||||
|
||||
return null
|
||||
|
||||
/obj/item/device/radio/examine(mob/user, var/distance = -1)
|
||||
. = ..(user, distance)
|
||||
|
||||
Reference in New Issue
Block a user