vocal barks - Fully customizable noises for talking!
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+22
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user