Skip to content

Commit

Permalink
Merge remote-tracking branch 'cmss13-devs/master' into project/ares/t…
Browse files Browse the repository at this point in the history
…echs
  • Loading branch information
realforest2001 committed Dec 1, 2023
2 parents a9a8126 + a0ea33b commit 410596d
Show file tree
Hide file tree
Showing 35 changed files with 655 additions and 196 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
#define RADIO_CHANNEL_PMC_CCT "PMC CCT"
#define RADIO_CHANNEL_WY_WO "SpecOps"

//Listening Devices
#define RADIO_CHANNEL_BUG_A "Listening Device A"
#define RADIO_CHANNEL_BUG_B "Listening Device B"

//1-Channel ERTs
#define RADIO_CHANNEL_DUTCH_DOZEN "DD"
#define RADIO_CHANNEL_VAI "VAI"
Expand Down
5 changes: 5 additions & 0 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
text = replacetext(text, char, repl_chars[char])
return text

///Helper for only alphanumeric characters plus common punctuation, spaces, underscore and hyphen _ -.
/proc/replace_non_alphanumeric_plus(text)
var/regex/alphanumeric = regex(@{"[^a-z0-9 ,.?!\-_&]"}, "gi")
return alphanumeric.Replace(text, "")

/proc/readd_quotes(text)
var/list/repl_chars = list(""" = "\"", "'" = "'")
for(var/char in repl_chars)
Expand Down
15 changes: 14 additions & 1 deletion code/controllers/subsystem/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Radiochat range: 1441 to 1489 (most devices refuse to be tune to other frequency
//Misc channels
#define YAUT_FREQ 1205
#define DUT_FREQ 1210
#define CMB_FREQ 1220
#define VAI_FREQ 1215
#define RMC_FREQ 1216
#define CMB_FREQ 1220

//WY Channels (1230-1249)
#define WY_FREQ 1231
Expand All @@ -99,6 +99,11 @@ Radiochat range: 1441 to 1489 (most devices refuse to be tune to other frequency
#define CLF_MED_FREQ 1274
#define CLF_CCT_FREQ 1275

//Listening Bugs (1290-1291)
#define BUG_A_FREQ 1290
#define BUG_B_FREQ 1291

//General Radio
#define MIN_FREQ 1460 // ------------------------------------------------------
#define PUB_FREQ 1461
#define MAX_FREQ 1468 // ------------------------------------------------------
Expand Down Expand Up @@ -191,6 +196,9 @@ GLOBAL_LIST_INIT(radiochannels, list(
RADIO_CHANNEL_CLF_ENGI = CLF_ENGI_FREQ,
RADIO_CHANNEL_CLF_MED = CLF_MED_FREQ,
RADIO_CHANNEL_CLF_CCT = CLF_CCT_FREQ,

RADIO_CHANNEL_BUG_A = BUG_A_FREQ,
RADIO_CHANNEL_BUG_B = BUG_B_FREQ,
))

// Response Teams
Expand All @@ -205,6 +213,9 @@ GLOBAL_LIST_INIT(radiochannels, list(
// PMC Frequencies
#define PMC_FREQS list(PMC_FREQ, PMC_CMD_FREQ, PMC_ENGI_FREQ, PMC_MED_FREQ, PMC_CCT_FREQ, WY_WO_FREQ, WY_FREQ)

//Listening Device Frequencies
#define BUG_FREQS list(BUG_A_FREQ, BUG_B_FREQ)

//Depts - used for colors in headset.dm, as well as deciding what the marine comms tower can listen into
#define DEPT_FREQS list(COMM_FREQ, MED_FREQ, ENG_FREQ, SEC_FREQ, SENTRY_FREQ, ALPHA_FREQ, BRAVO_FREQ, CHARLIE_FREQ, DELTA_FREQ, ECHO_FREQ, CRYO_FREQ, REQ_FREQ, JTAC_FREQ, INTEL_FREQ, WY_FREQ)

Expand Down Expand Up @@ -269,6 +280,8 @@ SUBSYSTEM_DEF(radio)
"[HC_FREQ]" = "hcradio",
"[PVST_FREQ]" = "pvstradio",
"[COLONY_FREQ]" = "deptradio",
"[BUG_A_FREQ]" = "airadio",
"[BUG_B_FREQ]" = "aiprivradio",
)

/datum/controller/subsystem/radio/proc/add_object(obj/device as obj, new_frequency as num, filter = null as text|null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@
listed_products = list(
list("STANDARD EQUIPMENT", -1, null, null, null),
list("Marine Combat Boots", round(scale * 15), /obj/item/clothing/shoes/marine, VENDOR_ITEM_REGULAR),
list("Marine Brown Combat Boots", round(scale * 15), /obj/item/clothing/shoes/marine/brown, VENDOR_ITEM_REGULAR),
list("USCM Uniform", round(scale * 15), /obj/item/clothing/under/marine, VENDOR_ITEM_REGULAR),
list("Marine Combat Gloves", round(scale * 15), /obj/item/clothing/gloves/marine, VENDOR_ITEM_REGULAR),
list("Marine Brown Combat Gloves", round(scale * 15), /obj/item/clothing/gloves/marine/brown, VENDOR_ITEM_REGULAR),
list("Marine Black Combat Gloves", round(scale * 15), /obj/item/clothing/gloves/marine/black, VENDOR_ITEM_REGULAR),
list("Marine Radio Headset", round(scale * 15), /obj/item/device/radio/headset/almayer, VENDOR_ITEM_REGULAR),
list("M10 Pattern Marine Helmet", round(scale * 15), /obj/item/clothing/head/helmet/marine, VENDOR_ITEM_REGULAR),
Expand Down
276 changes: 276 additions & 0 deletions code/game/objects/items/devices/radio/listening_bugs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
#define DISGUISE_REMOVE "remove disguise"
#define DISGUISE_RADIO "radio"
#define DISGUISE_PEN "pen"
#define DISGUISE_FOUNTAIN_PEN "fountain pen"
#define DISGUISE_ACCESS_TUNER "access tuner"
#define DISGUISE_WHISTLE "whistle"
#define DISGUISE_MASS_SPEC "mass-spectrometer"
#define DISGUISE_CAMERA "camera"
#define DISGUISE_ZIPPO "zippo lighter"
#define DISGUISE_TAPE_RECORDER "tape recorder"

/obj/item/device/radio/listening_bug
name = "listening device"
desc = "A small, and disguisable, listening device."

icon = 'icons/obj/items/devices.dmi'
icon_state = "voice0"
item_state = "analyzer"

w_class = SIZE_TINY
volume = RADIO_VOLUME_RAISED

broadcasting = FALSE
listening = FALSE
frequency = BUG_A_FREQ
canhear_range = 2
freqlock = TRUE
/// If the bug is disguised or not.
var/ready_to_disguise = FALSE
var/disguised = FALSE
/// Whether or not the bug can be used to listen to its own channel.
var/prevent_snooping = FALSE
/// The ID tag of the device, for identification.
var/nametag = "Device"

/obj/item/device/radio/listening_bug/ui_data(mob/user)
var/list/data = list()

data["broadcasting"] = broadcasting
data["listening"] = listening
data["frequency"] = frequency
data["freqlock"] = freqlock

var/list/radio_channels = list()

for(var/channel in channels)
var/channel_key = channel_to_prefix(channel)
radio_channels += list(list(
"name" = channel,
"status" = channels[channel] & FREQ_LISTENING,
"hotkey" = channel_key))

data["channels"] = radio_channels

data["command"] = volume
data["useCommand"] = use_volume
data["subspace"] = subspace_transmission
data["subspaceSwitchable"] = subspace_switchable
data["headset"] = FALSE

return data

/obj/item/device/radio/listening_bug/ui_act(action, params, datum/tgui/ui, datum/ui_state/state)
switch(action)
if("listen")
if(prevent_snooping)
to_chat(usr, SPAN_WARNING("This device cannot receive transmissions!"))
return
listening = !listening
return
if("subspace")
if(!ishuman(usr))
return
var/mob/living/carbon/human/user = usr
if(!check_access(user.wear_id) && !check_access(user.get_active_hand()))
to_chat(user, SPAN_WARNING("You need an authenticated ID card to change this function!"))
return
if(subspace_switchable)
subspace_transmission = !subspace_transmission
var/initial_prevent = initial(prevent_snooping)
if(initial_prevent)
prevent_snooping = TRUE
if(!subspace_transmission)
prevent_snooping = FALSE
channels = list()
return
..()

/obj/item/device/radio/listening_bug/hear_talk(mob/M as mob, msg, verb = "says", datum/language/speaking = null)
var/processed_verb = "[SPAN_RED("\[LSTN [nametag]\]")] [verb]"
if(broadcasting)
if(get_dist(src, M) <= 7)
talk_into(M, msg,null,processed_verb,speaking)

/obj/item/device/radio/listening_bug/afterattack(atom/target_atom, mob/user as mob, proximity)
if(!ready_to_disguise)
return ..()

var/obj/item/target_item = target_atom
if(!istype(target_item) || target_item.anchored || target_item.w_class >= SIZE_LARGE)
to_chat(user, SPAN_WARNING("You cannot disguise the listening device as this object."))
return FALSE

var/confirm = tgui_alert(user, "Are you sure you wish to disguise the listening device as '[target_item]'?", "Confirm Choice", list("Yes","No"), 20 SECONDS)
if(confirm != "Yes")
return FALSE

icon = target_item.icon
name = target_item.name
desc = target_item.desc
icon_state = target_item.icon_state
item_state = target_item.item_state
flags_equip_slot = target_item.flags_equip_slot
w_class = target_item.w_class
ready_to_disguise = FALSE
disguised = TRUE

/obj/item/device/radio/listening_bug/get_examine_text(mob/user)
if(disguised)
. = list()
var/size
switch(w_class)
if(SIZE_TINY)
size = "tiny"
if(SIZE_SMALL)
size = "small"
if(SIZE_MEDIUM)
size = "normal-sized"
. += "This is a [blood_color ? blood_color != "#030303" ? "bloody " : "oil-stained " : ""][icon2html(src, user)][src.name]. It is a [size] item."
if(desc)
. += desc
if(desc_lore)
. += SPAN_NOTICE("This has an <a href='byond://?src=\ref[src];desc_lore=1'>extended lore description</a>.")
else
. = ..()
. += SPAN_INFO("[src] is set to frequency [get_bug_letter()].")
if(nametag != initial(nametag))
. += SPAN_INFO("[src]'s nametag is set to '[nametag]'")

/obj/item/device/radio/listening_bug/verb/change_disguise()
set name = "Change Disguise"
set category = "Object"
set src in usr

if(usr.is_mob_incapacitated())
to_chat(usr, SPAN_WARNING("You cannot do this while incapacitated!"))
return FALSE

var/check = tgui_alert(usr, "Do you wish to change the disguise of this listening bug?", "Change Disguise?", list("Yes", "No"))
if(check != "Yes")
return FALSE
if(disguised)
var/remove_check = tgui_alert(usr, "Do you wish to remove the current disguise?", "Remove Disguise?", list("Yes","No"))
if(remove_check == "Yes")
icon = initial(icon)
name = initial(name)
desc = initial(desc)
icon_state = initial(icon_state)
item_state = initial(item_state)
flags_equip_slot = initial(flags_equip_slot)
w_class = initial(w_class)
disguised = FALSE
return TRUE

to_chat(usr, SPAN_HELPFUL("You can now change the disguise of the device by selecting a normal, or smaller, sized object."))
ready_to_disguise = TRUE
return TRUE

/obj/item/device/radio/listening_bug/proc/get_bug_letter()
switch(frequency)
if(BUG_A_FREQ)
return "A"
if(BUG_B_FREQ)
return "B"
if(SEC_FREQ)
return "MP"
if(PVST_FREQ)
return "PVST"
if(HC_FREQ)
return "HC"
if(WY_FREQ, PMC_CCT_FREQ)
return "WY"
if(PMC_CMD_FREQ)
return "WYC"
if(UPP_CCT_FREQ, UPP_KDO_FREQ)
return "UPP"
else
return "X"

#define OPTION_REMOVE "Remove Tag"
#define OPTION_NEW "New Tag"

/obj/item/device/radio/listening_bug/verb/set_nametag()
set name = "Set Nametag"
set category = "Object"
set src in usr

if(usr.is_mob_incapacitated())
to_chat(usr, SPAN_WARNING("You cannot do this while incapacitated!"))
return FALSE

var/check = tgui_alert(usr, "Do you wish to change the name tag of this listening bug?", "Change Name tag?", list("Yes", "No"))
if(check != "Yes")
return FALSE


var/new_nametag
var/remove
if(nametag != initial(nametag))
remove = tgui_alert(usr, "Do you wish to remove the current nametag?", "Remove Nametag", list("Yes", "No"))
if(remove == "Yes")
new_nametag = initial(nametag)
else
new_nametag = tgui_input_text(usr, "What new name tag do you wish to use?", "New Name", initial(nametag), 6)

if(!new_nametag || (new_nametag == nametag))
return FALSE

nametag = new_nametag
log_game("[key_name(usr)] set a listening device nametag to [new_nametag].")
return TRUE

#undef OPTION_REMOVE
#undef OPTION_NEW

/obj/item/device/radio/listening_bug/freq_a
frequency = BUG_A_FREQ

/obj/item/device/radio/listening_bug/freq_b
frequency = BUG_B_FREQ

/obj/item/device/radio/listening_bug/radio_linked
prevent_snooping = TRUE
subspace_transmission = TRUE
subspace_switchable = TRUE

/obj/item/device/radio/listening_bug/radio_linked/mp
frequency = SEC_FREQ
req_one_access = list(ACCESS_MARINE_BRIG)

/obj/item/device/radio/listening_bug/radio_linked/hc
frequency = HC_FREQ
req_one_access = list(ACCESS_MARINE_CO)
/obj/item/device/radio/listening_bug/radio_linked/hc/pvst
frequency = PVST_FREQ

/obj/item/device/radio/listening_bug/radio_linked/wy
frequency = WY_FREQ
req_one_access = list(ACCESS_WY_EXEC, ACCESS_WY_SECURITY)

/obj/item/device/radio/listening_bug/radio_linked/wy/pmc
frequency = PMC_CCT_FREQ
req_one_access = list(ACCESS_WY_EXEC, ACCESS_WY_SECURITY)

/obj/item/device/radio/listening_bug/radio_linked/upp
frequency = UPP_CCT_FREQ
req_one_access = list(ACCESS_UPP_COMMANDO, ACCESS_UPP_SECURITY)

/obj/item/device/radio/listening_bug/radio_linked/upp/commando
frequency = UPP_KDO_FREQ
req_one_access = list(ACCESS_UPP_COMMANDO)


// ENCRYPTION KEYS FOR LISTENING IN!
//REQURIES SUBSPACE ACTIVATION ON THE BUGS FIRST!
/obj/item/device/encryptionkey/listening_bug
desc = "A small encryption key for listening to a secret broadcasting device! Unlikely to work if the device is not using subspace communications!"
icon_state = "stripped_key"

/obj/item/device/encryptionkey/listening_bug/freq_a
name = "Listening Bug Encryption Key (A)"
channels = list(RADIO_CHANNEL_BUG_A = TRUE)

/obj/item/device/encryptionkey/listening_bug/freq_b
name = "Listening Bug Encryption Key (B)"
channels = list(RADIO_CHANNEL_BUG_B = TRUE)
5 changes: 3 additions & 2 deletions code/modules/asset_cache/asset_list_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@
log_debug("not atom! [item]")
continue

if (sprites[icon_file])
var/imgid = replacetext(replacetext("[k]", "/obj/item/", ""), "/", "-")

if(sprites[imgid])
continue

if(icon_state in icon_states(icon_file))
Expand All @@ -339,7 +341,6 @@
item = new k()
I = icon(item.icon, item.icon_state, SOUTH)
qdel(item)
var/imgid = replacetext(replacetext("[k]", "/obj/item/", ""), "/", "-")

Insert(imgid, I)
return ..()
Expand Down
5 changes: 5 additions & 0 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
return
..()

/obj/item/clothing/hear_talk(mob/M, msg)
for(var/obj/item/clothing/accessory/attached in accessories)
attached.hear_talk(M, msg)
..()

/obj/item/clothing/proc/get_armor(armortype)
var/armor_total = 0
var/armor_count = 0
Expand Down
Loading

0 comments on commit 410596d

Please sign in to comment.