From 2a720ce0548c3e1713688897a660b4e660e1826a Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 03:59:17 -0400 Subject: [PATCH 1/6] 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" From 8e152c38c9abf3c55398f45dd023d888825422a7 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 14:26:05 -0400 Subject: [PATCH 2/6] adds more barks for adminbus/genetics fuckery. also adds more barks for various station mobs! --- code/datums/bark.dm | 59 +++++++++++++++---- code/modules/mob/living/silicon/silicon.dm | 3 + .../mob/living/simple_animal/friendly/cat.dm | 3 + .../simple_animal/friendly/farm_animals.dm | 13 ++++ .../living/simple_animal/friendly/mouse.dm | 2 + .../living/simple_animal/friendly/plushie.dm | 2 + 6 files changed, 70 insertions(+), 12 deletions(-) diff --git a/code/datums/bark.dm b/code/datums/bark.dm index 7e7a2dcc5d..59f9f9d028 100644 --- a/code/datums/bark.dm +++ b/code/datums/bark.dm @@ -50,18 +50,6 @@ 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" @@ -96,3 +84,50 @@ 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! + + +// Genetics-only/admin-only sounds. These either clash hard with the audio design of the above sounds, or have some other form of audio design issue, but aren't *too* awful as a sometimes thing. +// Rule of fun very much applies to this section. Audio design is extremely important for the above section, but down here? No gods, no masters, pure anarchy. +// The min/max variables simply don't apply to these, as only chargen cares about them. As such, there's no need to define those. + +/datum/bark/bikehorn + name = "Bikehorn" + id = "horn" + soundpath = 'sound/instruments/bikehorn/Cn4.ogg' + ignore = TRUE // This is an unusually quiet sound. + +/datum/bark/bwoink + name = "Bwoink" + id = "bwoink" + soundpath = 'sound/effects/adminhelp.ogg' + ignore = TRUE // Emergent heart attack generation + +/datum/bark/merp + name = "Merp" + id = "merp" + soundpath = 'modular_citadel/sound/voice/merp.ogg' + ignore = TRUE + +/datum/bark/bark + name = "Bark" + id = "bark" + soundpath = 'modular_citadel/sound/voice/bark1.ogg' + ignore = TRUE + +/datum/bark/nya + name = "Nya" + id = "nya" + soundpath = 'modular_citadel/sound/voice/nya.ogg' + ignore = TRUE + +/datum/bark/moff + name = "Moff" + id = "moff" + soundpath = 'modular_citadel/sound/voice/mothsqueak.ogg' + ignore = TRUE + +/datum/bark/weh + name = "Weh" + id = "weh" + soundpath = 'modular_citadel/sound/voice/weh.ogg' + ignore = TRUE diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 7ad8a9c4f0..76bfcf6eba 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -50,6 +50,9 @@ typing_indicator_state = /obj/effect/overlay/typing_indicator/machine + vocal_bark_id = "synth" + vocal_pitch_range = 0.1 + /mob/living/silicon/Initialize(mapload) . = ..() GLOB.silicon_mobs += src diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index c1897c3c05..a7bd8ca921 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -35,6 +35,9 @@ collar_type = "cat" var/held_icon = "cat2" footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "mutedc4" + vocal_pitch = 1.4 + vocal_pitch_range = 0.4 /mob/living/simple_animal/pet/cat/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index c6dfc772c1..dd6ba49c07 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -36,6 +36,7 @@ var/datum/reagent/milk_reagent = /datum/reagent/consumable/milk footstep_type = FOOTSTEP_MOB_SHOE + vocal_bark_id = "banjoc3" /mob/living/simple_animal/hostile/retaliate/goat/Initialize(mapload, /datum/reagent/milk_reagent) udder = new (null, milk_reagent) @@ -143,6 +144,8 @@ blood_volume = BLOOD_VOLUME_NORMAL footstep_type = FOOTSTEP_MOB_SHOE + vocal_bark_id = "mutedc2" + vocal_pitch = 1.2 /mob/living/simple_animal/cow/Initialize(mapload) udder = new(null, milk_reagent) @@ -247,6 +250,8 @@ gold_core_spawnable = FRIENDLY_SPAWN footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "squeak" + vocal_pitch = 1.4 /mob/living/simple_animal/chick/Initialize(mapload) . = ..() @@ -309,6 +314,9 @@ var/static/chicken_count = 0 footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "synthgrunt" + vocal_pitch = 1.4 + vocal_pitch_range = 0.4 /mob/living/simple_animal/chicken/Initialize(mapload) . = ..() @@ -403,6 +411,8 @@ var/static/kiwi_count = 0 footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "squeak" + vocal_pitch = 1.4 /mob/living/simple_animal/kiwi/Destroy() --kiwi_count @@ -481,6 +491,8 @@ gold_core_spawnable = FRIENDLY_SPAWN footstep_type = FOOTSTEP_MOB_CLAW + vocal_bark_id = "squeak" + vocal_pitch = 1.4 /mob/living/simple_animal/babyKiwi/Initialize(mapload) . = ..() @@ -557,3 +569,4 @@ maxHealth = 75 blood_volume = BLOOD_VOLUME_NORMAL footstep_type = FOOTSTEP_MOB_SHOE + vocal_bark_id = "mutedc4" diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index d49eb1251d..f67c5dcb97 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -29,6 +29,8 @@ gold_core_spawnable = FRIENDLY_SPAWN var/chew_probability = 1 faction = list("rat") + vocal_bark_id = "squeak" + vocal_pitch = 1.4 /mob/living/simple_animal/mouse/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/simple_animal/friendly/plushie.dm b/code/modules/mob/living/simple_animal/friendly/plushie.dm index ff95e8fe86..4821695f45 100644 --- a/code/modules/mob/living/simple_animal/friendly/plushie.dm +++ b/code/modules/mob/living/simple_animal/friendly/plushie.dm @@ -29,6 +29,8 @@ atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 pressure_resistance = 200 + vocal_bark_id = "squeak" + vocal_pitch_range = 0.4 /mob/living/simple_animal/pet/plushie/ComponentInitialize() . = ..() From f30c9406cc40049235d00954843605dcca4a72fa Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 15:29:48 -0400 Subject: [PATCH 3/6] randomization! --- code/__HELPERS/global_lists.dm | 2 ++ code/_globalvars/lists/flavor_misc.dm | 1 + code/datums/bark.dm | 6 ++++++ code/modules/admin/create_mob.dm | 4 ++++ code/modules/client/preferences_savefile.dm | 6 +++--- code/modules/mob/dead/new_player/preferences_setup.dm | 3 +++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index cd17b3aed0..8b8c05063e 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -82,6 +82,8 @@ for(var/path in subtypesof(/datum/bark)) var/datum/bark/B = new path() GLOB.bark_list[B.id] = path + if(B.allow_random) + GLOB.bark_random_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)) diff --git a/code/_globalvars/lists/flavor_misc.dm b/code/_globalvars/lists/flavor_misc.dm index f300455173..ff5829ff73 100644 --- a/code/_globalvars/lists/flavor_misc.dm +++ b/code/_globalvars/lists/flavor_misc.dm @@ -45,6 +45,7 @@ GLOBAL_LIST_EMPTY(caps_list) //Bark bits GLOBAL_LIST_EMPTY(bark_list) +GLOBAL_LIST_EMPTY(bark_random_list) //a way to index the right bodypart list given the type of bodypart GLOBAL_LIST_INIT(mutant_reference_list, list( diff --git a/code/datums/bark.dm b/code/datums/bark.dm index 59f9f9d028..e07b1251cf 100644 --- a/code/datums/bark.dm +++ b/code/datums/bark.dm @@ -19,6 +19,7 @@ // 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 + var/allow_random = FALSE //Allows chargen randomization to use this. This is mainly to restrict the pool to sounds that fit well for most characters // 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. @@ -29,26 +30,31 @@ name = "Muted String (Low)" id = "mutedc2" soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C2.ogg' + allow_random = TRUE /datum/bark/mutedc3 name = "Muted String (Medium)" id = "mutedc3" soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C3.ogg' + allow_random = TRUE /datum/bark/mutedc4 name = "Muted String (High)" id = "mutedc4" soundpath = 'sound/instruments/synthesis_samples/guitar/crisis_muted/C4.ogg' + allow_random = TRUE /datum/bark/banjoc3 name = "Banjo (Medium)" id = "banjoc3" soundpath = 'sound/instruments/banjo/Cn3.ogg' + allow_random = TRUE /datum/bark/banjoc4 name = "Banjo (High)" id = "banjoc4" soundpath = 'sound/instruments/banjo/Cn4.ogg' + allow_random = TRUE /datum/bark/squeaky name = "Squeaky" diff --git a/code/modules/admin/create_mob.dm b/code/modules/admin/create_mob.dm index 9a74b63040..9441dbf90a 100644 --- a/code/modules/admin/create_mob.dm +++ b/code/modules/admin/create_mob.dm @@ -50,6 +50,10 @@ H.dna.features["flavor_text"] = "" //Oh no. H.dna.features["body_model"] = H.gender + H.set_bark(pick(GLOB.bark_random_list)) + H.vocal_pitch = ((H.gender == MALE ? rand(60, 120) : (H.gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100) + H.vocal_pitch_range = rand(10, 40) / 100 + SEND_SIGNAL(H, COMSIG_HUMAN_ON_RANDOMIZE) H.update_body(TRUE) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 1480770759..66f16fc153 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -1030,11 +1030,11 @@ 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)) + bark_id = sanitize_inlist(bark_id, GLOB.bark_list, pick(GLOB.bark_random_list)) 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)) + bark_pitch = sanitize_num_clamp(bark_pitch, initial(bark_path.minpitch), initial(bark_path.maxpitch), ((gender == MALE ? rand(60, 120) : (gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100)) + bark_variance = sanitize_num_clamp(bark_variance, initial(bark_path.minvariance), initial(bark_path.maxvariance), (rand(10, 40) / 100)) joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole)) //Validate job prefs diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm index a9233938ab..bb31b0e3ab 100644 --- a/code/modules/mob/dead/new_player/preferences_setup.dm +++ b/code/modules/mob/dead/new_player/preferences_setup.dm @@ -24,6 +24,9 @@ var/rando_race = pick(GLOB.roundstart_races) pref_species = new rando_race() features = random_features(pref_species?.id, gender) + bark_id = pick(GLOB.bark_random_list) + bark_pitch = ((gender == MALE ? rand(60, 120) : (gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100) + bark_variance = rand(10, 40) / 100 age = rand(AGE_MIN,AGE_MAX) /datum/preferences/proc/update_preview_icon(current_tab) From 425334b3b44b21157f1b73df5f339e0ab6ae72d2 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 15:50:40 -0400 Subject: [PATCH 4/6] fuck dna --- code/datums/dna.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/dna.dm b/code/datums/dna.dm index 6a93838d09..dd3b8de7fe 100644 --- a/code/datums/dna.dm +++ b/code/datums/dna.dm @@ -504,7 +504,7 @@ 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_speed = (deconstruct_block(getblock(structure, DNA_BARK_PITCH_BLOCK), 16) / 4) 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) From 512a8c783cd137cba0d6c7233780aa75a0b00079 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 9 Jun 2022 23:37:49 -0400 Subject: [PATCH 5/6] basic code cleanup and limits --- code/__DEFINES/say.dm | 16 ++++++++++++++++ code/datums/bark.dm | 12 ++++++------ code/game/say.dm | 6 ++++-- code/modules/admin/create_mob.dm | 4 ++-- code/modules/client/preferences_savefile.dm | 4 ++-- .../mob/dead/new_player/preferences_setup.dm | 4 ++-- code/modules/mob/living/say.dm | 6 ++++-- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index 73c5841ab9..2dabf79e8c 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -97,6 +97,22 @@ #define MAX_BROADCAST_LEN 512 #define MAX_CHARTER_LEN 80 +//Bark defines +#define BARK_DEFAULT_MINPITCH 0.6 +#define BARK_DEFAULT_MAXPITCH 1.4 +#define BARK_DEFAULT_MINVARY 0.1 +#define BARK_DEFAULT_MAXVARY 0.4 +#define BARK_DEFAULT_MINSPEED 2 +#define BARK_DEFAULT_MAXSPEED 8 + +#define BARK_SPEED_BASELINE 4 //Used to calculate delay between barks, any bark speeds below this feature higher bark density, any speeds above feature lower bark density. Keeps barking length consistent + +#define BARK_MAX_BARKS 128 +#define BARK_MAX_TIME (10 SECONDS) // More or less the amount of time the above takes to process through with a bark speed of 2. + +#define BARK_PITCH_RAND(gend) ((gend == MALE ? rand(60, 120) : (gend == FEMALE ? rand(80, 140) : rand(60,140))) / 100) //Macro for determining random pitch based off gender +#define BARK_VARIANCE_RAND (rand(BARK_DEFAULT_MINVARY * 100, BARK_DEFAULT_MAXVARY * 100) / 100) //Macro for randomizing bark variance to reduce the amount of copy-pasta necessary for that + // Is something in the IC chat filter? This is config dependent. #define CHAT_FILTER_CHECK(T) (config.ic_filter_regex && findtext(T, config.ic_filter_regex)) diff --git a/code/datums/bark.dm b/code/datums/bark.dm index e07b1251cf..a7119273c3 100644 --- a/code/datums/bark.dm +++ b/code/datums/bark.dm @@ -7,14 +7,14 @@ // 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 + var/minpitch = BARK_DEFAULT_MINPITCH + var/maxpitch = BARK_DEFAULT_MAXPITCH + var/minvariance = BARK_DEFAULT_MINVARY + var/maxvariance = BARK_DEFAULT_MAXVARY // 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 + var/minspeed = BARK_DEFAULT_MINSPEED + var/maxspeed = BARK_DEFAULT_MAXSPEED // Visibility vars. Regardless of what's set below, these can still be obtained via adminbus and genetics. Rule of fun. var/list/ckeys_allowed diff --git a/code/game/say.dm b/code/game/say.dm index 0de96fa3db..d0ef26dcb8 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -55,11 +55,13 @@ GLOBAL_LIST_INIT(freqtospan, list( continue if(!(M.client.prefs.toggles & SOUND_BARK)) hearers -= M - var/barks = round((LAZYLEN(message) / vocal_speed)) + 1 + var/barks = min(round((LAZYLEN(message) / vocal_speed)) + 1, BARK_MAX_BARKS) var/total_delay for(var/i in 1 to barks) + if(total_delay > BARK_MAX_TIME) + break 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 + total_delay += rand(DS2TICKS(vocal_speed / BARK_SPEED_BASELINE), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS(vocal_speed / BARK_SPEED_BASELINE)) 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/admin/create_mob.dm b/code/modules/admin/create_mob.dm index 9441dbf90a..19201299c2 100644 --- a/code/modules/admin/create_mob.dm +++ b/code/modules/admin/create_mob.dm @@ -51,8 +51,8 @@ H.dna.features["body_model"] = H.gender H.set_bark(pick(GLOB.bark_random_list)) - H.vocal_pitch = ((H.gender == MALE ? rand(60, 120) : (H.gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100) - H.vocal_pitch_range = rand(10, 40) / 100 + H.vocal_pitch = BARK_PITCH_RAND(H.gender) + H.vocal_pitch_range = BARK_VARIANCE_RAND SEND_SIGNAL(H, COMSIG_HUMAN_ON_RANDOMIZE) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 66f16fc153..249dbba45f 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -1033,8 +1033,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car bark_id = sanitize_inlist(bark_id, GLOB.bark_list, pick(GLOB.bark_random_list)) 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), ((gender == MALE ? rand(60, 120) : (gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100)) - bark_variance = sanitize_num_clamp(bark_variance, initial(bark_path.minvariance), initial(bark_path.maxvariance), (rand(10, 40) / 100)) + bark_pitch = sanitize_num_clamp(bark_pitch, initial(bark_path.minpitch), initial(bark_path.maxpitch), BARK_PITCH_RAND(gender)) + bark_variance = sanitize_num_clamp(bark_variance, initial(bark_path.minvariance), initial(bark_path.maxvariance), BARK_VARIANCE_RAND) joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole)) //Validate job prefs diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm index bb31b0e3ab..378313311e 100644 --- a/code/modules/mob/dead/new_player/preferences_setup.dm +++ b/code/modules/mob/dead/new_player/preferences_setup.dm @@ -25,8 +25,8 @@ pref_species = new rando_race() features = random_features(pref_species?.id, gender) bark_id = pick(GLOB.bark_random_list) - bark_pitch = ((gender == MALE ? rand(60, 120) : (gender == FEMALE ? rand(80, 140) : rand(60,140))) / 100) - bark_variance = rand(10, 40) / 100 + bark_pitch = BARK_PITCH_RAND(gender) + bark_variance = BARK_VARIANCE_RAND age = rand(AGE_MIN,AGE_MAX) /datum/preferences/proc/update_preview_icon(current_tab) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 6922489fdb..52693d1d88 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -317,11 +317,13 @@ GLOBAL_LIST_INIT(department_radio_keys, list( continue if(!(M.client.prefs.toggles & SOUND_BARK)) listening -= M - var/barks = round((LAZYLEN(message) / vocal_speed)) + 1 + var/barks = min(round((LAZYLEN(message) / vocal_speed)) + 1, BARK_MAX_BARKS) var/total_delay for(var/i in 1 to barks) + if(total_delay > BARK_MAX_TIME) + break 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 + total_delay += rand(DS2TICKS((vocal_speed / BARK_SPEED_BASELINE) * (is_yell ? 0.5 : 1)), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS((vocal_speed / BARK_SPEED_BASELINE) * (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) From 381c8fe183430dd43f4cae1dc53945f9a1e87f93 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Fri, 10 Jun 2022 04:05:02 -0400 Subject: [PATCH 6/6] additional cleanup - turns bark variance into a macro for easy consistency --- code/__DEFINES/say.dm | 2 ++ code/game/say.dm | 2 +- code/modules/client/preferences.dm | 2 +- code/modules/mob/living/say.dm | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index 2dabf79e8c..9debb3a699 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -113,6 +113,8 @@ #define BARK_PITCH_RAND(gend) ((gend == MALE ? rand(60, 120) : (gend == FEMALE ? rand(80, 140) : rand(60,140))) / 100) //Macro for determining random pitch based off gender #define BARK_VARIANCE_RAND (rand(BARK_DEFAULT_MINVARY * 100, BARK_DEFAULT_MAXVARY * 100) / 100) //Macro for randomizing bark variance to reduce the amount of copy-pasta necessary for that +#define BARK_DO_VARY(pitch, variance) (rand(((pitch * 100) - (variance*50)), ((pitch*100) + (variance*50))) / 100) + // Is something in the IC chat filter? This is config dependent. #define CHAT_FILTER_CHECK(T) (config.ic_filter_regex && findtext(T, config.ic_filter_regex)) diff --git a/code/game/say.dm b/code/game/say.dm index d0ef26dcb8..205ddc2f0e 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -60,7 +60,7 @@ GLOBAL_LIST_INIT(freqtospan, list( for(var/i in 1 to barks) if(total_delay > BARK_MAX_TIME) break - addtimer(CALLBACK(src, .proc/bark, hearers, range, vocal_volume, rand((vocal_pitch * 100), (vocal_pitch*100) + (vocal_pitch_range*100)) / 100), total_delay) + addtimer(CALLBACK(src, .proc/bark, hearers, range, vocal_volume, BARK_DO_VARY(vocal_pitch, vocal_pitch_range)), total_delay) total_delay += rand(DS2TICKS(vocal_speed / BARK_SPEED_BASELINE), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS(vocal_speed / BARK_SPEED_BASELINE)) 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) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 33e87ca0e3..8a9f122f43 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -3082,7 +3082,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) 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) + addtimer(CALLBACK(barkbox, /atom/movable/proc/bark, list(parent.mob), 7, 70, BARK_DO_VARY(bark_pitch, bark_variance)), total_delay) total_delay += rand(DS2TICKS(bark_speed/4), DS2TICKS(bark_speed/4) + DS2TICKS(bark_speed/4)) TICKS QDEL_IN(barkbox, total_delay) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 52693d1d88..b90909adf7 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -322,7 +322,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list( for(var/i in 1 to barks) if(total_delay > BARK_MAX_TIME) break - 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) + addtimer(CALLBACK(src, /atom/movable/proc/bark, listening, (message_range * (is_yell ? 4 : 1)), (vocal_volume * (is_yell ? 1.5 : 1)), BARK_DO_VARY(vocal_pitch, vocal_pitch_range)), total_delay) total_delay += rand(DS2TICKS((vocal_speed / BARK_SPEED_BASELINE) * (is_yell ? 0.5 : 1)), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS((vocal_speed / BARK_SPEED_BASELINE) * (is_yell ? 0.5 : 1))) TICKS