From 2a720ce0548c3e1713688897a660b4e660e1826a Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 03:59:17 -0400 Subject: [PATCH] vocal barks - Fully customizable noises for talking! --- code/__DEFINES/DNA.dm | 6 +- code/__DEFINES/preferences.dm | 3 +- code/__HELPERS/global_lists.dm | 4 + code/_globalvars/lists/flavor_misc.dm | 3 + code/datums/bark.dm | 98 +++++++++++++++++++ code/datums/dna.dm | 30 ++++-- code/game/atoms_movable.dm | 19 ++++ code/game/machinery/_machinery.dm | 3 + code/game/say.dm | 23 ++++- code/modules/client/preferences.dm | 82 +++++++++++++++- code/modules/client/preferences_savefile.dm | 20 +++- code/modules/client/preferences_toggles.dm | 11 +++ code/modules/mob/living/say.dm | 21 +++- .../mob/living/simple_animal/friendly/dog.dm | 7 ++ .../mob/living/simple_animal/friendly/fox.dm | 5 + tgstation.dme | 1 + 16 files changed, 320 insertions(+), 16 deletions(-) create mode 100644 code/datums/bark.dm diff --git a/code/__DEFINES/DNA.dm b/code/__DEFINES/DNA.dm index 5695995713..9cae56645f 100644 --- a/code/__DEFINES/DNA.dm +++ b/code/__DEFINES/DNA.dm @@ -80,7 +80,7 @@ //DNA - Because fuck you and your magic numbers being all over the codebase. #define DNA_BLOCK_SIZE 3 -#define DNA_UNI_IDENTITY_BLOCKS 15 +#define DNA_UNI_IDENTITY_BLOCKS 19 #define DNA_HAIR_COLOR_BLOCK 1 #define DNA_FACIAL_HAIR_COLOR_BLOCK 2 #define DNA_SKIN_TONE_BLOCK 3 @@ -96,6 +96,10 @@ #define DNA_MUTANTEAR_BLOCK 13 #define DNA_MUTANTMARKING_BLOCK 14 #define DNA_TAUR_BLOCK 15 +#define DNA_BARK_SOUND_BLOCK 16 +#define DNA_BARK_SPEED_BLOCK 17 +#define DNA_BARK_PITCH_BLOCK 18 +#define DNA_BARK_VARIANCE_BLOCK 19 #define DNA_SEQUENCE_LENGTH 4 #define DNA_MUTATION_BLOCKS 8 diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index d2aa2f6a91..5581d71080 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -15,6 +15,7 @@ #define DISABLE_DEATHRATTLE (1<<12) #define DISABLE_ARRIVALRATTLE (1<<13) #define COMBOHUD_LIGHTING (1<<14) +#define SOUND_BARK (1<<15) #define DEADMIN_ALWAYS (1<<0) #define DEADMIN_ANTAGONIST (1<<1) @@ -22,7 +23,7 @@ #define DEADMIN_POSITION_SECURITY (1<<3) #define DEADMIN_POSITION_SILICON (1<<4) -#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS) +#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS|SOUND_BARK) //Chat toggles #define CHAT_OOC (1<<0) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 3e5658fa00..cd17b3aed0 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -79,6 +79,10 @@ var/datum/emote/E = new path() E.emote_list[E.key] = E + for(var/path in subtypesof(/datum/bark)) + var/datum/bark/B = new path() + GLOB.bark_list[B.id] = path + // Hair Gradients - Initialise all /datum/sprite_accessory/hair_gradient into an list indexed by gradient-style name for(var/path in subtypesof(/datum/sprite_accessory/hair_gradient)) var/datum/sprite_accessory/hair_gradient/H = new path() diff --git a/code/_globalvars/lists/flavor_misc.dm b/code/_globalvars/lists/flavor_misc.dm index da8b0ed3ee..f300455173 100644 --- a/code/_globalvars/lists/flavor_misc.dm +++ b/code/_globalvars/lists/flavor_misc.dm @@ -43,6 +43,9 @@ GLOBAL_LIST_EMPTY(arachnid_spinneret_list) GLOBAL_LIST_EMPTY(arachnid_mandibles_list) GLOBAL_LIST_EMPTY(caps_list) + //Bark bits +GLOBAL_LIST_EMPTY(bark_list) + //a way to index the right bodypart list given the type of bodypart GLOBAL_LIST_INIT(mutant_reference_list, list( "tail_lizard" = GLOB.tails_list_lizard, diff --git a/code/datums/bark.dm b/code/datums/bark.dm new file mode 100644 index 0000000000..7e7a2dcc5d --- /dev/null +++ b/code/datums/bark.dm @@ -0,0 +1,98 @@ +//Datums for barks and bark accessories + +/datum/bark + var/name = "Default" + var/id = "Default" + var/soundpath //Path for the actual sound file used for the bark + + // Pitch vars. The actual range for a bark is [(pitch - (maxvariance*0.5)) to (pitch + (maxvariance*0.5))] + // Make absolutely sure to take variance into account when curating a sound for bark purposes. + var/minpitch = 0.6 + var/maxpitch = 1.4 + var/minvariance = 0.1 + var/maxvariance = 0.4 + + // Speed vars. Speed determines the number of characters required for each bark, with lower speeds being faster with higher bark density + var/minspeed = 2 + var/maxspeed = 8 + + // Visibility vars. Regardless of what's set below, these can still be obtained via adminbus and genetics. Rule of fun. + var/list/ckeys_allowed + var/ignore = FALSE //Controls whether or not this can be chosen in chargen + + +// So the basic jist of the sound design here: We make use primarily of shorter instrument samples for barks. We would've went with animalese instead, but doing so would've involved quite a bit of overhead to saycode. +// Short instrument samples tend to sound surprisingly nice for barks, being able to be played in rapid succession without being outright obnoxious. +// It isn't just instruments that work well here, however. Anything that works well as a stab? Short attack, no sustain, a decent amount of release? Also works extremely well for barks. + +/datum/bark/mutedc2 + name = "Muted String (Low)" + id = "mutedc2" + soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C2.ogg' + +/datum/bark/mutedc3 + name = "Muted String (Medium)" + id = "mutedc3" + soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C3.ogg' + +/datum/bark/mutedc4 + name = "Muted String (High)" + id = "mutedc4" + soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C4.ogg' + +/datum/bark/banjoc3 + name = "Banjo (Medium)" + id = "banjoc3" + soundpath = 'sound/instruments/banjo/Cn3.ogg' + +/datum/bark/banjoc4 + name = "Banjo (High)" + id = "banjoc4" + soundpath = 'sound/instruments/banjo/Cn4.ogg' + +/datum/bark/bikehorn + name = "Bikehorn" + id = "horn" + soundpath = 'sound/instruments/bikehorn/Cn4.ogg' + ignore = TRUE // Genetics only. This is an unusually quiet sound, but genetics should be allowed to have some !!fun!! + +/datum/bark/bwoink + name = "Bwoink" + id = "bwoink" + soundpath = 'sound/effects/adminhelp.ogg' + ignore = TRUE // Also genetics only. Emergent heart attack generation + +/datum/bark/squeaky + name = "Squeaky" + id = "squeak" + soundpath = 'sound/items/toysqueak1.ogg' + maxspeed = 4 + +/datum/bark/beep + name = "Beepy" + id = "beep" + soundpath = 'sound/machines/terminal_select.ogg' + maxpitch = 1 //Bringing the pitch higher just hurts your ears :< + maxspeed = 4 //This soundbyte's too short for larger speeds to not sound awkward + +/datum/bark/chitter + name = "Chittery" + id = "chitter" + minspeed = 6 //This is a pretty long sound + soundpath = 'sound/items/Ratchet.ogg' + +/datum/bark/synthetic_grunt + name = "Synthetic (Grunt)" + id = "synthgrunt" + soundpath = 'sound/misc/bloop.ogg' + +/datum/bark/synthetic + name = "Synthetic (Normal)" + id = "synth" + soundpath = 'sound/machines/uplinkerror.ogg' + +/datum/bark/bullet + name = "Windy" + id = "bullet" + maxpitch = 1.6 //This works well with higher pitches! + soundpath = 'sound/weapons/bulletflyby.ogg' //This works... Surprisingly well as a bark? It's neat! diff --git a/code/datums/dna.dm b/code/datums/dna.dm index 5d0ff4daec..6a93838d09 100644 --- a/code/datums/dna.dm +++ b/code/datums/dna.dm @@ -153,6 +153,10 @@ if(!GLOB.taur_list.len) init_sprite_accessory_subtypes(/datum/sprite_accessory/taur, GLOB.taur_list) L[DNA_TAUR_BLOCK] = construct_block(GLOB.taur_list.Find(features["taur"]), GLOB.taur_list.len) + L[DNA_BARK_SOUND_BLOCK] = construct_block(GLOB.bark_list.Find(H.vocal_bark_id), GLOB.bark_list.len) + L[DNA_BARK_SPEED_BLOCK] = construct_block(H.vocal_speed * 4, 16) + L[DNA_BARK_PITCH_BLOCK] = construct_block(H.vocal_pitch * 30, 48) + L[DNA_BARK_VARIANCE_BLOCK] = construct_block(H.vocal_pitch_range * 48, 48) for(var/i=1, i<=DNA_UNI_IDENTITY_BLOCKS, i++) if(L[i]) @@ -248,19 +252,19 @@ if(DNA_HAIR_STYLE_BLOCK) setblock(uni_identity, blocknumber, construct_block(GLOB.hair_styles_list.Find(H.hair_style), GLOB.hair_styles_list.len)) if(DNA_COLOR_ONE_BLOCK) - sanitize_hexcolor(features["mcolor"], 6) + setblock(uni_identity, blocknumber, sanitize_hexcolor(features["mcolor"], 6)) if(DNA_COLOR_TWO_BLOCK) - sanitize_hexcolor(features["mcolor2"], 6) + setblock(uni_identity, blocknumber, sanitize_hexcolor(features["mcolor2"], 6)) if(DNA_COLOR_THREE_BLOCK) - sanitize_hexcolor(features["mcolor3"], 6) + setblock(uni_identity, blocknumber, sanitize_hexcolor(features["mcolor3"], 6)) if(DNA_MUTANTTAIL_BLOCK) - construct_block(GLOB.mam_tails_list.Find(features["mam_tail"]), GLOB.mam_tails_list.len) + setblock(uni_identity, blocknumber, construct_block(GLOB.mam_tails_list.Find(features["mam_tail"]), GLOB.mam_tails_list.len)) if(DNA_MUTANTEAR_BLOCK) - construct_block(GLOB.mam_ears_list.Find(features["mam_ears"]), GLOB.mam_ears_list.len) + setblock(uni_identity, blocknumber, construct_block(GLOB.mam_ears_list.Find(features["mam_ears"]), GLOB.mam_ears_list.len)) if(DNA_MUTANTMARKING_BLOCK) - construct_block(GLOB.mam_body_markings_list.Find(features["mam_body_markings"]), GLOB.mam_body_markings_list.len) + setblock(uni_identity, blocknumber, construct_block(GLOB.mam_body_markings_list.Find(features["mam_body_markings"]), GLOB.mam_body_markings_list.len)) if(DNA_TAUR_BLOCK) - construct_block(GLOB.taur_list.Find(features["taur"]), GLOB.taur_list.len) + setblock(uni_identity, blocknumber, construct_block(GLOB.taur_list.Find(features["taur"]), GLOB.taur_list.len)) if(species.mutant_bodyparts["taur"] && ishuman(holder)) var/datum/sprite_accessory/taur/T = GLOB.taur_list[features["taur"]] switch(T?.taur_mode) @@ -272,6 +276,14 @@ H.physiology.footstep_type = FOOTSTEP_MOB_CRAWL else H.physiology.footstep_type = null + if(DNA_BARK_SOUND_BLOCK) + setblock(uni_identity, blocknumber, construct_block(GLOB.bark_list.Find(H.vocal_bark_id), GLOB.bark_list.len)) + if(DNA_BARK_SPEED_BLOCK) + setblock(uni_identity, blocknumber, construct_block(H.vocal_speed * 4, 16)) + if(DNA_BARK_PITCH_BLOCK) + setblock(uni_identity, blocknumber, construct_block(H.vocal_pitch * 30, 48)) + if(DNA_BARK_VARIANCE_BLOCK) + setblock(uni_identity, blocknumber, construct_block(H.vocal_pitch_range * 48, 48)) //Please use add_mutation or activate_mutation instead /datum/dna/proc/force_give(datum/mutation/human/HM) @@ -491,6 +503,10 @@ update_body_parts() if(mutations_overlay_update) update_mutations_overlay() + set_bark(GLOB.bark_list[deconstruct_block(getblock(structure, DNA_BARK_SOUND_BLOCK), GLOB.bark_list.len)]) + vocal_speed = (deconstruct_block(getblock(structure, DNA_BARK_PITCH_BLOCK), 16) / 16) + vocal_pitch = (deconstruct_block(getblock(structure, DNA_BARK_PITCH_BLOCK), 48) / 30) + vocal_pitch_range = (deconstruct_block(getblock(structure, DNA_BARK_VARIANCE_BLOCK), 48) / 48) /mob/proc/domutcheck() diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 7cad67bd84..ca133f882e 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -64,6 +64,14 @@ /// last time we yelled var/last_yell = 0 + // Text-to-bark sounds + var/sound/vocal_bark + var/vocal_bark_id + var/vocal_pitch = 1 + var/vocal_pitch_range = 0.2 //Actual pitch is (pitch - (vocal_pitch_range*0.5)) to (pitch + (vocal_pitch_range*0.5)) + var/vocal_volume = 70 //Baseline. This gets modified by yelling and other factors + var/vocal_speed = 4 //Lower values are faster, higher values are slower + /atom/movable/Initialize(mapload) . = ..() switch(blocks_emissive) @@ -696,6 +704,17 @@ var/datum/language_holder/LH = get_language_holder() return LH.update_atom_languages(src) +/// Sets the vocal bark for the atom, using the bark's ID +/atom/movable/proc/set_bark(id) + if(!id) + return FALSE + var/datum/bark/B = GLOB.bark_list[id] + if(!B) + return FALSE + vocal_bark = sound(initial(B.soundpath)) + vocal_bark_id = id + return vocal_bark + /* End language procs */ diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 0d95448702..1fb2405584 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -104,6 +104,9 @@ Class Procs: anchored = TRUE interaction_flags_atom = INTERACT_ATOM_ATTACK_HAND | INTERACT_ATOM_UI_INTERACT + vocal_bark_id = "synth" + vocal_pitch = 0.6 + var/stat = 0 var/use_power = IDLE_POWER_USE //0 = dont run the auto diff --git a/code/game/say.dm b/code/game/say.dm index b7bfe540d0..0de96fa3db 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -31,14 +31,35 @@ GLOBAL_LIST_INIT(freqtospan, list( /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/bark(list/hearers, distance, volume, pitch) + if(!vocal_bark) + if(!vocal_bark_id || !set_bark(vocal_bark_id)) //just-in-time bark generation + return + volume = min(volume, 100) + var/turf/T = get_turf(src) + for(var/mob/M in hearers) + M.playsound_local(T, vol = volume, vary = TRUE, frequency = pitch, max_distance = distance, falloff_distance = distance * 0.75, S = vocal_bark, distance_multiplier = 1) + /atom/movable/proc/can_speak() return 1 /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/list/hearers = get_hearers_in_view(range, source) + for(var/_AM in hearers) var/atom/movable/AM = _AM AM.Hear(rendered, src, message_language, message, , spans, message_mode, source) + if(vocal_bark || vocal_bark_id) + for(var/mob/M in hearers) + if(!M.client) + continue + if(!(M.client.prefs.toggles & SOUND_BARK)) + hearers -= M + var/barks = round((LAZYLEN(message) / vocal_speed)) + 1 + var/total_delay + for(var/i in 1 to barks) + addtimer(CALLBACK(src, .proc/bark, hearers, range, vocal_volume, rand((vocal_pitch * 100), (vocal_pitch*100) + (vocal_pitch_range*100)) / 100), total_delay) + total_delay += rand(DS2TICKS(vocal_speed/4), DS2TICKS(vocal_speed/4) + DS2TICKS(vocal_speed/4)) TICKS /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) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 8600e44faf..33e87ca0e3 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -140,6 +140,13 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/modified_limbs = list() //prosthetic/amputated limbs var/chosen_limb_id //body sprite selected to load for the users limbs, null means default, is sanitized when loaded + // Vocal bark prefs + var/bark_id = "mutedc3" + var/bark_speed = 4 + var/bark_pitch = 1 + var/bark_variance = 0.2 + COOLDOWN_DECLARE(bark_previewing) + /// Security record note section var/security_records /// Medical record note section @@ -795,11 +802,21 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "" + dat += "" dat += "
" dat += "

