PlayerOnServer class
Player on the server in online session.
Server-side base for a player simulated on the host, adding server-authoritative behavior on top of MpPlayer. It handles damage, lives and morphing as the authority, and player-vs-player collisions (keeping overlapping players apart and applying bump impulses).
Base classes
- class MpPlayer
- Player in online session.
Derived classes
- class LocalPlayerOnServer
- Local player in online session.
- class RemotePlayerOnServer
- Remote player in online session.
Constructors, destructors, conversion operators
- PlayerOnServer()
- Creates a new instance.
Public functions
- auto OnHandleCollision(ActorBase* other) -> bool override
- Called when the object collides with another object.
- auto CanCauseDamage(ActorBase* collider) -> bool override
- Called to check whether
collidercan cause damage to the object. -
auto TakeDamage(std::
int32_t amount, float pushForce = 0.0f, bool ignoreInvulnerable = false) -> bool override - Takes damage.
-
auto AddLives(std::
int32_t count) -> bool override - Adds lives.
- auto MorphTo(PlayerType type) -> bool override
- Morphs to a given player type.
Protected functions
- void OnUpdate(float timeMult) override
- Called every frame to update the object state.
- auto IsAttacking() const -> bool
- Returns
trueif the player is currently performing a damaging move.
Protected variables
-
std::
shared_ptr<ActorBase> _lastAttacker - Actor that last attacked this player (cleared once _
lastAttackerTimeout elapses). - float _lastAttackerTimeout
- Remaining time before the last attacker reference is cleared.
- bool _canTakeDamage
- Whether the player can currently take damage.
- bool _justWarped
- Whether the player has just warped.
- float _bumpCooldown
- Remaining cooldown before this player can be bumped by another player again.
- bool _bumpInitialized
- Whether player-vs-player collision dispatch has been enabled (done lazily after activation).