Skip to content

Commit cc136bc

Browse files
authored
Sound tweaks (#996)
* fix ghosts not hearing droning * change sound envs * footstep improvements * volume adjustments * fixes ambience for ghosts * fix ambient droning
1 parent 7de1a23 commit cc136bc

File tree

22 files changed

+122
-62
lines changed

22 files changed

+122
-62
lines changed

code/__DEFINES/footsteps.dm

+20-5
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ GLOBAL_LIST_INIT(footstep, list(
5555
'sound/effects/footstep/wood1.ogg',
5656
'sound/effects/footstep/wood2.ogg',
5757
'sound/effects/footstep/wood3.ogg',
58-
'sound/effects/footstep/wood4.ogg'), 100, 0),
58+
'sound/effects/footstep/wood4.ogg'), 80, 0),
5959
FOOTSTEP_FLOOR = list(list(
6060
'sound/effects/footstep/floor1.ogg',
6161
'sound/effects/footstep/floor2.ogg',
6262
'sound/effects/footstep/floor3.ogg',
6363
'sound/effects/footstep/floor4.ogg',
64-
'goon/sounds/footstep/floor5.ogg'), 75, -1),
64+
'goon/sounds/footstep/floor5.ogg'), 50, -1),
6565
FOOTSTEP_PLATING = list(list(
6666
'sound/effects/footstep/plating1.ogg',
6767
'sound/effects/footstep/plating2.ogg',
6868
'sound/effects/footstep/plating3.ogg',
69-
'sound/effects/footstep/plating4.ogg'), 100, 1),
69+
'sound/effects/footstep/plating4.ogg'), 70, 1),
7070
FOOTSTEP_CARPET = list(list(
7171
'sound/effects/footstep/carpet1.ogg',
7272
'sound/effects/footstep/carpet2.ogg',
@@ -105,12 +105,12 @@ GLOBAL_LIST_INIT(barefootstep, list(
105105
'sound/effects/footstep/woodbarefoot1.ogg',
106106
'sound/effects/footstep/woodbarefoot2.ogg',
107107
'sound/effects/footstep/woodbarefoot3.ogg',
108-
'sound/effects/footstep/woodbarefoot4.ogg'), 80, -1),
108+
'sound/effects/footstep/woodbarefoot4.ogg'), 20, -1),
109109
FOOTSTEP_HARD_BAREFOOT = list(list(
110110
'sound/effects/footstep/hardbarefoot1.ogg',
111111
'sound/effects/footstep/hardbarefoot2.ogg',
112112
'sound/effects/footstep/hardbarefoot3.ogg',
113-
'sound/effects/footstep/hardbarefoot4.ogg'), 80, -1),
113+
'sound/effects/footstep/hardbarefoot4.ogg'), 20, -1),
114114
FOOTSTEP_CARPET_BAREFOOT = list(list(
115115
'sound/effects/footstep/carpetbarefoot1.ogg',
116116
'sound/effects/footstep/carpetbarefoot2.ogg',
@@ -138,6 +138,11 @@ GLOBAL_LIST_INIT(barefootstep, list(
138138
'sound/effects/footstep/lava3.ogg'), 100, 0),
139139
FOOTSTEP_MEAT = list(list(
140140
'sound/effects/meatslap.ogg'), 100, 0),
141+
FOOTSTEP_CATWALK = list(list(
142+
'sound/effects/footstep/catwalk1.ogg',
143+
'sound/effects/footstep/catwalk2.ogg',
144+
'sound/effects/footstep/catwalk3.ogg',
145+
'sound/effects/footstep/catwalk4.ogg'), 30, 1),
141146
))
142147

143148
//claw footsteps lists
@@ -181,6 +186,11 @@ GLOBAL_LIST_INIT(clawfootstep, list(
181186
'sound/effects/footstep/lava3.ogg'), 100, 0),
182187
FOOTSTEP_MEAT = list(list(
183188
'sound/effects/meatslap.ogg'), 100, 0),
189+
FOOTSTEP_CATWALK = list(list(
190+
'sound/effects/footstep/catwalk1.ogg',
191+
'sound/effects/footstep/catwalk2.ogg',
192+
'sound/effects/footstep/catwalk3.ogg',
193+
'sound/effects/footstep/catwalk4.ogg'), 60, 1),
184194
))
185195

