From 457aed320ab7919a15ed43f656bf7af45d0c2735 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Thu, 2 Jul 2026 20:28:58 -0700 Subject: [PATCH] [MIRROR] Cyborg Footsteps (#12872) Co-authored-by: Zerum <76460494+NateSaruli@users.noreply.github.com> Co-authored-by: Cameron Lennox --- code/datums/elements/footstep.dm | 48 +++++++++++++++---- .../modules/mob/living/silicon/robot/robot.dm | 8 ++++ code/modules/mob/living/silicon/silicon.dm | 2 +- code/modules/mob/transform_procs.dm | 1 + 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/code/datums/elements/footstep.dm b/code/datums/elements/footstep.dm index 9dd3e94a1c..4142662712 100644 --- a/code/datums/elements/footstep.dm +++ b/code/datums/elements/footstep.dm @@ -1,4 +1,6 @@ #define SHOULD_DISABLE_FOOTSTEPS(source) +#define VOLUME_MULTIPLIER 0.3 +#define RANGE_ADJUSTMENT 0 ///Footstep element. Plays footsteps at parents location when it is appropriate. /datum/element/footstep @@ -26,11 +28,18 @@ src.footstep_type = footstep_type src.sound_vary = sound_vary + //Human footsteps if(ishuman(target)) RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(play_humanstep)) steps_for_living[target] = 0 return + //Cyborg footsteps + if(isrobot(target)) + RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(play_robotstep)) + steps_for_living[target] = 0 + return + footstep_sounds = check_footstep_type(footstep_type) RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(play_simplestep)) @@ -117,8 +126,6 @@ /datum/element/footstep/proc/play_simplestep(mob/living/source, atom/oldloc, direction, forced, list/old_locs, momentum_change) SIGNAL_HANDLER - var/volume_multiplier = 0.3 - if(!isturf(source.loc)) return @@ -127,7 +134,7 @@ return if(isfile(footstep_sounds) || istext(footstep_sounds)) - playsound(source.loc, footstep_sounds, volume * volume_multiplier, falloff = 1, vary = sound_vary) + playsound(source.loc, footstep_sounds, volume * VOLUME_MULTIPLIER, falloff = 1, vary = sound_vary) return var/turf_footstep = prepared_steps[footstep_type] @@ -138,15 +145,12 @@ /datum/element/footstep/proc/play_humanstep(mob/living/carbon/human/source, atom/oldloc, direction, forced, list/old_locs, momentum_change) SIGNAL_HANDLER - var/volume_multiplier = 0.3 - var/range_adjustment = 0 - var/list/prepared_steps = prepare_step(source) if(isnull(prepared_steps)) return if (source.client?.prefs?.read_preference(/datum/preference/toggle/human/ignore_shoes)) - play_barefoot_sound(source, prepared_steps, volume_multiplier, range_adjustment) + play_barefoot_sound(source, prepared_steps, VOLUME_MULTIPLIER, RANGE_ADJUSTMENT) return //cache for sanic speed (lists are references anyways) @@ -160,13 +164,13 @@ var/shoestep_type = prepared_steps[FOOTSTEP_MOB_SHOE] if(!isnull(shoestep_type) && footstep_sounds[shoestep_type]) // shoestep type can be null playsound(source.loc, pick(footstep_sounds[shoestep_type][1]), - footstep_sounds[shoestep_type][2] * volume * volume_multiplier, + footstep_sounds[shoestep_type][2] * volume * VOLUME_MULTIPLIER, TRUE, - footstep_sounds[shoestep_type][3] + e_range + range_adjustment, falloff = 1, vary = sound_vary) + footstep_sounds[shoestep_type][3] + e_range + RANGE_ADJUSTMENT, falloff = 1, vary = sound_vary) return // we are barefoot - play_barefoot_sound(source, prepared_steps, volume_multiplier, range_adjustment) + play_barefoot_sound(source, prepared_steps, VOLUME_MULTIPLIER, RANGE_ADJUSTMENT) /datum/element/footstep/proc/play_barefoot_sound(mob/living/carbon/human/source, list/prepared_steps, volume_multiplier, range_adjustment) @@ -196,4 +200,28 @@ return playsound(source_loc, footstep_sounds, 50, falloff = 1, vary = sound_vary) + + +/datum/element/footstep/proc/play_robotstep(mob/living/silicon/robot/source, atom/oldloc, direction, forced, list/old_locs, momentum_change) + SIGNAL_HANDLER + + var/list/prepared_steps = prepare_step(source) + if(isnull(prepared_steps)) + return + + // we are barefoot + play_robot_sound(source, prepared_steps, VOLUME_MULTIPLIER, RANGE_ADJUSTMENT) + +/datum/element/footstep/proc/play_robot_sound(mob/living/silicon/robot/source, list/prepared_steps, volume_multiplier, range_adjustment) + var/barefoot_type = prepared_steps[FOOTSTEP_MOB_BAREFOOT] + var/bare_footstep_sounds = check_footstep_type(source.custom_footstep) + + if(!isnull(barefoot_type) && bare_footstep_sounds[barefoot_type]) // barefoot_type can be null + playsound(source.loc, pick(bare_footstep_sounds[barefoot_type][1]), + bare_footstep_sounds[barefoot_type][2] * volume * volume_multiplier, + TRUE, + bare_footstep_sounds[barefoot_type][3] + e_range + range_adjustment, falloff = 1, vary = sound_vary) + +#undef RANGE_ADJUSTMENT +#undef VOLUME_MULTIPLIER #undef SHOULD_DISABLE_FOOTSTEPS diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index d16b598521..e1ae2d354e 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -525,6 +525,14 @@ to_chat(src, span_filter_notice("You harmlessly spark.")) spark_system.start() +/mob/living/silicon/robot/verb/set_footstep() //Verb for borgs to change their footstep sound. + set category = "Abilities.Settings" + set name = "Adjust Footstep Sound" + var/selected_footstep = tgui_input_list(src, "Select a footstep sound.", "Footstep Sound", GLOB.selectable_footstep) + if(!(selected_footstep in GLOB.selectable_footstep)) + return + custom_footstep = GLOB.selectable_footstep[selected_footstep] + ///Essentially, a Activate Held Object mode for borgs that acts just like pressing Z in hotkey mode but also works well with multibelts. /mob/living/silicon/robot/verb/alt_mode() set name = "Robot Activate Held Object" diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index ad59a5fa64..a4394d13c8 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -39,7 +39,7 @@ apply_default_language(GLOB.all_languages[LANGUAGE_GALCOM]) init_subsystems() - AddElement(/datum/element/footstep, FOOTSTEP_MOB_SHOE, 1, -6) + AddElement(/datum/element/footstep, custom_footstep, 1, -6) /mob/living/silicon/Destroy() common_radio = null // same ref as radio, deleted by child diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 4550652a28..09186b6d19 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -188,6 +188,7 @@ O.resize(B.size_multiplier, animate = TRUE, ignore_prefs = TRUE) O.fuzzy = B.fuzzy O.custom_speech_bubble = B.custom_speech_bubble + O.custom_footstep = B.custom_footstep SEND_GLOBAL_SIGNAL(COMSIG_GLOB_BORGIFY, O)