Speech preferences

" dat += "Custom Speech Verb:
" - dat += "[custom_speech_verb]
" + dat += "[custom_speech_verb]
" dat += "Custom Tongue:
" - dat += "[custom_tongue]
" + dat += "[custom_tongue]
" dat += "Additional Language
" - dat += "[additional_language]
" + dat += "[additional_language]
" + dat += "
" + dat += "

Vocal Bark preferences

" + var/datum/bark/B = GLOB.bark_list[bark_id] + dat += "Vocal Bark Sound:
" + dat += "[B ? initial(B.name) : "INVALID"]
" + dat += "Vocal Bark Speed: [bark_speed]
" + dat += "Vocal Bark Pitch: [bark_pitch]
" + dat += "Vocal Bark Variance: [bark_variance]
" + dat += "
Preview Bark
" dat += "
" @@ -2555,6 +2572,43 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(selected_language) additional_language = selected_language + if("barksound") + var/list/woof_woof = list() + for(var/path in GLOB.bark_list) + var/datum/bark/B = GLOB.bark_list[path] + if(initial(B.ignore)) + continue + if(initial(B.ckeys_allowed)) + var/list/allowed = initial(B.ckeys_allowed) + if(!allowed.Find(user.client.ckey)) + continue + woof_woof[initial(B.name)] = initial(B.id) + var/new_bork = input(user, "Choose your desired vocal bark", "Character Preference") as null|anything in woof_woof + if(new_bork) + bark_id = woof_woof[new_bork] + var/datum/bark/B = GLOB.bark_list[bark_id] //Now we need sanitization to take into account bark-specific min/max values + bark_speed = round(clamp(bark_speed, initial(B.minspeed), initial(B.maxspeed)), 1) + bark_pitch = clamp(bark_pitch, initial(B.minpitch), initial(B.maxpitch)) + bark_variance = clamp(bark_variance, initial(B.minvariance), initial(B.maxvariance)) + + if("barkspeed") + var/datum/bark/B = GLOB.bark_list[bark_id] + var/borkset = input(user, "Choose your desired bark speed (Higher is slower, lower is faster). Min: [initial(B.minspeed)]. Max: [initial(B.maxspeed)]", "Character Preference") as null|num + if(borkset) + bark_speed = round(clamp(borkset, initial(B.minspeed), initial(B.maxspeed)), 1) + + if("barkpitch") + var/datum/bark/B = GLOB.bark_list[bark_id] + var/borkset = input(user, "Choose your desired baseline bark pitch. Min: [initial(B.minpitch)]. Max: [initial(B.maxpitch)]", "Character Preference") as null|num + if(borkset) + bark_pitch = clamp(borkset, initial(B.minpitch), initial(B.maxpitch)) + + if("barkvary") + var/datum/bark/B = GLOB.bark_list[bark_id] + var/borkset = input(user, "Choose your desired baseline bark pitch. Min: [initial(B.minvariance)]. Max: [initial(B.maxvariance)]", "Character Preference") as null|num + if(borkset) + bark_variance = clamp(borkset, initial(B.minvariance), initial(B.maxvariance)) + if("bodysprite") var/selected_body_sprite = input(user, "Choose your desired body sprite", "Character Preference") as null|anything in pref_species.allowed_limb_ids if(selected_body_sprite) @@ -3015,6 +3069,23 @@ GLOBAL_LIST_EMPTY(preferences_datums) if("hud_toggle_flash") hud_toggle_flash = !hud_toggle_flash + if("barkpreview") + if(SSticker.current_state == GAME_STATE_STARTUP) //Timers don't tick at all during game startup, so let's just give an error message + to_chat(user, "Bark previews can't play during initialization!") + return + if(!COOLDOWN_FINISHED(src, bark_previewing)) + return + if(!parent || !parent.mob) + return + COOLDOWN_START(src, bark_previewing, (5 SECONDS)) + var/atom/movable/barkbox = new(get_turf(parent.mob)) + barkbox.set_bark(bark_id) + var/total_delay + for(var/i in 1 to (round((32 / bark_speed)) + 1)) + addtimer(CALLBACK(barkbox, /atom/movable/proc/bark, list(parent.mob), 7, 70, rand((bark_pitch * 100), (bark_pitch*100) + (bark_variance*100)) / 100), total_delay) + total_delay += rand(DS2TICKS(bark_speed/4), DS2TICKS(bark_speed/4) + DS2TICKS(bark_speed/4)) TICKS + QDEL_IN(barkbox, total_delay) + if("save") save_preferences() save_character() @@ -3236,6 +3307,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) character.additional_language = language_entry character.grant_language(language_entry, TRUE, TRUE) + character.set_bark(bark_id) + character.vocal_speed = bark_speed + character.vocal_pitch = bark_pitch + character.vocal_pitch_range = bark_variance + //limb stuff, only done when initially spawning in if(initial_spawn) //delete any existing prosthetic limbs to make sure no remnant prosthetics are left over - But DO NOT delete those that are species-related diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index a60e1dc63c..1480770759 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 54 +#define SAVEFILE_VERSION_MAX 55 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -42,6 +42,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car //if your savefile is 3 months out of date, then 'tough shit'. /datum/preferences/proc/update_preferences(current_version, savefile/S) + if(current_version < 55) //Bitflag toggles don't set their defaults when they're added, always defaulting to off instead. + toggles |= SOUND_BARK if(current_version < 46) //If you remove this, remove force_reset_keybindings() too. force_reset_keybindings_direct(TRUE) addtimer(CALLBACK(src, .proc/force_reset_keybindings), 30) //No mob available when this is run, timer allows user choice. @@ -845,6 +847,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["feature_silicon_flavor_text"] >> features["silicon_flavor_text"] S["feature_ooc_notes"] >> features["ooc_notes"] + // Barks + S["bark_id"] >> bark_id + S["bark_speed"] >> bark_speed + S["bark_pitch"] >> bark_pitch + S["bark_variance"] >> bark_variance + S["vore_flags"] >> vore_flags S["vore_taste"] >> vore_taste S["vore_smell"] >> vore_smell @@ -1022,6 +1030,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car scars_list["4"] = sanitize_text(scars_list["4"]) scars_list["5"] = sanitize_text(scars_list["5"]) + bark_id = sanitize_inlist(bark_id, GLOB.bark_list, initial(bark_id)) + var/datum/bark/bark_path = GLOB.bark_list[bark_id] + bark_speed = sanitize_num_clamp(bark_speed, initial(bark_path.minspeed), initial(bark_path.maxspeed), initial(bark_speed)) + bark_pitch = sanitize_num_clamp(bark_pitch, initial(bark_path.minpitch), initial(bark_path.maxpitch), initial(bark_pitch)) + bark_variance = sanitize_num_clamp(bark_variance, initial(bark_path.minvariance), initial(bark_path.maxvariance), initial(bark_variance)) + joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole)) //Validate job prefs for(var/j in job_preferences) @@ -1089,6 +1103,10 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["custom_speech_verb"] , custom_speech_verb) WRITE_FILE(S["custom_tongue"] , custom_tongue) WRITE_FILE(S["additional_language"] , additional_language) + WRITE_FILE(S["bark_id"] , bark_id) + WRITE_FILE(S["bark_speed"] , bark_speed) + WRITE_FILE(S["bark_pitch"] , bark_pitch) + WRITE_FILE(S["bark_variance"] , bark_variance) // records WRITE_FILE(S["security_records"] , security_records) diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index a019ade471..c4d0aa0e80 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -227,6 +227,17 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggleprayersounds)() return C.prefs.toggles & SOUND_PRAYERS +TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggle_bark)() + set name = "Hear/Silence Vocal Barks" + set category = "Preferences" + set desc = "Hear Vocal Barks" + usr.client.prefs.toggles ^= SOUND_BARK + usr.client.prefs.save_preferences() + to_chat(usr, "You will now [(usr.client.prefs.toggles & SOUND_BARK) ? "hear" : "no longer hear"] vocal barks when other people talk.") + SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Toggle Vocal Barks", "[usr.client.prefs.toggles & SOUND_BARK ? "Enabled" : "Disabled"]")) +/datum/verbs/menu/Settings/Sound/toggle_bark/Get_checked(client/C) + return C.prefs.toggles & SOUND_BARK + /datum/verbs/menu/Settings/Sound/verb/stop_client_sounds() set name = "Stop Sounds" set category = "Preferences" diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index a6acd7d514..6922489fdb 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -297,8 +297,9 @@ GLOBAL_LIST_INIT(department_radio_keys, list( AM.Hear(rendered, src, message_language, message, null, spans, message_mode, source) SEND_GLOBAL_SIGNAL(COMSIG_GLOB_LIVING_SAY_SPECIAL, src, message) - if(client && !eavesdrop_range && say_test(message) == "2") // Yell hook - process_yelling(listening, rendered, src, message_language, message, spans, message_mode, source) + var/is_yell = (say_test(message) == "2") + if(client && !eavesdrop_range && is_yell) // Yell hook + listening |= process_yelling(listening, rendered, src, message_language, message, spans, message_mode, source) //speech bubble var/list/speech_bubble_recipients = list() @@ -309,6 +310,20 @@ GLOBAL_LIST_INIT(department_radio_keys, list( I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA INVOKE_ASYNC(GLOBAL_PROC, /.proc/flick_overlay, I, speech_bubble_recipients, 30) + //Listening gets trimmed here if a vocal bark's present. If anyone ever makes this proc return listening, make sure to instead initialize a copy of listening in here to avoid wonkiness + if(vocal_bark || vocal_bark_id) + for(var/mob/M in listening) + if(!M.client) + continue + if(!(M.client.prefs.toggles & SOUND_BARK)) + listening -= M + var/barks = round((LAZYLEN(message) / vocal_speed)) + 1 + var/total_delay + for(var/i in 1 to barks) + addtimer(CALLBACK(src, /atom/movable/proc/bark, listening, (message_range * (is_yell ? 4 : 1)), (vocal_volume * (is_yell ? 1.5 : 1)), rand(vocal_pitch * 100, ((vocal_pitch*100) + (vocal_pitch_range*100))) / 100), total_delay) + total_delay += rand(DS2TICKS((vocal_speed/4) * (is_yell ? 0.5 : 1)), DS2TICKS(vocal_speed/4) + DS2TICKS((vocal_speed/4) * (is_yell ? 0.5 : 1))) TICKS + + /atom/movable/proc/process_yelling(list/already_heard, rendered, atom/movable/speaker, datum/language/message_language, message, list/spans, message_mode, obj/source) if(last_yell > (world.time - 10)) to_chat(src, "Your voice doesn't project as far as you try to yell in such quick succession.") // yeah no, no spamming an expensive floodfill. @@ -333,6 +348,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list( var/atom/movable/AM = _AM AM.Hear(rendered, speaker, message_language, message, null, spans, message_mode, source) + return overhearing + /mob/proc/binarycheck() return FALSE diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 748a182ba3..fb8c937ea8 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -20,6 +20,9 @@ footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "bullet" + vocal_speed = 6 + /mob/living/simple_animal/pet/dog/ComponentInitialize() . = ..() AddElement(/datum/element/wuv, "yaps happily!", EMOTE_AUDIBLE, /datum/mood_event/pet_animal, "growls!", EMOTE_AUDIBLE) @@ -639,6 +642,8 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( mob_size = MOB_SIZE_SMALL collar_type = "puppy" + vocal_pitch = 1.6 + //puppies cannot wear anything. /mob/living/simple_animal/pet/dog/corgi/puppy/Topic(href, href_list) if(href_list["remove_inv"] || href_list["add_inv"]) @@ -660,6 +665,8 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( maxbodytemp = T0C + 40 held_icon = "void_puppy" + vocal_pitch = 0.6 + /mob/living/simple_animal/pet/dog/corgi/puppy/void/Process_Spacemove(movement_dir = 0) return 1 //Void puppies can navigate space. diff --git a/code/modules/mob/living/simple_animal/friendly/fox.dm b/code/modules/mob/living/simple_animal/friendly/fox.dm index 4e4fd7ccfc..475b50d44a 100644 --- a/code/modules/mob/living/simple_animal/friendly/fox.dm +++ b/code/modules/mob/living/simple_animal/friendly/fox.dm @@ -23,6 +23,11 @@ gold_core_spawnable = FRIENDLY_SPAWN footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "bullet" + vocal_speed = 2 + vocal_pitch = 1.6 + vocal_pitch_range = 0.4 + /mob/living/simple_animal/pet/fox/ComponentInitialize() . = ..() AddElement(/datum/element/mob_holder, "fox") diff --git a/tgstation.dme b/tgstation.dme index dd5872b680..83cc66968c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -443,6 +443,7 @@ #include "code\datums\action.dm" #include "code\datums\ai_laws.dm" #include "code\datums\armor.dm" +#include "code\datums\bark.dm" #include "code\datums\beam.dm" #include "code\datums\beepsky_fashion.dm" #include "code\datums\browser.dm"