Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blooper, finally #106

Merged
merged 36 commits into from Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
629df77
blooper begin
RashCat Aug 12, 2023
a295d12
LETS DO THIS
RashCat Aug 13, 2023
77667fd
Defines done
RashCat Aug 13, 2023
15d73bf
Its working :+1:
RashCat Sep 10, 2023
e667839
NOW IT'S WORKING
RashCat Sep 17, 2023
63a7553
...
RashCat Sep 17, 2023
351b370
I broke everything
RashCat Sep 28, 2023
04abff2
idk
RashCat Sep 28, 2023
3ca009a
It's working
RashCat Sep 30, 2023
e3e1499
Almost done
RashCat Oct 3, 2023
fa30f00
Some changes
RashCat Oct 3, 2023
bf2dbef
Also some changes
RashCat Oct 3, 2023
f0fb797
Some changes
RashCat Oct 4, 2023
2dbd67c
It's almost end.
RashCat Oct 4, 2023
da870c6
IT'S THE END OF TIMES
RashCat Oct 4, 2023
b520d7a
Забыл про 900 коммитов до...
RashCat Oct 4, 2023
acfa68b
Merge branch 'blooper' of https://github.com/RaShCat/FF-STG into blooper
RashCat Oct 4, 2023
76c05f4
Some kek moment fix.
RashCat Oct 5, 2023
234810c
Update global_lists.dm
Oct 6, 2023
b6e56a6
Update code/game/atoms_movable.dm
Oct 6, 2023
29ca697
Update code/__HELPERS/global_lists.dm
Oct 6, 2023
c49b791
Update code/game/atoms_movable.dm
Oct 6, 2023
b6bc503
VishenkaNeedThis
RashCat Oct 6, 2023
24089c1
Merge branch 'blooper' of https://github.com/RaShCat/FF-STG into blooper
RashCat Oct 6, 2023
36d9489
SpecialForSomeone
RashCat Oct 6, 2023
8619b88
Little fix
RashCat Oct 6, 2023
ea41b98
Separate
RashCat Oct 6, 2023
85bfff7
How Veshenka Saying
RashCat Oct 6, 2023
23e6923
Prettier. You know.
RashCat Oct 6, 2023
f5deb65
Update tff_modular/modules/blooper/atoms_movable.dm
Oct 6, 2023
e3e3369
Update tff_modular/modules/blooper/atoms_movable.dm
Oct 6, 2023
4aa93c8
Update code/__DEFINES/~ff_defines/dcs/signals.dm
Oct 6, 2023
9eaebf4
fix sound falloff
Iajret Oct 6, 2023
fa0aa4b
UltraMegaChanges
RashCat Oct 7, 2023
130ffb9
Bark->Blooper
RashCat Oct 11, 2023
faa8478
remove unnecessary defines
Iajret Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/__DEFINES/~ff_defines/DNA.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#define SPECIES_NABBER "nabber"
#define SPECIES_TESHARI_ALT "teshari_alt"
// Blooper defines
#define DNA_BARK_SOUND_BLOCK 16
#define DNA_BARK_SPEED_BLOCK 17
#define DNA_BARK_PITCH_BLOCK 18
#define DNA_BARK_VARIANCE_BLOCK 19
// Blooper defines
2 changes: 2 additions & 0 deletions code/__DEFINES/~ff_defines/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GLOBAL_LIST_EMPTY(bark_list)
GLOBAL_LIST_EMPTY(bark_random_list)
2 changes: 2 additions & 0 deletions code/__DEFINES/~ff_defines/dcs/signals.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define COMSIG_MOVABLE_BARK "movable_bark" //from base of atom/movable/proc/bark(): (list/hearers, distance, volume, pitch)
This conversation was marked as resolved.
Show resolved Hide resolved
#define COMSIG_MOVABLE_QUEUE_BARK "movable_queue_bark" //from base of atom/movable/proc/send_speech(): (list/hearers, message, range, atom/movable/source, bubble_type, list/spans, datum/language/message_language, message_mode)
19 changes: 19 additions & 0 deletions code/__DEFINES/~ff_defines/say.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//Bark defines
#define BARK_DEFAULT_MINPITCH 0.4
#define BARK_DEFAULT_MAXPITCH 2
#define BARK_DEFAULT_MINVARY 0.1
#define BARK_DEFAULT_MAXVARY 0.8
#define BARK_DEFAULT_MINSPEED 2
#define BARK_DEFAULT_MAXSPEED 16

