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

Add flight speed #6076

Open
wants to merge 9 commits into
base: minor-next
Choose a base branch
from
Open

Conversation

Sergittos
Copy link

@Sergittos Sergittos commented Oct 7, 2023

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

@dktapps
Copy link
Member

dktapps commented Oct 8, 2023

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 setMovementSpeed() affect flying speed, and why the server-side flight speed doesn't change when sprint-flying (which is inconsistent with movement speed).

The name setFlightSpeed() would be more in line with functions like setMovementSpeed().

@ShockedPlot7560
Copy link
Member

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?

@ShockedPlot7560 ShockedPlot7560 added Category: API Related to the plugin API Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Dec 16, 2023
@Sergittos Sergittos changed the title Add fly speed Add flight speed Jan 27, 2024
Copy link
Member

@ShockedPlot7560 ShockedPlot7560 left a 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){
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: API Related to the plugin API Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants