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

Preserving players and grabbed objects between sectors #2596

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

Vankata453
Copy link
Member

Previously, each sector would contain its own instances of the Player object for each available player. This, however, makes it tedious to preserve player data across sectors, for example, the currently grabbed object.

GameObjectManager now supports moving objects to another GameObjectManager.

Now, the Level instantiates all Players in the "main" sector, and each sector, on activation, moves those players to itself, so it can manage them, essentially making players global for the level. This allows retaining the full state of all players, between sectors.

Any grabbed/carried object by a player is also moved between sectors, together with the player.

Additionally, a fix for the slow moving animation of grabbed objects, when teleporting while carrying them, is included. Carried objects now teleport together with the player.

Fixes #2191.

Previously, each sector would contain its own instances of the `Player` object for each available player.
This, however, makes it tedious to preserve player data across sectors, for example, the currently grabbed object.

`GameObjectManager` now supports moving objects to another `GameObjectManager`.

Now, the `Level` instantiates all `Player`s in the "main" sector, and each sector, on activation, moves those players to itself, so it can manage them, essentially making players global for the level.
This allows retaining the full state of all players, between sectors.

Any grabbed/carried object by a player is also moved between sectors, together with the player.

Additionally, a fix for the slow moving animation of grabbed objects, when teleporting while carrying them, is included.
Carried objects now teleport together with the player.

Fixes SuperTux#2191.
@Vankata453
Copy link
Member Author

This pull request seems to break trampoline collision. I noticed the trampoline doesn't have hit.top set to true in the CollisionHit it recieves, when colliding with the player, even though the collision does occur on the top. In fact, left, right and bottom of the provided CollisionHit are false, too.

The only time the top collision is detected is when the player collides with the left or right side of the trampoline, otherwise nothing is detected. I have no idea what causes this.

2023-08-22.14-39-53.mp4

@mrkubax10 mrkubax10 added status:in-progress Progress has been done, but more is intended be done type:feature category:code type:bugfix Pull Requests that fix bugs. labels Aug 28, 2023
@Vankata453 Vankata453 added status:needs-review Work needs to be reviewed by other people and removed status:in-progress Progress has been done, but more is intended be done labels Oct 30, 2023
@mrkubax10 mrkubax10 requested a review from tobbi November 1, 2023 19:00
Copy link
Member

@Rusty-Box Rusty-Box left a comment

Choose a reason for hiding this comment

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

Missing keys, otherwise works great!

Copy link
Member

@Rusty-Box Rusty-Box left a comment

Choose a reason for hiding this comment

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

Keys work too!

Copy link
Member

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

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

after a quick look, it's completely fine

@Vankata453 Vankata453 merged commit cf06f96 into SuperTux:master Nov 16, 2023
33 checks passed
@Vankata453 Vankata453 deleted the preserving-grabbed-objects branch November 16, 2023 22:23
@mrkubax10 mrkubax10 removed the status:needs-review Work needs to be reviewed by other people label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Carryable objects and doors
5 participants