#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 24
#define BARK_MAX_TIME (1.5 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

#define BARK_DO_VARY(pitch, variance) (rand(((pitch * 100) - (variance*50)), ((pitch*100) + (variance*50))) / 100)

#define BARK_SOUND_FALLOFF_EXPONENT(distance) (distance/7) //At lower ranges, we want the exponent to be below 1 so that whispers don't sound too awkward. At higher ranges, we want the exponent fairly high to make yelling less obnoxious
8 changes: 8 additions & 0 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
sort_list(GLOB.laugh_types, GLOBAL_PROC_REF(cmp_typepaths_asc))
//SKYRAT EDIT END

//THE FLUFFY FRONTIER EDIT ADDITION BEGIN - Без этого никуда.
This conversation was marked as resolved.
Show resolved Hide resolved
for(var/spath in subtypesof(/datum/bark))
This conversation was marked as resolved.
Show resolved Hide resolved
var/datum/bark/B = new spath()
GLOB.bark_list[B.id] = spath
if(B.allow_random)
GLOB.bark_random_list[B.id] = spath
//THE FLUFFY FRONTIER EDIT END

/// Inits GLOB.species_list. Not using GLOBAL_LIST_INIT b/c it depends on GLOB.string_lists
/proc/init_species_list()
for(var/spath in subtypesof(/datum/species))
Expand Down
6 changes: 6 additions & 0 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@
if(NAMEOF(src, glide_size))
set_glide_size(var_value)
. = TRUE
// THE FLUFFY FRONTIER - EDIT BEGIN - BLOOPER
This conversation was marked as resolved.
Show resolved Hide resolved
if(NAMEOF(src, vocal_bark)) // Sorry, Vishenka.
if(isfile(var_value))
vocal_bark = sound(var_value) //bark() expects vocal_bark to already be a sound datum, for performance reasons. adminbus QoL!
. = TRUE
// THE FLUFFY FRONTIE - EDIT END - BLOOPER
This conversation was marked as resolved.
Show resolved Hide resolved

if(!isnull(.))
datum_flags |= DF_VAR_EDITED
Expand Down
118 changes: 118 additions & 0 deletions tff_modular/modules/blooper/atoms_movable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/atom/movable/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_MOVABLE_BARK, .proc/handle_special_bark)

/atom/movable/Destroy()
UnregisterSignal(src, COMSIG_MOVABLE_BARK)
. = ..()

/atom/movable/proc/handle_special_bark(atom/movable/source, list/listeners, distance, volume, pitch)
SIGNAL_HANDLER

if(!GLOB.blooper_allowed)
return //No need to run if there are no barks to begin with

var/list/soundpaths
switch(GLOB.bark_list[source.vocal_bark_id])
if(/datum/bark/gaster)
soundpaths = list(
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_1.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_2.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_3.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_4.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_5.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_6.ogg',
'tff_modular/modules/blooper/voice/barks/undertale/voice_gaster_7.ogg'
)
else
return

source.vocal_bark = sound(pick(soundpaths))

This conversation was marked as resolved.
Show resolved Hide resolved
/atom/movable
// Text-to-bark sounds
// Да. У нас все атом могут иметь звучение для say.
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
var/vocal_speed = 4 //Lower values are faster, higher values are slower
var/vocal_current_bark //When barks are queued, this gets passed to the bark proc. If vocal_current_bark doesn't match the args passed to the bark proc (if passed at all), then the bark simply doesn't play. Basic curtailing of spam~

/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

