[MIRROR] Frequency locks Confessional intercoms, but an emag can bypass it [MDB IGNORE] (#17185)

* Frequency locks Confessional intercoms, but an emag can bypass it (#70745)

* Confessional intercoms are frequency locked, but can be emagged to bypass the restriction.

* Frequency locks Confessional intercoms, but an emag can bypass it

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-10-26 09:12:02 -04:00
committed by GitHub
co-authored by MrMelbert
parent c6a2454d98
commit 6ece6b7d4b
7 changed files with 50 additions and 9 deletions
+7
View File
@@ -121,3 +121,10 @@
///give this to can_receive to specify that there is no restriction on what z level this signal is sent to
#define RADIO_NO_Z_LEVEL_RESTRICTION 0
/// Radio frequency is unlocked and can be ajusted by anyone
#define RADIO_FREQENCY_UNLOCKED 0
/// Radio frequency is locked, unchangeable by players
#define RADIO_FREQENCY_LOCKED 1
/// Radio frequency is locked and unchangeable, but can be unlocked by an emag
#define RADIO_FREQENCY_EMAGGABLE_LOCK 2
@@ -39,6 +39,15 @@
else
. += span_notice("It's <i>unscrewed</i> from the wall, and can be <b>detached</b>.")
if(anonymize)
. += span_notice("Speaking through this intercom will anonymize your voice.")
if(freqlock == RADIO_FREQENCY_UNLOCKED)
if(obj_flags & EMAGGED)
. += span_warning("Its frequency lock has been shorted...")
else
. += span_notice("It has a frequency lock set to [frequency/10].")
/obj/item/radio/intercom/screwdriver_act(mob/living/user, obj/item/tool)
if(unscrewed)
user.visible_message(span_notice("[user] starts tightening [src]'s screws..."), span_notice("You start screwing in [src]..."))
@@ -112,6 +121,29 @@
. = ..()
AreaPowerCheck() // Make sure the area/local APC is powered first before we actually turn back on.
/obj/item/radio/intercom/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
return
switch(freqlock)
// Emagging an intercom with an emaggable lock will remove the lock
if(RADIO_FREQENCY_EMAGGABLE_LOCK)
balloon_alert(user, "frequency lock cleared")
playsound(src, SFX_SPARKS, 75, TRUE, SILENCED_SOUND_EXTRARANGE)
freqlock = RADIO_FREQENCY_UNLOCKED
obj_flags |= EMAGGED
// A fully locked one will do nothing, as locked is intended to be used for stuff that should never be changed
if(RADIO_FREQENCY_LOCKED)
balloon_alert(user, "can't override frequency lock!")
playsound(src, 'sound/machines/buzz-two.ogg', 50, FALSE, SILENCED_SOUND_EXTRARANGE)
// Emagging an unlocked one will do nothing, for now
else
return
return ..()
/obj/item/radio/intercom/update_icon_state()
icon_state = on ? initial(icon_state) : "intercom-p"
return ..()
@@ -148,7 +180,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/radio/intercom, 26)
/obj/item/radio/intercom/chapel
name = "Confessional intercom"
desc = "Talk through this... to confess your many sins. Conceals your voice, to keep them secret."
anonymize = TRUE
freqlock = RADIO_FREQENCY_EMAGGABLE_LOCK
/obj/item/radio/intercom/chapel/Initialize(mapload, ndir, building)
. = ..()
@@ -52,7 +52,7 @@
/// If true, subspace_transmission can be toggled at will.
var/subspace_switchable = FALSE
/// Frequency lock to stop the user from untuning specialist radios.
var/freqlock = FALSE
var/freqlock = RADIO_FREQENCY_UNLOCKED
/// If true, broadcasts will be large and BOLD.
var/use_command = FALSE
/// If true, use_command can be toggled at will.
@@ -368,7 +368,7 @@
data["frequency"] = frequency
data["minFrequency"] = freerange ? MIN_FREE_FREQ : MIN_FREQ
data["maxFrequency"] = freerange ? MAX_FREE_FREQ : MAX_FREQ
data["freqlock"] = freqlock
data["freqlock"] = freqlock != RADIO_FREQENCY_UNLOCKED
data["channels"] = list()
for(var/channel in channels)
data["channels"][channel] = channels[channel] & FREQ_LISTENING
@@ -386,7 +386,7 @@
return
switch(action)
if("frequency")
if(freqlock)
if(freqlock != RADIO_FREQENCY_UNLOCKED)
return
var/tune = params["tune"]
var/adjust = text2num(params["adjust"])
+1 -1
View File
@@ -30,7 +30,7 @@
return
var/obj/item/radio/radio = nukie.ears
radio.set_frequency(FREQ_SYNDICATE)
radio.freqlock = TRUE
radio.freqlock = RADIO_FREQENCY_LOCKED
if(command_radio)
radio.command = TRUE
radio.use_command = TRUE
+1 -1
View File
@@ -54,7 +54,7 @@
if(has_radio)
var/obj/item/radio/headset = human_to_equip.ears
headset.set_frequency(team_radio_freq)
headset.freqlock = TRUE
headset.freqlock = RADIO_FREQENCY_LOCKED
headset.independent = TRUE
human_to_equip.dna.species.stunmod = 0
+2 -2
View File
@@ -23,7 +23,7 @@
var/obj/item/radio/headset/R = H.ears
R.set_frequency(FREQ_CENTCOM)
R.freqlock = TRUE
R.freqlock = RADIO_FREQENCY_LOCKED
if(additional_radio)
R.keyslot2 = new additional_radio()
R.recalculateChannels()
@@ -460,7 +460,7 @@
var/obj/item/radio/R = H.ears
R.set_frequency(FREQ_CENTCOM)
R.freqlock = TRUE
R.freqlock = RADIO_FREQENCY_LOCKED
var/obj/item/card/id/W = H.wear_id
W.registered_name = H.real_name
W.update_label()
+2 -2
View File
@@ -26,7 +26,7 @@
var/obj/item/radio/headset/R = H.ears
R.set_frequency(FREQ_CENTCOM)
R.freqlock = TRUE
R.freqlock = RADIO_FREQENCY_LOCKED
..()
/datum/outfit/space
@@ -135,7 +135,7 @@
var/obj/item/radio/outfit_radio = equipped.ears
if(outfit_radio)
outfit_radio.set_frequency(FREQ_SYNDICATE)
outfit_radio.freqlock = TRUE
outfit_radio.freqlock = RADIO_FREQENCY_LOCKED
var/obj/item/card/id/outfit_id = equipped.wear_id
if(outfit_id)