From 96b578e761329e7b11aa8acfd884a087ebef8a49 Mon Sep 17 00:00:00 2001 From: Ben <91219575+Ben10083@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:42:40 -0400 Subject: [PATCH] Prevents spamming open and close tarps (#3768) # 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
Screenshots & Videos 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
# Changelog :cl: fix: fixes exploit relating to cloaking tarps by adding a delay before tarp can be closed again. /:cl: --------- Co-authored-by: harryob --- .../objects/structures/crates_lockers/closets.dm | 2 +- code/modules/cm_marines/equipment/gear.dm | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 05355feeb154..e6c215d0208f 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -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 diff --git a/code/modules/cm_marines/equipment/gear.dm b/code/modules/cm_marines/equipment/gear.dm index 98e7dbcf49df..ff6c715b520b 100644 --- a/code/modules/cm_marines/equipment/gear.dm +++ b/code/modules/cm_marines/equipment/gear.dm @@ -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" @@ -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 . = ..() @@ -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()