Per-source movement sounds. (#22800)

Movement sounds for mobs are now handled by a single component. Movement
sounds are fed into it through signals, which contain both a movement
source (like an item for a mob, causing the sound) and a list of sounds
to pick from.

To-do:

- [x] Figure out how to do barefoot species sounds
- [x] Maybe movement sounds for simple mobs
- [x] More movement sounds for other items

---------

Signed-off-by: Matt Atlas <mattiathebest2000@hotmail.it>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
This commit is contained in:
Matt Atlas
2026-07-23 18:29:50 +00:00
committed by GitHub
co-authored by Matt Atlas VMSolidus
parent 901ad7f0cb
commit 5682f3c651
68 changed files with 365 additions and 43 deletions
@@ -10,6 +10,7 @@
mob_swap_flags = ~HEAVY
light_system = MOVABLE_LIGHT
blocks_emissive = EMISSIVE_BLOCK_NONE
footstep_component_type = /datum/component/mob_footsteps/human
/mob/living/carbon/human/Initialize(mapload, var/new_species = null)
if(!dna)
@@ -129,15 +129,7 @@
handle_leg_damage()
var/turf/T = get_turf(loc)
var/footsound
var/top_layer = 0
if(istype(T))
for(var/obj/structure/S in T)
if(S.layer > top_layer && S.footstep_sound)
top_layer = S.layer
footsound = S.footstep_sound
if(!footsound)
footsound = T.footstep_sound
if (client && T)
var/turf/T1 = GET_TURF_ABOVE(T)
@@ -149,16 +141,7 @@
return
last_x = x
last_y = y
if(shoes)
var/obj/item/clothing/shoes/S = shoes
if(S.do_special_footsteps(m_intent))
return
if (m_intent == M_RUN)
playsound(src, (is_noisy ? footsound : species.footsound), 70, TRUE, extrarange = MEDIUM_RANGE_SOUND_EXTRARANGE, required_asfx_toggles = ASFX_FOOTSTEPS)
else
footstep++
if (footstep % 2)
playsound(src, (is_noisy ? footsound : species.footsound), 40, TRUE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE, required_asfx_toggles = ASFX_FOOTSTEPS)
/mob/living/carbon/human/proc/handle_leg_damage()
if(!can_feel_pain())
+12
View File
@@ -917,6 +917,9 @@ default behaviour is:
register_init_signals()
AddElement(/datum/element/connect_loc, loc_connections)
load_footstep_component()
if(footstep_sound)
SEND_SIGNAL(src, COMSIG_MOB_ADD_FOOTSTEP_SOUND, src, footstep_sound)
/mob/living/Destroy()
cameraFollow = null
@@ -1075,3 +1078,12 @@ default behaviour is:
set_density(FALSE)
else
set_density(TRUE)
/**
* Used to override if a mob should have footsteps or not.
*/
/mob/living/proc/load_footstep_component()
if(anchored)
return
LoadComponent(footstep_component_type)
@@ -41,6 +41,10 @@
var/fire_stacks_temperature = 0
var/footstep = 0
/// The type of footstep components spawned for the mob. Particularly important for humans, which have barefoot sounds.
var/footstep_component_type = /datum/component/mob_footsteps
/// The footstep sounds we want to play.
var/list/footstep_sound
/// This is used to determine if the mob failed a breath. If they did fail a breath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/failed_last_breath = 0
@@ -51,6 +51,7 @@
attack_sound = 'sound/weapons/bite.ogg'
emote_sounds = list('sound/effects/creatures/spider_critter.ogg')
sample_data = list("Genetic markers identified as being linked with stem cell differentiaton", "Tissue sample contains high muscle content")
footstep_sound = 'sound/effects/creatures/spider_walk.ogg'
//nursemaids - these create webs and eggs
/mob/living/simple_animal/hostile/giant_spider/nurse
@@ -1158,6 +1158,11 @@
visual_effect_icon = ATTACK_EFFECT_SMASH
..()
/mob/living/simple_animal/load_footstep_component()
if(flying || !footstep_sound)
return
return ..()
#undef BLOOD_NONE
#undef BLOOD_LIGHT
#undef BLOOD_MEDIUM