Radio Things (#9487)

This commit is contained in:
Geeves
2020-08-06 21:13:03 +02:00
committed by GitHub
parent 5a9713a3b9
commit 010de3fc9d
10 changed files with 118 additions and 90 deletions
@@ -7,36 +7,36 @@
w_class = ITEMSIZE_TINY
slot_flags = SLOT_EARS
var/translate_binary = FALSE
var/translate_hive = FALSE
var/translate_hivenet = FALSE
var/syndie = FALSE // Signifies that it de-crypts Syndicate transmissions
var/list/channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE)
var/list/additional_channels = list()
/obj/item/device/encryptionkey/attackby(obj/item/W, mob/user)
return
/obj/item/device/encryptionkey/syndicate
icon_state = "cypherkey"
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE, CHANNEL_MERCENARY = TRUE)
additional_channels = list(CHANNEL_MERCENARY = TRUE)
origin_tech = list(TECH_ILLEGAL = 3)
desc_antag = "An encryption key that allows you to intercept comms and speak on private non-station channels. Use :t to access the private channel."
syndie = TRUE
/obj/item/device/encryptionkey/raider
icon_state = "cypherkey"
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE, CHANNEL_RAIDER = TRUE)
additional_channels = list(CHANNEL_RAIDER = TRUE)
origin_tech = list(TECH_ILLEGAL = 2)
syndie = TRUE
/obj/item/device/encryptionkey/burglar
icon_state = "cypherkey"
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE, CHANNEL_BURGLAR = TRUE)
additional_channels = list(CHANNEL_BURGLAR = TRUE)
origin_tech = list(TECH_ILLEGAL = 2)
syndie = TRUE
/obj/item/device/encryptionkey/ninja
icon_state = "cypherkey"
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE, CHANNEL_NINJA = TRUE)
additional_channels = list(CHANNEL_NINJA = TRUE)
origin_tech = list(TECH_ILLEGAL = 3)
syndie = TRUE
@@ -141,13 +141,57 @@
name = "\improper ERT radio encryption key"
channels = list(CHANNEL_RESPONSE_TEAM = TRUE)
/obj/item/device/encryptionkey/entertainment
name = "entertainment radio key"
channels = list(CHANNEL_ENTERTAINMENT = TRUE)
/obj/item/device/encryptionkey/rev
name = "standard encryption key"
desc = "An encryption key for a radio headset. Contains cypherkeys."
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE, CHANNEL_RAIDER = TRUE)
additional_channels = list(CHANNEL_RAIDER = TRUE)
origin_tech = list(TECH_ILLEGAL = 2)
desc_antag = "An encryption key that allows you to speak on private non-station channels. Use :x to access the private channel."
/obj/item/device/encryptionkey/eng_spare
name = "spare engineering radio encryption key"
additional_channels = list(CHANNEL_ENGINEERING = TRUE)
/obj/item/device/encryptionkey/med_spare
name = "spare medical radio encryption key"
additional_channels = list(CHANNEL_MEDICAL = TRUE)
/obj/item/device/encryptionkey/sec_spare
name = "spare security radio encryption key"
additional_channels = list(CHANNEL_SECURITY = TRUE)
/obj/item/device/encryptionkey/sci_spare
name = "spare science radio encryption key"
additional_channels = list(CHANNEL_SCIENCE = TRUE)
// Encryption Key Pouch
/obj/item/storage/box/fancy/keypouch
name = "encryption key pouch"
desc = "A pouch designed to store three encryption keys."
icon = 'icons/obj/radio.dmi'
icon_state = "keypouch0"
icon_type = "key"
storage_type = "pouch"
opened = TRUE
closable = FALSE
center_of_mass = list("x" = 16,"y" = 7)
storage_slots = 3
can_hold = list(/obj/item/device/encryptionkey)
starts_with = null
/obj/item/storage/box/fancy/keypouch/Initialize()
. = ..()
update_icon()
/obj/item/storage/box/fancy/keypouch/eng
starts_with = list(/obj/item/device/encryptionkey/eng_spare = 3)
/obj/item/storage/box/fancy/keypouch/med
starts_with = list(/obj/item/device/encryptionkey/med_spare = 3)
/obj/item/storage/box/fancy/keypouch/sec
starts_with = list(/obj/item/device/encryptionkey/sec_spare = 3)
/obj/item/storage/box/fancy/keypouch/sci
starts_with = list(/obj/item/device/encryptionkey/sci_spare = 3)
@@ -4,13 +4,12 @@
icon_state = "headset"
item_state = "headset"
matter = list(DEFAULT_WALL_MATERIAL = 75)
subspace_transmission = 1
subspace_transmission = TRUE
canhear_range = 0 // can't hear headsets from very far away
slot_flags = SLOT_EARS
var/translate_binary = 0
var/translate_hive = 0
var/translate_hivenet = 0
var/translate_binary = FALSE
var/translate_hivenet = FALSE
var/obj/item/device/encryptionkey/keyslot1 = null
var/obj/item/device/encryptionkey/keyslot2 = null
@@ -28,7 +27,7 @@
keyslot1 = new ks1type(src)
if(ks2type)
keyslot2 = new ks2type(src)
recalculateChannels(1)
recalculateChannels(TRUE)
/obj/item/device/radio/headset/Destroy()
QDEL_NULL(keyslot1)
@@ -45,15 +44,18 @@
to_chat(user, "The following channels are available:")
to_chat(user, radio_desc)
/obj/item/device/radio/headset/handle_message_mode(mob/living/M as mob, message, channel)
if (channel == "special")
if (translate_binary)
var/datum/language/binary = all_languages["Robot Talk"]
/obj/item/device/radio/headset/setupRadioDescription()
if(translate_binary || translate_hivenet)
..(", :+ - Special")
else
..()
/obj/item/device/radio/headset/handle_message_mode(mob/living/M, message, channel)
if(channel == "special")
if(translate_binary)
var/datum/language/binary = all_languages[LANGUAGE_ROBOT]
binary.broadcast(M, message)
if (translate_hive)
var/datum/language/hivemind = all_languages["Hivemind"]
hivemind.broadcast(M, message)
if (translate_hivenet)
if(translate_hivenet)
var/datum/language/bug = all_languages[LANGUAGE_VAURCA]
bug.broadcast(M, message)
return null
@@ -69,105 +71,74 @@
return ..(freq, level)
return -1
/obj/item/device/radio/headset/attackby(obj/item/W as obj, mob/user as mob)
// ..()
user.set_machine(src)
if (!( W.isscrewdriver() || (istype(W, /obj/item/device/encryptionkey/ ))))
return
/obj/item/device/radio/headset/attackby(obj/item/W, mob/user)
if(W.isscrewdriver())
if(keyslot1 || keyslot2)
for(var/ch_name in channels)
SSradio.remove_object(src, radiochannels[ch_name])
secure_radio_connections[ch_name] = null
if(keyslot1)
var/turf/T = get_turf(user)
if(T)
keyslot1.forceMove(T)
keyslot1 = null
if(keyslot2)
var/turf/T = get_turf(user)
if(T)
keyslot2.forceMove(T)
keyslot2 = null
recalculateChannels()
to_chat(user, "You pop out the encryption keys in the headset!")
recalculateChannels(TRUE)
to_chat(user, SPAN_NOTICE("You pop out the encryption keys in the headset!"))
else
to_chat(user, "This headset doesn't have any encryption keys! How useless...")
to_chat(user, SPAN_WARNING("This headset doesn't have any encryption keys!"))
if(istype(W, /obj/item/device/encryptionkey/))
else if(istype(W, /obj/item/device/encryptionkey))
if(keyslot1 && keyslot2)
to_chat(user, "The headset can't hold another key!")
to_chat(user, SPAN_WARNING("The headset can't hold another key!"))
return
if(!keyslot1)
user.drop_from_inventory(W,src)
user.drop_from_inventory(W, src)
keyslot1 = W
else
user.drop_from_inventory(W,src)
user.drop_from_inventory(W, src)
keyslot2 = W
recalculateChannels()
return
recalculateChannels(TRUE)
/obj/item/device/radio/headset/proc/recalculateChannels(var/setDescription = 0)
/obj/item/device/radio/headset/proc/recalculateChannels(var/setDescription = FALSE)
src.channels = list()
src.translate_binary = 0
src.translate_hive = 0
src.translate_hivenet = 0
src.syndie = 0
src.translate_binary = FALSE
src.translate_hivenet = FALSE
src.syndie = FALSE
if(keyslot1)
for(var/ch_name in keyslot1.channels)
for(var/keyslot in list(keyslot1, keyslot2))
if(!keyslot)
continue
var/obj/item/device/encryptionkey/K = keyslot
for(var/ch_name in K.channels)
if(ch_name in src.channels)
continue
src.channels += ch_name
src.channels[ch_name] = keyslot1.channels[ch_name]
src.channels[ch_name] = K.channels[ch_name]
if(keyslot1.translate_binary)
src.translate_binary = 1
if(keyslot1.translate_hive)
src.translate_hive = 1
if(keyslot1.translate_hivenet)
src.translate_hivenet = 1
if(keyslot1.syndie)
src.syndie = 1
if(keyslot2)
for(var/ch_name in keyslot2.channels)
for(var/ch_name in K.additional_channels)
if(ch_name in src.channels)
continue
src.channels += ch_name
src.channels[ch_name] = keyslot2.channels[ch_name]
src.channels[ch_name] = K.additional_channels[ch_name]
if(keyslot2.translate_binary)
src.translate_binary = 1
if(K.translate_binary)
src.translate_binary = TRUE
if(keyslot2.translate_hive)
src.translate_hive = 1
if(keyslot2.translate_hivenet)
src.translate_hivenet = 1
if(keyslot2.syndie)
src.syndie = 1
if(K.translate_hivenet)
src.translate_hivenet = TRUE
if(K.syndie)
src.syndie = TRUE
for (var/ch_name in channels)
if(!SSradio)
@@ -176,7 +147,7 @@
src.name = "broken radio headset"
return
secure_radio_connections[ch_name] = SSradio.add_object(src, radiochannels[ch_name], RADIO_CHAT)
secure_radio_connections[ch_name] = SSradio.add_object(src, radiochannels[ch_name], RADIO_CHAT)
if(setDescription)
setupRadioDescription()
@@ -254,7 +225,7 @@
name = "mining radio headset"
desc = "Headset used by dwarves. It has an inbuilt subspace antenna for better reception."
icon_state = "mine_headset"
ks1type = /obj/item/device/encryptionkey/headset_cargo
ks2type = /obj/item/device/encryptionkey/headset_cargo
/obj/item/device/radio/headset/headset_mining/alt
name = "mining bowman radio headset"
@@ -393,7 +364,7 @@
/obj/item/device/radio/headset/hivenet
translate_hivenet = 1
ks1type = /obj/item/device/encryptionkey/hivenet
ks2type = /obj/item/device/encryptionkey/hivenet
/obj/item/device/radio/headset/syndicate
name = "military headset"
@@ -427,7 +398,7 @@
/obj/item/device/radio/headset/binary
origin_tech = list(TECH_ILLEGAL = 3)
ks1type = /obj/item/device/encryptionkey/binary
ks2type = /obj/item/device/encryptionkey/binary
/obj/item/device/radio/headset/ert
name = "emergency response team radio headset"
@@ -468,4 +439,4 @@
/obj/item/device/radio/headset/heads/ai_integrated/Destroy()
myAi = null
return ..()
return ..()
@@ -126,7 +126,7 @@ var/global/list/default_medbay_channels = list(
ui.set_initial_data(data)
ui.open()
/obj/item/device/radio/proc/setupRadioDescription()
/obj/item/device/radio/proc/setupRadioDescription(var/additional_radio_desc)
var/radio_text = ""
for(var/i = 1 to channels.len)
var/channel = channels[i]
@@ -136,6 +136,8 @@ var/global/list/default_medbay_channels = list(
radio_text += ", "
radio_desc = radio_text
if(additional_radio_desc)
radio_desc += additional_radio_desc
/obj/item/device/radio/proc/list_channels(var/mob/user)
return list_internal_channels(user)