186196
//heavy footsteps list
@@ -199,5 +209,10 @@ GLOBAL_LIST_INIT(heavyfootstep, list(
199209
'sound/effects/footstep/lava3.ogg'), 100, 0),
200210
FOOTSTEP_MEAT = list(list(
201211
'sound/effects/meatslap.ogg'), 100, 0),
212+
FOOTSTEP_CATWALK = list(list(
213+
'sound/effects/footstep/catwalk1.ogg',
214+
'sound/effects/footstep/catwalk2.ogg',
215+
'sound/effects/footstep/catwalk3.ogg',
216+
'sound/effects/footstep/catwalk4.ogg'), 100, 1),
202217
))
203218

code/__DEFINES/sound.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@
8282
#define SOUND_ENVIROMENT_PHASED list(1.8, 0.5, -1000, -4000, 0, 5, 0.1, 1, -15500, 0.007, 2000, 0.05, 0.25, 1, 1.18, 0.348, -5, 2000, 250, 0, 3, 100, 63)
8383

8484
//"sound areas": easy way of keeping different types of areas consistent.
85-
#define SOUND_AREA_STANDARD_STATION SOUND_ENVIRONMENT_PARKING_LOT
86-
#define SOUND_AREA_LARGE_ENCLOSED SOUND_ENVIRONMENT_QUARRY
85+
#define SOUND_AREA_STANDARD_STATION SOUND_ENVIRONMENT_STONEROOM
86+
#define SOUND_AREA_LARGE_ENCLOSED SOUND_ENVIRONMENT_HANGAR
8787
#define SOUND_AREA_SMALL_ENCLOSED SOUND_ENVIRONMENT_BATHROOM
88-
#define SOUND_AREA_TUNNEL_ENCLOSED SOUND_ENVIRONMENT_STONEROOM
88+
#define SOUND_AREA_TUNNEL_ENCLOSED SOUND_ENVIRONMENT_CAVE
8989
#define SOUND_AREA_LARGE_SOFTFLOOR SOUND_ENVIRONMENT_CARPETED_HALLWAY
9090
#define SOUND_AREA_MEDIUM_SOFTFLOOR SOUND_ENVIRONMENT_LIVINGROOM
9191
#define SOUND_AREA_SMALL_SOFTFLOOR SOUND_ENVIRONMENT_ROOM

code/controllers/subsystem/ambience.dm

+43
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,46 @@ SUBSYSTEM_DEF(ambience)
9191
if(!M.has_light_nearby() && prob(0.5))
9292
return ..(M, pick(minecraft_cave_noises))
9393
return ..()
94+
95+
/// Set the mob's tracked ambience area, and unset the old one.
96+
/mob/proc/update_ambience_area(area/new_area)
97+
var/old_tracked_area = ambience_tracked_area
98+
if(old_tracked_area)
99+
UnregisterSignal(old_tracked_area, COMSIG_AREA_POWER_CHANGE)
100+
ambience_tracked_area = null
101+
102+
if(!client)
103+
playing_ambience = null
104+
return
105+
106+
if(new_area)
107+
ambience_tracked_area = new_area
108+
RegisterSignal(ambience_tracked_area, COMSIG_AREA_POWER_CHANGE, PROC_REF(refresh_looping_ambience), TRUE)
109+
110+
refresh_looping_ambience()
111+
112+
///Tries to play looping ambience to the mobs.
113+
/mob/proc/refresh_looping_ambience()
114+
SIGNAL_HANDLER
115+
if(!client)
116+
return
117+
118+
var/area/my_area = get_area(src)
119+
120+
if(!(client.prefs.toggles & SOUND_SHIP_AMBIENCE) || !my_area?.ambient_buzz)
121+
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
122+
playing_ambience = null
123+
return
124+
125+
//Station ambience is dependant on a functioning and charged APC.
126+
if(!is_mining_level(my_area.z) && ((!my_area.apc || !my_area.apc.operating || !my_area.apc.cell?.charge && my_area.requires_power)))
127+
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
128+
playing_ambience = null
129+
return
130+
131+
else
132+
if(playing_ambience == ambience_tracked_area?.ambient_buzz)
133+
return
134+
135+
playing_ambience = my_area.ambient_buzz
136+
SEND_SOUND(src, sound(my_area.ambient_buzz, repeat = 1, wait = 0, volume = my_area.ambient_buzz_vol, channel = CHANNEL_BUZZ))

