1
0
Fork 0

Plugins can set flying speed.

This commit is contained in:
madmaxoft 2014-03-20 16:14:40 +01:00
parent 9fae50f447
commit b370cacf0c
4 changed files with 124 additions and 80 deletions

View File

@ -1666,17 +1666,18 @@ a_Player:OpenWindow(Window);
GetClientHandle = { Params = "", Return = "{{cClientHandle}}", Notes = "Returns the client handle representing the player's connection. May be nil (AI players)." },
GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player (based on the first group). Prefix player messages with this code." },
GetCurrentXp = { Params = "", Return = "number", Notes = "Returns the current amount of XP" },
GetEffectiveGameMode = { Params = "", Return = "{{eGameMode|GameMode}}", Notes = "Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions." },
GetEffectiveGameMode = { Params = "", Return = "{{Globals#GameMode|GameMode}}", Notes = "(OBSOLETE) Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions. Note that this function is the same as GetGameMode(), use that function instead." },
GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." },
GetEyeHeight = { Return = "number", Notes = "Returns the height of the player's eyes, in absolute coords" },
GetEyePosition = { Return = "{{Vector3d|EyePositionVector}}", Notes = "Returns the position of the player's eyes, as a {{Vector3d}}" },
GetFloaterID = { Params = "", Return = "number", Notes = "Returns the Entity ID of the fishing hook floater that belongs to the player. Returns -1 if no floater is associated with the player. FIXME: Undefined behavior when the player has used multiple fishing rods simultanously." },
GetFlyingMaxSpeed = { Params = "", Return = "number", Notes = "Returns the maximum flying speed, relative to the default game flying speed. Defaults to 1, but plugins may modify it for faster or slower flying." },
GetFoodExhaustionLevel = { Params = "", Return = "number", Notes = "Returns the food exhaustion level" },
GetFoodLevel = { Params = "", Return = "number", Notes = "Returns the food level (number of half-drumsticks on-screen)" },
GetFoodPoisonedTicksRemaining = { Params = "", Return = "", Notes = "Returns the number of ticks left for the food posoning effect" },
GetFoodSaturationLevel = { Params = "", Return = "number", Notes = "Returns the food saturation (overcharge of the food level, is depleted before food level)" },
GetFoodTickTimer = { Params = "", Return = "", Notes = "Returns the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." },
GetGameMode = { Return = "{{eGameMode|GameMode}}", Notes = "Returns the player's gamemode. The player may have their gamemode unassigned, in which case they inherit the gamemode from the current {{cWorld|world}}.<br /> <b>NOTE:</b> Instead of comparing the value returned by this function to the gmXXX constants, use the IsGameModeXXX() functions. These functions handle the gamemode inheritance automatically."},
GetGameMode = { Return = "{{Globals#GameMode|GameMode}}", Notes = "Returns the player's gamemode. The player may have their gamemode unassigned, in which case they inherit the gamemode from the current {{cWorld|world}}.<br /> <b>NOTE:</b> Instead of comparing the value returned by this function to the gmXXX constants, use the IsGameModeXXX() functions. These functions handle the gamemode inheritance automatically."},
GetGroups = { Return = "array-table of {{cGroup}}", Notes = "Returns all the groups that this player is member of, as a table. The groups are stored in the array part of the table, beginning with index 1."},
GetIP = { Return = "string", Notes = "Returns the IP address of the player, if available. Returns an empty string if there's no IP to report."},
GetInventory = { Return = "{{cInventory|Inventory}}", Notes = "Returns the player's inventory"},
@ -1721,12 +1722,13 @@ a_Player:OpenWindow(Window);
SetCrouch = { Params = "IsCrouched", Return = "", Notes = "Sets the crouch state, broadcasts the change to other players." },
SetCurrentExperience = { Params = "XPAmount", Return = "", Notes = "Sets the current amount of experience (and indirectly, the XP level)." },
SetFlying = { Params = "IsFlying", Notes = "Sets if the player is flying or not." },
SetFlyingMaxSpeed = { Params = "FlyingMaxSpeed", Return = "", Notes = "Sets the flying maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client." },
SetFoodExhaustionLevel = { Params = "ExhaustionLevel", Return = "", Notes = "Sets the food exhaustion to the specified level." },
SetFoodLevel = { Params = "FoodLevel", Return = "", Notes = "Sets the food level (number of half-drumsticks on-screen)" },
SetFoodPoisonedTicksRemaining = { Params = "FoodPoisonedTicksRemaining", Return = "", Notes = "Sets the number of ticks remaining for food poisoning. Doesn't send foodpoisoning effect to the client, use FoodPoison() for that." },
SetFoodSaturationLevel = { Params = "FoodSaturationLevel", Return = "", Notes = "Sets the food saturation (overcharge of the food level)." },
SetFoodTickTimer = { Params = "FoodTickTimer", Return = "", Notes = "Sets the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." },
SetGameMode = { Params = "{{eGameMode|NewGameMode}}", Return = "", Notes = "Sets the gamemode for the player. The new gamemode overrides the world's default gamemode, unless it is set to gmInherit." },
SetGameMode = { Params = "{{Globals#GameMode|NewGameMode}}", Return = "", Notes = "Sets the gamemode for the player. The new gamemode overrides the world's default gamemode, unless it is set to gmInherit." },
SetIsFishing = { Params = "IsFishing, [FloaterEntityID]", Return = "", Notes = "Sets the 'IsFishing' flag for the player. The floater entity ID is expected for the true variant, it can be omitted when IsFishing is false. FIXME: Undefined behavior when multiple fishing rods are used simultanously" },
SetName = { Params = "Name", Return = "", Notes = "Sets the player name. This rename will NOT be visible to any players already in the server who are close enough to see this player." },
SetNormalMaxSpeed = { Params = "NormalMaxSpeed", Return = "", Notes = "Sets the normal (walking) maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client, if appropriate." },

