Skip to content

Commit

Permalink
You can no longer phase through a flipped table. (#3284)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

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

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->
Bugfixes are good.

## Changelog

:cl:
add: Examine hints for flipped tables
fix: You can no longer phase through a flipped table.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Gristlebee authored Aug 17, 2024
1 parent a3f1a58 commit 3e3e8c4
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions code/game/objects/structures/table_flipped.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand All @@ -51,10 +63,10 @@
. = ..()
if(!istype(user) || !user.can_interact_with(src))
return FALSE
user.visible_message("<span class='danger'>[user] starts flipping [src]!</span>", "<span class='notice'>You start flipping over the [src]!</span>")
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("<span class='danger'>[user] flips over the [src]!</span>", "<span class='notice'>You flip over the [src]!</span>")
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)

0 comments on commit 3e3e8c4

Please sign in to comment.