code/datums/elements/footstep.dm

+28-14
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,15 @@
7676
var/mob/living/carbon/carbon_source = source
7777
if(!carbon_source.get_bodypart(BODY_ZONE_L_LEG) && !carbon_source.get_bodypart(BODY_ZONE_R_LEG))
7878
return
79-
if(carbon_source.m_intent == MOVE_INTENT_WALK)
80-
return// stealth
8179

8280
steps_for_living[source] += 1
8381
var/steps = steps_for_living[source]
8482

85-
if(steps >= 6)
83+
if(steps >= 8)
8684
steps_for_living[source] = 0
8785
steps = 0
8886

89-
if(steps % 2)
87+
if(floor(steps) % 2)
9088
return
9189

9290
if(steps != 0 && !source.has_gravity()) // don't need to step as often when you hop around
@@ -109,7 +107,7 @@
109107
/datum/element/footstep/proc/play_simplestep(mob/living/source, atom/oldloc, direction, forced, list/old_locs, momentum_change)
110108
SIGNAL_HANDLER
111109

112-
if (forced || SHOULD_DISABLE_FOOTSTEPS(source))
110+
if (forced || SHOULD_DISABLE_FOOTSTEPS(source) || source.moving_diagonally == SECOND_DIAG_STEP)
113111
return
114112

115113
var/list/prepared_steps = prepare_step(source)
@@ -137,13 +135,13 @@
137135
/datum/element/footstep/proc/play_humanstep(mob/living/carbon/human/source, atom/oldloc, direction, forced, list/old_locs, momentum_change)
138136
SIGNAL_HANDLER
139137

140-
if (forced || SHOULD_DISABLE_FOOTSTEPS(source) || !momentum_change)
138+
if (forced || SHOULD_DISABLE_FOOTSTEPS(source) || !momentum_change || source.moving_diagonally == SECOND_DIAG_STEP)
141139
return
142140

143141
var/volume_multiplier = 1
144142
var/range_adjustment = 0
145143

146-
if(HAS_TRAIT(source, TRAIT_LIGHT_STEP))
144+
if((source.m_intent == MOVE_INTENT_WALK) || HAS_TRAIT(source, TRAIT_LIGHT_STEP))
147145
volume_multiplier = 0.6
148146
range_adjustment = -2
149147

@@ -183,15 +181,31 @@
183181
vary = sound_vary
184182
)
185183
else
186-
var/barefoot_type = prepared_steps[FOOTSTEP_MOB_BAREFOOT]
187-
var/bare_footstep_sounds = GLOB.barefootstep
188-
if(!isnull(barefoot_type) && bare_footstep_sounds[barefoot_type])
184+
var/obj/item/bodypart/leg/right_leg = source.get_bodypart(BODY_ZONE_R_LEG)
185+
var/obj/item/bodypart/leg/left_leg = source.get_bodypart(BODY_ZONE_L_LEG)
186+
var/barefoot_type = right_leg?.barefoot_step_type
187+
if(!barefoot_type || left_leg && prob(50))
188+
barefoot_type = left_leg.barefoot_step_type
189+
190+
var/list/turf_sound_type = prepared_steps[barefoot_type]
191+
var/list/sound_pool
192+
switch(barefoot_type)
193+
if(FOOTSTEP_MOB_CLAW)
194+
sound_pool = GLOB.clawfootstep
195+
if(FOOTSTEP_MOB_BAREFOOT)
196+
sound_pool = GLOB.barefootstep
197+
if(FOOTSTEP_MOB_HEAVY)
198+
sound_pool = GLOB.heavyfootstep
199+
if(FOOTSTEP_MOB_SHOE)
200+
sound_pool = GLOB.footstep
201+
202+
if(!isnull(sound_pool) && !isnull(barefoot_type) && sound_pool[turf_sound_type])
189203
heard_clients = playsound(
190204
source.loc,
191-
pick(bare_footstep_sounds[barefoot_type][1]),
192-
bare_footstep_sounds[barefoot_type][2] * volume * volume_multiplier,
205+
pick(sound_pool[turf_sound_type][1]),
206+
sound_pool[turf_sound_type][2] * volume * volume_multiplier,
193207
TRUE,
194-
bare_footstep_sounds[barefoot_type][3] + e_range + range_adjustment,
208+
sound_pool[turf_sound_type][3] + e_range + range_adjustment,
195209
falloff_distance = 1,
196210
vary = sound_vary
197211
)
@@ -203,7 +217,7 @@
203217
/datum/element/footstep/proc/play_simplestep_machine(atom/movable/source, atom/oldloc, direction, forced, list/old_locs, momentum_change)
204218
SIGNAL_HANDLER
205219

