mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
# Conflicts: # .github/CODEOWNERS # .github/workflows/compile_changelogs.yml # .github/workflows/stale.yml # SQL/database_changelog.md # _maps/map_files/CatwalkStation/CatwalkStation_2023.dmm # code/__DEFINES/atom_hud.dm # code/__DEFINES/inventory.dm # code/__DEFINES/mobs.dm # code/__DEFINES/species_clothing_paths.dm # code/__DEFINES/subsystems.dm # code/__DEFINES/surgery.dm # code/__HELPERS/global_lists.dm # code/_globalvars/lists/maintenance_loot.dm # code/_globalvars/traits/_traits.dm # code/controllers/subsystem/minor_mapping.dm # code/controllers/subsystem/processing/quirks.dm # code/controllers/subsystem/shuttle.dm # code/datums/components/palette.dm # code/datums/components/surgery_initiator.dm # code/datums/diseases/advance/advance.dm # code/datums/hud.dm # code/datums/mood.dm # code/datums/mutations/chameleon.dm # code/datums/quirks/negative_quirks/nyctophobia.dm # code/datums/status_effects/debuffs/debuffs.dm # code/datums/status_effects/debuffs/drunk.dm # code/datums/status_effects/debuffs/slime/slime_leech.dm # code/datums/weather/weather.dm # code/game/data_huds.dm # code/game/objects/items.dm # code/game/objects/items/devices/scanners/health_analyzer.dm # code/game/objects/items/frog_statue.dm # code/game/objects/items/rcd/RLD.dm # code/game/objects/items/robot/items/hypo.dm # code/game/objects/items/stacks/medical.dm # code/game/objects/items/stacks/wrap.dm # code/game/objects/items/storage/garment.dm # code/game/objects/items/tools/medical/defib.dm # code/game/objects/items/weaponry.dm # code/game/objects/items/weaponry/melee/misc.dm # code/game/objects/structures/crates_lockers/closets/secure/security.dm # code/game/objects/structures/curtains.dm # code/game/objects/structures/dresser.dm # code/game/objects/structures/girders.dm # code/game/objects/structures/maintenance.dm # code/game/objects/structures/mirror.dm # code/modules/admin/greyscale_modify_menu.dm # code/modules/admin/verbs/light_debug.dm # code/modules/antagonists/ashwalker/ashwalker.dm # code/modules/antagonists/heretic/knowledge/starting_lore.dm # code/modules/antagonists/ninja/ninjaDrainAct.dm # code/modules/art/paintings.dm # code/modules/client/preferences.dm # code/modules/client/verbs/ooc.dm # code/modules/clothing/head/wig.dm # code/modules/events/disease_outbreak.dm # code/modules/holodeck/holo_effect.dm # code/modules/jobs/job_types/head_of_security.dm # code/modules/jobs/job_types/security_officer.dm # code/modules/library/skill_learning/generic_skillchips/point.dm # code/modules/mining/lavaland/ash_flora.dm # code/modules/mining/lavaland/mining_loot/megafauna/ash_drake.dm # code/modules/mob/dead/new_player/new_player.dm # code/modules/mob/living/basic/guardian/guardian.dm # code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm # code/modules/mob/living/carbon/carbon.dm # code/modules/mob/living/carbon/human/human.dm # code/modules/mob/living/carbon/human/human_defines.dm # code/modules/mob/living/carbon/life.dm # code/modules/mob/living/living.dm # code/modules/mob/living/living_defines.dm # code/modules/mob/mob.dm # code/modules/mob_spawn/ghost_roles/mining_roles.dm # code/modules/mod/mod_control.dm # code/modules/mod/modules/modules_general.dm # code/modules/modular_computers/computers/item/computer_ui.dm # code/modules/paperwork/paper.dm # code/modules/paperwork/paperbin.dm # code/modules/power/lighting/light.dm # code/modules/projectiles/guns/energy/kinetic_accelerator.dm # code/modules/projectiles/projectile.dm # code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm # code/modules/reagents/chemistry/reagents/food_reagents.dm # code/modules/reagents/chemistry/reagents/other_reagents.dm # code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm # code/modules/research/xenobiology/crossbreeding/_clothing.dm # code/modules/research/xenobiology/crossbreeding/prismatic.dm # code/modules/surgery/advanced/brainwashing.dm # code/modules/surgery/advanced/lobotomy.dm # code/modules/surgery/amputation.dm # code/modules/surgery/blood_filter.dm # code/modules/surgery/bodyparts/_bodyparts.dm # code/modules/surgery/brain_surgery.dm # code/modules/surgery/cavity_implant.dm # code/modules/surgery/coronary_bypass.dm # code/modules/surgery/gastrectomy.dm # code/modules/surgery/healing.dm # code/modules/surgery/limb_augmentation.dm # code/modules/surgery/organ_manipulation.dm # code/modules/surgery/revival.dm # code/modules/surgery/sleeper_protocol.dm # code/modules/surgery/surgery_helpers.dm # code/modules/surgery/surgery_step.dm # code/modules/unit_tests/_unit_tests.dm # code/modules/unit_tests/designs.dm # code/modules/unit_tests/icon_state_worn.dm # code/modules/unit_tests/screenshots/screenshot_antag_icons_cultist.png # code/modules/unit_tests/screenshots/screenshot_antag_icons_headrevolutionary.png # code/modules/unit_tests/screenshots/screenshot_antag_icons_provocateur.png # code/modules/unit_tests/screenshots/screenshot_husk_body.png # code/modules/unit_tests/screenshots/screenshot_husk_body_missing_limbs.png # icons/map_icons/clothing/head/_head.dmi # icons/map_icons/clothing/shoes.dmi # icons/map_icons/items/_item.dmi # icons/mob/huds/hud.dmi # icons/mob/inhands/64x64_lefthand.dmi # icons/mob/inhands/64x64_righthand.dmi # icons/obj/machines/computer.dmi # tgui/packages/tgui/interfaces/OperatingComputer.jsx # tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferences/MainPage.tsx # tgui/packages/tgui/interfaces/PreferencesMenu/types.ts # tgui/packages/tgui/interfaces/SurgeryInitiator.tsx # tools/icon_cutter/check.py
252 lines
9.6 KiB
Plaintext
252 lines
9.6 KiB
Plaintext
//Speech verbs.
|
|
|
|
///what clients use to speak. when you type a message into the chat bar in say mode, this is the first thing that goes off serverside.
|
|
/mob/verb/say_verb(message as text)
|
|
set name = "Say"
|
|
set category = "IC"
|
|
set instant = TRUE
|
|
|
|
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
|
to_chat(usr, span_danger("Speech is currently admin-disabled."))
|
|
return
|
|
|
|
//queue this message because verbs are scheduled to process after SendMaps in the tick and speech is pretty expensive when it happens.
|
|
//by queuing this for next tick the mc can compensate for its cost instead of having speech delay the start of the next tick
|
|
if(message)
|
|
QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_PROC_REF(/atom/movable, say), message), SSspeech_controller)
|
|
|
|
///Whisper verb
|
|
/mob/verb/whisper_verb(message as text)
|
|
set name = "Whisper"
|
|
set category = "IC"
|
|
set instant = TRUE
|
|
|
|
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
|
to_chat(usr, span_danger("Speech is currently admin-disabled."))
|
|
return
|
|
|
|
if(message)
|
|
QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_PROC_REF(/mob, whisper), message), SSspeech_controller)
|
|
|
|
/**
|
|
* Whisper a message.
|
|
*
|
|
* Basic level implementation just speaks the message, nothing else.
|
|
*/
|
|
/mob/proc/whisper(message, bubble_type, list/spans = list(), sanitize = TRUE, datum/language/language, ignore_spam = FALSE, forced, filterproof)
|
|
if(!message)
|
|
return
|
|
say(message, language = language)
|
|
|
|
///The me emote verb
|
|
/mob/verb/me_verb(message as text)
|
|
set name = "Me"
|
|
set category = "IC"
|
|
set desc = "Perform a custom emote. Leave blank to pick between an audible or a visible emote (Defaults to visible)."
|
|
|
|
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
|
to_chat(usr, span_danger("Speech is currently admin-disabled."))
|
|
return
|
|
|
|
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
|
|
|
|
QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_PROC_REF(/mob, emote), "me", NONE, message, TRUE), SSspeech_controller)
|
|
|
|
/mob/try_speak(message, ignore_spam = FALSE, forced = null, filterproof = FALSE)
|
|
var/list/filter_result
|
|
var/list/soft_filter_result
|
|
if(client && !forced && !filterproof)
|
|
//The filter doesn't act on the sanitized message, but the raw message.
|
|
filter_result = CAN_BYPASS_FILTER(src) ? null : is_ic_filtered(message)
|
|
if(!filter_result)
|
|
soft_filter_result = CAN_BYPASS_FILTER(src) ? null : is_soft_ic_filtered(message)
|
|
|
|
if(filter_result && !filterproof)
|
|
//The filter warning message shows the sanitized message though.
|
|
to_chat(src, span_warning("That message contained a word prohibited in IC chat! Consider reviewing the server rules."))
|
|
to_chat(src, span_warning("\"[message]\""))
|
|
REPORT_CHAT_FILTER_TO_USER(src, filter_result)
|
|
log_filter("IC", message, filter_result)
|
|
SSblackbox.record_feedback("tally", "ic_blocked_words", 1, LOWER_TEXT(config.ic_filter_regex.match))
|
|
return FALSE
|
|
|
|
if(soft_filter_result && !filterproof)
|
|
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to say it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
|
|
SSblackbox.record_feedback("tally", "soft_ic_blocked_words", 1, LOWER_TEXT(config.soft_ic_filter_regex.match))
|
|
log_filter("Soft IC", message, filter_result)
|
|
return FALSE
|
|
message_admins("[ADMIN_LOOKUPFLW(usr)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term. Message: \"[html_encode(message)]\"")
|
|
log_admin_private("[key_name(usr)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term. Message: \"[message]\"")
|
|
SSblackbox.record_feedback("tally", "passed_soft_ic_blocked_words", 1, LOWER_TEXT(config.soft_ic_filter_regex.match))
|
|
log_filter("Soft IC (Passed)", message, filter_result)
|
|
|
|
if(client && !(ignore_spam || forced))
|
|
if(client.prefs.muted & MUTE_IC)
|
|
to_chat(src, span_danger("You cannot speak IC (muted)."))
|
|
return FALSE
|
|
if(client.handle_spam_prevention(message, MUTE_IC))
|
|
return FALSE
|
|
|
|
var/sigreturn = SEND_SIGNAL(src, COMSIG_MOB_TRY_SPEECH, message, ignore_spam, forced)
|
|
if(sigreturn & COMPONENT_IGNORE_CAN_SPEAK)
|
|
return TRUE
|
|
if(sigreturn & COMPONENT_CANNOT_SPEAK)
|
|
return FALSE
|
|
|
|
if(!..()) // the can_speak check
|
|
if(HAS_MIND_TRAIT(src, TRAIT_MIMING))
|
|
to_chat(src, span_green("Your vow of silence prevents you from speaking!"))
|
|
else
|
|
to_chat(src, span_warning("You find yourself unable to speak!"))
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/mob/can_speak(allow_mimes = FALSE)
|
|
if(!allow_mimes && HAS_MIND_TRAIT(src, TRAIT_MIMING))
|
|
return FALSE
|
|
|
|
return ..()
|
|
|
|
/**
|
|
* say_dead
|
|
* allows you to speak as a dead person
|
|
* Args:
|
|
* - message: The message you're sending to chat.
|
|
* - mannequin_controller: If someone else is forcing you to speak, this is the mob doing it.
|
|
*/
|
|
/mob/proc/say_dead(message, mob/mannequin_controller)
|
|
var/name = real_name
|
|
var/alt_name = ""
|
|
|
|
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
|
to_chat(usr, span_danger("Speech is currently admin-disabled."))
|
|
return
|
|
|
|
//SKYRAT EDIT ADDITION
|
|
if(!GLOB.dchat_allowed && !check_rights(R_ADMIN, FALSE))
|
|
to_chat(src, "<span class='danger'>Dead chat is currently muted.</span>")
|
|
return
|
|
//SKYRAT EDIT END
|
|
|
|
var/jb = is_banned_from(mannequin_controller?.ckey || ckey, "Deadchat")
|
|
if(QDELETED(src))
|
|
return
|
|
|
|
if(jb)
|
|
to_chat(src, span_danger("You have been banned from deadchat."))
|
|
return
|
|
|
|
if (src.client)
|
|
if(src.client.prefs.muted & MUTE_DEADCHAT)
|
|
to_chat(src, span_danger("You cannot talk in deadchat (muted)."))
|
|
return
|
|
|
|
if(SSlag_switch.measures[SLOWMODE_SAY] && !HAS_TRAIT(src, TRAIT_BYPASS_MEASURES) && src == usr)
|
|
if(!COOLDOWN_FINISHED(client, say_slowmode))
|
|
to_chat(src, span_warning("Message not sent due to slowmode. Please wait [SSlag_switch.slowmode_cooldown/10] seconds between messages.\n\"[message]\""))
|
|
return
|
|
COOLDOWN_START(client, say_slowmode, SSlag_switch.slowmode_cooldown)
|
|
|
|
if(src.client.handle_spam_prevention(message,MUTE_DEADCHAT))
|
|
return
|
|
|
|
var/mob/dead/observer/O = src
|
|
if(isobserver(src) && O.deadchat_name)
|
|
name = "[O.deadchat_name]"
|
|
else
|
|
if(mind?.name)
|
|
name = "[mind.name]"
|
|
else
|
|
name = real_name
|
|
if(name != real_name)
|
|
alt_name = " (died as [real_name])"
|
|
|
|
var/spanned = generate_messagepart(message)
|
|
var/source = "<span class='game'><span class='prefix'>DEAD:</span> <span class='name'>[name]</span>[alt_name]"
|
|
var/rendered = " <span class='message'>[emoji_parse(spanned)]</span></span>"
|
|
log_talk(message, LOG_SAY, tag="DEAD")
|
|
if(SEND_SIGNAL(src, COMSIG_MOB_DEADSAY, message) & MOB_DEADSAY_SIGNAL_INTERCEPT)
|
|
return
|
|
var/displayed_key = key
|
|
if(client?.holder?.fakekey)
|
|
displayed_key = null
|
|
deadchat_broadcast(rendered, source, follow_target = src, speaker_key = displayed_key)
|
|
|
|
///Check if this message is an emote
|
|
/mob/proc/check_emote(message, forced)
|
|
if(message[1] == "*")
|
|
emote(copytext(message, length(message[1]) + 1), intentional = !forced)
|
|
return TRUE
|
|
|
|
///Check if the mob has a hivemind channel
|
|
/mob/proc/hivecheck()
|
|
return FALSE
|
|
|
|
///The amount of items we are looking for in the message
|
|
#define MESSAGE_MODS_LENGTH 6
|
|
|
|
/mob/proc/check_for_custom_say_emote(message, list/mods)
|
|
var/customsaypos = findtext(message, "*")
|
|
if(!customsaypos)
|
|
return message
|
|
if (!isnull(ckey) && is_banned_from(ckey, "Emote"))
|
|
return copytext(message, customsaypos + 1)
|
|
mods[MODE_CUSTOM_SAY_EMOTE] = copytext(message, 1, customsaypos)
|
|
message = copytext(message, customsaypos + 1)
|
|
if (!message)
|
|
mods[MODE_CUSTOM_SAY_ERASE_INPUT] = TRUE
|
|
message = "an interesting thing to say"
|
|
return message
|
|
/**
|
|
* Extracts and cleans message of any extenstions at the begining of the message
|
|
* Inserts the info into the passed list, returns the cleaned message
|
|
*
|
|
* Result can be
|
|
* * SAY_MODE (Things like aliens, channels that aren't channels)
|
|
* * MODE_WHISPER (Quiet speech)
|
|
* * MODE_SING (Singing)
|
|
* * MODE_HEADSET (Common radio channel)
|
|
* * RADIO_EXTENSION the extension we're using (lots of values here)
|
|
* * RADIO_KEY the radio key we're using, to make some things easier later (lots of values here)
|
|
* * LANGUAGE_EXTENSION the language we're trying to use (lots of values here)
|
|
*/
|
|
/mob/proc/get_message_mods(message, list/mods)
|
|
for(var/I in 1 to MESSAGE_MODS_LENGTH)
|
|
// Prevents "...text" from being read as a radio message
|
|
if (length(message) > 1 && message[2] == message[1])
|
|
continue
|
|
|
|
var/key = message[1]
|
|
var/chop_to = 2 //By default we just take off the first char
|
|
if(key == "#" && !mods[WHISPER_MODE])
|
|
mods[WHISPER_MODE] = MODE_WHISPER
|
|
else if(key == "%" && !mods[MODE_SING])
|
|
mods[MODE_SING] = TRUE
|
|
else if(key == ";" && !mods[MODE_HEADSET])
|
|
if(stat == CONSCIOUS) //necessary indentation so it gets stripped of the semicolon anyway.
|
|
mods[MODE_HEADSET] = TRUE
|
|
else if((key in GLOB.department_radio_prefixes) && length(message) > length(key) + 1 && !mods[RADIO_EXTENSION])
|
|
mods[RADIO_KEY] = LOWER_TEXT(message[1 + length(key)])
|
|
mods[RADIO_EXTENSION] = GLOB.department_radio_keys[mods[RADIO_KEY]]
|
|
chop_to = length(key) + 2
|
|
else if(key == "," && !mods[LANGUAGE_EXTENSION])
|
|
for(var/ld in GLOB.all_languages)
|
|
var/datum/language/LD = ld
|
|
if(initial(LD.key) == message[1 + length(message[1])])
|
|
// No, you cannot speak in xenocommon just because you know the key
|
|
if(!can_speak_language(LD))
|
|
return message
|
|
mods[LANGUAGE_EXTENSION] = LD
|
|
chop_to = length(key) + length(initial(LD.key)) + 1
|
|
if(!mods[LANGUAGE_EXTENSION])
|
|
return message
|
|
else
|
|
return message
|
|
message = trim_left(copytext_char(message, chop_to))
|
|
if(!message)
|
|
return
|
|
return message
|
|
|
|
#undef MESSAGE_MODS_LENGTH
|