class
RemotePlayerOnServerRemote player in online session.
Base classes
- class PlayerOnServer
- Player on the server in online session.
Public types
- enum class PlayerFlags { None = 0, SpecialMoveMask = 0x07, IsFacingLeft = 0x10, IsVisible = 0x20, IsActivelyPushing = 0x40, JustWarped = 0x100 }
- State flags of the remote player.
Constructors, destructors, conversion operators
-
RemotePlayerOnServer(std::
shared_ptr<PeerDescriptor> peerDesc)
Public functions
- auto IsLedgeClimbAllowed() const -> bool override
- Returns
true
if ledge climbing is allowed. -
auto OnHandleCollision(std::
shared_ptr<ActorBase> other) -> bool override - Called when the object collides with another object.
-
auto OnLevelChanging(Actors::
ActorBase* initiator, ExitType exitType) -> bool override - Called when the level is about to change.
- auto PrepareLevelCarryOver() -> PlayerCarryOver override
- Returns current carry over information.
- void WarpToPosition(Vector2f pos, WarpFlags flags) override
- Warps to a given position.
-
auto SetModifier(Modifier modifier,
const std::
shared_ptr<ActorBase>& decor) -> bool override - Sets current modifier.
- auto Freeze(float timeLeft) -> bool override
- Freezes the player for specified time.
- void SetInvulnerability(float timeLeft, InvulnerableType type) override
- Sets invulnerability.
-
auto AddHealth(std::
int32_t amount) -> bool override - Adds health.
-
auto AddLives(std::
int32_t count) -> bool override - Adds lives.
-
auto AddAmmo(WeaponType weaponType,
std::
int16_t count) -> bool override - Adds weapon ammo.
-
void AddWeaponUpgrade(WeaponType weaponType,
std::
uint8_t upgrade) override - Adds weapon upgrade.
- auto SetDizzy(float timeLeft) -> bool override
- Sets duration of dizziness.
- auto SetShield(ShieldType shieldType, float timeLeft) -> bool override
- Sets active shield.
- auto IncreaseShieldTime(float timeLeft) -> bool override
- Increases active shield time.
- auto FireCurrentWeapon(WeaponType weaponType) -> bool override
- Fires currently equipped weapon.
- void EmitWeaponFlare() override
- Emits weapon flare after firing.
- void SetCurrentWeapon(WeaponType weaponType, SetCurrentWeaponReason reason) override
- Sets current weapon.
- void SyncWithServer(Vector2f pos, Vector2f speed, bool isVisible, bool isFacingLeft, bool isActivelyPushing)
- Synchronizes the player with server.
- void ForceResyncWithServer(Vector2f pos, Vector2f speed)
- Forcefully resynchronizes the player with server (e.g., after respawning or warping)
Public variables
- PlayerFlags Flags
- State flags.
-
std::
uint64_t PressedKeys - Pressed keys.
-
std::
uint64_t PressedKeysLast - Previously pressed keys.
-
std::
uint32_t UpdatedFrame - Last frame when pressed keys were updated.
Protected functions
- auto OnActivatedAsync(const ActorActivationDetails& details) -> Task<bool> override
- Called when the object is created and activated.
- void OnUpdate(float timeMult) override
- Called every frame to update the object state.
- void OnHitSpring(Vector2f pos, Vector2f force, bool keepSpeedX, bool keepSpeedY, bool& removeSpecialMove) override
- Called when a spring is hit.