206-
if (forced || SHOULD_DISABLE_FOOTSTEPS(source))
220+
if (forced || SHOULD_DISABLE_FOOTSTEPS(source) || source.moving_diagonally == SECOND_DIAG_STEP)
207221
return
208222

209223
var/turf/open/source_loc = get_turf(source)

code/game/area/areas.dm

+3-37
Original file line numberDiff line numberDiff line change
@@ -403,43 +403,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
403403
for(var/atom/movable/recipient as anything in arrived.important_recursive_contents[RECURSIVE_CONTENTS_AREA_SENSITIVE])
404404
SEND_SIGNAL(recipient, COMSIG_ENTER_AREA, src)
405405

406-
if(!isliving(arrived))
407-
return
408-
409-
var/mob/living/L = arrived
410-
if(!L.ckey)
411-
return
412-
413-
if(old_area)
414-
L.UnregisterSignal(old_area, COMSIG_AREA_POWER_CHANGE)
415-
L.RegisterSignal(src, COMSIG_AREA_POWER_CHANGE, TYPE_PROC_REF(/mob, refresh_looping_ambience), TRUE)
416-
417-
if(L.playing_ambience != ambient_buzz)
418-
L.refresh_looping_ambience()
419-
420-
///Tries to play looping ambience to the mobs.
421-
/mob/proc/refresh_looping_ambience()
422-
SIGNAL_HANDLER
423-
if(!client)
424-
return
425-
426-
var/area/my_area = get_area(src)
427-
428-
if(!(client?.prefs.toggles & SOUND_SHIP_AMBIENCE) || !my_area.ambient_buzz)
429-
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
430-
playing_ambience = null
431-
return
432-
433-
//Station ambience is dependant on a functioning and charged APC.
434-
if(!is_mining_level(my_area.z) && ((!my_area.apc || !my_area.apc.operating || !my_area.apc.cell?.charge && my_area.requires_power)))
435-
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
436-
playing_ambience = null
437-
return
438-
439-
else
440-
playing_ambience = my_area.ambient_buzz
441-
SEND_SOUND(src, sound(my_area.ambient_buzz, repeat = 1, wait = 0, volume = my_area.ambient_buzz_vol, channel = CHANNEL_BUZZ))
442-
406+
if(ismob(arrived))
407+
var/mob/M = arrived
408+
M.update_ambience_area(src)
443409

