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

Relative login location #13

Open
goodroach opened this issue May 15, 2023 · 5 comments
Open

Relative login location #13

goodroach opened this issue May 15, 2023 · 5 comments

Comments

@goodroach
Copy link

Is your feature request related to a problem? Please describe.
There is currently a problem in movecraft where if you crash or especially if your passenger crashes, they often are respawned at the exact location they spawned in. This usually causes some unfortunate deaths (for flying crafts) airships fly very high or even over the void.

Describe the solution you'd like
The solution will be when you log back into a server, the location where you log in should be the relative location of that piloted ship. If you were on a craft when you logged out, then you should teleport to the location where the ship went.

This can be done by getting the craft the player logged off on, and then moving the relog location to the ship's very last location. You can check the craft the player last logged out by determining if the player was within a ship's hitbox and using the movecraft location to move the location where the player logs in to the exact relative location in the ship.

If there is any specific way you would like this to be done please let me know.

@TylerS1066 TylerS1066 transferred this issue from APDevTeam/Movecraft May 15, 2023
@TylerS1066
Copy link
Contributor

I think this makes the most sense to belong in Beaming, since this plugin will (eventually) handle all respawn mechanics of Movecraft. Frankly, I think this plugin needs a rewrite from the ground up, so I'm going to open a discussion on how we want to do that, but I'll put down my ideas on how this specific side would work (for the code).

I think it's time we follow Movecraft-Combat's lead here and break one of the core principles BacaYarro had: storing data outside the world. I think this can be super simple, on a player logging out we would store in memory a map from the craft they were on to their UUID and position inside the craft hitbox. On craft release, we would store in our database the new (translated) login location for them. On login, we would check if there is a login location, and if so place them there and delete it.

One concern I thought of is how to track the rotations of the craft. I'm not sure if Movecraft keeps track of the "front" or how many rotations a craft has gone through, so we may need to add on to the core API to allow that.

@goodroach
Copy link
Author

Well if movecraft can track where and when the pilot pilots, then we can track where the player is relative to that location. Then, using some math, we can determine the location where the player logged off.

@TylerS1066
Copy link
Contributor

Well if movecraft can track where and when the pilot pilots, then we can track where the player is relative to that location. Then, using some math, we can determine the location where the player logged off.

Correct, which should be simple, with the exception of craft rotation. We'd know their offset, but if the craft rotates then we're off.

Here's the discussions I mentioned: https://github.com/orgs/APDevTeam/discussions/582

@goodroach
Copy link
Author

One method you can track rotation is to record the number of times a craft has rotated in either direction and then use that count (think multiplying imaginary numbers) to determine in what direction then apply some kind of rotation matrix to that location relative to the known pivot point of the craft.

@TylerS1066
Copy link
Contributor

I agree, but I think we probably need to do that in base Movecraft and expose it in the API, probably create some sort of "rotations since pilot" field to Craft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants