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

Revive tableflip fixes #3882

Merged
merged 5 commits into from
Jul 15, 2023
Merged
Changes from all 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
12 changes: 8 additions & 4 deletions code/game/objects/structures/tables_racks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,13 @@
/// Checks whether a table is a straight line along a given axis
/obj/structure/surface/table/proc/straight_table_check(direction)
var/obj/structure/surface/table/table = src
while(table)
var/obj/structure/surface/table/side_table
var/tables_count = 7 // Lazy extra safety against infinite loops. If table big, can't flip, i guess.
while(--tables_count)
// Check whether there are connected tables perpendicular to the axis
for(var/angle in list(-90, 90))
table = locate() in get_step(loc, turn(direction, angle))
if(table && !table.flipped)
side_table = locate() in get_step(table, turn(direction, angle))
if(side_table && !side_table.flipped)
return FALSE
table = locate() in get_step(table, direction)
if(!table || table.flipped)
Expand All @@ -339,6 +341,8 @@
var/obj/structure/surface/table/reinforced/reinforced_table = table
if(reinforced_table.status == RTABLE_NORMAL)
return FALSE
if(!tables_count)
return FALSE
return TRUE

/obj/structure/surface/table/verb/do_flip()
Expand Down Expand Up @@ -421,7 +425,7 @@
to_chat(usr, SPAN_WARNING("You have moved a table too recently."))
return FALSE

if(!skip_straight_check && (!straight_table_check(turn(direction, 90)) || !straight_table_check(turn(direction, -90))))
if(!skip_straight_check && !(straight_table_check(turn(direction, 90)) && straight_table_check(turn(direction, -90))))
to_chat(usr, SPAN_WARNING("[src] is too wide to be flipped."))
return FALSE

Expand Down
Loading