From 39af91989263da9873e69f1e4d03bcaf365b2114 Mon Sep 17 00:00:00 2001 From: Lucy Date: Tue, 22 Oct 2024 22:29:25 -0400 Subject: [PATCH 1/2] Prevent spamming climbing `do_after`s --- code/__DEFINES/~monkestation/do_afters.dm | 1 + code/datums/elements/climbable.dm | 6 +++--- tgstation.dme | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 code/__DEFINES/~monkestation/do_afters.dm diff --git a/code/__DEFINES/~monkestation/do_afters.dm b/code/__DEFINES/~monkestation/do_afters.dm new file mode 100644 index 000000000000..d874131ac265 --- /dev/null +++ b/code/__DEFINES/~monkestation/do_afters.dm @@ -0,0 +1 @@ +#define DOAFTER_SOURCE_CLIMBING "doafter_climbing" diff --git a/code/datums/elements/climbable.dm b/code/datums/elements/climbable.dm index 0916ec149678..15e9c5d292e4 100644 --- a/code/datums/elements/climbable.dm +++ b/code/datums/elements/climbable.dm @@ -72,7 +72,7 @@ adjusted_climb_time *= 0.3 //monkestation edit - CYBERNETICS LAZYADDASSOCLIST(current_climbers, climbed_thing, user) - if(do_after(user, adjusted_climb_time, climbed_thing)) + if(do_after(user, adjusted_climb_time, climbed_thing, interaction_key = DOAFTER_SOURCE_CLIMBING)) // monkestation edit: add an interaction key if(QDELETED(climbed_thing)) //Checking if structure has been destroyed return @@ -155,8 +155,8 @@ ///Tries to climb onto the target if the forced movement of the mob allows it /datum/element/climbable/proc/attempt_sprint_climb(datum/source, mob/bumpee) if(HAS_TRAIT(bumpee, TRAIT_FREERUNNING)) - if(do_after(bumpee, climb_time, source)) + if(do_after(bumpee, climb_time, source, interaction_key = DOAFTER_SOURCE_CLIMBING)) do_climb(source, bumpee) else - if(do_after(bumpee, climb_time * 1.2, source)) + if(do_after(bumpee, climb_time * 1.2, source, interaction_key = DOAFTER_SOURCE_CLIMBING)) do_climb(source, bumpee) diff --git a/tgstation.dme b/tgstation.dme index e14aba6c89d9..9827a6879b06 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -422,6 +422,7 @@ #include "code\__DEFINES\~monkestation\cooldowns.dm" #include "code\__DEFINES\~monkestation\cybernetics.dm" #include "code\__DEFINES\~monkestation\DNA.dm" +#include "code\__DEFINES\~monkestation\do_afters.dm" #include "code\__DEFINES\~monkestation\elevation.dm" #include "code\__DEFINES\~monkestation\factions.dm" #include "code\__DEFINES\~monkestation\guns.dm" From a468735e20564216cf49bf1a967a8022c744b05f Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 23 Oct 2024 03:37:05 -0400 Subject: [PATCH 2/2] Prevent chat spam --- code/datums/elements/climbable.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/datums/elements/climbable.dm b/code/datums/elements/climbable.dm index 15e9c5d292e4..89843e08a22c 100644 --- a/code/datums/elements/climbable.dm +++ b/code/datums/elements/climbable.dm @@ -54,7 +54,7 @@ /datum/element/climbable/proc/climb_structure(atom/climbed_thing, mob/living/user, params) - if(!can_climb(climbed_thing, user)) + if(!can_climb(climbed_thing, user) || DOING_INTERACTION(user, DOAFTER_SOURCE_CLIMBING)) return climbed_thing.add_fingerprint(user) user.visible_message(span_warning("[user] starts climbing onto [climbed_thing]."), \ @@ -154,6 +154,8 @@ ///Tries to climb onto the target if the forced movement of the mob allows it /datum/element/climbable/proc/attempt_sprint_climb(datum/source, mob/bumpee) + if(DOING_INTERACTION(bumpee, DOAFTER_SOURCE_CLIMBING)) + return if(HAS_TRAIT(bumpee, TRAIT_FREERUNNING)) if(do_after(bumpee, climb_time, source, interaction_key = DOAFTER_SOURCE_CLIMBING)) do_climb(source, bumpee)