mirror of
https://github.com/KabKebab/GS13.git
synced 2026-07-11 16:08:32 +01:00
Merge pull request #9747 from Ghommie/Ghommie-cit329
Fixing AI holopad speech text being small and whispers ending in multiple exclamation marks oxymoron.
This commit is contained in:
@@ -149,10 +149,10 @@
|
||||
|
||||
friend_talk(message)
|
||||
|
||||
/mob/camera/imaginary_friend/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/mob/camera/imaginary_friend/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
if (client?.prefs.chat_on_map && (client.prefs.see_chat_non_mob || ismob(speaker)))
|
||||
create_chat_message(speaker, message_language, raw_message, spans, message_mode)
|
||||
to_chat(src, compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode))
|
||||
to_chat(src, compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode, FALSE, source))
|
||||
|
||||
/mob/camera/imaginary_friend/proc/friend_talk(message)
|
||||
message = capitalize(trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)))
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
if(voice_activated)
|
||||
flags_1 |= HEAR_1
|
||||
|
||||
/obj/machinery/door/password/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/obj/machinery/door/password/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(!density || !voice_activated || radio_freq)
|
||||
return
|
||||
|
||||
+697
-697
File diff suppressed because it is too large
Load Diff
+1087
-1087
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,150 @@
|
||||
/obj/item/radio/intercom
|
||||
name = "station intercom"
|
||||
desc = "Talk through this."
|
||||
icon_state = "intercom"
|
||||
anchored = TRUE
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
canhear_range = 2
|
||||
var/number = 0
|
||||
var/anyai = 1
|
||||
var/mob/living/silicon/ai/ai = list()
|
||||
var/last_tick //used to delay the powercheck
|
||||
dog_fashion = null
|
||||
var/unfastened = FALSE
|
||||
|
||||
/obj/item/radio/intercom/unscrewed
|
||||
unfastened = TRUE
|
||||
|
||||
/obj/item/radio/intercom/ratvar
|
||||
name = "hierophant intercom"
|
||||
desc = "A modified intercom that uses the Hierophant network instead of subspace tech. Can listen to and broadcast on any frequency."
|
||||
icon_state = "intercom_ratvar"
|
||||
freerange = TRUE
|
||||
|
||||
/obj/item/radio/intercom/ratvar/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
to_chat(user, "<span class='danger'>[src] is fastened to the wall with [is_servant_of_ratvar(user) ? "replicant alloy" : "some material you've never seen"], and can't be removed.</span>")
|
||||
return //no unfastening!
|
||||
. = ..()
|
||||
|
||||
/obj/item/radio/intercom/ratvar/process()
|
||||
if(!istype(SSticker.mode, /datum/game_mode/clockwork_cult))
|
||||
invisibility = INVISIBILITY_OBSERVER
|
||||
alpha = 125
|
||||
emped = TRUE
|
||||
else
|
||||
invisibility = initial(invisibility)
|
||||
alpha = initial(alpha)
|
||||
emped = FALSE
|
||||
..()
|
||||
|
||||
/obj/item/radio/intercom/Initialize(mapload, ndir, building)
|
||||
. = ..()
|
||||
if(building)
|
||||
setDir(ndir)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/radio/intercom/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/intercom/examine(mob/user)
|
||||
. = ..()
|
||||
if(!unfastened)
|
||||
. += "<span class='notice'>It's <b>screwed</b> and secured to the wall.</span>"
|
||||
else
|
||||
. += "<span class='notice'>It's <i>unscrewed</i> from the wall, and can be <b>detached</b>.</span>"
|
||||
|
||||
/obj/item/radio/intercom/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
if(unfastened)
|
||||
user.visible_message("<span class='notice'>[user] starts tightening [src]'s screws...</span>", "<span class='notice'>You start screwing in [src]...</span>")
|
||||
if(I.use_tool(src, user, 30, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] tightens [src]'s screws!</span>", "<span class='notice'>You tighten [src]'s screws.</span>")
|
||||
unfastened = FALSE
|
||||
else
|
||||
user.visible_message("<span class='notice'>[user] starts loosening [src]'s screws...</span>", "<span class='notice'>You start unscrewing [src]...</span>")
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] loosens [src]'s screws!</span>", "<span class='notice'>You unscrew [src], loosening it from the wall.</span>")
|
||||
unfastened = TRUE
|
||||
return
|
||||
else if(istype(I, /obj/item/wrench))
|
||||
if(!unfastened)
|
||||
to_chat(user, "<span class='warning'>You need to unscrew [src] from the wall first!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] starts unsecuring [src]...</span>", "<span class='notice'>You start unsecuring [src]...</span>")
|
||||
I.play_tool_sound(src)
|
||||
if(I.use_tool(src, user, 80))
|
||||
user.visible_message("<span class='notice'>[user] unsecures [src]!</span>", "<span class='notice'>You detach [src] from the wall.</span>")
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
new/obj/item/wallframe/intercom(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/intercom/attack_ai(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/radio/intercom/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/item/radio/intercom/interact(mob/user)
|
||||
..()
|
||||
ui_interact(user, state = GLOB.default_state)
|
||||
|
||||
/obj/item/radio/intercom/can_receive(freq, level)
|
||||
if(!on)
|
||||
return FALSE
|
||||
if(wires.is_cut(WIRE_RX))
|
||||
return FALSE
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(isnull(position) || !(position.z in level))
|
||||
return FALSE
|
||||
if(!src.listening)
|
||||
return FALSE
|
||||
if(freq == FREQ_SYNDICATE)
|
||||
if(!(src.syndie))
|
||||
return FALSE//Prevents broadcast of messages over devices lacking the encryption
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/radio/intercom/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
if (message_mode == MODE_INTERCOM)
|
||||
return // Avoid hearing the same thing twice
|
||||
if(!anyai && !(speaker in ai))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/radio/intercom/process()
|
||||
if(((world.timeofday - last_tick) > 30) || ((world.timeofday - last_tick) < 0))
|
||||
last_tick = world.timeofday
|
||||
|
||||
var/area/A = get_area(src)
|
||||
if(!A || emped)
|
||||
on = FALSE
|
||||
else
|
||||
on = A.powered(EQUIP) // set "on" to the power status
|
||||
|
||||
if(!on)
|
||||
icon_state = "intercom-p"
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
/obj/item/radio/intercom/add_blood_DNA(list/blood_dna)
|
||||
return FALSE
|
||||
|
||||
//Created through the autolathe or through deconstructing intercoms. Can be applied to wall to make a new intercom on it!
|
||||
/obj/item/wallframe/intercom
|
||||
name = "intercom frame"
|
||||
desc = "A ready-to-go intercom. Just slap it on a wall and screw it in!"
|
||||
icon_state = "intercom"
|
||||
result_path = /obj/item/radio/intercom/unscrewed
|
||||
pixel_shift = 29
|
||||
inverse = TRUE
|
||||
materials = list(MAT_METAL = 75, MAT_GLASS = 25)
|
||||
/obj/item/radio/intercom
|
||||
name = "station intercom"
|
||||
desc = "Talk through this."
|
||||
icon_state = "intercom"
|
||||
anchored = TRUE
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
canhear_range = 2
|
||||
var/number = 0
|
||||
var/anyai = 1
|
||||
var/mob/living/silicon/ai/ai = list()
|
||||
var/last_tick //used to delay the powercheck
|
||||
dog_fashion = null
|
||||
var/unfastened = FALSE
|
||||
|
||||
/obj/item/radio/intercom/unscrewed
|
||||
unfastened = TRUE
|
||||
|
||||
/obj/item/radio/intercom/ratvar
|
||||
name = "hierophant intercom"
|
||||
desc = "A modified intercom that uses the Hierophant network instead of subspace tech. Can listen to and broadcast on any frequency."
|
||||
icon_state = "intercom_ratvar"
|
||||
freerange = TRUE
|
||||
|
||||
/obj/item/radio/intercom/ratvar/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
to_chat(user, "<span class='danger'>[src] is fastened to the wall with [is_servant_of_ratvar(user) ? "replicant alloy" : "some material you've never seen"], and can't be removed.</span>")
|
||||
return //no unfastening!
|
||||
. = ..()
|
||||
|
||||
/obj/item/radio/intercom/ratvar/process()
|
||||
if(!istype(SSticker.mode, /datum/game_mode/clockwork_cult))
|
||||
invisibility = INVISIBILITY_OBSERVER
|
||||
alpha = 125
|
||||
emped = TRUE
|
||||
else
|
||||
invisibility = initial(invisibility)
|
||||
alpha = initial(alpha)
|
||||
emped = FALSE
|
||||
..()
|
||||
|
||||
/obj/item/radio/intercom/Initialize(mapload, ndir, building)
|
||||
. = ..()
|
||||
if(building)
|
||||
setDir(ndir)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/radio/intercom/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/intercom/examine(mob/user)
|
||||
. = ..()
|
||||
if(!unfastened)
|
||||
. += "<span class='notice'>It's <b>screwed</b> and secured to the wall.</span>"
|
||||
else
|
||||
. += "<span class='notice'>It's <i>unscrewed</i> from the wall, and can be <b>detached</b>.</span>"
|
||||
|
||||
/obj/item/radio/intercom/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
if(unfastened)
|
||||
user.visible_message("<span class='notice'>[user] starts tightening [src]'s screws...</span>", "<span class='notice'>You start screwing in [src]...</span>")
|
||||
if(I.use_tool(src, user, 30, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] tightens [src]'s screws!</span>", "<span class='notice'>You tighten [src]'s screws.</span>")
|
||||
unfastened = FALSE
|
||||
else
|
||||
user.visible_message("<span class='notice'>[user] starts loosening [src]'s screws...</span>", "<span class='notice'>You start unscrewing [src]...</span>")
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
user.visible_message("<span class='notice'>[user] loosens [src]'s screws!</span>", "<span class='notice'>You unscrew [src], loosening it from the wall.</span>")
|
||||
unfastened = TRUE
|
||||
return
|
||||
else if(istype(I, /obj/item/wrench))
|
||||
if(!unfastened)
|
||||
to_chat(user, "<span class='warning'>You need to unscrew [src] from the wall first!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] starts unsecuring [src]...</span>", "<span class='notice'>You start unsecuring [src]...</span>")
|
||||
I.play_tool_sound(src)
|
||||
if(I.use_tool(src, user, 80))
|
||||
user.visible_message("<span class='notice'>[user] unsecures [src]!</span>", "<span class='notice'>You detach [src] from the wall.</span>")
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
new/obj/item/wallframe/intercom(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/intercom/attack_ai(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/radio/intercom/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/item/radio/intercom/interact(mob/user)
|
||||
..()
|
||||
ui_interact(user, state = GLOB.default_state)
|
||||
|
||||
/obj/item/radio/intercom/can_receive(freq, level)
|
||||
if(!on)
|
||||
return FALSE
|
||||
if(wires.is_cut(WIRE_RX))
|
||||
return FALSE
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(isnull(position) || !(position.z in level))
|
||||
return FALSE
|
||||
if(!src.listening)
|
||||
return FALSE
|
||||
if(freq == FREQ_SYNDICATE)
|
||||
if(!(src.syndie))
|
||||
return FALSE//Prevents broadcast of messages over devices lacking the encryption
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/radio/intercom/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if (message_mode == MODE_INTERCOM)
|
||||
return // Avoid hearing the same thing twice
|
||||
if(!anyai && !(speaker in ai))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/radio/intercom/process()
|
||||
if(((world.timeofday - last_tick) > 30) || ((world.timeofday - last_tick) < 0))
|
||||
last_tick = world.timeofday
|
||||
|
||||
var/area/A = get_area(src)
|
||||
if(!A || emped)
|
||||
on = FALSE
|
||||
else
|
||||
on = A.powered(EQUIP) // set "on" to the power status
|
||||
|
||||
if(!on)
|
||||
icon_state = "intercom-p"
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
/obj/item/radio/intercom/add_blood_DNA(list/blood_dna)
|
||||
return FALSE
|
||||
|
||||
//Created through the autolathe or through deconstructing intercoms. Can be applied to wall to make a new intercom on it!
|
||||
/obj/item/wallframe/intercom
|
||||
name = "intercom frame"
|
||||
desc = "A ready-to-go intercom. Just slap it on a wall and screw it in!"
|
||||
icon_state = "intercom"
|
||||
result_path = /obj/item/radio/intercom/unscrewed
|
||||
pixel_shift = 29
|
||||
inverse = TRUE
|
||||
materials = list(MAT_METAL = 75, MAT_GLASS = 25)
|
||||
|
||||
@@ -1,428 +1,428 @@
|
||||
/obj/item/radio
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
name = "station bounced radio"
|
||||
icon_state = "walkietalkie"
|
||||
item_state = "walkietalkie"
|
||||
desc = "A basic handheld radio that communicates with local telecommunication networks."
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
|
||||
flags_1 = CONDUCT_1 | HEAR_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL=75, MAT_GLASS=25)
|
||||
obj_flags = USES_TGUI
|
||||
|
||||
var/on = TRUE
|
||||
var/frequency = FREQ_COMMON
|
||||
var/canhear_range = 3 // The range around the radio in which mobs can hear what it receives.
|
||||
var/emped = 0 // Tracks the number of EMPs currently stacked.
|
||||
|
||||
var/broadcasting = FALSE // Whether the radio will transmit dialogue it hears nearby.
|
||||
var/listening = TRUE // Whether the radio is currently receiving.
|
||||
var/prison_radio = FALSE // If true, the transmit wire starts cut.
|
||||
var/unscrewed = FALSE // Whether wires are accessible. Toggleable by screwdrivering.
|
||||
var/freerange = FALSE // If true, the radio has access to the full spectrum.
|
||||
var/subspace_transmission = FALSE // If true, the radio transmits and receives on subspace exclusively.
|
||||
var/subspace_switchable = FALSE // If true, subspace_transmission can be toggled at will.
|
||||
var/freqlock = FALSE // Frequency lock to stop the user from untuning specialist radios.
|
||||
var/use_command = FALSE // If true, broadcasts will be large and BOLD.
|
||||
var/command = FALSE // If true, use_command can be toggled at will.
|
||||
|
||||
// Encryption key handling
|
||||
var/obj/item/encryptionkey/keyslot
|
||||
var/translate_binary = FALSE // If true, can hear the special binary channel.
|
||||
var/independent = FALSE // If true, can say/hear on the special CentCom channel.
|
||||
var/syndie = FALSE // If true, hears all well-known channels automatically, and can say/hear on the Syndicate channel.
|
||||
var/list/channels = list() // Map from name (see communications.dm) to on/off. First entry is current department (:h).
|
||||
var/list/secure_radio_connections
|
||||
|
||||
var/const/FREQ_LISTENING = 1
|
||||
//FREQ_BROADCASTING = 2
|
||||
|
||||
/obj/item/radio/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] starts bouncing [src] off [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/radio/proc/set_frequency(new_frequency)
|
||||
SEND_SIGNAL(src, COMSIG_RADIO_NEW_FREQUENCY, args)
|
||||
remove_radio(src, frequency)
|
||||
frequency = add_radio(src, new_frequency)
|
||||
|
||||
/obj/item/radio/proc/recalculateChannels()
|
||||
channels = list()
|
||||
translate_binary = FALSE
|
||||
syndie = FALSE
|
||||
independent = FALSE
|
||||
|
||||
if(keyslot)
|
||||
for(var/ch_name in keyslot.channels)
|
||||
if(!(ch_name in channels))
|
||||
channels[ch_name] = keyslot.channels[ch_name]
|
||||
|
||||
if(keyslot.translate_binary)
|
||||
translate_binary = TRUE
|
||||
if(keyslot.syndie)
|
||||
syndie = TRUE
|
||||
if(keyslot.independent)
|
||||
independent = TRUE
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
|
||||
|
||||
/obj/item/radio/proc/make_syndie() // Turns normal radios into Syndicate radios!
|
||||
qdel(keyslot)
|
||||
keyslot = new /obj/item/encryptionkey/syndicate
|
||||
syndie = 1
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/radio/Destroy()
|
||||
remove_radio_all(src) //Just to be sure
|
||||
QDEL_NULL(wires)
|
||||
QDEL_NULL(keyslot)
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/Initialize()
|
||||
wires = new /datum/wires/radio(src)
|
||||
if(prison_radio)
|
||||
wires.cut(WIRE_TX) // OH GOD WHY
|
||||
secure_radio_connections = new
|
||||
. = ..()
|
||||
frequency = sanitize_frequency(frequency, freerange)
|
||||
set_frequency(frequency)
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
|
||||
|
||||
/obj/item/radio/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
|
||||
|
||||
/obj/item/radio/interact(mob/user)
|
||||
if(unscrewed && !isAI(user))
|
||||
wires.interact(user)
|
||||
add_fingerprint(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/radio/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state)
|
||||
. = ..()
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "radio", name, 370, 220 + channels.len * 22, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/item/radio/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["broadcasting"] = broadcasting
|
||||
data["listening"] = listening
|
||||
data["frequency"] = frequency
|
||||
data["minFrequency"] = freerange ? MIN_FREE_FREQ : MIN_FREQ
|
||||
data["maxFrequency"] = freerange ? MAX_FREE_FREQ : MAX_FREQ
|
||||
data["freqlock"] = freqlock
|
||||
data["channels"] = list()
|
||||
for(var/channel in channels)
|
||||
data["channels"][channel] = channels[channel] & FREQ_LISTENING
|
||||
data["command"] = command
|
||||
data["useCommand"] = use_command
|
||||
data["subspace"] = subspace_transmission
|
||||
data["subspaceSwitchable"] = subspace_switchable
|
||||
data["headset"] = istype(src, /obj/item/radio/headset)
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/radio/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("frequency")
|
||||
if(freqlock)
|
||||
return
|
||||
var/tune = params["tune"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(tune == "input")
|
||||
var/min = format_frequency(freerange ? MIN_FREE_FREQ : MIN_FREQ)
|
||||
var/max = format_frequency(freerange ? MAX_FREE_FREQ : MAX_FREQ)
|
||||
tune = input("Tune frequency ([min]-[max]):", name, format_frequency(frequency)) as null|num
|
||||
if(!isnull(tune) && !..())
|
||||
if (tune < MIN_FREE_FREQ && tune <= MAX_FREE_FREQ / 10)
|
||||
// allow typing 144.7 to get 1447
|
||||
tune *= 10
|
||||
. = TRUE
|
||||
else if(adjust)
|
||||
tune = frequency + adjust * 10
|
||||
. = TRUE
|
||||
else if(text2num(tune) != null)
|
||||
tune = tune * 10
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_frequency(sanitize_frequency(tune, freerange))
|
||||
if("listen")
|
||||
listening = !listening
|
||||
. = TRUE
|
||||
if("broadcast")
|
||||
broadcasting = !broadcasting
|
||||
. = TRUE
|
||||
if("channel")
|
||||
var/channel = params["channel"]
|
||||
if(!(channel in channels))
|
||||
return
|
||||
if(channels[channel] & FREQ_LISTENING)
|
||||
channels[channel] &= ~FREQ_LISTENING
|
||||
else
|
||||
channels[channel] |= FREQ_LISTENING
|
||||
. = TRUE
|
||||
if("command")
|
||||
use_command = !use_command
|
||||
. = TRUE
|
||||
if("subspace")
|
||||
if(subspace_switchable)
|
||||
subspace_transmission = !subspace_transmission
|
||||
if(!subspace_transmission)
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
. = TRUE
|
||||
|
||||
/obj/item/radio/talk_into(atom/movable/M, message, channel, list/spans, datum/language/language)
|
||||
if(!spans)
|
||||
spans = list(M.speech_span)
|
||||
if(!language)
|
||||
language = M.get_default_language()
|
||||
INVOKE_ASYNC(src, .proc/talk_into_impl, M, message, channel, spans.Copy(), language)
|
||||
return ITALICS | REDUCE_RANGE
|
||||
|
||||
/obj/item/radio/proc/talk_into_impl(atom/movable/M, message, channel, list/spans, datum/language/language)
|
||||
if(!on)
|
||||
return // the device has to be on
|
||||
if(!M || !message)
|
||||
return
|
||||
if(wires.is_cut(WIRE_TX)) // Permacell and otherwise tampered-with radios
|
||||
return
|
||||
if(!M.IsVocal())
|
||||
return
|
||||
|
||||
if(use_command)
|
||||
spans |= SPAN_COMMAND
|
||||
|
||||
/*
|
||||
Roughly speaking, radios attempt to make a subspace transmission (which
|
||||
is received, processed, and rebroadcast by the telecomms satellite) and
|
||||
if that fails, they send a mundane radio transmission.
|
||||
|
||||
Headsets cannot send/receive mundane transmissions, only subspace.
|
||||
Syndicate radios can hear transmissions on all well-known frequencies.
|
||||
CentCom radios can hear the CentCom frequency no matter what.
|
||||
*/
|
||||
|
||||
// From the channel, determine the frequency and get a reference to it.
|
||||
var/freq
|
||||
if(channel && channels && channels.len > 0)
|
||||
if(channel == MODE_DEPARTMENT)
|
||||
channel = channels[1]
|
||||
freq = secure_radio_connections[channel]
|
||||
if (!channels[channel]) // if the channel is turned off, don't broadcast
|
||||
return
|
||||
else
|
||||
freq = frequency
|
||||
channel = null
|
||||
|
||||
// Nearby active jammers severely gibberish the message
|
||||
var/turf/position = get_turf(src)
|
||||
for(var/obj/item/jammer/jammer in GLOB.active_jammers)
|
||||
var/turf/jammer_turf = get_turf(jammer)
|
||||
if(position.z == jammer_turf.z && (get_dist(position, jammer_turf) < jammer.range))
|
||||
message = Gibberish(message,100)
|
||||
break
|
||||
|
||||
// Determine the identity information which will be attached to the signal.
|
||||
var/atom/movable/virtualspeaker/speaker = new(null, M, src)
|
||||
|
||||
// Construct the signal
|
||||
var/datum/signal/subspace/vocal/signal = new(src, freq, speaker, language, message, spans)
|
||||
|
||||
// Independent radios, on the CentCom frequency, reach all independent radios
|
||||
if (independent && (freq == FREQ_CENTCOM || freq == FREQ_CTF_RED || freq == FREQ_CTF_BLUE))
|
||||
signal.data["compression"] = 0
|
||||
signal.transmission_method = TRANSMISSION_SUPERSPACE
|
||||
signal.levels = list(0) // reaches all Z-levels
|
||||
signal.broadcast()
|
||||
return
|
||||
|
||||
// All radios make an attempt to use the subspace system first
|
||||
signal.send_to_receivers()
|
||||
|
||||
// If the radio is subspace-only, that's all it can do
|
||||
if (subspace_transmission)
|
||||
return
|
||||
|
||||
// Non-subspace radios will check in a couple of seconds, and if the signal
|
||||
// was never received, send a mundane broadcast (no headsets).
|
||||
addtimer(CALLBACK(src, .proc/backup_transmission, signal), 20)
|
||||
|
||||
/obj/item/radio/proc/backup_transmission(datum/signal/subspace/vocal/signal)
|
||||
var/turf/T = get_turf(src)
|
||||
if (signal.data["done"] && (T.z in signal.levels))
|
||||
return
|
||||
|
||||
// Okay, the signal was never processed, send a mundane broadcast.
|
||||
signal.data["compression"] = 0
|
||||
signal.transmission_method = TRANSMISSION_RADIO
|
||||
signal.levels = list(T.z)
|
||||
signal.broadcast()
|
||||
|
||||
/obj/item/radio/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
if(radio_freq || !broadcasting || get_dist(src, speaker) > canhear_range)
|
||||
return
|
||||
|
||||
if(message_mode == MODE_WHISPER || message_mode == MODE_WHISPER_CRIT)
|
||||
// radios don't pick up whispers very well
|
||||
raw_message = stars(raw_message)
|
||||
else if(message_mode == MODE_L_HAND || message_mode == MODE_R_HAND)
|
||||
// try to avoid being heard double
|
||||
if (loc == speaker && ismob(speaker))
|
||||
var/mob/M = speaker
|
||||
var/idx = M.get_held_index_of_item(src)
|
||||
// left hands are odd slots
|
||||
if (idx && (idx % 2) == (message_mode == MODE_L_HAND))
|
||||
return
|
||||
|
||||
talk_into(speaker, raw_message, , spans, language=message_language)
|
||||
|
||||
// Checks if this radio can receive on the given frequency.
|
||||
/obj/item/radio/proc/can_receive(freq, level)
|
||||
// deny checks
|
||||
if (!on || !listening || wires.is_cut(WIRE_RX))
|
||||
return FALSE
|
||||
if (freq == FREQ_SYNDICATE && !syndie)
|
||||
return FALSE
|
||||
if (freq == FREQ_CENTCOM)
|
||||
return independent // hard-ignores the z-level check
|
||||
if (!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(!position || !(position.z in level))
|
||||
return FALSE
|
||||
|
||||
// allow checks: are we listening on that frequency?
|
||||
if (freq == frequency)
|
||||
return TRUE
|
||||
for(var/ch_name in channels)
|
||||
if(channels[ch_name] & FREQ_LISTENING)
|
||||
//the GLOB.radiochannels list is located in communications.dm
|
||||
if(GLOB.radiochannels[ch_name] == text2num(freq) || syndie)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/radio/examine(mob/user)
|
||||
. = ..()
|
||||
if (unscrewed)
|
||||
. += "<span class='notice'>It can be attached and modified.</span>"
|
||||
else
|
||||
. += "<span class='notice'>It cannot be modified or attached.</span>"
|
||||
|
||||
/obj/item/radio/attackby(obj/item/W, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
unscrewed = !unscrewed
|
||||
if(unscrewed)
|
||||
to_chat(user, "<span class='notice'>The radio can now be attached and modified!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The radio can no longer be modified or attached!</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/emp_act(severity)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
emped++ //There's been an EMP; better count it
|
||||
var/curremp = emped //Remember which EMP this was
|
||||
if (listening && ismob(loc)) // if the radio is turned on and on someone's person they notice
|
||||
to_chat(loc, "<span class='warning'>\The [src] overloads.</span>")
|
||||
broadcasting = FALSE
|
||||
listening = FALSE
|
||||
for (var/ch_name in channels)
|
||||
channels[ch_name] = 0
|
||||
on = FALSE
|
||||
spawn(200)
|
||||
if(emped == curremp) //Don't fix it if it's been EMP'd again
|
||||
emped = 0
|
||||
if (!istype(src, /obj/item/radio/intercom)) // intercoms will turn back on on their own
|
||||
on = TRUE
|
||||
|
||||
///////////////////////////////
|
||||
//////////Borg Radios//////////
|
||||
///////////////////////////////
|
||||
//Giving borgs their own radio to have some more room to work with -Sieve
|
||||
|
||||
/obj/item/radio/borg
|
||||
name = "cyborg radio"
|
||||
subspace_switchable = TRUE
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/radio/borg/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
/obj/item/radio/borg/syndicate
|
||||
syndie = 1
|
||||
keyslot = new /obj/item/encryptionkey/syndicate
|
||||
|
||||
/obj/item/radio/borg/syndicate/Initialize()
|
||||
. = ..()
|
||||
set_frequency(FREQ_SYNDICATE)
|
||||
|
||||
/obj/item/radio/borg/attackby(obj/item/W, mob/user, params)
|
||||
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
if(keyslot)
|
||||
for(var/ch_name in channels)
|
||||
SSradio.remove_object(src, GLOB.radiochannels[ch_name])
|
||||
secure_radio_connections[ch_name] = null
|
||||
|
||||
|
||||
if(keyslot)
|
||||
var/turf/T = get_turf(user)
|
||||
if(T)
|
||||
keyslot.forceMove(T)
|
||||
keyslot = null
|
||||
|
||||
recalculateChannels()
|
||||
to_chat(user, "<span class='notice'>You pop out the encryption key in the radio.</span>")
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>This radio doesn't have any encryption keys!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/encryptionkey/))
|
||||
if(keyslot)
|
||||
to_chat(user, "<span class='warning'>The radio can't hold another key!</span>")
|
||||
return
|
||||
|
||||
if(!keyslot)
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
keyslot = W
|
||||
|
||||
recalculateChannels()
|
||||
|
||||
|
||||
/obj/item/radio/off // Station bounced radios, their only difference is spawning with the speakers off, this was made to help the lag.
|
||||
listening = 0 // And it's nice to have a subtype too for future features.
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
|
||||
/obj/item/radio/internal
|
||||
var/obj/item/implant/radio/implant
|
||||
|
||||
/obj/item/radio/internal/Initialize(mapload, obj/item/implant/radio/_implant)
|
||||
. = ..()
|
||||
implant = _implant
|
||||
|
||||
/obj/item/radio/internal/Destroy()
|
||||
if(implant?.imp_in)
|
||||
qdel(implant)
|
||||
else
|
||||
return ..()
|
||||
/obj/item/radio
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
name = "station bounced radio"
|
||||
icon_state = "walkietalkie"
|
||||
item_state = "walkietalkie"
|
||||
desc = "A basic handheld radio that communicates with local telecommunication networks."
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
|
||||
flags_1 = CONDUCT_1 | HEAR_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL=75, MAT_GLASS=25)
|
||||
obj_flags = USES_TGUI
|
||||
|
||||
var/on = TRUE
|
||||
var/frequency = FREQ_COMMON
|
||||
var/canhear_range = 3 // The range around the radio in which mobs can hear what it receives.
|
||||
var/emped = 0 // Tracks the number of EMPs currently stacked.
|
||||
|
||||
var/broadcasting = FALSE // Whether the radio will transmit dialogue it hears nearby.
|
||||
var/listening = TRUE // Whether the radio is currently receiving.
|
||||
var/prison_radio = FALSE // If true, the transmit wire starts cut.
|
||||
var/unscrewed = FALSE // Whether wires are accessible. Toggleable by screwdrivering.
|
||||
var/freerange = FALSE // If true, the radio has access to the full spectrum.
|
||||
var/subspace_transmission = FALSE // If true, the radio transmits and receives on subspace exclusively.
|
||||
var/subspace_switchable = FALSE // If true, subspace_transmission can be toggled at will.
|
||||
var/freqlock = FALSE // Frequency lock to stop the user from untuning specialist radios.
|
||||
var/use_command = FALSE // If true, broadcasts will be large and BOLD.
|
||||
var/command = FALSE // If true, use_command can be toggled at will.
|
||||
|
||||
// Encryption key handling
|
||||
var/obj/item/encryptionkey/keyslot
|
||||
var/translate_binary = FALSE // If true, can hear the special binary channel.
|
||||
var/independent = FALSE // If true, can say/hear on the special CentCom channel.
|
||||
var/syndie = FALSE // If true, hears all well-known channels automatically, and can say/hear on the Syndicate channel.
|
||||
var/list/channels = list() // Map from name (see communications.dm) to on/off. First entry is current department (:h).
|
||||
var/list/secure_radio_connections
|
||||
|
||||
var/const/FREQ_LISTENING = 1
|
||||
//FREQ_BROADCASTING = 2
|
||||
|
||||
/obj/item/radio/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] starts bouncing [src] off [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/radio/proc/set_frequency(new_frequency)
|
||||
SEND_SIGNAL(src, COMSIG_RADIO_NEW_FREQUENCY, args)
|
||||
remove_radio(src, frequency)
|
||||
frequency = add_radio(src, new_frequency)
|
||||
|
||||
/obj/item/radio/proc/recalculateChannels()
|
||||
channels = list()
|
||||
translate_binary = FALSE
|
||||
syndie = FALSE
|
||||
independent = FALSE
|
||||
|
||||
if(keyslot)
|
||||
for(var/ch_name in keyslot.channels)
|
||||
if(!(ch_name in channels))
|
||||
channels[ch_name] = keyslot.channels[ch_name]
|
||||
|
||||
if(keyslot.translate_binary)
|
||||
translate_binary = TRUE
|
||||
if(keyslot.syndie)
|
||||
syndie = TRUE
|
||||
if(keyslot.independent)
|
||||
independent = TRUE
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
|
||||
|
||||
/obj/item/radio/proc/make_syndie() // Turns normal radios into Syndicate radios!
|
||||
qdel(keyslot)
|
||||
keyslot = new /obj/item/encryptionkey/syndicate
|
||||
syndie = 1
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/radio/Destroy()
|
||||
remove_radio_all(src) //Just to be sure
|
||||
QDEL_NULL(wires)
|
||||
QDEL_NULL(keyslot)
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/Initialize()
|
||||
wires = new /datum/wires/radio(src)
|
||||
if(prison_radio)
|
||||
wires.cut(WIRE_TX) // OH GOD WHY
|
||||
secure_radio_connections = new
|
||||
. = ..()
|
||||
frequency = sanitize_frequency(frequency, freerange)
|
||||
set_frequency(frequency)
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
|
||||
|
||||
/obj/item/radio/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
|
||||
|
||||
/obj/item/radio/interact(mob/user)
|
||||
if(unscrewed && !isAI(user))
|
||||
wires.interact(user)
|
||||
add_fingerprint(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/radio/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state)
|
||||
. = ..()
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "radio", name, 370, 220 + channels.len * 22, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/item/radio/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["broadcasting"] = broadcasting
|
||||
data["listening"] = listening
|
||||
data["frequency"] = frequency
|
||||
data["minFrequency"] = freerange ? MIN_FREE_FREQ : MIN_FREQ
|
||||
data["maxFrequency"] = freerange ? MAX_FREE_FREQ : MAX_FREQ
|
||||
data["freqlock"] = freqlock
|
||||
data["channels"] = list()
|
||||
for(var/channel in channels)
|
||||
data["channels"][channel] = channels[channel] & FREQ_LISTENING
|
||||
data["command"] = command
|
||||
data["useCommand"] = use_command
|
||||
data["subspace"] = subspace_transmission
|
||||
data["subspaceSwitchable"] = subspace_switchable
|
||||
data["headset"] = istype(src, /obj/item/radio/headset)
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/radio/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("frequency")
|
||||
if(freqlock)
|
||||
return
|
||||
var/tune = params["tune"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(tune == "input")
|
||||
var/min = format_frequency(freerange ? MIN_FREE_FREQ : MIN_FREQ)
|
||||
var/max = format_frequency(freerange ? MAX_FREE_FREQ : MAX_FREQ)
|
||||
tune = input("Tune frequency ([min]-[max]):", name, format_frequency(frequency)) as null|num
|
||||
if(!isnull(tune) && !..())
|
||||
if (tune < MIN_FREE_FREQ && tune <= MAX_FREE_FREQ / 10)
|
||||
// allow typing 144.7 to get 1447
|
||||
tune *= 10
|
||||
. = TRUE
|
||||
else if(adjust)
|
||||
tune = frequency + adjust * 10
|
||||
. = TRUE
|
||||
else if(text2num(tune) != null)
|
||||
tune = tune * 10
|
||||
. = TRUE
|
||||
if(.)
|
||||
set_frequency(sanitize_frequency(tune, freerange))
|
||||
if("listen")
|
||||
listening = !listening
|
||||
. = TRUE
|
||||
if("broadcast")
|
||||
broadcasting = !broadcasting
|
||||
. = TRUE
|
||||
if("channel")
|
||||
var/channel = params["channel"]
|
||||
if(!(channel in channels))
|
||||
return
|
||||
if(channels[channel] & FREQ_LISTENING)
|
||||
channels[channel] &= ~FREQ_LISTENING
|
||||
else
|
||||
channels[channel] |= FREQ_LISTENING
|
||||
. = TRUE
|
||||
if("command")
|
||||
use_command = !use_command
|
||||
. = TRUE
|
||||
if("subspace")
|
||||
if(subspace_switchable)
|
||||
subspace_transmission = !subspace_transmission
|
||||
if(!subspace_transmission)
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
. = TRUE
|
||||
|
||||
/obj/item/radio/talk_into(atom/movable/M, message, channel, list/spans, datum/language/language)
|
||||
if(!spans)
|
||||
spans = list(M.speech_span)
|
||||
if(!language)
|
||||
language = M.get_default_language()
|
||||
INVOKE_ASYNC(src, .proc/talk_into_impl, M, message, channel, spans.Copy(), language)
|
||||
return ITALICS | REDUCE_RANGE
|
||||
|
||||
/obj/item/radio/proc/talk_into_impl(atom/movable/M, message, channel, list/spans, datum/language/language)
|
||||
if(!on)
|
||||
return // the device has to be on
|
||||
if(!M || !message)
|
||||
return
|
||||
if(wires.is_cut(WIRE_TX)) // Permacell and otherwise tampered-with radios
|
||||
return
|
||||
if(!M.IsVocal())
|
||||
return
|
||||
|
||||
if(use_command)
|
||||
spans |= SPAN_COMMAND
|
||||
|
||||
/*
|
||||
Roughly speaking, radios attempt to make a subspace transmission (which
|
||||
is received, processed, and rebroadcast by the telecomms satellite) and
|
||||
if that fails, they send a mundane radio transmission.
|
||||
|
||||
Headsets cannot send/receive mundane transmissions, only subspace.
|
||||
Syndicate radios can hear transmissions on all well-known frequencies.
|
||||
CentCom radios can hear the CentCom frequency no matter what.
|
||||
*/
|
||||
|
||||
// From the channel, determine the frequency and get a reference to it.
|
||||
var/freq
|
||||
if(channel && channels && channels.len > 0)
|
||||
if(channel == MODE_DEPARTMENT)
|
||||
channel = channels[1]
|
||||
freq = secure_radio_connections[channel]
|
||||
if (!channels[channel]) // if the channel is turned off, don't broadcast
|
||||
return
|
||||
else
|
||||
freq = frequency
|
||||
channel = null
|
||||
|
||||
// Nearby active jammers severely gibberish the message
|
||||
var/turf/position = get_turf(src)
|
||||
for(var/obj/item/jammer/jammer in GLOB.active_jammers)
|
||||
var/turf/jammer_turf = get_turf(jammer)
|
||||
if(position.z == jammer_turf.z && (get_dist(position, jammer_turf) < jammer.range))
|
||||
message = Gibberish(message,100)
|
||||
break
|
||||
|
||||
// Determine the identity information which will be attached to the signal.
|
||||
var/atom/movable/virtualspeaker/speaker = new(null, M, src)
|
||||
|
||||
// Construct the signal
|
||||
var/datum/signal/subspace/vocal/signal = new(src, freq, speaker, language, message, spans)
|
||||
|
||||
// Independent radios, on the CentCom frequency, reach all independent radios
|
||||
if (independent && (freq == FREQ_CENTCOM || freq == FREQ_CTF_RED || freq == FREQ_CTF_BLUE))
|
||||
signal.data["compression"] = 0
|
||||
signal.transmission_method = TRANSMISSION_SUPERSPACE
|
||||
signal.levels = list(0) // reaches all Z-levels
|
||||
signal.broadcast()
|
||||
return
|
||||
|
||||
// All radios make an attempt to use the subspace system first
|
||||
signal.send_to_receivers()
|
||||
|
||||
// If the radio is subspace-only, that's all it can do
|
||||
if (subspace_transmission)
|
||||
return
|
||||
|
||||
// Non-subspace radios will check in a couple of seconds, and if the signal
|
||||
// was never received, send a mundane broadcast (no headsets).
|
||||
addtimer(CALLBACK(src, .proc/backup_transmission, signal), 20)
|
||||
|
||||
/obj/item/radio/proc/backup_transmission(datum/signal/subspace/vocal/signal)
|
||||
var/turf/T = get_turf(src)
|
||||
if (signal.data["done"] && (T.z in signal.levels))
|
||||
return
|
||||
|
||||
// Okay, the signal was never processed, send a mundane broadcast.
|
||||
signal.data["compression"] = 0
|
||||
signal.transmission_method = TRANSMISSION_RADIO
|
||||
signal.levels = list(T.z)
|
||||
signal.broadcast()
|
||||
|
||||
/obj/item/radio/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(radio_freq || !broadcasting || get_dist(src, speaker) > canhear_range)
|
||||
return
|
||||
|
||||
if(message_mode == MODE_WHISPER || message_mode == MODE_WHISPER_CRIT)
|
||||
// radios don't pick up whispers very well
|
||||
raw_message = stars(raw_message)
|
||||
else if(message_mode == MODE_L_HAND || message_mode == MODE_R_HAND)
|
||||
// try to avoid being heard double
|
||||
if (loc == speaker && ismob(speaker))
|
||||
var/mob/M = speaker
|
||||
var/idx = M.get_held_index_of_item(src)
|
||||
// left hands are odd slots
|
||||
if (idx && (idx % 2) == (message_mode == MODE_L_HAND))
|
||||
return
|
||||
|
||||
talk_into(speaker, raw_message, , spans, language=message_language)
|
||||
|
||||
// Checks if this radio can receive on the given frequency.
|
||||
/obj/item/radio/proc/can_receive(freq, level)
|
||||
// deny checks
|
||||
if (!on || !listening || wires.is_cut(WIRE_RX))
|
||||
return FALSE
|
||||
if (freq == FREQ_SYNDICATE && !syndie)
|
||||
return FALSE
|
||||
if (freq == FREQ_CENTCOM)
|
||||
return independent // hard-ignores the z-level check
|
||||
if (!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(!position || !(position.z in level))
|
||||
return FALSE
|
||||
|
||||
// allow checks: are we listening on that frequency?
|
||||
if (freq == frequency)
|
||||
return TRUE
|
||||
for(var/ch_name in channels)
|
||||
if(channels[ch_name] & FREQ_LISTENING)
|
||||
//the GLOB.radiochannels list is located in communications.dm
|
||||
if(GLOB.radiochannels[ch_name] == text2num(freq) || syndie)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/radio/examine(mob/user)
|
||||
. = ..()
|
||||
if (unscrewed)
|
||||
. += "<span class='notice'>It can be attached and modified.</span>"
|
||||
else
|
||||
. += "<span class='notice'>It cannot be modified or attached.</span>"
|
||||
|
||||
/obj/item/radio/attackby(obj/item/W, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
unscrewed = !unscrewed
|
||||
if(unscrewed)
|
||||
to_chat(user, "<span class='notice'>The radio can now be attached and modified!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The radio can no longer be modified or attached!</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/emp_act(severity)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
emped++ //There's been an EMP; better count it
|
||||
var/curremp = emped //Remember which EMP this was
|
||||
if (listening && ismob(loc)) // if the radio is turned on and on someone's person they notice
|
||||
to_chat(loc, "<span class='warning'>\The [src] overloads.</span>")
|
||||
broadcasting = FALSE
|
||||
listening = FALSE
|
||||
for (var/ch_name in channels)
|
||||
channels[ch_name] = 0
|
||||
on = FALSE
|
||||
spawn(200)
|
||||
if(emped == curremp) //Don't fix it if it's been EMP'd again
|
||||
emped = 0
|
||||
if (!istype(src, /obj/item/radio/intercom)) // intercoms will turn back on on their own
|
||||
on = TRUE
|
||||
|
||||
///////////////////////////////
|
||||
//////////Borg Radios//////////
|
||||
///////////////////////////////
|
||||
//Giving borgs their own radio to have some more room to work with -Sieve
|
||||
|
||||
/obj/item/radio/borg
|
||||
name = "cyborg radio"
|
||||
subspace_switchable = TRUE
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/radio/borg/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
/obj/item/radio/borg/syndicate
|
||||
syndie = 1
|
||||
keyslot = new /obj/item/encryptionkey/syndicate
|
||||
|
||||
/obj/item/radio/borg/syndicate/Initialize()
|
||||
. = ..()
|
||||
set_frequency(FREQ_SYNDICATE)
|
||||
|
||||
/obj/item/radio/borg/attackby(obj/item/W, mob/user, params)
|
||||
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
if(keyslot)
|
||||
for(var/ch_name in channels)
|
||||
SSradio.remove_object(src, GLOB.radiochannels[ch_name])
|
||||
secure_radio_connections[ch_name] = null
|
||||
|
||||
|
||||
if(keyslot)
|
||||
var/turf/T = get_turf(user)
|
||||
if(T)
|
||||
keyslot.forceMove(T)
|
||||
keyslot = null
|
||||
|
||||
recalculateChannels()
|
||||
to_chat(user, "<span class='notice'>You pop out the encryption key in the radio.</span>")
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>This radio doesn't have any encryption keys!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/encryptionkey/))
|
||||
if(keyslot)
|
||||
to_chat(user, "<span class='warning'>The radio can't hold another key!</span>")
|
||||
return
|
||||
|
||||
if(!keyslot)
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
keyslot = W
|
||||
|
||||
recalculateChannels()
|
||||
|
||||
|
||||
/obj/item/radio/off // Station bounced radios, their only difference is spawning with the speakers off, this was made to help the lag.
|
||||
listening = 0 // And it's nice to have a subtype too for future features.
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
|
||||
/obj/item/radio/internal
|
||||
var/obj/item/implant/radio/implant
|
||||
|
||||
/obj/item/radio/internal/Initialize(mapload, obj/item/implant/radio/_implant)
|
||||
. = ..()
|
||||
implant = _implant
|
||||
|
||||
/obj/item/radio/internal/Destroy()
|
||||
if(implant?.imp_in)
|
||||
qdel(implant)
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -1,290 +1,290 @@
|
||||
/obj/item/taperecorder
|
||||
name = "universal recorder"
|
||||
desc = "A device that can record to cassette tapes, and play them. It automatically translates the content in playback."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "taperecorder_empty"
|
||||
item_state = "analyzer"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
flags_1 = HEAR_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
materials = list(MAT_METAL=60, MAT_GLASS=30)
|
||||
force = 2
|
||||
throwforce = 0
|
||||
var/recording = 0
|
||||
var/playing = 0
|
||||
var/playsleepseconds = 0
|
||||
var/obj/item/tape/mytape
|
||||
var/starting_tape_type = /obj/item/tape/random
|
||||
var/open_panel = 0
|
||||
var/canprint = 1
|
||||
|
||||
|
||||
/obj/item/taperecorder/Initialize(mapload)
|
||||
. = ..()
|
||||
if(starting_tape_type)
|
||||
mytape = new starting_tape_type(src)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/examine(mob/user)
|
||||
. = ..()
|
||||
. += "The wire panel is [open_panel ? "opened" : "closed"]."
|
||||
|
||||
/obj/item/taperecorder/attackby(obj/item/I, mob/user, params)
|
||||
if(!mytape && istype(I, /obj/item/tape))
|
||||
if(!user.transferItemToLoc(I,src))
|
||||
return
|
||||
mytape = I
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/proc/eject(mob/user)
|
||||
if(mytape)
|
||||
to_chat(user, "<span class='notice'>You remove [mytape] from [src].</span>")
|
||||
stop()
|
||||
user.put_in_hands(mytape)
|
||||
mytape = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/taperecorder/fire_act(exposed_temperature, exposed_volume)
|
||||
mytape.ruin() //Fires destroy the tape
|
||||
..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/item/taperecorder/attack_hand(mob/user)
|
||||
if(loc == user)
|
||||
if(mytape)
|
||||
if(!user.is_holding(src))
|
||||
return ..()
|
||||
eject(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/taperecorder/proc/can_use(mob/user)
|
||||
if(user && ismob(user))
|
||||
if(!user.incapacitated())
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/ejectverb()
|
||||
set name = "Eject Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
|
||||
eject(usr)
|
||||
|
||||
|
||||
/obj/item/taperecorder/update_icon()
|
||||
if(!mytape)
|
||||
icon_state = "taperecorder_empty"
|
||||
else if(recording)
|
||||
icon_state = "taperecorder_recording"
|
||||
else if(playing)
|
||||
icon_state = "taperecorder_playing"
|
||||
else
|
||||
icon_state = "taperecorder_idle"
|
||||
|
||||
|
||||
/obj/item/taperecorder/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode)
|
||||
. = ..()
|
||||
if(mytape && recording)
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] [message]"
|
||||
|
||||
/obj/item/taperecorder/verb/record()
|
||||
set name = "Start Recording"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
if(mytape.used_capacity < mytape.max_capacity)
|
||||
to_chat(usr, "<span class='notice'>Recording started.</span>")
|
||||
recording = 1
|
||||
update_icon()
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording started."
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
while(recording && used < max)
|
||||
mytape.used_capacity++
|
||||
used++
|
||||
sleep(10)
|
||||
recording = 0
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The tape is full.</span>")
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/stop()
|
||||
set name = "Stop"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
|
||||
if(recording)
|
||||
recording = 0
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording stopped."
|
||||
to_chat(usr, "<span class='notice'>Recording stopped.</span>")
|
||||
return
|
||||
else if(playing)
|
||||
playing = 0
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/play()
|
||||
set name = "Play Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
playing = 1
|
||||
update_icon()
|
||||
to_chat(usr, "<span class='notice'>Playing started.</span>")
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
for(var/i = 1, used < max, sleep(10 * playsleepseconds))
|
||||
if(!mytape)
|
||||
break
|
||||
if(playing == 0)
|
||||
break
|
||||
if(mytape.storedinfo.len < i)
|
||||
break
|
||||
say(mytape.storedinfo[i])
|
||||
if(mytape.storedinfo.len < i + 1)
|
||||
playsleepseconds = 1
|
||||
sleep(10)
|
||||
say("End of recording.")
|
||||
else
|
||||
playsleepseconds = mytape.timestamp[i + 1] - mytape.timestamp[i]
|
||||
if(playsleepseconds > 14)
|
||||
sleep(10)
|
||||
say("Skipping [playsleepseconds] seconds of silence")
|
||||
playsleepseconds = 1
|
||||
i++
|
||||
|
||||
playing = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/attack_self(mob/user)
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
stop()
|
||||
else
|
||||
record()
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/print_transcript()
|
||||
set name = "Print Transcript"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
if(!canprint)
|
||||
to_chat(usr, "<span class='notice'>The recorder can't print that fast!</span>")
|
||||
return
|
||||
if(recording || playing)
|
||||
return
|
||||
|
||||
to_chat(usr, "<span class='notice'>Transcript printed.</span>")
|
||||
var/obj/item/paper/P = new /obj/item/paper(get_turf(src))
|
||||
var/t1 = "<B>Transcript:</B><BR><BR>"
|
||||
for(var/i = 1, mytape.storedinfo.len >= i, i++)
|
||||
t1 += "[mytape.storedinfo[i]]<BR>"
|
||||
P.info = t1
|
||||
P.name = "paper- 'Transcript'"
|
||||
usr.put_in_hands(P)
|
||||
canprint = 0
|
||||
sleep(300)
|
||||
canprint = 1
|
||||
|
||||
|
||||
//empty tape recorders
|
||||
/obj/item/taperecorder/empty
|
||||
starting_tape_type = null
|
||||
|
||||
|
||||
/obj/item/tape
|
||||
name = "tape"
|
||||
desc = "A magnetic tape that can hold up to ten minutes of content."
|
||||
icon_state = "tape_white"
|
||||
icon = 'icons/obj/device.dmi'
|
||||
item_state = "analyzer"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
materials = list(MAT_METAL=20, MAT_GLASS=5)
|
||||
force = 1
|
||||
throwforce = 0
|
||||
var/max_capacity = 600
|
||||
var/used_capacity = 0
|
||||
var/list/storedinfo = list()
|
||||
var/list/timestamp = list()
|
||||
var/ruined = 0
|
||||
|
||||
/obj/item/tape/fire_act(exposed_temperature, exposed_volume)
|
||||
ruin()
|
||||
..()
|
||||
|
||||
/obj/item/tape/attack_self(mob/user)
|
||||
if(!ruined)
|
||||
to_chat(user, "<span class='notice'>You pull out all the tape!</span>")
|
||||
ruin()
|
||||
|
||||
|
||||
/obj/item/tape/proc/ruin()
|
||||
//Lets not add infinite amounts of overlays when our fireact is called
|
||||
//repeatedly
|
||||
if(!ruined)
|
||||
add_overlay("ribbonoverlay")
|
||||
ruined = 1
|
||||
|
||||
|
||||
/obj/item/tape/proc/fix()
|
||||
cut_overlay("ribbonoverlay")
|
||||
ruined = 0
|
||||
|
||||
|
||||
/obj/item/tape/attackby(obj/item/I, mob/user, params)
|
||||
if(ruined && istype(I, /obj/item/screwdriver) || istype(I, /obj/item/pen))
|
||||
to_chat(user, "<span class='notice'>You start winding the tape back in...</span>")
|
||||
if(I.use_tool(src, user, 120))
|
||||
to_chat(user, "<span class='notice'>You wound the tape back in.</span>")
|
||||
fix()
|
||||
|
||||
//Random colour tapes
|
||||
/obj/item/tape/random
|
||||
icon_state = "random_tape"
|
||||
|
||||
/obj/item/tape/random/New()
|
||||
icon_state = "tape_[pick("white", "blue", "red", "yellow", "purple")]"
|
||||
..()
|
||||
/obj/item/taperecorder
|
||||
name = "universal recorder"
|
||||
desc = "A device that can record to cassette tapes, and play them. It automatically translates the content in playback."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "taperecorder_empty"
|
||||
item_state = "analyzer"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
flags_1 = HEAR_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
materials = list(MAT_METAL=60, MAT_GLASS=30)
|
||||
force = 2
|
||||
throwforce = 0
|
||||
var/recording = 0
|
||||
var/playing = 0
|
||||
var/playsleepseconds = 0
|
||||
var/obj/item/tape/mytape
|
||||
var/starting_tape_type = /obj/item/tape/random
|
||||
var/open_panel = 0
|
||||
var/canprint = 1
|
||||
|
||||
|
||||
/obj/item/taperecorder/Initialize(mapload)
|
||||
. = ..()
|
||||
if(starting_tape_type)
|
||||
mytape = new starting_tape_type(src)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/examine(mob/user)
|
||||
. = ..()
|
||||
. += "The wire panel is [open_panel ? "opened" : "closed"]."
|
||||
|
||||
/obj/item/taperecorder/attackby(obj/item/I, mob/user, params)
|
||||
if(!mytape && istype(I, /obj/item/tape))
|
||||
if(!user.transferItemToLoc(I,src))
|
||||
return
|
||||
mytape = I
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/proc/eject(mob/user)
|
||||
if(mytape)
|
||||
to_chat(user, "<span class='notice'>You remove [mytape] from [src].</span>")
|
||||
stop()
|
||||
user.put_in_hands(mytape)
|
||||
mytape = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/taperecorder/fire_act(exposed_temperature, exposed_volume)
|
||||
mytape.ruin() //Fires destroy the tape
|
||||
..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/item/taperecorder/attack_hand(mob/user)
|
||||
if(loc == user)
|
||||
if(mytape)
|
||||
if(!user.is_holding(src))
|
||||
return ..()
|
||||
eject(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/taperecorder/proc/can_use(mob/user)
|
||||
if(user && ismob(user))
|
||||
if(!user.incapacitated())
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/ejectverb()
|
||||
set name = "Eject Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
|
||||
eject(usr)
|
||||
|
||||
|
||||
/obj/item/taperecorder/update_icon()
|
||||
if(!mytape)
|
||||
icon_state = "taperecorder_empty"
|
||||
else if(recording)
|
||||
icon_state = "taperecorder_recording"
|
||||
else if(playing)
|
||||
icon_state = "taperecorder_playing"
|
||||
else
|
||||
icon_state = "taperecorder_idle"
|
||||
|
||||
|
||||
/obj/item/taperecorder/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(mytape && recording)
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] [message]"
|
||||
|
||||
/obj/item/taperecorder/verb/record()
|
||||
set name = "Start Recording"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
if(mytape.used_capacity < mytape.max_capacity)
|
||||
to_chat(usr, "<span class='notice'>Recording started.</span>")
|
||||
recording = 1
|
||||
update_icon()
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording started."
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
while(recording && used < max)
|
||||
mytape.used_capacity++
|
||||
used++
|
||||
sleep(10)
|
||||
recording = 0
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>The tape is full.</span>")
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/stop()
|
||||
set name = "Stop"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
|
||||
if(recording)
|
||||
recording = 0
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording stopped."
|
||||
to_chat(usr, "<span class='notice'>Recording stopped.</span>")
|
||||
return
|
||||
else if(playing)
|
||||
playing = 0
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/play()
|
||||
set name = "Play Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
playing = 1
|
||||
update_icon()
|
||||
to_chat(usr, "<span class='notice'>Playing started.</span>")
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
for(var/i = 1, used < max, sleep(10 * playsleepseconds))
|
||||
if(!mytape)
|
||||
break
|
||||
if(playing == 0)
|
||||
break
|
||||
if(mytape.storedinfo.len < i)
|
||||
break
|
||||
say(mytape.storedinfo[i])
|
||||
if(mytape.storedinfo.len < i + 1)
|
||||
playsleepseconds = 1
|
||||
sleep(10)
|
||||
say("End of recording.")
|
||||
else
|
||||
playsleepseconds = mytape.timestamp[i + 1] - mytape.timestamp[i]
|
||||
if(playsleepseconds > 14)
|
||||
sleep(10)
|
||||
say("Skipping [playsleepseconds] seconds of silence")
|
||||
playsleepseconds = 1
|
||||
i++
|
||||
|
||||
playing = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/taperecorder/attack_self(mob/user)
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
stop()
|
||||
else
|
||||
record()
|
||||
|
||||
|
||||
/obj/item/taperecorder/verb/print_transcript()
|
||||
set name = "Print Transcript"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
if(!canprint)
|
||||
to_chat(usr, "<span class='notice'>The recorder can't print that fast!</span>")
|
||||
return
|
||||
if(recording || playing)
|
||||
return
|
||||
|
||||
to_chat(usr, "<span class='notice'>Transcript printed.</span>")
|
||||
var/obj/item/paper/P = new /obj/item/paper(get_turf(src))
|
||||
var/t1 = "<B>Transcript:</B><BR><BR>"
|
||||
for(var/i = 1, mytape.storedinfo.len >= i, i++)
|
||||
t1 += "[mytape.storedinfo[i]]<BR>"
|
||||
P.info = t1
|
||||
P.name = "paper- 'Transcript'"
|
||||
usr.put_in_hands(P)
|
||||
canprint = 0
|
||||
sleep(300)
|
||||
canprint = 1
|
||||
|
||||
|
||||
//empty tape recorders
|
||||
/obj/item/taperecorder/empty
|
||||
starting_tape_type = null
|
||||
|
||||
|
||||
/obj/item/tape
|
||||
name = "tape"
|
||||
desc = "A magnetic tape that can hold up to ten minutes of content."
|
||||
icon_state = "tape_white"
|
||||
icon = 'icons/obj/device.dmi'
|
||||
item_state = "analyzer"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
materials = list(MAT_METAL=20, MAT_GLASS=5)
|
||||
force = 1
|
||||
throwforce = 0
|
||||
var/max_capacity = 600
|
||||
var/used_capacity = 0
|
||||
var/list/storedinfo = list()
|
||||
var/list/timestamp = list()
|
||||
var/ruined = 0
|
||||
|
||||
/obj/item/tape/fire_act(exposed_temperature, exposed_volume)
|
||||
ruin()
|
||||
..()
|
||||
|
||||
/obj/item/tape/attack_self(mob/user)
|
||||
if(!ruined)
|
||||
to_chat(user, "<span class='notice'>You pull out all the tape!</span>")
|
||||
ruin()
|
||||
|
||||
|
||||
/obj/item/tape/proc/ruin()
|
||||
//Lets not add infinite amounts of overlays when our fireact is called
|
||||
//repeatedly
|
||||
if(!ruined)
|
||||
add_overlay("ribbonoverlay")
|
||||
ruined = 1
|
||||
|
||||
|
||||
/obj/item/tape/proc/fix()
|
||||
cut_overlay("ribbonoverlay")
|
||||
ruined = 0
|
||||
|
||||
|
||||
/obj/item/tape/attackby(obj/item/I, mob/user, params)
|
||||
if(ruined && istype(I, /obj/item/screwdriver) || istype(I, /obj/item/pen))
|
||||
to_chat(user, "<span class='notice'>You start winding the tape back in...</span>")
|
||||
if(I.use_tool(src, user, 120))
|
||||
to_chat(user, "<span class='notice'>You wound the tape back in.</span>")
|
||||
fix()
|
||||
|
||||
//Random colour tapes
|
||||
/obj/item/tape/random
|
||||
icon_state = "random_tape"
|
||||
|
||||
/obj/item/tape/random/New()
|
||||
icon_state = "tape_[pick("white", "blue", "red", "yellow", "purple")]"
|
||||
..()
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
interact(user)
|
||||
return ..()
|
||||
|
||||
/obj/item/toy/eightball/haunted/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode)
|
||||
/obj/item/toy/eightball/haunted/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
last_message = raw_message
|
||||
|
||||
|
||||
+7
-5
@@ -28,19 +28,21 @@ GLOBAL_LIST_INIT(freqtospan, list(
|
||||
language = get_default_language()
|
||||
send_speech(message, 7, src, , spans, message_language=language)
|
||||
|
||||
/atom/movable/proc/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/atom/movable/proc/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, args)
|
||||
|
||||
/atom/movable/proc/can_speak()
|
||||
return 1
|
||||
|
||||
/atom/movable/proc/send_speech(message, range = 7, obj/source = src, bubble_type, list/spans, datum/language/message_language = null, message_mode)
|
||||
var/rendered = compose_message(src, message_language, message, , spans, message_mode)
|
||||
/atom/movable/proc/send_speech(message, range = 7, atom/movable/source = src, bubble_type, list/spans, datum/language/message_language = null, message_mode)
|
||||
var/rendered = compose_message(src, message_language, message, , spans, message_mode, source)
|
||||
for(var/_AM in get_hearers_in_view(range, source))
|
||||
var/atom/movable/AM = _AM
|
||||
AM.Hear(rendered, src, message_language, message, , spans, message_mode)
|
||||
AM.Hear(rendered, src, message_language, message, , spans, message_mode, source)
|
||||
|
||||
/atom/movable/proc/compose_message(atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, face_name = FALSE)
|
||||
/atom/movable/proc/compose_message(atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, face_name = FALSE, atom/movable/source)
|
||||
if(!source)
|
||||
source = speaker
|
||||
//This proc uses text() because it is faster than appending strings. Thanks BYOND.
|
||||
//Basic span
|
||||
var/spanpart1 = "<span class='[radio_freq ? get_radio_span(radio_freq) : "game say"]'>"
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
else
|
||||
to_chat(M, message)
|
||||
|
||||
/mob/camera/eminence/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/mob/camera/eminence/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(is_reebe(z) || is_servant_of_ratvar(speaker) || GLOB.ratvar_approaches || GLOB.ratvar_awakens) //Away from Reebe, the Eminence can't hear anything
|
||||
to_chat(src, message)
|
||||
|
||||
@@ -118,7 +118,7 @@ the new instance inside the host to be updated to the template's stats.
|
||||
follow_next(Dir & NORTHWEST)
|
||||
last_move_tick = world.time
|
||||
|
||||
/mob/camera/disease/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/mob/camera/disease/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
var/atom/movable/to_follow = speaker
|
||||
if(radio_freq)
|
||||
@@ -130,7 +130,7 @@ the new instance inside the host to be updated to the template's stats.
|
||||
else
|
||||
link = ""
|
||||
// Recompose the message, because it's scrambled by default
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode, FALSE, source)
|
||||
to_chat(src, "[link] [message]")
|
||||
|
||||
|
||||
|
||||
+101
-101
@@ -1,101 +1,101 @@
|
||||
#define INCLUSIVE_MODE 1
|
||||
#define EXCLUSIVE_MODE 2
|
||||
#define RECOGNIZER_MODE 3
|
||||
#define VOICE_SENSOR_MODE 4
|
||||
|
||||
/obj/item/assembly/voice
|
||||
name = "voice analyzer"
|
||||
desc = "A small electronic device able to record a voice sample, and send a signal when that sample is repeated."
|
||||
icon_state = "voice"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
flags_1 = HEAR_1
|
||||
attachable = TRUE
|
||||
verb_say = "beeps"
|
||||
verb_ask = "beeps"
|
||||
verb_exclaim = "beeps"
|
||||
var/listening = FALSE
|
||||
var/recorded = "" //the activation message
|
||||
var/mode = 1
|
||||
var/static/list/modes = list("inclusive",
|
||||
"exclusive",
|
||||
"recognizer",
|
||||
"voice sensor")
|
||||
|
||||
/obj/item/assembly/voice/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Use a multitool to swap between \"inclusive\", \"exclusive\", \"recognizer\", and \"voice sensor\" mode.</span>"
|
||||
|
||||
/obj/item/assembly/voice/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
if(speaker == src)
|
||||
return
|
||||
|
||||
if(listening && !radio_freq)
|
||||
record_speech(speaker, raw_message, message_language)
|
||||
else
|
||||
if(check_activation(speaker, raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language)
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(EXCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(RECOGNIZER_MODE)
|
||||
recorded = speaker.GetVoice()
|
||||
listening = FALSE
|
||||
say("Your voice pattern is saved.", message_language)
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/check_activation(atom/movable/speaker, raw_message)
|
||||
. = FALSE
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
if(findtext(raw_message, recorded))
|
||||
. = TRUE
|
||||
if(EXCLUSIVE_MODE)
|
||||
if(raw_message == recorded)
|
||||
. = TRUE
|
||||
if(RECOGNIZER_MODE)
|
||||
if(speaker.GetVoice() == recorded)
|
||||
. = TRUE
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
. = TRUE
|
||||
|
||||
/obj/item/assembly/voice/multitool_act(mob/living/user, obj/item/I)
|
||||
mode %= modes.len
|
||||
mode++
|
||||
to_chat(user, "<span class='notice'>You set [src] into [modes[mode]] mode.</span>")
|
||||
listening = FALSE
|
||||
recorded = ""
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/activate()
|
||||
if(!secured || holder)
|
||||
return FALSE
|
||||
listening = !listening
|
||||
say("[listening ? "Now" : "No longer"] recording input.")
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
. = ..()
|
||||
listening = FALSE
|
||||
|
||||
#undef INCLUSIVE_MODE
|
||||
#undef EXCLUSIVE_MODE
|
||||
#undef RECOGNIZER_MODE
|
||||
#undef VOICE_SENSOR_MODE
|
||||
#define INCLUSIVE_MODE 1
|
||||
#define EXCLUSIVE_MODE 2
|
||||
#define RECOGNIZER_MODE 3
|
||||
#define VOICE_SENSOR_MODE 4
|
||||
|
||||
/obj/item/assembly/voice
|
||||
name = "voice analyzer"
|
||||
desc = "A small electronic device able to record a voice sample, and send a signal when that sample is repeated."
|
||||
icon_state = "voice"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
flags_1 = HEAR_1
|
||||
attachable = TRUE
|
||||
verb_say = "beeps"
|
||||
verb_ask = "beeps"
|
||||
verb_exclaim = "beeps"
|
||||
var/listening = FALSE
|
||||
var/recorded = "" //the activation message
|
||||
var/mode = 1
|
||||
var/static/list/modes = list("inclusive",
|
||||
"exclusive",
|
||||
"recognizer",
|
||||
"voice sensor")
|
||||
|
||||
/obj/item/assembly/voice/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Use a multitool to swap between \"inclusive\", \"exclusive\", \"recognizer\", and \"voice sensor\" mode.</span>"
|
||||
|
||||
/obj/item/assembly/voice/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(speaker == src)
|
||||
return
|
||||
|
||||
if(listening && !radio_freq)
|
||||
record_speech(speaker, raw_message, message_language)
|
||||
else
|
||||
if(check_activation(speaker, raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language)
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(EXCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(RECOGNIZER_MODE)
|
||||
recorded = speaker.GetVoice()
|
||||
listening = FALSE
|
||||
say("Your voice pattern is saved.", message_language)
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/check_activation(atom/movable/speaker, raw_message)
|
||||
. = FALSE
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
if(findtext(raw_message, recorded))
|
||||
. = TRUE
|
||||
if(EXCLUSIVE_MODE)
|
||||
if(raw_message == recorded)
|
||||
. = TRUE
|
||||
if(RECOGNIZER_MODE)
|
||||
if(speaker.GetVoice() == recorded)
|
||||
. = TRUE
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
. = TRUE
|
||||
|
||||
/obj/item/assembly/voice/multitool_act(mob/living/user, obj/item/I)
|
||||
mode %= modes.len
|
||||
mode++
|
||||
to_chat(user, "<span class='notice'>You set [src] into [modes[mode]] mode.</span>")
|
||||
listening = FALSE
|
||||
recorded = ""
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/activate()
|
||||
if(!secured || holder)
|
||||
return FALSE
|
||||
listening = !listening
|
||||
say("[listening ? "Now" : "No longer"] recording input.")
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
. = ..()
|
||||
listening = FALSE
|
||||
|
||||
#undef INCLUSIVE_MODE
|
||||
#undef EXCLUSIVE_MODE
|
||||
#undef RECOGNIZER_MODE
|
||||
#undef VOICE_SENSOR_MODE
|
||||
|
||||
@@ -859,7 +859,7 @@
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 5
|
||||
|
||||
/obj/item/integrated_circuit/input/microphone/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode)
|
||||
/obj/item/integrated_circuit/input/microphone/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
var/translated = FALSE
|
||||
if(speaker && message)
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/mob/dead/observer/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
if (!message)
|
||||
return
|
||||
|
||||
var/message_mode = get_message_mode(message)
|
||||
if(client && (message_mode == MODE_ADMIN || message_mode == MODE_DEADMIN))
|
||||
message = copytext(message, 3)
|
||||
if(findtext(message, " ", 1, 2))
|
||||
message = copytext(message, 2)
|
||||
|
||||
if(message_mode == MODE_ADMIN)
|
||||
client.cmd_admin_say(message)
|
||||
else if(message_mode == MODE_DEADMIN)
|
||||
client.dsay(message)
|
||||
return
|
||||
|
||||
src.log_talk(message, LOG_SAY, tag="ghost")
|
||||
|
||||
if(check_emote(message))
|
||||
return
|
||||
|
||||
. = say_dead(message)
|
||||
|
||||
/mob/dead/observer/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
var/atom/movable/to_follow = speaker
|
||||
if(radio_freq)
|
||||
var/atom/movable/virtualspeaker/V = speaker
|
||||
|
||||
if(isAI(V.source))
|
||||
var/mob/living/silicon/ai/S = V.source
|
||||
to_follow = S.eyeobj
|
||||
else
|
||||
to_follow = V.source
|
||||
var/link = FOLLOW_LINK(src, to_follow)
|
||||
// Create map text prior to modifying message for goonchat
|
||||
if (client?.prefs.chat_on_map && (client.prefs.see_chat_non_mob || ismob(speaker)))
|
||||
create_chat_message(speaker, message_language, raw_message, spans, message_mode)
|
||||
// Recompose the message, because it's scrambled by default
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
to_chat(src, "[link] [message]")
|
||||
|
||||
/mob/dead/observer/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
if (!message)
|
||||
return
|
||||
|
||||
var/message_mode = get_message_mode(message)
|
||||
if(client && (message_mode == MODE_ADMIN || message_mode == MODE_DEADMIN))
|
||||
message = copytext(message, 3)
|
||||
if(findtext(message, " ", 1, 2))
|
||||
message = copytext(message, 2)
|
||||
|
||||
if(message_mode == MODE_ADMIN)
|
||||
client.cmd_admin_say(message)
|
||||
else if(message_mode == MODE_DEADMIN)
|
||||
client.dsay(message)
|
||||
return
|
||||
|
||||
src.log_talk(message, LOG_SAY, tag="ghost")
|
||||
|
||||
if(check_emote(message))
|
||||
return
|
||||
|
||||
. = say_dead(message)
|
||||
|
||||
/mob/dead/observer/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
var/atom/movable/to_follow = speaker
|
||||
if(radio_freq)
|
||||
var/atom/movable/virtualspeaker/V = speaker
|
||||
|
||||
if(isAI(V.source))
|
||||
var/mob/living/silicon/ai/S = V.source
|
||||
to_follow = S.eyeobj
|
||||
else
|
||||
to_follow = V.source
|
||||
var/link = FOLLOW_LINK(src, to_follow)
|
||||
// Create map text prior to modifying message for goonchat
|
||||
if (client?.prefs.chat_on_map && (client.prefs.see_chat_non_mob || ismob(speaker)))
|
||||
create_chat_message(speaker, message_language, raw_message, spans, message_mode)
|
||||
// Recompose the message, because it's scrambled by default
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode, FALSE, source)
|
||||
to_chat(src, "[link] [message]")
|
||||
|
||||
|
||||
@@ -221,11 +221,11 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
|
||||
if(succumbed)
|
||||
succumb()
|
||||
to_chat(src, compose_message(src, language, message, , spans, message_mode))
|
||||
to_chat(src, compose_message(src, language, message, null, spans, message_mode))
|
||||
|
||||
return 1
|
||||
|
||||
/mob/living/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
/mob/living/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(!client)
|
||||
return
|
||||
@@ -245,8 +245,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
playsound_local(src,'sound/voice/radio.ogg', 30, 1)
|
||||
|
||||
// Recompose message for AI hrefs, language incomprehension.
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
message = hear_intercept(message, speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode, FALSE, source)
|
||||
message = hear_intercept(message, speaker, message_language, raw_message, radio_freq, spans, message_mode, FALSE, source)
|
||||
|
||||
show_message(message, MSG_AUDIBLE, deaf_message, deaf_type)
|
||||
return message
|
||||
@@ -262,8 +262,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
var/list/listening = get_hearers_in_view(message_range+eavesdrop_range, source)
|
||||
var/list/the_dead = list()
|
||||
var/list/yellareas //CIT CHANGE - adds the ability for yelling to penetrate walls and echo throughout areas
|
||||
if(say_test(message) == "2") //CIT CHANGE - ditto
|
||||
yellareas = get_areas_in_range(message_range*0.5,src) //CIT CHANGE - ditto
|
||||
if(!eavesdrop_range && say_test(message) == "2") //CIT CHANGE - ditto
|
||||
yellareas = get_areas_in_range(message_range*0.5, source) //CIT CHANGE - ditto
|
||||
for(var/_M in GLOB.player_list)
|
||||
var/mob/M = _M
|
||||
if(M.stat != DEAD) //not dead, not important
|
||||
@@ -274,7 +274,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
continue
|
||||
if(!M.client || !client) //client is so that ghosts don't have to listen to mice
|
||||
continue
|
||||
if(get_dist(M, src) > 7 || M.z != z) //they're out of range of normal hearing
|
||||
if(get_dist(M, source) > 7 || M.z != z) //they're out of range of normal hearing
|
||||
if(eavesdropping_modes[message_mode] && !(M.client.prefs.chat_toggles & CHAT_GHOSTWHISPER)) //they're whispering and we have hearing whispers at any range off
|
||||
continue
|
||||
if(!(M.client.prefs.chat_toggles & CHAT_GHOSTEARS)) //they're talking normally and we have hearing at any range off
|
||||
@@ -286,15 +286,15 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
var/eavesrendered
|
||||
if(eavesdrop_range)
|
||||
eavesdropping = stars(message)
|
||||
eavesrendered = compose_message(src, message_language, eavesdropping, , spans, message_mode)
|
||||
eavesrendered = compose_message(src, message_language, eavesdropping, null, spans, message_mode, FALSE, source)
|
||||
|
||||
var/rendered = compose_message(src, message_language, message, , spans, message_mode)
|
||||
var/rendered = compose_message(src, message_language, message, null, spans, message_mode, FALSE, source)
|
||||
for(var/_AM in listening)
|
||||
var/atom/movable/AM = _AM
|
||||
if(eavesdrop_range && get_dist(source, AM) > message_range && !(the_dead[AM]))
|
||||
AM.Hear(eavesrendered, src, message_language, eavesdropping, , spans, message_mode)
|
||||
AM.Hear(eavesrendered, src, message_language, eavesdropping, null, spans, message_mode, source)
|
||||
else
|
||||
AM.Hear(rendered, src, message_language, message, , spans, message_mode)
|
||||
AM.Hear(rendered, src, message_language, message, null, spans, message_mode, source)
|
||||
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_LIVING_SAY_SPECIAL, src, message)
|
||||
|
||||
//speech bubble
|
||||
|
||||
@@ -1,197 +1,197 @@
|
||||
// AI EYE
|
||||
//
|
||||
// An invisible (no icon) mob that the AI controls to look around the station with.
|
||||
// It streams chunks as it moves around, which will show it what the AI can and cannot see.
|
||||
|
||||
/mob/camera/aiEye
|
||||
name = "Inactive AI Eye"
|
||||
|
||||
invisibility = INVISIBILITY_MAXIMUM
|
||||
hud_possible = list(ANTAG_HUD, AI_DETECT_HUD = HUD_LIST_LIST)
|
||||
var/list/visibleCameraChunks = list()
|
||||
var/mob/living/silicon/ai/ai = null
|
||||
var/relay_speech = FALSE
|
||||
var/use_static = USE_STATIC_OPAQUE
|
||||
var/static_visibility_range = 16
|
||||
var/ai_detector_visible = TRUE
|
||||
var/ai_detector_color = COLOR_RED
|
||||
|
||||
/mob/camera/aiEye/Initialize()
|
||||
. = ..()
|
||||
GLOB.aiEyes += src
|
||||
update_ai_detect_hud()
|
||||
setLoc(loc, TRUE)
|
||||
|
||||
/mob/camera/aiEye/proc/update_ai_detect_hud()
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
var/list/old_images = hud_list[AI_DETECT_HUD]
|
||||
if(!ai_detector_visible)
|
||||
hud.remove_from_hud(src)
|
||||
QDEL_LIST(old_images)
|
||||
return
|
||||
|
||||
if(!hud.hudusers.len)
|
||||
//no one is watching, do not bother updating anything
|
||||
return
|
||||
hud.remove_from_hud(src)
|
||||
|
||||
var/static/list/vis_contents_objects = list()
|
||||
var/obj/effect/overlay/ai_detect_hud/hud_obj = vis_contents_objects[ai_detector_color]
|
||||
if(!hud_obj)
|
||||
hud_obj = new /obj/effect/overlay/ai_detect_hud()
|
||||
hud_obj.color = ai_detector_color
|
||||
vis_contents_objects[ai_detector_color] = hud_obj
|
||||
|
||||
var/list/new_images = list()
|
||||
var/list/turfs = get_visible_turfs()
|
||||
for(var/T in turfs)
|
||||
var/image/I = (old_images.len > new_images.len) ? old_images[new_images.len + 1] : image(null, T)
|
||||
I.loc = T
|
||||
I.vis_contents += hud_obj
|
||||
new_images += I
|
||||
for(var/i in (new_images.len + 1) to old_images.len)
|
||||
qdel(old_images[i])
|
||||
hud_list[AI_DETECT_HUD] = new_images
|
||||
hud.add_to_hud(src)
|
||||
|
||||
/mob/camera/aiEye/proc/get_visible_turfs()
|
||||
if(!isturf(loc))
|
||||
return list()
|
||||
var/client/C = GetViewerClient()
|
||||
var/view = C ? getviewsize(C.view) : getviewsize(world.view)
|
||||
var/turf/lowerleft = locate(max(1, x - (view[1] - 1)/2), max(1, y - (view[2] - 1)/2), z)
|
||||
var/turf/upperright = locate(min(world.maxx, lowerleft.x + (view[1] - 1)), min(world.maxy, lowerleft.y + (view[2] - 1)), lowerleft.z)
|
||||
return block(lowerleft, upperright)
|
||||
|
||||
// Use this when setting the aiEye's location.
|
||||
// It will also stream the chunk that the new loc is in.
|
||||
|
||||
/mob/camera/aiEye/proc/setLoc(T, force_update = FALSE)
|
||||
if(ai)
|
||||
if(!isturf(ai.loc))
|
||||
return
|
||||
T = get_turf(T)
|
||||
if(!force_update && (T == get_turf(src)) )
|
||||
return //we are already here!
|
||||
if (T)
|
||||
forceMove(T)
|
||||
else
|
||||
moveToNullspace()
|
||||
if(use_static != USE_STATIC_NONE)
|
||||
ai.camera_visibility(src)
|
||||
if(ai.client && !ai.multicam_on)
|
||||
ai.client.eye = src
|
||||
update_ai_detect_hud()
|
||||
update_parallax_contents()
|
||||
//Holopad
|
||||
if(istype(ai.current, /obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = ai.current
|
||||
H.move_hologram(ai, T)
|
||||
if(ai.camera_light_on)
|
||||
ai.light_cameras()
|
||||
if(ai.master_multicam)
|
||||
ai.master_multicam.refresh_view()
|
||||
|
||||
/mob/camera/aiEye/Move()
|
||||
return 0
|
||||
|
||||
/mob/camera/aiEye/proc/GetViewerClient()
|
||||
if(ai)
|
||||
return ai.client
|
||||
return null
|
||||
|
||||
/mob/camera/aiEye/Destroy()
|
||||
if(ai)
|
||||
ai.all_eyes -= src
|
||||
ai = null
|
||||
for(var/V in visibleCameraChunks)
|
||||
var/datum/camerachunk/c = V
|
||||
c.remove(src)
|
||||
GLOB.aiEyes -= src
|
||||
if(ai_detector_visible)
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
hud.remove_from_hud(src)
|
||||
var/list/L = hud_list[AI_DETECT_HUD]
|
||||
QDEL_LIST(L)
|
||||
return ..()
|
||||
|
||||
/atom/proc/move_camera_by_click()
|
||||
if(isAI(usr))
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
if(AI.eyeobj && (AI.multicam_on || (AI.client.eye == AI.eyeobj)) && (AI.eyeobj.z == z))
|
||||
AI.cameraFollow = null
|
||||
if (isturf(loc) || isturf(src))
|
||||
AI.eyeobj.setLoc(src)
|
||||
|
||||
// This will move the AIEye. It will also cause lights near the eye to light up, if toggled.
|
||||
// This is handled in the proc below this one.
|
||||
|
||||
/client/proc/AIMove(n, direct, mob/living/silicon/ai/user)
|
||||
|
||||
var/initial = initial(user.sprint)
|
||||
var/max_sprint = 50
|
||||
|
||||
if(user.cooldown && user.cooldown < world.timeofday) // 3 seconds
|
||||
user.sprint = initial
|
||||
|
||||
for(var/i = 0; i < max(user.sprint, initial); i += 20)
|
||||
var/turf/step = get_turf(get_step(user.eyeobj, direct))
|
||||
if(step)
|
||||
user.eyeobj.setLoc(step)
|
||||
|
||||
user.cooldown = world.timeofday + 5
|
||||
if(user.acceleration)
|
||||
user.sprint = min(user.sprint + 0.5, max_sprint)
|
||||
else
|
||||
user.sprint = initial
|
||||
|
||||
if(!user.tracking)
|
||||
user.cameraFollow = null
|
||||
|
||||
// Return to the Core.
|
||||
/mob/living/silicon/ai/proc/view_core()
|
||||
if(istype(current,/obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = current
|
||||
H.clear_holo(src)
|
||||
else
|
||||
current = null
|
||||
cameraFollow = null
|
||||
unset_machine()
|
||||
|
||||
if(!eyeobj || !eyeobj.loc || QDELETED(eyeobj))
|
||||
to_chat(src, "ERROR: Eyeobj not found. Creating new eye...")
|
||||
create_eye()
|
||||
|
||||
eyeobj.setLoc(loc)
|
||||
|
||||
/mob/living/silicon/ai/proc/create_eye()
|
||||
if(eyeobj)
|
||||
return
|
||||
eyeobj = new /mob/camera/aiEye()
|
||||
all_eyes += eyeobj
|
||||
eyeobj.ai = src
|
||||
eyeobj.setLoc(loc)
|
||||
eyeobj.name = "[name] (AI Eye)"
|
||||
|
||||
/mob/living/silicon/ai/verb/toggle_acceleration()
|
||||
set category = "AI Commands"
|
||||
set name = "Toggle Camera Acceleration"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
acceleration = !acceleration
|
||||
to_chat(usr, "Camera acceleration has been toggled [acceleration ? "on" : "off"].")
|
||||
|
||||
/mob/camera/aiEye/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
if(relay_speech && speaker && ai && !radio_freq && speaker != ai && near_camera(speaker))
|
||||
ai.relay_speech(message, speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
|
||||
/obj/effect/overlay/ai_detect_hud
|
||||
name = ""
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
icon = 'icons/effects/alphacolors.dmi'
|
||||
icon_state = ""
|
||||
alpha = 100
|
||||
layer = ABOVE_ALL_MOB_LAYER
|
||||
plane = GAME_PLANE
|
||||
// AI EYE
|
||||
//
|
||||
// An invisible (no icon) mob that the AI controls to look around the station with.
|
||||
// It streams chunks as it moves around, which will show it what the AI can and cannot see.
|
||||
|
||||
/mob/camera/aiEye
|
||||
name = "Inactive AI Eye"
|
||||
|
||||
invisibility = INVISIBILITY_MAXIMUM
|
||||
hud_possible = list(ANTAG_HUD, AI_DETECT_HUD = HUD_LIST_LIST)
|
||||
var/list/visibleCameraChunks = list()
|
||||
var/mob/living/silicon/ai/ai = null
|
||||
var/relay_speech = FALSE
|
||||
var/use_static = USE_STATIC_OPAQUE
|
||||
var/static_visibility_range = 16
|
||||
var/ai_detector_visible = TRUE
|
||||
var/ai_detector_color = COLOR_RED
|
||||
|
||||
/mob/camera/aiEye/Initialize()
|
||||
. = ..()
|
||||
GLOB.aiEyes += src
|
||||
update_ai_detect_hud()
|
||||
setLoc(loc, TRUE)
|
||||
|
||||
/mob/camera/aiEye/proc/update_ai_detect_hud()
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
var/list/old_images = hud_list[AI_DETECT_HUD]
|
||||
if(!ai_detector_visible)
|
||||
hud.remove_from_hud(src)
|
||||
QDEL_LIST(old_images)
|
||||
return
|
||||
|
||||
if(!hud.hudusers.len)
|
||||
//no one is watching, do not bother updating anything
|
||||
return
|
||||
hud.remove_from_hud(src)
|
||||
|
||||
var/static/list/vis_contents_objects = list()
|
||||
var/obj/effect/overlay/ai_detect_hud/hud_obj = vis_contents_objects[ai_detector_color]
|
||||
if(!hud_obj)
|
||||
hud_obj = new /obj/effect/overlay/ai_detect_hud()
|
||||
hud_obj.color = ai_detector_color
|
||||
vis_contents_objects[ai_detector_color] = hud_obj
|
||||
|
||||
var/list/new_images = list()
|
||||
var/list/turfs = get_visible_turfs()
|
||||
for(var/T in turfs)
|
||||
var/image/I = (old_images.len > new_images.len) ? old_images[new_images.len + 1] : image(null, T)
|
||||
I.loc = T
|
||||
I.vis_contents += hud_obj
|
||||
new_images += I
|
||||
for(var/i in (new_images.len + 1) to old_images.len)
|
||||
qdel(old_images[i])
|
||||
hud_list[AI_DETECT_HUD] = new_images
|
||||
hud.add_to_hud(src)
|
||||
|
||||
/mob/camera/aiEye/proc/get_visible_turfs()
|
||||
if(!isturf(loc))
|
||||
return list()
|
||||
var/client/C = GetViewerClient()
|
||||
var/view = C ? getviewsize(C.view) : getviewsize(world.view)
|
||||
var/turf/lowerleft = locate(max(1, x - (view[1] - 1)/2), max(1, y - (view[2] - 1)/2), z)
|
||||
var/turf/upperright = locate(min(world.maxx, lowerleft.x + (view[1] - 1)), min(world.maxy, lowerleft.y + (view[2] - 1)), lowerleft.z)
|
||||
return block(lowerleft, upperright)
|
||||
|
||||
// Use this when setting the aiEye's location.
|
||||
// It will also stream the chunk that the new loc is in.
|
||||
|
||||
/mob/camera/aiEye/proc/setLoc(T, force_update = FALSE)
|
||||
if(ai)
|
||||
if(!isturf(ai.loc))
|
||||
return
|
||||
T = get_turf(T)
|
||||
if(!force_update && (T == get_turf(src)) )
|
||||
return //we are already here!
|
||||
if (T)
|
||||
forceMove(T)
|
||||
else
|
||||
moveToNullspace()
|
||||
if(use_static != USE_STATIC_NONE)
|
||||
ai.camera_visibility(src)
|
||||
if(ai.client && !ai.multicam_on)
|
||||
ai.client.eye = src
|
||||
update_ai_detect_hud()
|
||||
update_parallax_contents()
|
||||
//Holopad
|
||||
if(istype(ai.current, /obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = ai.current
|
||||
H.move_hologram(ai, T)
|
||||
if(ai.camera_light_on)
|
||||
ai.light_cameras()
|
||||
if(ai.master_multicam)
|
||||
ai.master_multicam.refresh_view()
|
||||
|
||||
/mob/camera/aiEye/Move()
|
||||
return 0
|
||||
|
||||
/mob/camera/aiEye/proc/GetViewerClient()
|
||||
if(ai)
|
||||
return ai.client
|
||||
return null
|
||||
|
||||
/mob/camera/aiEye/Destroy()
|
||||
if(ai)
|
||||
ai.all_eyes -= src
|
||||
ai = null
|
||||
for(var/V in visibleCameraChunks)
|
||||
var/datum/camerachunk/c = V
|
||||
c.remove(src)
|
||||
GLOB.aiEyes -= src
|
||||
if(ai_detector_visible)
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
hud.remove_from_hud(src)
|
||||
var/list/L = hud_list[AI_DETECT_HUD]
|
||||
QDEL_LIST(L)
|
||||
return ..()
|
||||
|
||||
/atom/proc/move_camera_by_click()
|
||||
if(isAI(usr))
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
if(AI.eyeobj && (AI.multicam_on || (AI.client.eye == AI.eyeobj)) && (AI.eyeobj.z == z))
|
||||
AI.cameraFollow = null
|
||||
if (isturf(loc) || isturf(src))
|
||||
AI.eyeobj.setLoc(src)
|
||||
|
||||
// This will move the AIEye. It will also cause lights near the eye to light up, if toggled.
|
||||
// This is handled in the proc below this one.
|
||||
|
||||
/client/proc/AIMove(n, direct, mob/living/silicon/ai/user)
|
||||
|
||||
var/initial = initial(user.sprint)
|
||||
var/max_sprint = 50
|
||||
|
||||
if(user.cooldown && user.cooldown < world.timeofday) // 3 seconds
|
||||
user.sprint = initial
|
||||
|
||||
for(var/i = 0; i < max(user.sprint, initial); i += 20)
|
||||
var/turf/step = get_turf(get_step(user.eyeobj, direct))
|
||||
if(step)
|
||||
user.eyeobj.setLoc(step)
|
||||
|
||||
user.cooldown = world.timeofday + 5
|
||||
if(user.acceleration)
|
||||
user.sprint = min(user.sprint + 0.5, max_sprint)
|
||||
else
|
||||
user.sprint = initial
|
||||
|
||||
if(!user.tracking)
|
||||
user.cameraFollow = null
|
||||
|
||||
// Return to the Core.
|
||||
/mob/living/silicon/ai/proc/view_core()
|
||||
if(istype(current,/obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = current
|
||||
H.clear_holo(src)
|
||||
else
|
||||
current = null
|
||||
cameraFollow = null
|
||||
unset_machine()
|
||||
|
||||
if(!eyeobj || !eyeobj.loc || QDELETED(eyeobj))
|
||||
to_chat(src, "ERROR: Eyeobj not found. Creating new eye...")
|
||||
create_eye()
|
||||
|
||||
eyeobj.setLoc(loc)
|
||||
|
||||
/mob/living/silicon/ai/proc/create_eye()
|
||||
if(eyeobj)
|
||||
return
|
||||
eyeobj = new /mob/camera/aiEye()
|
||||
all_eyes += eyeobj
|
||||
eyeobj.ai = src
|
||||
eyeobj.setLoc(loc)
|
||||
eyeobj.name = "[name] (AI Eye)"
|
||||
|
||||
/mob/living/silicon/ai/verb/toggle_acceleration()
|
||||
set category = "AI Commands"
|
||||
set name = "Toggle Camera Acceleration"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
acceleration = !acceleration
|
||||
to_chat(usr, "Camera acceleration has been toggled [acceleration ? "on" : "off"].")
|
||||
|
||||
/mob/camera/aiEye/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(relay_speech && speaker && ai && !radio_freq && speaker != ai && near_camera(speaker))
|
||||
ai.relay_speech(message, speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
|
||||
/obj/effect/overlay/ai_detect_hud
|
||||
name = ""
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
icon = 'icons/effects/alphacolors.dmi'
|
||||
icon_state = ""
|
||||
alpha = 100
|
||||
layer = ABOVE_ALL_MOB_LAYER
|
||||
plane = GAME_PLANE
|
||||
|
||||
@@ -378,7 +378,7 @@ Difficulty: Very Hard
|
||||
. += observer_desc
|
||||
. += "It is activated by [activation_method]."
|
||||
|
||||
/obj/machinery/anomalous_crystal/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode)
|
||||
/obj/machinery/anomalous_crystal/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode, atom/movable/source)
|
||||
..()
|
||||
if(isliving(speaker))
|
||||
ActivationReaction(speaker, ACTIVATE_SPEECH)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/mob/living/simple_animal/slime/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode)
|
||||
/mob/living/simple_animal/slime/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(speaker != src && !radio_freq && !stat)
|
||||
if (speaker in Friends)
|
||||
|
||||
Reference in New Issue
Block a user