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

Fix Tableflip scanning logic + infinite loop #3740

Closed
wants to merge 3 commits into from

Conversation

fira
Copy link
Member

@fira fira commented Jun 27, 2023

About the pull request

Infinite loop observed live.

This fixes three things with the table flipping:

  • The table scan at top shouldn't be in the loop, since it's always done from the starting loc
  • The table scan reuses table, meaning that the second part would essentially "follow turns" through already-flipped tables incorrectly. This is both incorrect and would cause the infinite loop.
  • The table scan is now capped at 8 tables in either direction. This should mean you can't flip a 12 long table from edge, but can from the middle. Unintended feature, but it makes sense...

Testing Photographs and Procedure

Flipping 5 wide flat tables still works.

Changelog

🆑
fix: Fixed an issue with table flips that could make some tables incorrectly unflippable, and cause infinite loops. It is no longer possible to flip tables more than 8 long in either direction from flipping point.
/:cl:

@github-actions github-actions bot added the Fix Fix one bug, make ten more label Jun 27, 2023
Copy link
Contributor

@Drulikar Drulikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to reproduce the examples you mentioned, and this PR does resolve them. Though its still kinda weird that crossed/tshape tables are allowed to be flipped since they visually look connected (usually) and theres no way you could realistically flip those.

@Drulikar
Copy link
Contributor

You can try this adaption to deal with disallowing L or T shaped tables:
patch.diff.txt

@fira
Copy link
Member Author

fira commented Jun 28, 2023

Yeah i'll add it in, this should work

@fira fira marked this pull request as draft June 28, 2023 11:14
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the Stale beg a maintainer to review your PR label Jul 6, 2023
@github-actions github-actions bot closed this Jul 13, 2023
@Drulikar Drulikar mentioned this pull request Jul 13, 2023
github-merge-queue bot pushed a commit that referenced this pull request Jul 15, 2023
# About the pull request

This PR revives #3740 and applies my suggested changes to that PR
preventing T and cross shaped table flips.

# Explain why it's good for the game

Fixes a game ending exploit, and also gives a bit more sanity to table
flipping.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Old testing:
This cannot be flipped now: 

![image](https://github.com/cmss13-devs/cmss13/assets/76988376/7d4c7535-167c-44fb-9473-f7c97bc95e8c)
But this can from the checkmark locations: 

![image](https://github.com/cmss13-devs/cmss13/assets/76988376/ef46cc98-b586-4a51-b389-5cc39a119324)

</details>

# Changelog
:cl: Drathek, Fira
fix: Fixed an issue with table flips that could make some tables
incorrectly unflippable, and cause infinite loops. It is no longer
possible to flip tables that t-shape or cross, or spans more than 5
tiles away from you.
/:cl:

---------

Co-authored-by: Fira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Fix one bug, make ten more Stale beg a maintainer to review your PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants