Skip to content

Commit

Permalink
Prevents spamming open and close tarps (#3768)
Browse files Browse the repository at this point in the history
# About the pull request

Fixes #3734
Deals with exploit that allows the user to spam open and close a tarp,
making it hard for the Xeno to hit the marine, this makes it so when
tarp is opened, 3 seconds must pass before it can be closed again. If 3
seconds isn't enough, delay can be lengthened.

# Explain why it's good for the game

I was tasked by the Xeno Agents to buff Xeno win rate by any means
necessary, including fixing exploits.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


https://github.com/cmss13-devs/cmss13/assets/91219575/999e0f72-a802-41d3-b1d8-5a4569d84e5a

Before


![image](https://github.com/cmss13-devs/cmss13/assets/91219575/7eb71b25-4077-4042-bab6-760f0c429190)
After

</details>


# Changelog
:cl:
fix: fixes exploit relating to cloaking tarps by adding a delay before
tarp can be closed again.
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
Ben10083 and harryob committed Jun 30, 2023
1 parent ed90141 commit 96b578e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

/obj/structure/closet/proc/toggle(mob/living/user)
user.next_move = world.time + 5
if(!(src.opened ? src.close() : src.open()))
if(!(src.opened ? src.close(user) : src.open()))
to_chat(user, SPAN_NOTICE("It won't budge!"))
return

Expand Down
12 changes: 9 additions & 3 deletions code/modules/cm_marines/equipment/gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
var/is_animating = FALSE
var/first_open = TRUE
exit_stun = 0
/// used to implement a delay before tarp can be entered again after opened (anti-exploit)
COOLDOWN_DECLARE(toggle_delay)

/obj/structure/closet/bodybag/tarp/snow
icon_state = "snowtarp_closed"
Expand Down Expand Up @@ -91,9 +93,9 @@
exit_stun = 1
can_store_dead = TRUE

/obj/structure/closet/bodybag/tarp/reactive/scout/close()
/obj/structure/closet/bodybag/tarp/reactive/scout/close(mob/user)
if(!skillcheck(usr, SKILL_SPEC_WEAPONS, SKILL_SPEC_ALL) && usr.skills.get_skill_level(SKILL_SPEC_WEAPONS) != SKILL_SPEC_SCOUT)
to_chat(usr, SPAN_WARNING("You don't seem to know how to use [src]..."))
to_chat(user, SPAN_WARNING("You don't seem to know how to use [src]..."))
return
. = ..()

Expand Down Expand Up @@ -137,10 +139,14 @@
return

/obj/structure/closet/bodybag/tarp/open()
COOLDOWN_START(src, toggle_delay, 3 SECONDS) //3 seconds must pass before tarp can be closed
. = ..()
handle_cloaking()

/obj/structure/closet/bodybag/tarp/close()
/obj/structure/closet/bodybag/tarp/close(mob/user)
if(!COOLDOWN_FINISHED(src, toggle_delay))
to_chat(user, SPAN_WARNING("It is too soon to close [src]!"))
return FALSE
. = ..()
handle_cloaking()

Expand Down

0 comments on commit 96b578e

Please sign in to comment.