Add disabling footstep sounds and parallax to the lag switch panel (#62999)

At the last Toolbox Tournament, @MrStonedOne pointed out some big performance consumers. Some are disablable through easy means, but others were not. This adds two easy ones to the mix.
This commit is contained in:
Mothblocks
2021-11-22 23:19:33 -08:00
committed by GitHub
parent 96e85e0ff8
commit 6ea8b19eb9
5 changed files with 49 additions and 10 deletions
+11 -1
View File
@@ -1,3 +1,5 @@
#define SHOULD_DISABLE_FOOTSTEPS(source) ((SSlag_switch.measures[DISABLE_FOOTSTEPS] && !(HAS_TRAIT(source, TRAIT_BYPASS_MEASURES))) || HAS_TRAIT(source, TRAIT_SILENT_FOOTSTEPS))
///Footstep element. Plays footsteps at parents location when it is appropriate.
/datum/element/footstep
element_flags = ELEMENT_DETACH|ELEMENT_BESPOKE
@@ -92,6 +94,9 @@
/datum/element/footstep/proc/play_simplestep(mob/living/source)
SIGNAL_HANDLER
if (SHOULD_DISABLE_FOOTSTEPS(source))
return
var/turf/open/source_loc = prepare_step(source)
if(!source_loc)
return
@@ -115,7 +120,7 @@
/datum/element/footstep/proc/play_humanstep(mob/living/carbon/human/source)
SIGNAL_HANDLER
if(HAS_TRAIT(source, TRAIT_SILENT_FOOTSTEPS))
if (SHOULD_DISABLE_FOOTSTEPS(source))
return
var/volume_multiplier = 1
@@ -149,7 +154,12 @@
/datum/element/footstep/proc/play_simplestep_machine(atom/movable/source)
SIGNAL_HANDLER
if (SHOULD_DISABLE_FOOTSTEPS(source))
return
var/turf/open/source_loc = get_turf(source)
if(!istype(source_loc))
return
playsound(source_loc, footstep_sounds, 50, falloff_distance = 1, vary = sound_vary)
#undef SHOULD_DISABLE_FOOTSTEPS