/atom/movable/proc/bark(list/listeners, distance, volume, pitch, queue_time)
if(!GLOB.blooper_allowed)
return
if(queue_time && vocal_current_bark != queue_time)
return
if(SEND_SIGNAL(src, COMSIG_MOVABLE_BARK, listeners, distance, volume, pitch))
return //bark interception. this probably counts as some flavor of BDSM
This conversation was marked as resolved.
Show resolved Hide resolved
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 listeners)
M.playsound_local(T, vol = volume, vary = TRUE, frequency = pitch, max_distance = distance, falloff_distance = 0, falloff_exponent = BARK_SOUND_FALLOFF_EXPONENT(distance), sound_to_use = vocal_bark, distance_multiplier = 1)

/atom/movable/send_speech(message, range = 7, obj/source = src, bubble_type, list/spans, datum/language/message_language, list/message_mods = list(), forced = FALSE, tts_message, list/tts_filter)
. = ..()
var/list/listeners = get_hearers_in_view(range, source)
if(SEND_SIGNAL(src, COMSIG_MOVABLE_QUEUE_BARK, listeners, args) || vocal_bark || vocal_bark_id)
for(var/mob/M in listeners)
if(!M.client)
continue
if(!(M.client?.prefs.read_preference(/datum/preference/toggle/hear_sound_bark)))
listeners -= M
var/barks = min(round((LAZYLEN(message) / vocal_speed)) + 1, BARK_MAX_BARKS)
var/total_delay
vocal_current_bark = world.time //this is juuuuust random enough to reliably be unique every time send_speech() is called, in most scenarios
for(var/i in 1 to barks)
if(total_delay > BARK_MAX_TIME)
break
addtimer(CALLBACK(src, .proc/bark, listeners, range, vocal_volume, BARK_DO_VARY(vocal_pitch, vocal_pitch_range), vocal_current_bark), total_delay)
Iajret marked this conversation as resolved.
Show resolved Hide resolved
total_delay += rand(DS2TICKS(vocal_speed / BARK_SPEED_BASELINE), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS(vocal_speed / BARK_SPEED_BASELINE)) TICKS

/randomize_human(mob/living/carbon/human/human)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мы ж переопределяем, а не создаём новый

. = ..()
human.set_bark(pick(GLOB.bark_random_list))
human.vocal_pitch = BARK_PITCH_RAND(human.gender)
human.vocal_pitch_range = BARK_VARIANCE_RAND

/mob/living/send_speech(message_raw, message_range = 6, obj/source = src, bubble_type = bubble_icon, list/spans, datum/language/message_language = null, list/message_mods = list(), forced = null, tts_message, list/tts_filter)
. = ..()
if(client)
if(!(client?.prefs.read_preference(/datum/preference/toggle/send_sound_bark)))
return
var/whisper_range = 0
vocal_volume = 55
if(message_mods[WHISPER_MODE])
vocal_volume = 25
whisper_range = MESSAGE_RANGE - WHISPER_RANGE
var/list/listening = get_hearers_in_view(message_range + whisper_range, source)
var/is_yell = (say_test(message_raw) == "2")
//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(SEND_SIGNAL(src, COMSIG_MOVABLE_QUEUE_BARK, listening, args) || vocal_bark || vocal_bark_id)
for(var/mob/M in listening)
if(!M.client)
continue
if(!(M.client?.prefs.read_preference(/datum/preference/toggle/hear_sound_bark)))
listening -= M
var/barks = min(round((LAZYLEN(message_raw) / vocal_speed)) + 1, BARK_MAX_BARKS)
var/total_delay
vocal_current_bark = world.time
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 ? 2 : 1)), BARK_DO_VARY(vocal_pitch, vocal_pitch_range), vocal_current_bark), total_delay)
Iajret marked this conversation as resolved.
Show resolved Hide resolved
total_delay += rand(DS2TICKS(vocal_speed / BARK_SPEED_BASELINE), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS((vocal_speed / BARK_SPEED_BASELINE) * (is_yell ? 0.5 : 1))) TICKS
Loading
Loading