mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 00:23:29 +01:00
Port Bay's intercom overhaul
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
aSignal = new(src)
|
||||
aSignal.code = rand(1,100)
|
||||
|
||||
aSignal.frequency = sanitize_frequency(rand(1441, 1489))
|
||||
aSignal.frequency = sanitize_frequency(rand(PUBLIC_LOW_FREQ, PUBLIC_HIGH_FREQ))
|
||||
|
||||
/obj/effect/anomaly/proc/anomalyEffect()
|
||||
if(prob(50))
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
/obj/item/radio/integrated/signal/initialize()
|
||||
if(!radio_controller)
|
||||
return
|
||||
if (src.frequency < 1441 || src.frequency > 1489)
|
||||
if (src.frequency < PUBLIC_LOW_FREQ || src.frequency > PUBLIC_HIGH_FREQ)
|
||||
src.frequency = sanitize_frequency(src.frequency)
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
@@ -13,24 +13,27 @@
|
||||
var/translate_hive = 0
|
||||
var/obj/item/device/encryptionkey/keyslot1 = null
|
||||
var/obj/item/device/encryptionkey/keyslot2 = null
|
||||
maxf = 1489
|
||||
|
||||
var/ks1type = null
|
||||
var/ks2type = null
|
||||
|
||||
/obj/item/device/radio/headset/New()
|
||||
..()
|
||||
internal_channels.Cut()
|
||||
if(ks1type)
|
||||
keyslot1 = new ks1type(src)
|
||||
if(ks2type)
|
||||
keyslot2 = new ks2type(src)
|
||||
recalculateChannels(1)
|
||||
|
||||
/obj/item/device/radio/headset/list_channels(var/mob/user)
|
||||
return list_secure_channels()
|
||||
|
||||
/obj/item/device/radio/headset/examine(mob/user)
|
||||
if(!(..(user, 1) && radio_desc))
|
||||
return
|
||||
|
||||
user << "The following channels are built-in:"
|
||||
user << "The following channels are available:"
|
||||
user << radio_desc
|
||||
|
||||
/obj/item/device/radio/headset/handle_message_mode(mob/living/M as mob, message, channel)
|
||||
@@ -258,7 +261,6 @@
|
||||
desc = "The headset of the boss's boss."
|
||||
icon_state = "com_headset"
|
||||
item_state = "headset"
|
||||
freerange = 1
|
||||
ks2type = /obj/item/device/encryptionkey/ert
|
||||
|
||||
/obj/item/device/radio/headset/ert/alt
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/obj/item/device/radio/intercom
|
||||
name = "station intercom"
|
||||
name = "station intercom (General)"
|
||||
desc = "Talk through this."
|
||||
icon_state = "intercom"
|
||||
anchored = 1
|
||||
@@ -7,16 +7,40 @@
|
||||
canhear_range = 2
|
||||
flags = CONDUCT | NOBLOODY
|
||||
var/number = 0
|
||||
var/anyai = 1
|
||||
var/circuitry_installed=1
|
||||
var/mob/living/silicon/ai/ai = list()
|
||||
var/circuitry_installed = 1
|
||||
var/last_tick //used to delay the powercheck
|
||||
var/buildstage = 0
|
||||
|
||||
/obj/item/device/radio/intercom/custom
|
||||
name = "station intercom (Custom)"
|
||||
broadcasting = 0
|
||||
listening = 0
|
||||
|
||||
/obj/item/device/radio/intercom/universe/New()
|
||||
tag = "UNIVERSE"
|
||||
return ..()
|
||||
/obj/item/device/radio/intercom/interrogation
|
||||
name = "station intercom (Interrogation)"
|
||||
frequency = 1449
|
||||
|
||||
/obj/item/device/radio/intercom/private
|
||||
name = "station intercom (Private)"
|
||||
frequency = AI_FREQ
|
||||
|
||||
/obj/item/device/radio/intercom/specops
|
||||
name = "\improper Spec Ops intercom"
|
||||
frequency = ERT_FREQ
|
||||
|
||||
/obj/item/device/radio/intercom/department
|
||||
canhear_range = 5
|
||||
broadcasting = 0
|
||||
listening = 1
|
||||
|
||||
/obj/item/device/radio/intercom/department/medbay
|
||||
name = "station intercom (Medbay)"
|
||||
frequency = MED_I_FREQ
|
||||
|
||||
/obj/item/device/radio/intercom/department/security
|
||||
name = "station intercom (Security)"
|
||||
frequency = SEC_I_FREQ
|
||||
|
||||
/obj/item/device/radio/intercom/New(turf/loc, var/ndir = 0, var/building = 3)
|
||||
..()
|
||||
buildstage = building
|
||||
@@ -30,6 +54,28 @@
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/radio/intercom/department/medbay/New()
|
||||
..()
|
||||
internal_channels = default_medbay_channels.Copy()
|
||||
|
||||
/obj/item/device/radio/intercom/department/security/New()
|
||||
..()
|
||||
internal_channels = list(
|
||||
num2text(PUB_FREQ) = list(),
|
||||
num2text(SEC_I_FREQ) = list(access_security)
|
||||
)
|
||||
|
||||
/obj/item/device/radio/intercom/syndicate
|
||||
name = "illicit intercom"
|
||||
desc = "Talk through this. Evilly"
|
||||
frequency = SYND_FREQ
|
||||
subspace_transmission = 1
|
||||
syndie = 1
|
||||
|
||||
/obj/item/device/radio/intercom/syndicate/New()
|
||||
..()
|
||||
internal_channels[num2text(SYND_FREQ)] = list(access_syndicate)
|
||||
|
||||
/obj/item/device/radio/intercom/Destroy()
|
||||
processing_objects.Remove(src)
|
||||
return ..()
|
||||
@@ -64,12 +110,6 @@
|
||||
|
||||
return canhear_range
|
||||
|
||||
|
||||
/obj/item/device/radio/intercom/hear_talk(mob/M as mob, msg)
|
||||
if(!src.anyai && !(M in src.ai))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/device/radio/intercom/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
switch(buildstage)
|
||||
if(3)
|
||||
@@ -147,11 +187,16 @@
|
||||
/obj/item/device/radio/intercom/process()
|
||||
if(((world.timeofday - last_tick) > 30) || ((world.timeofday - last_tick) < 0))
|
||||
last_tick = world.timeofday
|
||||
if(!areaMaster)
|
||||
|
||||
|
||||
if(!src.loc)
|
||||
on = 0
|
||||
update_icon()
|
||||
return
|
||||
on = areaMaster.powered(EQUIP) // set "on" to the power status
|
||||
else
|
||||
var/area/A = get_area(src)
|
||||
if(!A)
|
||||
on = 0
|
||||
else
|
||||
on = A.powered(EQUIP) // set "on" to the power status
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/intercom_electronics
|
||||
@@ -161,4 +206,22 @@
|
||||
desc = "Looks like a circuit. Probably is."
|
||||
w_class = 2.0
|
||||
m_amt = 50
|
||||
g_amt = 50
|
||||
g_amt = 50
|
||||
|
||||
/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 ""
|
||||
|
||||
/obj/item/device/radio/intercom/locked/ai_private
|
||||
name = "\improper AI intercom"
|
||||
frequency = AI_FREQ
|
||||
|
||||
/obj/item/device/radio/intercom/locked/confessional
|
||||
name = "confessional intercom"
|
||||
frequency = 1480
|
||||
@@ -1,3 +1,24 @@
|
||||
var/global/list/default_internal_channels = list(
|
||||
num2text(PUB_FREQ) = list(),
|
||||
num2text(AI_FREQ) = list(access_captain),
|
||||
num2text(ERT_FREQ) = list(access_cent_specops),
|
||||
num2text(COMM_FREQ)= list(access_heads),
|
||||
num2text(ENG_FREQ) = list(access_engine),
|
||||
num2text(MED_FREQ) = list(access_medical),
|
||||
num2text(MED_I_FREQ)=list(access_medical),
|
||||
num2text(SEC_FREQ) = list(access_security),
|
||||
num2text(SEC_I_FREQ)=list(access_security),
|
||||
num2text(SCI_FREQ) = list(access_research),
|
||||
num2text(SUP_FREQ) = list(access_cargo),
|
||||
num2text(SRV_FREQ) = list(access_hop, access_bar, access_kitchen, access_hydroponics, access_janitor, access_clown, access_mime)
|
||||
)
|
||||
|
||||
var/global/list/default_medbay_channels = list(
|
||||
num2text(PUB_FREQ) = list(),
|
||||
num2text(MED_FREQ) = list(access_medical),
|
||||
num2text(MED_I_FREQ) = list(access_medical)
|
||||
)
|
||||
|
||||
/obj/item/device/radio
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
name = "station bounced radio"
|
||||
@@ -14,12 +35,9 @@
|
||||
var/b_stat = 0
|
||||
var/broadcasting = 0
|
||||
var/listening = 1
|
||||
var/freerange = 0 // 0 - Sanitize frequencies, 1 - Full range
|
||||
var/list/channels = list() //see communications.dm for full list. First channes is a "default" for :h
|
||||
var/subspace_transmission = 0
|
||||
var/syndie = 0//Holder to see if it's a syndicate encrpyed radio
|
||||
var/maxf = 1499
|
||||
// "Example" = FREQ_LISTENING|FREQ_BROADCASTING
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
throw_speed = 2
|
||||
@@ -32,6 +50,7 @@
|
||||
var/prison_radio = 0
|
||||
var/atom/follow_target // Custom follow target for autosay-using bots
|
||||
|
||||
var/list/internal_channels
|
||||
|
||||
/obj/item/device/radio
|
||||
var/datum/radio_frequency/radio_connection
|
||||
@@ -51,24 +70,17 @@
|
||||
|
||||
if(prison_radio)
|
||||
wires.CutWireIndex(WIRE_TRANSMIT)
|
||||
|
||||
|
||||
internal_channels = default_internal_channels.Copy()
|
||||
|
||||
/obj/item/device/radio/initialize()
|
||||
|
||||
if(freerange)
|
||||
if(frequency < 1200 || frequency > 1600)
|
||||
frequency = sanitize_frequency(frequency, maxf)
|
||||
// The max freq is higher than a regular headset to decrease the chance of people listening in, if you use the higher channels.
|
||||
else if (frequency < 1441 || frequency > maxf)
|
||||
//log_to_dd("[src] ([type]) has a frequency of [frequency], sanitizing.")
|
||||
frequency = sanitize_frequency(frequency, maxf)
|
||||
|
||||
if(frequency < RADIO_LOW_FREQ || frequency > RADIO_HIGH_FREQ)
|
||||
frequency = sanitize_frequency(frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
|
||||
set_frequency(frequency)
|
||||
|
||||
for (var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = radio_controller.add_object(src, radiochannels[ch_name], RADIO_CHAT)
|
||||
|
||||
|
||||
/obj/item/device/radio/attack_self(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
@@ -95,19 +107,57 @@
|
||||
<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])
|
||||
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)
|
||||
return list_internal_channels(user)
|
||||
|
||||
/obj/item/device/radio/proc/list_secure_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/list_internal_channels(var/mob/user)
|
||||
var/dat = ""
|
||||
for (var/internal_chan in internal_channels)
|
||||
if(has_channel_access(user, internal_chan))
|
||||
dat+="<A href='byond://?src=\ref[src];spec_freq=[internal_chan]'>[get_frequency_name(text2num(internal_chan))]</A><br>"
|
||||
|
||||
if(dat)
|
||||
dat = "<br><b>Internal Channels</b><br>" + dat
|
||||
return dat
|
||||
|
||||
/obj/item/device/radio/proc/has_channel_access(var/mob/user, var/freq)
|
||||
if(!user)
|
||||
return 0
|
||||
|
||||
if(!(freq in internal_channels))
|
||||
return 0
|
||||
|
||||
if(isobserver(user) && check_rights(R_ADMIN,0))
|
||||
return 1
|
||||
|
||||
var/list/access = list()
|
||||
if(issilicon(user))
|
||||
access = get_all_accesses()
|
||||
else
|
||||
var/obj/item/weapon/card/id/I = user.get_id_card()
|
||||
if(istype(I))
|
||||
access = I.access
|
||||
return has_access(list(), internal_channels[freq], access)
|
||||
|
||||
/obj/item/device/radio/proc/text_wires()
|
||||
if (b_stat)
|
||||
return wires.GetInteractWindow()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
|
||||
var/list = !!(chan_stat&FREQ_LISTENING)!=0
|
||||
return {"
|
||||
@@ -130,20 +180,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 (!freerange || (frequency < 1200 || frequency > 1600))
|
||||
new_frequency = sanitize_frequency(new_frequency, maxf)
|
||||
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,17 +203,17 @@
|
||||
channels[chan_name] &= ~FREQ_LISTENING
|
||||
else
|
||||
channels[chan_name] |= FREQ_LISTENING
|
||||
. = 1
|
||||
else if(href_list["spec_freq"])
|
||||
var freq = href_list["spec_freq"]
|
||||
if(has_channel_access(usr, freq))
|
||||
set_frequency(text2num(freq))
|
||||
. = 1
|
||||
if(href_list["nowindow"]) // here for pAIs, maybe others will want it, idk
|
||||
return 1
|
||||
|
||||
if (!( master ))
|
||||
if (istype(loc, /mob))
|
||||
interact(loc)
|
||||
else
|
||||
updateDialog()
|
||||
else
|
||||
if (istype(master.loc, /mob))
|
||||
interact(master.loc)
|
||||
else
|
||||
updateDialog()
|
||||
if(.)
|
||||
interact(usr)
|
||||
add_fingerprint(usr)
|
||||
|
||||
/obj/item/device/radio/proc/autosay(var/message, var/from, var/channel, var/zlevel = config.contact_levels) //BS12 EDIT
|
||||
@@ -505,15 +555,22 @@
|
||||
/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/syndicate
|
||||
syndie = 1
|
||||
keyslot = new /obj/item/device/encryptionkey/syndicate
|
||||
|
||||
/obj/item/device/radio/borg/Destroy()
|
||||
myborg = null
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/borg/list_channels(var/mob/user)
|
||||
return list_secure_channels(user)
|
||||
|
||||
/obj/item/device/radio/borg/syndicate/New()
|
||||
..()
|
||||
@@ -607,27 +664,36 @@
|
||||
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
|
||||
usr << "Subspace Transmission is enabled"
|
||||
else
|
||||
subspace_transmission = 0
|
||||
usr << "Subspace Transmission is disabled"
|
||||
if(subspace_transmission == 0)//Simple as fuck, clears the channel list to prevent talking/listening over them if subspace transmission is disabled
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
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
|
||||
var/enable_subspace_transmission = text2num(href_list["mode"])
|
||||
if(enable_subspace_transmission != subspace_transmission)
|
||||
subspace_transmission = !subspace_transmission
|
||||
if(subspace_transmission)
|
||||
usr << "<span class='notice'>Subspace Transmission is enabled</span>"
|
||||
else
|
||||
usr << "<span class='notice'>Subspace Transmission is disabled</span>"
|
||||
|
||||
..()
|
||||
if(subspace_transmission == 0)//Simple as fuck, clears the channel list to prevent talking/listening over them if subspace transmission is disabled
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
. = 1
|
||||
if (href_list["shutup"]) // Toggle loudspeaker mode, AKA everyone around you hearing your radio.
|
||||
var/do_shut_up = text2num(href_list["shutup"])
|
||||
if(do_shut_up != shut_up)
|
||||
shut_up = !shut_up
|
||||
if(shut_up)
|
||||
canhear_range = 0
|
||||
usr << "<span class='notice'>Loadspeaker disabled.</span>"
|
||||
else
|
||||
canhear_range = 3
|
||||
usr << "<span class='notice'>Loadspeaker enabled.</span>"
|
||||
. = 1
|
||||
|
||||
if(.)
|
||||
interact(usr)
|
||||
|
||||
/obj/item/device/radio/borg/interact(mob/user as mob)
|
||||
if(!on)
|
||||
@@ -642,19 +708,17 @@
|
||||
[format_frequency(frequency)]
|
||||
<A href='byond://?src=\ref[src];freq=2'>+</A>
|
||||
<A href='byond://?src=\ref[src];freq=10'>+</A><BR>
|
||||
<A href='byond://?src=\ref[src];mode=1'>Toggle Broadcast Mode</A><BR>
|
||||
Loudspeaker: [shut_up ? "<A href='byond://?src=\ref[src];shutup=0'>Disengaged</A>" : "<A href='byond://?src=\ref[src];shutup=1'>Engaged</A>"]<BR>
|
||||
Broadcasting: [subspace_transmission ? "<A href='byond://?src=\ref[src];mode=0'>Disable</A>" : "<A href='byond://?src=\ref[src];mode=1'>Enable</A>"]<BR>
|
||||
Loudspeaker: [shut_up ? "<A href='byond://?src=\ref[src];shutup=0'>Enable</A>" : "<A href='byond://?src=\ref[src];shutup=1'>Disable</A>"]<BR>
|
||||
"}
|
||||
|
||||
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")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/radio/proc/config(op)
|
||||
if(radio_controller)
|
||||
for (var/ch_name in channels)
|
||||
@@ -668,3 +732,17 @@
|
||||
|
||||
/obj/item/device/radio/off
|
||||
listening = 0
|
||||
|
||||
/obj/item/device/radio/phone
|
||||
broadcasting = 0
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "red_phone"
|
||||
listening = 1
|
||||
name = "phone"
|
||||
|
||||
/obj/item/device/radio/phone/medbay
|
||||
frequency = MED_I_FREQ
|
||||
|
||||
/obj/item/device/radio/phone/medbay/New()
|
||||
..()
|
||||
internal_channels = default_medbay_channels.Copy()
|
||||
|
||||
Reference in New Issue
Block a user