Reduced simple animal emote sounds to short range (#18806)

Reduced simple animal emote sounds to short range.
Turned the var that hold those sounds into a lazylist, saving memory (as
most simple animals don't have emote sounds).
This commit is contained in:
Fluffy
2024-04-04 10:44:22 +00:00
committed by GitHub
parent 252fd9dc42
commit fad2849536
2 changed files with 51 additions and 4 deletions
@@ -41,7 +41,9 @@
var/speak_chance = 0
var/list/emote_hear = list() //Hearable emotes
var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps
var/list/emote_sounds = list()
///A list of sounds that this animal will randomly play, lazy list
var/list/emote_sounds
var/sound_time = TRUE
var/turns_per_move = 1
@@ -475,7 +477,7 @@
//This is called when an animal 'speaks'. It does nothing here, but descendants should override it to add audio
/mob/living/simple_animal/proc/speak_audio()
if(emote_sounds.len)
if(LAZYLEN(emote_sounds))
make_noise(TRUE)
return
@@ -760,7 +762,10 @@
to_chat(usr, SPAN_WARNING("Ability on cooldown 2 seconds."))
return
playsound(src, pick(emote_sounds), 75, 1)
var/sound_to_play = LAZYPICK(emote_sounds, FALSE)
if(sound_to_play)
playsound(src, sound_to_play, 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
if(client)
sound_time = FALSE
addtimer(CALLBACK(src, PROC_REF(reset_sound_time)), 2 SECONDS)
@@ -800,7 +805,7 @@
if(speak_emote.len)
verb = pick(speak_emote)
if(emote_sounds.len)
if(LAZYLEN(emote_sounds))
var/sound_chance = TRUE
if(client) // we do not want people who assume direct control to spam
sound_chance = prob(50)
@@ -0,0 +1,42 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: FluffyGhost
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- tweak: "Reduced simple animal emote sounds to short range."
- backend: "Turned the var that hold those sounds into a lazylist, saving memory (as most simple animals don't have emote sounds)."