View File

@ -45,6 +45,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
, m_ClientHandle(a_Client)
, m_NormalMaxSpeed(1.0)
, m_SprintingMaxSpeed(1.3)
, m_FlyingMaxSpeed(1.0)
, m_IsCrouched(false)
, m_IsSprinting(false)
, m_IsFlying(false)
@ -684,7 +685,21 @@ const cSlotNums & cPlayer::GetInventoryPaintSlots(void) const
double cPlayer::GetMaxSpeed(void) const
{
return m_IsSprinting ? m_SprintingMaxSpeed : m_NormalMaxSpeed;
if (m_IsFlying)
{
return m_FlyingMaxSpeed;
}
else
{
if (m_IsSprinting)
{
return m_SprintingMaxSpeed;
}
else
{
return m_NormalMaxSpeed;
}
}
}
@ -694,7 +709,7 @@ double cPlayer::GetMaxSpeed(void) const
void cPlayer::SetNormalMaxSpeed(double a_Speed)
{
m_NormalMaxSpeed = a_Speed;
if (!m_IsSprinting)
if (!m_IsSprinting && !m_IsFlying)
{
m_ClientHandle->SendPlayerMaxSpeed();
}
@ -707,7 +722,7 @@ void cPlayer::SetNormalMaxSpeed(double a_Speed)
void cPlayer::SetSprintingMaxSpeed(double a_Speed)
{
m_SprintingMaxSpeed = a_Speed;
if (m_IsSprinting)
if (m_IsSprinting && !m_IsFlying)
{
m_ClientHandle->SendPlayerMaxSpeed();
}
@ -717,6 +732,18 @@ void cPlayer::SetSprintingMaxSpeed(double a_Speed)
void cPlayer::SetFlyingMaxSpeed(double a_Speed)
{
m_FlyingMaxSpeed = a_Speed;
// Update the flying speed, always:
m_ClientHandle->SendPlayerAbilities();
}
void cPlayer::SetCrouch(bool a_IsCrouched)
{
// Set the crouch status, broadcast to all visible players

View File

@ -47,19 +47,19 @@ public:
virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); };
/// Returns the curently equipped weapon; empty item if none
/** Returns the curently equipped weapon; empty item if none */
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
/// Returns the currently equipped helmet; empty item if none
/** Returns the currently equipped helmet; empty item if none */
virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); }
/// Returns the currently equipped chestplate; empty item if none
/** Returns the currently equipped chestplate; empty item if none */
virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); }
/// Returns the currently equipped leggings; empty item if none
/** Returns the currently equipped leggings; empty item if none */
virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); }
/// Returns the currently equipped boots; empty item if none
/** Returns the currently equipped boots; empty item if none */
virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); }
@ -77,36 +77,41 @@ public:
*/
short DeltaExperience(short a_Xp_delta);
/// Gets the experience total - XpTotal for score on death
/** Gets the experience total - XpTotal for score on death */
inline short GetXpLifetimeTotal(void) { return m_LifetimeTotalXp; }
/// Gets the currrent experience
/** Gets the currrent experience */
inline short GetCurrentXp(void) { return m_CurrentXp; }
/// Gets the current level - XpLevel
/** Gets the current level - XpLevel */
short GetXpLevel(void);
/// Gets the experience bar percentage - XpP
/** Gets the experience bar percentage - XpP */
float GetXpPercentage(void);
/// Caculates the amount of XP needed for a given level, ref: http://minecraft.gamepedia.com/XP
/** Caculates the amount of XP needed for a given level
Ref: http://minecraft.gamepedia.com/XP
*/
static short XpForLevel(short int a_Level);
/// inverse of XpForLevel, ref: http://minecraft.gamepedia.com/XP values are as per this with pre-calculations
/** Inverse of XpForLevel
Ref: http://minecraft.gamepedia.com/XP
values are as per this with pre-calculations
*/
static short CalcLevelFromXp(short int a_CurrentXp);
// tolua_end
/// Starts charging the equipped bow
/** Starts charging the equipped bow */
void StartChargingBow(void);
/// Finishes charging the current bow. Returns the number of ticks for which the bow has been charged
/** Finishes charging the current bow. Returns the number of ticks for which the bow has been charged */
int FinishChargingBow(void);
/// Cancels the current bow charging
/** Cancels the current bow charging */
void CancelChargingBow(void);
/// Returns true if the player is currently charging the bow
/** Returns true if the player is currently charging the bow */
bool IsChargingBow(void) const { return m_IsChargingBow; }
void SetTouchGround( bool a_bTouchGround );
@ -124,16 +129,16 @@ public:
// tolua_begin
/// Returns the position where projectiles thrown by this player should start, player eye position + adjustment
/** Returns the position where projectiles thrown by this player should start, player eye position + adjustment */
Vector3d GetThrowStartPos(void) const;
/// Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff.
/** Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff. */
Vector3d GetThrowSpeed(double a_SpeedCoeff) const;
/// Returns the current gamemode. Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable
/** Returns the current gamemode. Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable */
eGameMode GetGameMode(void) const { return m_GameMode; }
/// Returns the current effective gamemode (inherited gamemode is resolved before returning)
/** Returns the current effective gamemode (inherited gamemode is resolved before returning) */
eGameMode GetEffectiveGameMode(void) const { return (m_GameMode == gmNotSet) ? m_World->GetGameMode() : m_GameMode; }
/** Sets the gamemode for the player.
@ -142,24 +147,24 @@ public:
*/
void SetGameMode(eGameMode a_GameMode);
/// Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world
/** Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world */
bool IsGameModeCreative(void) const;
/// Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world
/** Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world */
bool IsGameModeSurvival(void) const;
/// Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world
/** Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world */
bool IsGameModeAdventure(void) const;
AString GetIP(void) const { return m_IP; } // tolua_export
/// Returns the associated team, NULL if none
/** Returns the associated team, NULL if none */
cTeam * GetTeam(void) { return m_Team; } // tolua_export
/// Sets the player team, NULL if none
/** Sets the player team, NULL if none */
void SetTeam(cTeam * a_Team);
/// Forces the player to query the scoreboard for his team
/** Forces the player to query the scoreboard for his team */
cTeam * UpdateTeam(void);
// tolua_end
@ -169,24 +174,24 @@ public:
// Sets the current gamemode, doesn't check validity, doesn't send update packets to client
void LoginSetGameMode(eGameMode a_GameMode);
/// Forces the player to move in the given direction.
/** Forces the player to move in the given direction. */
void ForceSetSpeed(Vector3d a_Direction); // tolua_export
/// Tries to move to a new position, with attachment-related checks (y == -999)
/** Tries to move to a new position, with attachment-related checks (y == -999) */
void MoveTo(const Vector3d & a_NewPos); // tolua_export
cWindow * GetWindow(void) { return m_CurrentWindow; } // tolua_export
const cWindow * GetWindow(void) const { return m_CurrentWindow; }
/// Opens the specified window; closes the current one first using CloseWindow()
/** Opens the specified window; closes the current one first using CloseWindow() */
void OpenWindow(cWindow * a_Window); // Exported in ManualBindings.cpp
// tolua_begin
/// Closes the current window, resets current window to m_InventoryWindow. A plugin may refuse the closing if a_CanRefuse is true
/** Closes the current window, resets current window to m_InventoryWindow. A plugin may refuse the closing if a_CanRefuse is true */
void CloseWindow(bool a_CanRefuse = true);
/// Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow
/** Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow */
void CloseWindowIfID(char a_WindowID, bool a_CanRefuse = true);
cClientHandle * GetClientHandle(void) const { return m_ClientHandle; }
@ -208,10 +213,10 @@ public:
typedef std::list< cGroup* > GroupList;
typedef std::list< std::string > StringList;
/// Adds a player to existing group or creates a new group when it doesn't exist
/** Adds a player to existing group or creates a new group when it doesn't exist */
void AddToGroup( const AString & a_GroupName ); // tolua_export
/// Removes a player from the group, resolves permissions and group inheritance (case sensitive)
/** Removes a player from the group, resolves permissions and group inheritance (case sensitive) */
void RemoveFromGroup( const AString & a_GroupName ); // tolua_export
bool HasPermission( const AString & a_Permission ); // tolua_export
@ -234,7 +239,7 @@ public:
/** tosses a pickup newly created from a_Item */
void TossPickup(const cItem & a_Item);
/// Heals the player by the specified amount of HPs (positive only); sends health update
/** Heals the player by the specified amount of HPs (positive only); sends health update */
void Heal(int a_Health);
int GetFoodLevel (void) const { return m_FoodLevel; }
@ -243,7 +248,7 @@ public:
double GetFoodExhaustionLevel (void) const { return m_FoodExhaustionLevel; }
int GetFoodPoisonedTicksRemaining(void) const { return m_FoodPoisonedTicksRemaining; }
/// Returns true if the player is satiated, i. e. their foodlevel is at the max and they cannot eat anymore
/** Returns true if the player is satiated, i. e. their foodlevel is at the max and they cannot eat anymore */
bool IsSatiated(void) const { return (m_FoodLevel >= MAX_FOOD_LEVEL); }
void SetFoodLevel (int a_FoodLevel);
@ -252,28 +257,28 @@ public:
void SetFoodExhaustionLevel (double a_FoodExhaustionLevel);
void SetFoodPoisonedTicksRemaining(int a_FoodPoisonedTicksRemaining);
/// Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full"
/** Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full" */
bool Feed(int a_Food, double a_Saturation);
/// Adds the specified exhaustion to m_FoodExhaustion. Expects only positive values.
/** Adds the specified exhaustion to m_FoodExhaustion. Expects only positive values. */
void AddFoodExhaustion(double a_Exhaustion)
{
m_FoodExhaustionLevel += a_Exhaustion;
}
/// Starts the food poisoning for the specified amount of ticks; if already foodpoisoned, sets FoodPoisonedTicksRemaining to the larger of the two
/** Starts the food poisoning for the specified amount of ticks; if already foodpoisoned, sets FoodPoisonedTicksRemaining to the larger of the two */
void FoodPoison(int a_NumTicks);
/// Returns true if the player is currently in the process of eating the currently equipped item
/** Returns true if the player is currently in the process of eating the currently equipped item */
bool IsEating(void) const { return (m_EatingFinishTick >= 0); }
/// Returns true if the player is currently flying.
/** Returns true if the player is currently flying. */
bool IsFlying(void) const { return m_IsFlying; }
/** Returns if a player is sleeping in a bed */
bool IsInBed(void) const { return m_bIsInBed; }
/// returns true if the player has thrown out a floater.
/** returns true if the player has thrown out a floater. */
bool IsFishing(void) const { return m_IsFishing; }
void SetIsFishing(bool a_IsFishing, int a_FloaterID = -1) { m_IsFishing = a_IsFishing; m_FloaterID = a_FloaterID; }
@ -285,13 +290,13 @@ public:
/** Sets a player's in-bed state; we can't be sure plugins will keep this value updated, so no exporting */
void SetIsInBed(bool a_Flag) { m_bIsInBed = a_Flag; }
/// Starts eating the currently equipped item. Resets the eating timer and sends the proper animation packet
/** Starts eating the currently equipped item. Resets the eating timer and sends the proper animation packet */
void StartEating(void);
/// Finishes eating the currently equipped item. Consumes the item, updates health and broadcasts the packets
/** Finishes eating the currently equipped item. Consumes the item, updates health and broadcasts the packets */
void FinishEating(void);
/// Aborts the current eating operation
/** Aborts the current eating operation */
void AbortEating(void);
virtual void KilledBy(cEntity * a_Killer) override;
@ -320,45 +325,51 @@ public:
cItem & GetDraggingItem(void) {return m_DraggingItem; }
// In UI windows, when inventory-painting:
/// Clears the list of slots that are being inventory-painted. To be used by cWindow only
/** Clears the list of slots that are being inventory-painted. To be used by cWindow only */
void ClearInventoryPaintSlots(void);
/// Adds a slot to the list for inventory painting. To be used by cWindow only
/** Adds a slot to the list for inventory painting. To be used by cWindow only */
void AddInventoryPaintSlot(int a_SlotNum);
/// Returns the list of slots currently stored for inventory painting. To be used by cWindow only
/** Returns the list of slots currently stored for inventory painting. To be used by cWindow only */
const cSlotNums & GetInventoryPaintSlots(void) const;
// tolua_begin
/// Returns the current relative maximum speed (takes current sprinting state into account)
/** Returns the current relative maximum speed (takes current sprinting / flying state into account) */
double GetMaxSpeed(void) const;
/// Gets the normal relative maximum speed
/** Gets the normal relative maximum speed */
double GetNormalMaxSpeed(void) const { return m_NormalMaxSpeed; }
/// Gets the sprinting relative maximum speed
/** Gets the sprinting relative maximum speed */
double GetSprintingMaxSpeed(void) const { return m_SprintingMaxSpeed; }
/// Sets the normal maximum speed, as reported in the 1.6.1+ protocol. Sends the update to player, if needed.
/** Gets the flying relative maximum speed */
double GetFlyingMaxSpeed(void) const { return m_FlyingMaxSpeed; }
/** Sets the normal relative maximum speed. Sends the update to player, if needed. */
void SetNormalMaxSpeed(double a_Speed);
/// Sets the sprinting maximum speed, as reported in the 1.6.1+ protocol. Sends the update to player, if needed.
/** Sets the sprinting relative maximum speed. Sends the update to player, if needed. */
void SetSprintingMaxSpeed(double a_Speed);
/// Sets the crouch status, broadcasts to all visible players
/** Sets the flying relative maximum speed. Sends the update to player, if needed. */
void SetFlyingMaxSpeed(double a_Speed);
/** Sets the crouch status, broadcasts to all visible players */
void SetCrouch(bool a_IsCrouched);
/// Starts or stops sprinting, sends the max speed update to the client, if needed
/** Starts or stops sprinting, sends the max speed update to the client, if needed */
void SetSprint(bool a_IsSprinting);
/// Flags the player as flying
/** Flags the player as flying */
void SetFlying(bool a_IsFlying);
/// If true the player can fly even when he's not in creative.
/** If true the player can fly even when he's not in creative. */
void SetCanFly(bool a_CanFly);
/// Returns wheter the player can fly or not.
/** Returns wheter the player can fly or not. */
virtual bool CanFly(void) const { return m_CanFly; }
// tolua_end
@ -380,7 +391,7 @@ protected:
AString m_PlayerName;
AString m_LoadedWorldName;
/// Xp Level stuff
/** Xp Level stuff */
enum
{
XP_TO_LEVEL15 = 255,
@ -391,22 +402,22 @@ protected:
bool m_bVisible;
// Food-related variables:
/// Represents the food bar, one point equals half a "drumstick"
/** Represents the food bar, one point equals half a "drumstick" */
int m_FoodLevel;
/// "Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel
/** "Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel */
double m_FoodSaturationLevel;
/// Count-up to the healing or damaging action, based on m_FoodLevel
/** Count-up to the healing or damaging action, based on m_FoodLevel */
int m_FoodTickTimer;
/// A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. Each action adds a little
/** A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. Each action adds a little */
double m_FoodExhaustionLevel;
/// Number of ticks remaining for the foodpoisoning effect; zero if not foodpoisoned
/** Number of ticks remaining for the foodpoisoning effect; zero if not foodpoisoned */
int m_FoodPoisonedTicksRemaining;
/// Last position that has been recorded for food-related processing:
/** Last position that has been recorded for food-related processing: */
Vector3d m_LastFoodPos;
float m_LastJumpHeight;
@ -422,7 +433,7 @@ protected:
eGameMode m_GameMode;
AString m_IP;
/// The item being dragged by the cursor while in a UI window
/** The item being dragged by the cursor while in a UI window */
cItem m_DraggingItem;
long long m_LastPlayerListTime;
@ -437,11 +448,16 @@ protected:
Default value is 1. */
double m_NormalMaxSpeed;
/** Max speed, relative to the game default max speed.
/** Max speed, relative to the game default max speed, when sprinting.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1.3 */
Default value is 1.3. */
double m_SprintingMaxSpeed;
/** Max speed, relative to the game default flying max speed, when flying.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1. */
double m_FlyingMaxSpeed;
bool m_IsCrouched;
bool m_IsSprinting;
bool m_IsFlying;
@ -451,10 +467,10 @@ protected:
bool m_CanFly; // If this is true the player can fly. Even if he is not in creative.
/// The world tick in which eating will be finished. -1 if not eating
/** The world tick in which eating will be finished. -1 if not eating */
Int64 m_EatingFinishTick;
/// Player Xp level
/** Player Xp level */
short int m_LifetimeTotalXp;
short int m_CurrentXp;
@ -475,19 +491,19 @@ protected:
virtual void Destroyed(void);
/// Filters out damage for creative mode/friendly fire
/** Filters out damage for creative mode/friendly fire */
virtual void DoTakeDamage(TakeDamageInfo & TDI) override;
/** Stops players from burning in creative mode */
virtual void TickBurning(cChunk & a_Chunk) override;
/// Called in each tick to handle food-related processing
/** Called in each tick to handle food-related processing */
void HandleFood(void);
/// Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item.
/** Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item. */
void HandleFloater(void);
/// Adds food exhaustion based on the difference between Pos and LastPos, sprinting status and swimming (in water block)
/** Adds food exhaustion based on the difference between Pos and LastPos, sprinting status and swimming (in water block) */
void ApplyFoodExhaustionFromMovement();
/** Flag representing whether the player is currently in a bed

View File

@ -687,8 +687,7 @@ void cProtocol172::SendPlayerAbilities(void)
Flags |= 0x04;
}
Pkt.WriteByte(Flags);
// TODO: Pkt.WriteFloat(m_Client->GetPlayer()->GetMaxFlyingSpeed());
Pkt.WriteFloat(0.05f);
Pkt.WriteFloat((float)(0.05 * m_Client->GetPlayer()->GetFlyingMaxSpeed()));
Pkt.WriteFloat((float)(0.1 * m_Client->GetPlayer()->GetMaxSpeed()));
}