444410
/**
445411
* Called when an atom exits an area

code/game/area/areas/misc.dm

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ambience_index = AMBIENCE_SPACE
1616
flags_1 = CAN_BE_DIRTY_1
1717
sound_environment = SOUND_AREA_SPACE
18+
ambient_buzz = null
1819

1920
/area/space/nearstation
2021
icon_state = "space_near"

code/game/area/areas/station.dm

+2
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,8 @@
13451345
power_environ = FALSE
13461346
area_flags = NO_ALERTS
13471347
outdoors = TRUE
1348+
1349+
ambient_buzz = null
13481350
ambience_index = AMBIENCE_SPACE
13491351
flags_1 = CAN_BE_DIRTY_1
13501352
sound_environment = SOUND_AREA_SPACE

code/game/objects/structures/lattice.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
/obj/structure/lattice/catwalk/Initialize(mapload)
9090
. = ..()
91-
AddElement(/datum/element/footstep_override, footstep = FOOTSTEP_CATWALK)
91+
AddElement(/datum/element/footstep_override, clawfootstep = FOOTSTEP_CATWALK, heavyfootstep = FOOTSTEP_CATWALK, footstep = FOOTSTEP_CATWALK)
9292

9393
/obj/structure/lattice/catwalk/deconstruction_hints(mob/user)
9494
return span_notice("The supporting rods look like they could be <b>cut</b>.")

code/game/turfs/open/floor/overfloor_catwalk.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
var/turf/T = loc
4646
T.update_underfloor_accessibility()
4747

48-
AddElement(/datum/element/footstep_override, footstep = FOOTSTEP_CATWALK)
48+
AddElement(/datum/element/footstep_override, clawfootstep = FOOTSTEP_CATWALK, heavyfootstep = FOOTSTEP_CATWALK, footstep = FOOTSTEP_CATWALK)
4949

5050
var/static/list/loc_connections = list(
5151
COMSIG_TURF_CHANGE = PROC_REF(pre_turf_change)

code/modules/client/preferences/middleware/legacy_toggles.dm

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
else
119119
user.stop_sound_channel(CHANNEL_LOBBYMUSIC)
120120

121+
if(legacy_flag == SOUND_SHIP_AMBIENCE)
122+
user.refresh_looping_ambience()
121123
return TRUE
122124

123125
var/legacy_chat_flag = legacy_chat_toggles[preference]

code/modules/mob/dead/observer/observer.dm

+5
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
304304
abstract_move(destination) // move like the wind
305305
return TRUE
306306

307+
/mob/dead/observer/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change)
308+
. = ..()
309+
var/area/new_area = get_area(src)
310+
update_ambience_area(new_area)
311+
307312
/mob/dead/observer/verb/reenter_corpse()
308313
set category = "Ghost"
309314
set name = "Re-enter Corpse"

code/modules/mob/login.dm

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191

9292
update_client_colour()
9393
update_mouse_pointer()
94+
update_ambience_area(get_area(src))
95+
9496
if(client)
9597
if(client.view_size)
9698
client.view_size.resetToDefault() // Resets the client.view in case it was changed.

code/modules/mob/logout.dm

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
SStgui.on_logout(src)
55
unset_machine()
66
remove_from_player_list()
7+
update_ambience_area(null) // Unset ambience vars so it plays again on login
78
..()
89

910
if(loc)

code/modules/mob/mob_defines.dm

+2
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,5 @@
228228

229229
/// Keeps track of what ambience we are playing. Yeah i know it sucks.
230230
var/playing_ambience
231+
/// A ref of the area we're taking our ambient loop from.
232+
var/area/ambience_tracked_area

code/modules/surgery/bodyparts/parts.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@
294294
var/digitigrade_id
295295
/// Used solely by digitigrade limbs to remember what their old limb ID was.
296296
var/old_limb_id
297-
297+
/// Used by the footstep element.
298+
var/barefoot_step_type = FOOTSTEP_MOB_BAREFOOT
298299

299300
/obj/item/bodypart/leg/left
300301
name = "left leg"

code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm

+2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
limb_id = SPECIES_LIZARD
3737
can_be_digitigrade = TRUE
3838
digitigrade_id = "digitigrade"
39+
barefoot_step_type = FOOTSTEP_MOB_CLAW
3940

4041
/obj/item/bodypart/leg/right/lizard
4142
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
4243
limb_id = SPECIES_LIZARD
4344
can_be_digitigrade = TRUE
4445
digitigrade_id = "digitigrade"
46+
barefoot_step_type = FOOTSTEP_MOB_CLAW

code/modules/surgery/bodyparts/species_parts/teshari_bodyparts.dm

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
limb_id = SPECIES_TESHARI
6363
should_draw_greyscale = TRUE
6464
bodytype = BODYTYPE_TESHARI | BODYTYPE_ORGANIC
65+
barefoot_step_type = FOOTSTEP_MOB_CLAW
6566

6667
/obj/item/bodypart/leg/left/teshari
6768
icon_greyscale = 'icons/mob/species/teshari/bodyparts.dmi'
@@ -72,6 +73,7 @@
7273
limb_id = SPECIES_TESHARI
7374
should_draw_greyscale = TRUE
7475
bodytype = BODYTYPE_TESHARI | BODYTYPE_ORGANIC
76+
barefoot_step_type = FOOTSTEP_MOB_CLAW
7577

7678
///////////////////////////////////////////////////////////
7779
/obj/item/bodypart/head/robot/surplus/teshari

0 commit comments

Comments
 (0)