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
Add flight speed #6076
base: minor-next
Are you sure you want to change the base?
Add flight speed #6076
Conversation
My issue with this is the same as the past PRs on the subject. There's no explanation or documentation of what the values mean, or why it's 0.05 by default. What's the unit? Blocks per seconds? Blocks per tick? There's also going to be questions like why doesn't The name |
I also think the name isn't quite right. It will indeed be confusing. However, I don't think that the unity problem should hinder the merge of adding APIs. It's up to the developers to find out what they're modifying, and a warning could be added in the docs about this. That the unit is not determined and that the value should be handled with care? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me
@@ -515,6 +519,17 @@ public function hasAutoJump() : bool{ | |||
return $this->autoJump; | |||
} | |||
|
|||
public function setFlightSpeed(float $flightSpeed) : void{ | |||
if($flightSpeed >= 0 && $this->flightSpeed !== $flightSpeed){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we disallow setting negative flight speed values? Negative values make the player fly backwards, and this can be used in some game modes
Introduction
This pull request makes it possible for developers to modify a player's flight speed.
Relevant issues
Closes #5155
Changes
API changes
Added the following methods in
Player
:Player->setFlightSpeed()
: Sets the player's flight speed.Player->getFlightSpeed()
: Returns the player's flight speed.Added the following constant in
Player
:Player::DEFAULT_FLIGHT_SPEED
Tests
https://streamable.com/vctb3y