From 181de5568507a2164f58354e18a379fadde65c54 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:30:31 -0700 Subject: [PATCH 1/7] Update miscellaneous.dm --- code/modules/clothing/shoes/miscellaneous.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index b0d760ebd9..db4db25258 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -298,7 +298,7 @@ /obj/item/clothing/shoes/bronze/Initialize() . = ..() - AddComponent(/datum/component/squeak, list('sound/machines/clockcult/integration_cog_install.ogg' = 1, 'sound/magic/clockwork/fellowship_armory.ogg' = 1), 50) + AddComponent(/datum/component/squeak, list('sound/machines/clockcult/integration_cog_install.ogg' = 1, 'sound/magic/clockwork/fellowship_armory.ogg' = 1), 50, footstep_only = TRUE) /obj/item/clothing/shoes/wheelys name = "Wheely-Heels" From 29228a9df4e5cd6b5f46c69c474fa7c11d50c1f0 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:36:53 -0700 Subject: [PATCH 2/7] Update squeak.dm --- code/datums/components/squeak.dm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 792222b27b..2cbf0828a2 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -11,6 +11,13 @@ // This is to stop squeak spam from inhand usage var/last_use = 0 var/use_delay = 20 + + // squeak cooldowns + var/last_squeak = 0 + var/squeak_delay = 10 + + /// chance we'll be stopped from squeaking by cooldown when something crossing us squeaks + var/cross_squeak_delay_chance = 33 // about 3 things can squeak at a time /datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override) if(!isatom(parent)) @@ -19,6 +26,7 @@ if(ismovable(parent)) RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT), .proc/play_squeak) RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ITEM_WEARERCROSSED), .proc/play_squeak_crossed) + RegisterSignal(parent, COMSIG_CROSS_SQUEAKED, .proc/delay_squeak) RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react) if(isitem(parent)) RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), .proc/play_squeak) @@ -39,6 +47,9 @@ use_delay = use_delay_override /datum/component/squeak/proc/play_squeak() + if(last_squeak + squeak_delay < world.time) + return + last_squeak = world.time if(prob(squeak_chance)) if(!override_squeak_sounds) playsound(parent, pickweight(default_squeak_sounds), volume, 1, -1) @@ -52,7 +63,7 @@ else steps++ -/datum/component/squeak/proc/play_squeak_crossed(atom/movable/AM) +/datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/AM) if(isitem(AM)) var/obj/item/I = AM if(I.item_flags & ABSTRACT) @@ -64,12 +75,17 @@ var/atom/current_parent = parent if(isturf(current_parent.loc)) play_squeak() + SEND_SIGNAL(AM, COMSIG_CROSS_SQUEAKED) /datum/component/squeak/proc/use_squeak() if(last_use + use_delay < world.time) last_use = world.time play_squeak() +/datum/component/squeak/proc/delay_squeak() + if(prob(cross_squeak_delay_chance)) + last_squeak = world.time + /datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot) RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE) From 58a19ffe4b74a9cab1a9dc850b597a4e1da7c9fc Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:38:11 -0700 Subject: [PATCH 3/7] Update signals.dm --- code/__DEFINES/dcs/signals.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 7e1a83486d..f006caf1c1 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -452,6 +452,9 @@ #define COMPONENT_TWOHANDED_BLOCK_WIELD 1 #define COMSIG_TWOHANDED_UNWIELD "twohanded_unwield" //from base of datum/component/two_handed/proc/unwield(mob/living/carbon/user): (/mob/user) +// /datum/component/squeak signals +#define COMSIG_CROSS_SQUEAKED "cross_squeaked" // sent when a squeak component squeaks from crossing something, to delay anything else crossing that might squeak to prevent ear hurt. + // /datum/action signals #define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action) #define COMPONENT_ACTION_BLOCK_TRIGGER 1 From 10d23efa87dfe79647fd160574c39b8fba21cc22 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:38:35 -0700 Subject: [PATCH 4/7] Update miscellaneous.dm --- code/modules/clothing/shoes/miscellaneous.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index db4db25258..b0d760ebd9 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -298,7 +298,7 @@ /obj/item/clothing/shoes/bronze/Initialize() . = ..() - AddComponent(/datum/component/squeak, list('sound/machines/clockcult/integration_cog_install.ogg' = 1, 'sound/magic/clockwork/fellowship_armory.ogg' = 1), 50, footstep_only = TRUE) + AddComponent(/datum/component/squeak, list('sound/machines/clockcult/integration_cog_install.ogg' = 1, 'sound/magic/clockwork/fellowship_armory.ogg' = 1), 50) /obj/item/clothing/shoes/wheelys name = "Wheely-Heels" From 79313209c356efd9862b64f567ddb8bda6b316e6 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:42:13 -0700 Subject: [PATCH 5/7] Update squeak.dm --- code/datums/components/squeak.dm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 2cbf0828a2..452a781e6b 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -14,7 +14,7 @@ // squeak cooldowns var/last_squeak = 0 - var/squeak_delay = 10 + var/squeak_delay = 5 /// chance we'll be stopped from squeaking by cooldown when something crossing us squeaks var/cross_squeak_delay_chance = 33 // about 3 things can squeak at a time @@ -47,9 +47,13 @@ use_delay = use_delay_override /datum/component/squeak/proc/play_squeak() - if(last_squeak + squeak_delay < world.time) - return - last_squeak = world.time + do_play_squeak() + +/datum/component/squeak/proc/do_play_squeak(bypass_cooldown = FALSE) + if(!bypass_cooldown) + last_squeak + squeak_delay < world.time) + return + last_squeak = world.time if(prob(squeak_chance)) if(!override_squeak_sounds) playsound(parent, pickweight(default_squeak_sounds), volume, 1, -1) @@ -58,7 +62,7 @@ /datum/component/squeak/proc/step_squeak() if(steps > step_delay) - play_squeak() + do_play_squeak(TRUE) steps = 0 else steps++ From 23880e284a53b5c06022200e351e271b565d94d7 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 6 Aug 2020 21:48:01 -0700 Subject: [PATCH 6/7] Update squeak.dm --- code/datums/components/squeak.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 452a781e6b..d3bd72968f 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -50,15 +50,16 @@ do_play_squeak() /datum/component/squeak/proc/do_play_squeak(bypass_cooldown = FALSE) - if(!bypass_cooldown) - last_squeak + squeak_delay < world.time) - return - last_squeak = world.time + if(!bypass_cooldown && ((last_squeak + squeak_delay) < world.time)) + return FALSE if(prob(squeak_chance)) if(!override_squeak_sounds) playsound(parent, pickweight(default_squeak_sounds), volume, 1, -1) else playsound(parent, pickweight(override_squeak_sounds), volume, 1, -1) + last_squeak = world.time + return TRUE + return FALSE /datum/component/squeak/proc/step_squeak() if(steps > step_delay) @@ -78,8 +79,8 @@ return var/atom/current_parent = parent if(isturf(current_parent.loc)) - play_squeak() - SEND_SIGNAL(AM, COMSIG_CROSS_SQUEAKED) + if(do_play_squeak()) + SEND_SIGNAL(AM, COMSIG_CROSS_SQUEAKED) /datum/component/squeak/proc/use_squeak() if(last_use + use_delay < world.time) From 94fa7e4fbba519ac274a0802808e0c51127ed9db Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Fri, 7 Aug 2020 01:06:23 -0700 Subject: [PATCH 7/7] Update squeak.dm --- code/datums/components/squeak.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index d3bd72968f..df44aef4de 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -50,7 +50,7 @@ do_play_squeak() /datum/component/squeak/proc/do_play_squeak(bypass_cooldown = FALSE) - if(!bypass_cooldown && ((last_squeak + squeak_delay) < world.time)) + if(!bypass_cooldown && ((last_squeak + squeak_delay) >= world.time)) return FALSE if(prob(squeak_chance)) if(!override_squeak_sounds)