From 3e3e8c415c1b0c8ab74d3ba472ae28539096a8d4 Mon Sep 17 00:00:00 2001
From: Gristlebee <56049844+Gristlebee@users.noreply.github.com>
Date: Sat, 17 Aug 2024 13:24:55 -0700
Subject: [PATCH] You can no longer phase through a flipped table. (#3284)
## About The Pull Request
Flipped tables had an issue where they didnt block movement properly
from it's outward side, or it's inward if you flipped it while diagonal.
Adds an extra proc to help check the directions and fixes the other
checks so people can't occasionally phase directly through a flipped
table.
Also adds an examine hint to flipped tables on how to right them, and
changes the span classes to macros
## Why It's Good For The Game
Bugfixes are good.
## Changelog
:cl:
add: Examine hints for flipped tables
fix: You can no longer phase through a flipped table.
/:cl:
---
code/game/objects/structures/table_flipped.dm | 28 +++++++++++++------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/code/game/objects/structures/table_flipped.dm b/code/game/objects/structures/table_flipped.dm
index c006695a7df0..28af5d0b63bd 100644
--- a/code/game/objects/structures/table_flipped.dm
+++ b/code/game/objects/structures/table_flipped.dm
@@ -17,10 +17,22 @@
AddElement(/datum/element/connect_loc, loc_connections)
+/obj/structure/flippedtable/examine(mob/user)
+ . = ..()
+ . += span_notice("You could right the [name] by control shift-clicking it.")
+
+/obj/structure/flippedtable/proc/check_dir()
+ if(dir == NORTHEAST || dir == SOUTHEAST)
+ return EAST
+ if(dir == NORTHWEST || dir == SOUTHWEST)
+ return WEST
+ return dir
+
/obj/structure/flippedtable/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
- var/attempted_dir = get_dir(loc, target)
- if(table_type == /obj/structure/table/glass) //Glass table, jolly ranchers pass
+ var/table_dir = check_dir()
+ var/attempted_dir = get_dir(loc, mover)
+ if(table_type == /obj/structure/table/glass) //Glass table, lasers can pass
if(istype(mover) && (mover.pass_flags & PASSGLASS))
return TRUE
if(istype(mover, /obj/projectile))
@@ -29,20 +41,20 @@
if(proj_obj.trajectory && angle2dir_cardinal(proj_obj.trajectory.angle) == dir)
return TRUE
return FALSE
- return attempted_dir != dir
+ return attempted_dir != table_dir
/obj/structure/flippedtable/proc/on_exit(datum/source, atom/movable/exiter, direction)
SIGNAL_HANDLER
-
+ var/table_dir = check_dir()
if(exiter == src)
return // Let's not block ourselves.
- if(table_type == /obj/structure/table/glass) //Glass table, jolly ranchers pass
+ if(table_type == /obj/structure/table/glass) //Glass table, lasers pass
if(istype(exiter) && (exiter.pass_flags & PASSGLASS))
return
if(istype(exiter, /obj/projectile))
return
- if(direction == dir)
+ if(direction == table_dir)
exiter.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT
return
@@ -51,10 +63,10 @@
. = ..()
if(!istype(user) || !user.can_interact_with(src))
return FALSE
- user.visible_message("[user] starts flipping [src]!", "You start flipping over the [src]!")
+ user.visible_message(span_danger("[user] starts flipping [src]!"), span_notice("You start flipping over the [src]!"))
if(do_after(user, max_integrity/4))
var/obj/structure/table/table_unflip = new table_type(src.loc)
table_unflip.obj_integrity = obj_integrity
- user.visible_message("[user] flips over the [src]!", "You flip over the [src]!")
+ user.visible_message(span_danger("[user] flips over the [src]!"), span_notice("You flip over the [src]!"))
playsound(src, 'sound/items/trayhit2.ogg', 100)
qdel(src)