Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevents spamming open and close tarps #3768

Merged
merged 7 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
. = ..()
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