Skip to content

Commit

Permalink
Prevent spamming climbing attempts (#3924)
Browse files Browse the repository at this point in the history
* Prevent spamming climbing `do_after`s

* Prevent chat spam
  • Loading branch information
Absolucy authored Oct 23, 2024
1 parent 89b8510 commit 21b3902
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/~monkestation/do_afters.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define DOAFTER_SOURCE_CLIMBING "doafter_climbing"
10 changes: 6 additions & 4 deletions code/datums/elements/climbable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]."), \
Expand All @@ -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

Expand Down Expand Up @@ -154,9 +154,11 @@

///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))
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)
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 21b3902

Please sign in to comment.