From d9e573f883042c6ca5c32e13f44eba43154aa308 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Sun, 25 Aug 2024 14:52:20 -0400
Subject: [PATCH] Adds size-based slowdowns to flipping tables. (#26452)
* Makes only humans able to flip tables
* tiny delay for humans too
* better wording
* No delay for humans
* Apply suggestions from code review
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* Update code/game/objects/structures/tables_racks.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
---------
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
---
code/game/objects/structures/tables_racks.dm | 33 ++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index 5c9f02a76ea..92dd37c15e1 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -328,22 +328,51 @@
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user) || !can_be_flipped || is_ventcrawling(user))
return
+ var/flip_speed = get_flip_speed(user)
+
if(!flipped)
+
+ if(flip_speed > 0)
+ user.visible_message("[user] starts trying to flip [src]!", "You start trying to flip [src][flip_speed >= 5 SECONDS ? " (it'll take about [flip_speed / 10] seconds)." : ""].")
+ if(!do_after(user, flip_speed, TRUE, src))
+ user.visible_message("[user] gives up on trying to flip [src].")
+ return
if(!flip(get_cardinal_dir(user, src)))
to_chat(user, "It won't budge.")
return
- user.visible_message("[user] flips \the [src]!")
+
+ user.visible_message("[user] flips [src]!")
if(climbable)
structure_shaken()
else
+ if(flip_speed > 0)
+ user.visible_message("[user] starts trying to right [src]!", "You start trying to right [src][flip_speed >= 5 SECONDS ? " (it'll take about [flip_speed / 10] seconds)." : ""]")
+ if(!do_after(user, flip_speed, TRUE, src))
+ user.visible_message("[user] gives up on trying to right [src].")
+ return
if(!unflip())
to_chat(user, "It won't budge.")
+ user.visible_message("[user] rights [src]!")
+
+/obj/structure/table/proc/get_flip_speed(mob/living/flipper)
+ if(!istype(flipper))
+ return 0 SECONDS // sure
+ if(!issimple_animal(flipper))
+ return 0 SECONDS
+ switch(flipper.mob_size)
+ if(MOB_SIZE_TINY)
+ return 30 SECONDS // you can do it but you gotta *really* work for it
+ if(MOB_SIZE_SMALL)
+ return 5 SECONDS // not gonna terrorize anything
+ else
+ return 0 SECONDS
+
/obj/structure/table/proc/flip(direction)
if(flipped)
- return FALSE
+ return 0
if(!straight_table_check(turn(direction, 90)) || !straight_table_check(turn(direction, -90)))
return FALSE