mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-15 20:52:41 +00:00
Makes it possible to select department channels on intercoms.
This commit is contained in:
@@ -245,8 +245,8 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
//Ensure the frequency is within bounds of what it should be sending/recieving at
|
||||
/proc/sanitize_frequency(var/f, var/low = PUBLIC_LOW_FREQ, var/high = PUBLIC_HIGH_FREQ)
|
||||
f = round(f)
|
||||
f = max(high, f)
|
||||
f = min(low, f)
|
||||
f = max(low, f)
|
||||
f = min(high, f)
|
||||
if ((f % 2) == 0) //Ensure the last digit is an odd number
|
||||
f += 1
|
||||
return f
|
||||
|
||||
@@ -139,7 +139,7 @@ var/datum/antagonist/traitor/traitors
|
||||
if(istype(R,/obj/item/device/radio))
|
||||
// generate list of radio freqs
|
||||
var/obj/item/device/radio/target_radio = R
|
||||
var/freq = 1441
|
||||
var/freq = PUBLIC_LOW_FREQ
|
||||
var/list/freqlist = list()
|
||||
while (freq <= PUBLIC_HIGH_FREQ)
|
||||
if (freq < 1451 || freq > PUB_FREQ)
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
if(!req_one_access) req_one_access = list()
|
||||
if(!L) return 0
|
||||
if(!istype(L, /list)) return 0
|
||||
for(var/req in src.req_access)
|
||||
if(!(req in L)) //doesn't have this access
|
||||
return has_access(req_access, req_one_access, L)
|
||||
|
||||
/proc/has_access(var/list/req_access, var/list/req_one_access, var/list/accesses)
|
||||
for(var/req in req_access)
|
||||
if(!(req in accesses)) //doesn't have this access
|
||||
return 0
|
||||
if(src.req_one_access.len)
|
||||
for(var/req in src.req_one_access)
|
||||
if(req in L) //has an access from the single access list
|
||||
if(req_one_access.len)
|
||||
for(var/req in req_one_access)
|
||||
if(req in accesses) //has an access from the single access list
|
||||
return 1
|
||||
return 0
|
||||
return 1
|
||||
@@ -219,13 +222,12 @@ proc/get_all_job_icons() //For all existing HUD icons
|
||||
|
||||
if(I)
|
||||
var/job_icons = get_all_job_icons()
|
||||
var/centcom = get_all_centcom_jobs()
|
||||
|
||||
if(I.assignment in job_icons) //Check if the job has a hud icon
|
||||
return I.assignment
|
||||
if(I.rank in job_icons)
|
||||
return I.rank
|
||||
|
||||
var/centcom = get_all_centcom_jobs()
|
||||
if(I.assignment in centcom) //Return with the NT logo if it is a Centcom job
|
||||
return "Centcom"
|
||||
if(I.rank in centcom)
|
||||
|
||||
@@ -353,7 +353,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
|
||||
// --- This following recording is intended for research and feedback in the use of department radio channels ---
|
||||
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/blackbox_msg = "[part_a][name][part_blackbox_b][quotedmsg][part_c]</span>"
|
||||
var/blackbox_msg = "[part_a][name][part_blackbox_b][quotedmsg][part_c]"
|
||||
//var/blackbox_admin_msg = "[part_a][M.name] (Real name: [M.real_name])[part_blackbox_b][quotedmsg][part_c]"
|
||||
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
@@ -531,13 +531,10 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
|
||||
var/obj/item/device/radio/headset/radio = new
|
||||
|
||||
var/part_b = "</span><b> \icon[radio]\[[freq_text]\][part_b_extra]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/part_c = "</span></span>"
|
||||
|
||||
// --- This following recording is intended for research and feedback in the use of department radio channels ---
|
||||
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/blackbox_msg = "[part_a][source][part_blackbox_b]\"[text]\"[part_c]"
|
||||
//var/blackbox_admin_msg = "[part_a][M.name] (Real name: [M.real_name])[part_blackbox_b][quotedmsg][part_c]"
|
||||
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
if(istype(blackbox))
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Access check is of the type requires one. These have been carefully selected to avoid allowing the janitor to see channels he shouldn't
|
||||
var/global/list/default_intercom_channels = list(
|
||||
num2text(PUB_FREQ) = list(),
|
||||
num2text(AI_FREQ) = list(access_synth),
|
||||
num2text(ERT_FREQ) = list(access_cent_specops),
|
||||
num2text(COMM_FREQ) = list(access_heads),
|
||||
num2text(ENG_FREQ) = list(access_engine_equip, access_atmospherics),
|
||||
num2text(MED_FREQ) = list(access_medical_equip),
|
||||
num2text(SEC_FREQ) = list(access_security),
|
||||
num2text(SCI_FREQ) = list(access_tox,access_robotics,access_xenobiology),
|
||||
num2text(SUP_FREQ) = list(access_cargo),
|
||||
num2text(SRV_FREQ) = list(access_janitor, access_hydroponics)
|
||||
)
|
||||
|
||||
/obj/item/device/radio/intercom
|
||||
name = "station intercom"
|
||||
desc = "Talk through this."
|
||||
@@ -11,9 +25,39 @@
|
||||
var/mob/living/silicon/ai/ai = list()
|
||||
var/last_tick //used to delay the powercheck
|
||||
|
||||
var/list/intercom_channels
|
||||
|
||||
/obj/item/device/radio/intercom/New()
|
||||
..()
|
||||
processing_objects += src
|
||||
intercom_channels = default_intercom_channels
|
||||
|
||||
/obj/item/device/radio/intercom/syndicate
|
||||
name = "illicit intercom"
|
||||
|
||||
/obj/item/device/radio/intercom/syndicate/New()
|
||||
..()
|
||||
intercom_channels = list(
|
||||
num2text(PUB_FREQ) = list(),
|
||||
num2text(SYND_FREQ) = list(access_syndicate),
|
||||
num2text(COMM_FREQ) = list(access_syndicate),
|
||||
num2text(ENG_FREQ) = list(access_syndicate),
|
||||
num2text(MED_FREQ) = list(access_syndicate),
|
||||
num2text(SEC_FREQ) = list(access_syndicate),
|
||||
num2text(SCI_FREQ) = list(access_syndicate),
|
||||
num2text(SUP_FREQ) = list(access_syndicate),
|
||||
num2text(SRV_FREQ) = list(access_syndicate)
|
||||
)
|
||||
|
||||
/obj/item/device/radio/intercom/proc/has_channel_access(var/mob/user, var/freq)
|
||||
if(!user)
|
||||
return 0
|
||||
|
||||
if(!(freq in intercom_channels))
|
||||
return 0
|
||||
|
||||
var/obj/item/weapon/card/id/I = user.GetIdCard()
|
||||
return has_access(list(), intercom_channels[freq], I ? I.GetAccess() : list())
|
||||
|
||||
/obj/item/device/radio/intercom/Destroy()
|
||||
processing_objects -= src
|
||||
@@ -29,6 +73,16 @@
|
||||
spawn (0)
|
||||
attack_self(user)
|
||||
|
||||
/obj/item/device/radio/intercom/list_channels(var/mob/user)
|
||||
var/dat = ""
|
||||
for (var/priv_chan in intercom_channels)
|
||||
if(has_channel_access(user, priv_chan))
|
||||
dat+="<A href='byond://?src=\ref[src];spec_freq=[priv_chan]'>[get_frequency_name(text2num(priv_chan))]</A><br>"
|
||||
|
||||
if(dat)
|
||||
dat = "<br><b>Available Channels</b><br>" + dat
|
||||
return dat
|
||||
|
||||
/obj/item/device/radio/intercom/receive_range(freq, level)
|
||||
if (!on)
|
||||
return -1
|
||||
@@ -57,8 +111,8 @@
|
||||
if(!src.loc)
|
||||
on = 0
|
||||
else
|
||||
var/area/A = src.loc.loc
|
||||
if(!A || !isarea(A))
|
||||
var/area/A = get_area(src)
|
||||
if(!A)
|
||||
on = 0
|
||||
else
|
||||
on = A.powered(EQUIP) // set "on" to the power status
|
||||
@@ -68,9 +122,25 @@
|
||||
else
|
||||
icon_state = "intercom"
|
||||
|
||||
/obj/item/device/radio/intercom/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["spec_freq"])
|
||||
var freq = href_list["spec_freq"]
|
||||
if(has_channel_access(usr, freq))
|
||||
set_frequency(text2num(freq))
|
||||
. = 1
|
||||
|
||||
if(.)
|
||||
interact(usr)
|
||||
|
||||
/obj/item/device/radio/intercom/locked
|
||||
var/locked_frequency
|
||||
|
||||
/obj/item/device/radio/intercom/locked/set_frequency(var/frequency)
|
||||
if(frequency == locked_frequency)
|
||||
..(locked_frequency)
|
||||
|
||||
/obj/item/device/radio/intercom/locked/list_channels()
|
||||
return ""
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
suffix = "\[3\]"
|
||||
icon_state = "walkietalkie"
|
||||
item_state = "walkietalkie"
|
||||
req_access = list(access_synth)
|
||||
|
||||
var/on = 1 // 0 for off
|
||||
var/last_transmission
|
||||
@@ -89,17 +88,19 @@
|
||||
<A href='byond://?src=\ref[src];freq=10'>+</A><BR>
|
||||
"}
|
||||
|
||||
for (var/ch_name in channels)
|
||||
dat+=text_sec_channel(ch_name, channels[ch_name])
|
||||
|
||||
if(allowed(user))
|
||||
dat+= "Channel Name: [(frequency in DEPT_FREQS) ? get_frequency_name(frequency) : "Unknown"]<BR>"
|
||||
dat+=list_channels(user)
|
||||
|
||||
dat+={"[text_wires()]</TT></body></html>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
return
|
||||
|
||||
/obj/item/device/radio/proc/list_channels(var/mob/user)
|
||||
var/dat = ""
|
||||
for (var/ch_name in channels)
|
||||
dat+=text_sec_channel(ch_name, channels[ch_name])
|
||||
return dat
|
||||
|
||||
/obj/item/device/radio/proc/text_wires()
|
||||
if (b_stat)
|
||||
return wires.GetInteractWindow()
|
||||
@@ -122,7 +123,7 @@
|
||||
/obj/item/device/radio/Topic(href, href_list)
|
||||
if(..() || !on)
|
||||
usr << browse(null, "window=radio")
|
||||
return
|
||||
return 1
|
||||
|
||||
usr.set_machine(src)
|
||||
if (href_list["track"])
|
||||
@@ -130,20 +131,20 @@
|
||||
var/mob/living/silicon/ai/A = locate(href_list["track2"])
|
||||
if(A && target)
|
||||
A.ai_actual_track(target)
|
||||
return
|
||||
. = 1
|
||||
|
||||
else if (href_list["freq"])
|
||||
var/new_frequency = (frequency + text2num(href_list["freq"]))
|
||||
if ((frequency < RADIO_LOW_FREQ || frequency > RADIO_HIGH_FREQ) || !allowed(usr))
|
||||
if ((new_frequency < PUBLIC_LOW_FREQ || new_frequency > PUBLIC_HIGH_FREQ))
|
||||
new_frequency = sanitize_frequency(new_frequency)
|
||||
set_frequency(new_frequency)
|
||||
if(hidden_uplink)
|
||||
if(hidden_uplink.check_trigger(usr, frequency, traitor_frequency))
|
||||
usr << browse(null, "window=radio")
|
||||
return
|
||||
|
||||
. = 1
|
||||
else if (href_list["talk"])
|
||||
ToggleBroadcast()
|
||||
. = 1
|
||||
else if (href_list["listen"])
|
||||
var/chan_name = href_list["ch_name"]
|
||||
if (!chan_name)
|
||||
@@ -153,10 +154,11 @@
|
||||
channels[chan_name] &= ~FREQ_LISTENING
|
||||
else
|
||||
channels[chan_name] |= FREQ_LISTENING
|
||||
|
||||
. = 1
|
||||
if(href_list["nowindow"]) // here for pAIs, maybe others will want it, idk
|
||||
return
|
||||
return 1
|
||||
|
||||
if(.)
|
||||
interact(usr)
|
||||
|
||||
/obj/item/device/radio/proc/autosay(var/message, var/from, var/channel) //BS12 EDIT
|
||||
@@ -501,12 +503,16 @@
|
||||
/obj/item/device/radio/borg
|
||||
var/mob/living/silicon/robot/myborg = null // Cyborg which owns this radio. Used for power checks
|
||||
var/obj/item/device/encryptionkey/keyslot = null//Borg radios can handle a single encryption key
|
||||
var/shut_up = 0
|
||||
var/shut_up = 1
|
||||
icon = 'icons/obj/robot_component.dmi' // Cyborgs radio icons should look like the component.
|
||||
icon_state = "radio"
|
||||
canhear_range = 3
|
||||
canhear_range = 0
|
||||
subspace_transmission = 1
|
||||
|
||||
/obj/item/device/radio/borg/Destroy()
|
||||
myborg = null
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/borg/talk_into()
|
||||
. = ..()
|
||||
if (isrobot(src.loc))
|
||||
@@ -588,8 +594,8 @@
|
||||
return
|
||||
|
||||
/obj/item/device/radio/borg/Topic(href, href_list)
|
||||
if(usr.stat || !on)
|
||||
return
|
||||
if(..())
|
||||
return 1
|
||||
if (href_list["mode"])
|
||||
if(subspace_transmission != 1)
|
||||
subspace_transmission = 1
|
||||
@@ -601,14 +607,14 @@
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
return 1
|
||||
if (href_list["shutup"]) // Toggle loudspeaker mode, AKA everyone around you hearing your radio.
|
||||
shut_up = !shut_up
|
||||
if(shut_up)
|
||||
canhear_range = 0
|
||||
else
|
||||
canhear_range = 3
|
||||
|
||||
..()
|
||||
return 1
|
||||
|
||||
/obj/item/device/radio/borg/interact(mob/user as mob)
|
||||
if(!on)
|
||||
@@ -628,8 +634,7 @@
|
||||
"}
|
||||
|
||||
if(subspace_transmission)//Don't even bother if subspace isn't turned on
|
||||
for (var/ch_name in channels)
|
||||
dat+=text_sec_channel(ch_name, channels[ch_name])
|
||||
dat+=list_channels(user)
|
||||
dat+={"[text_wires()]</TT></body></html>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
assignment = "Synthetic"
|
||||
|
||||
/obj/item/weapon/card/id/synthetic/New()
|
||||
access = get_all_station_access()
|
||||
access = get_all_station_access() + access_synth
|
||||
..()
|
||||
|
||||
/obj/item/weapon/card/id/centcom
|
||||
|
||||
Reference in New Issue
Block a user