mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
adds a playsoundtoken proc that allows one-shot sound tokens playing, and adds support for it to emotes. (#96519)
This commit is contained in:
+26
-8
@@ -61,12 +61,18 @@
|
||||
var/cooldown = 0.8 SECONDS
|
||||
/// Does this message have a message that can be modified by the user?
|
||||
var/can_message_change = FALSE
|
||||
/// How long is the shared emote cooldown triggered by this emote?
|
||||
var/general_emote_audio_cooldown = 2 SECONDS
|
||||
/// How long is the specific emote cooldown triggered by this emote?
|
||||
var/specific_emote_audio_cooldown = 5 SECONDS
|
||||
/// How long is the shared emote cooldown triggered by this emote when used intentionally?
|
||||
var/manual_general_emote_audio_cooldown = 2 SECONDS
|
||||
/// How long is the specific emote cooldown triggered by this emote when used intentionally?
|
||||
var/manual_specific_emote_audio_cooldown = 5 SECONDS
|
||||
/// How long is the shared emote cooldown triggered by this emote when forced?
|
||||
var/forced_general_emote_audio_cooldown = 2 SECONDS
|
||||
/// How long is the specific emote cooldown triggered by this emote when forced?
|
||||
var/forced_specific_emote_audio_cooldown = 2 SECONDS
|
||||
/// Does this emote's sound ignore walls?
|
||||
var/sound_wall_ignore = FALSE
|
||||
///Does this emote use sound tokens? this means it also ignores walls.
|
||||
var/use_sound_tokens = FALSE
|
||||
|
||||
/datum/emote/New()
|
||||
switch(mob_type_allowed_typecache)
|
||||
@@ -112,15 +118,27 @@
|
||||
user.log_message(msg, LOG_EMOTE)
|
||||
|
||||
var/tmp_sound = get_sound(user)
|
||||
if(tmp_sound && should_play_sound(user, intentional) && TIMER_COOLDOWN_FINISHED(user, "general_emote_audio_cooldown") && TIMER_COOLDOWN_FINISHED(user, type))
|
||||
TIMER_COOLDOWN_START(user, type, specific_emote_audio_cooldown)
|
||||
TIMER_COOLDOWN_START(user, "general_emote_audio_cooldown", general_emote_audio_cooldown)
|
||||
if(tmp_sound && should_play_sound(user, intentional))
|
||||
if(intentional)
|
||||
if(!TIMER_COOLDOWN_FINISHED(user, MANUAL_GENERAL_EMOTE_AUDIO_COOLDOWN) || !TIMER_COOLDOWN_FINISHED(user, MANUAL_SPECIFIC_EMOTE_AUDIO_COOLDOWN(type)) || !TIMER_COOLDOWN_FINISHED(user, FORCED_GENERAL_EMOTE_AUDIO_COOLDOWN) || !TIMER_COOLDOWN_FINISHED(user, FORCED_SPECIFIC_EMOTE_AUDIO_COOLDOWN(type)))
|
||||
return FALSE
|
||||
else
|
||||
if(!TIMER_COOLDOWN_FINISHED(user, FORCED_GENERAL_EMOTE_AUDIO_COOLDOWN) || !TIMER_COOLDOWN_FINISHED(user, FORCED_SPECIFIC_EMOTE_AUDIO_COOLDOWN(type)))
|
||||
return FALSE
|
||||
TIMER_COOLDOWN_START(user, MANUAL_SPECIFIC_EMOTE_AUDIO_COOLDOWN(type), manual_specific_emote_audio_cooldown)
|
||||
TIMER_COOLDOWN_START(user, MANUAL_GENERAL_EMOTE_AUDIO_COOLDOWN, manual_general_emote_audio_cooldown)
|
||||
TIMER_COOLDOWN_START(user, FORCED_SPECIFIC_EMOTE_AUDIO_COOLDOWN(type), forced_specific_emote_audio_cooldown)
|
||||
TIMER_COOLDOWN_START(user, FORCED_GENERAL_EMOTE_AUDIO_COOLDOWN, forced_general_emote_audio_cooldown)
|
||||
|
||||
var/frequency = null
|
||||
if (affected_by_pitch && SStts.tts_enabled && SStts.pitch_enabled)
|
||||
frequency = rand(MIN_EMOTE_PITCH, MAX_EMOTE_PITCH) * (1 + sqrt(abs(user.pitch)) * sign(user.pitch) * EMOTE_TTS_PITCH_MULTIPLIER)
|
||||
else if(vary)
|
||||
frequency = rand(MIN_EMOTE_PITCH, MAX_EMOTE_PITCH)
|
||||
playsound(source = user,soundin = tmp_sound,vol = 50, vary = FALSE, ignore_walls = sound_wall_ignore, frequency = frequency)
|
||||
if(use_sound_tokens && sound_wall_ignore)
|
||||
playsoundtoken(source = user, soundin = tmp_sound, range = SOUND_RANGE, volume = 50)
|
||||
else
|
||||
playsound(source = user,soundin = tmp_sound,vol = 50, vary = FALSE, ignore_walls = sound_wall_ignore, frequency = frequency)
|
||||
|
||||
|
||||
var/is_important = running_emote_type & EMOTE_IMPORTANT
|
||||
|
||||
Reference in New Issue
Block a user