Skip to content

Custom Shoe Sounds fix. #5388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/modules/clothing/shoes/boots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
. = ..()

create_storage(storage_type = /datum/storage/pockets/shoes)
AddElement(/datum/element/shoesteps/combine_boot_sounds) //MONKESTATION EDIT
AddComponent(/datum/component/shoesteps/combine_boot_sounds) //MONKESTATION EDIT

/obj/item/clothing/shoes/jackboots/fast
slowdown = -1
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/shoes/cowboy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//There's a snake in my boot
new /mob/living/basic/snake(src)

AddElement(/datum/element/shoesteps/combine_boot_sounds) //MONKESTATION EDIT
AddComponent(/datum/component/shoesteps/combine_boot_sounds) //MONKESTATION EDIT


/obj/item/clothing/shoes/cowboy/equipped(mob/living/carbon/user, slot)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
#define DOAFTER_SOURCE_SHOESTEP_TOGGLE "doafter_shoestep_toggle"

///A simple element that lets shoes have togglable custom sounds
/datum/element/shoesteps
/datum/component/shoesteps
dupe_mode = COMPONENT_DUPE_UNIQUE
var/list/custom_sounds = list()
var/sounds = TRUE

/datum/element/shoesteps/Attach(atom/movable/target)
. = ..()
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(target, COMSIG_CLICK_CTRL, PROC_REF(on_ctrl_click))
RegisterSignal(target, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
RegisterSignal(target, COMSIG_ITEM_DROPPED, PROC_REF(on_drop))
/datum/component/shoesteps/RegisterWithParent()
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(parent, COMSIG_CLICK_CTRL, PROC_REF(on_ctrl_click))
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop))

/datum/element/shoesteps/Detach(atom/source)
. = ..()
UnregisterSignal(source, list(COMSIG_ATOM_EXAMINE, COMSIG_CLICK_CTRL, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
/datum/component/shoesteps/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_ATOM_EXAMINE, COMSIG_CLICK_CTRL, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))

/datum/element/shoesteps/proc/on_examine(datum/source, mob/user, list/examine_text)
/datum/component/shoesteps/proc/on_examine(datum/source, mob/user, list/examine_text)
SIGNAL_HANDLER

examine_text += span_notice("There seems to be a noisemaker inside, which will change your walking sounds. You can enable or disable it using Ctrl Click.")
examine_text += span_notice("The noisemaker is currently [(sounds) ? "on" : "off"].")

/datum/element/shoesteps/proc/on_ctrl_click(datum/source, mob/living/carbon/clicker)
/datum/component/shoesteps/proc/on_ctrl_click(datum/source, mob/living/carbon/clicker)
SIGNAL_HANDLER

INVOKE_ASYNC(src, PROC_REF(toggle_sounds), clicker)

/datum/element/shoesteps/proc/toggle_sounds(mob/living/carbon/clicker)
/datum/component/shoesteps/proc/toggle_sounds(mob/living/carbon/clicker)
if(!DOING_INTERACTION(clicker, DOAFTER_SOURCE_SHOESTEP_TOGGLE))
if(do_after(clicker, 1.5 SECONDS, interaction_key = DOAFTER_SOURCE_SHOESTEP_TOGGLE))
sounds = !sounds
to_chat(clicker, span_warning("You turn the noisemaker [sounds ? "on" : "off"]."))

/datum/element/shoesteps/proc/on_equip(datum/source, mob/equipper, slot)
/datum/component/shoesteps/proc/on_equip(datum/source, mob/equipper, slot)
SIGNAL_HANDLER

if(ishuman(equipper) && (slot & ITEM_SLOT_FEET))
RegisterSignal(equipper, COMSIG_MOB_PREPARE_STEP_SOUND, PROC_REF(prepare_steps), override = TRUE)

/datum/element/shoesteps/proc/on_drop(datum/source, mob/living/carbon/user, slot)
/datum/component/shoesteps/proc/on_drop(datum/source, mob/living/carbon/user, slot)
SIGNAL_HANDLER

if(user.get_item_by_slot(ITEM_SLOT_FEET) == source)
UnregisterSignal(user, COMSIG_MOB_PREPARE_STEP_SOUND)

/datum/element/shoesteps/proc/prepare_steps(mob/living/carbon/source, list/steps)
/datum/component/shoesteps/proc/prepare_steps(mob/living/carbon/source, list/steps)
SIGNAL_HANDLER
if(sounds)
steps[STEP_SOUND_SHOE_OVERRIDE] = custom_sounds
Expand All @@ -63,7 +62,7 @@ extra range addition
)

*/
/datum/element/shoesteps/combine_boot_sounds
/datum/component/shoesteps/combine_boot_sounds
custom_sounds = list(
FOOTSTEP_WOOD = list(list(
'monkestation/sound/effects/hl2/footstep/combinewood1.ogg',
Expand Down Expand Up @@ -121,7 +120,7 @@ extra range addition
'monkestation/sound/effects/ballpit.ogg'), 100, 0),
)

/datum/element/shoesteps/orchestra_hit
/datum/component/shoesteps/orchestra_hit
custom_sounds = list(
FOOTSTEP_WOOD = list(list( // I would like to apologize for this. It was intended as a ohoho joke during development to show off it works
'monkestation/sound/effects/artifacts/orchestral/hit01.ogg',
Expand Down Expand Up @@ -324,6 +323,6 @@ extra range addition

/obj/item/clothing/shoes/clown_shoes/orchestra/Initialize(mapload)
. = ..()
AddElement(/datum/element/shoesteps/orchestra_hit)
AddComponent(/datum/component/shoesteps/orchestra_hit)

#undef DOAFTER_SOURCE_SHOESTEP_TOGGLE
2 changes: 1 addition & 1 deletion monkestation/code/modules/clothing/shoes/shoe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
/obj/item/clothing/shoes/civilprotection_boots/Initialize(mapload)//copied from jackboots (should these be a subtype of jackboots?)
. = ..()
create_storage(storage_type = /datum/storage/pockets/shoes)
AddElement(/datum/element/shoesteps/combine_boot_sounds)
AddComponent(/datum/component/shoesteps/combine_boot_sounds)

//START HEELS

Expand Down
2 changes: 1 addition & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -5976,6 +5976,7 @@
#include "monkestation\code\datums\components\lock_on_cursor.dm"
#include "monkestation\code\datums\components\multi_hit.dm"
#include "monkestation\code\datums\components\pixel_shift.dm"
#include "monkestation\code\datums\components\shoesteps.dm"
#include "monkestation\code\datums\components\throw_bounce.dm"
#include "monkestation\code\datums\components\turf_checker_complex.dm"
#include "monkestation\code\datums\components\turf_healing.dm"
Expand All @@ -5989,7 +5990,6 @@
#include "monkestation\code\datums\elements\basic_eating.dm"
#include "monkestation\code\datums\elements\light_eater.dm"
#include "monkestation\code\datums\elements\loomable.dm"
#include "monkestation\code\datums\elements\shoesteps.dm"
#include "monkestation\code\datums\elements\trash_if_empty.dm"
#include "monkestation\code\datums\elements\uncompressed_storage.dm"
#include "monkestation\code\datums\ert\moff_inspectors.dm"
Expand Down
Loading