add Player::currentState

This commit is contained in:
Kae 2024-09-02 22:18:09 +10:00
parent efa57d3081
commit 90db1e0fba
2 changed files with 21 additions and 15 deletions

View File

@ -2202,6 +2202,10 @@ pair<HumanoidEmote, float> Player::currentEmote() const {
return make_pair(m_emoteState, m_emoteCooldownTimer); return make_pair(m_emoteState, m_emoteCooldownTimer);
} }
Player::State Player::currentState() const {
return m_state;
}
List<ChatAction> Player::pullPendingChatActions() { List<ChatAction> Player::pullPendingChatActions() {
return take(m_pendingChatActions); return take(m_pendingChatActions);
} }

View File

@ -60,6 +60,21 @@ class Player :
public virtual EmoteEntity { public virtual EmoteEntity {
public: public:
enum class State {
Idle,
Walk,
Run,
Jump,
Fall,
Swim,
SwimIdle,
TeleportIn,
TeleportOut,
Crouch,
Lounge
};
static EnumMap<State> const StateNames;
Player(PlayerConfigPtr config, Uuid uuid = Uuid()); Player(PlayerConfigPtr config, Uuid uuid = Uuid());
Player(PlayerConfigPtr config, ByteArray const& netStore); Player(PlayerConfigPtr config, ByteArray const& netStore);
Player(PlayerConfigPtr config, Json const& diskStore); Player(PlayerConfigPtr config, Json const& diskStore);
@ -385,6 +400,8 @@ public:
void addEmote(HumanoidEmote const& emote, Maybe<float> emoteCooldown = {}); void addEmote(HumanoidEmote const& emote, Maybe<float> emoteCooldown = {});
pair<HumanoidEmote, float> currentEmote() const; pair<HumanoidEmote, float> currentEmote() const;
State currentState() const;
List<ChatAction> pullPendingChatActions() override; List<ChatAction> pullPendingChatActions() override;
Maybe<String> inspectionLogName() const override; Maybe<String> inspectionLogName() const override;
@ -483,21 +500,6 @@ public:
void setSecretProperty(String const& name, Json const& value); void setSecretProperty(String const& name, Json const& value);
private: private:
enum class State {
Idle,
Walk,
Run,
Jump,
Fall,
Swim,
SwimIdle,
TeleportIn,
TeleportOut,
Crouch,
Lounge
};
static EnumMap<State> const StateNames;
typedef LuaMessageHandlingComponent<LuaStorableComponent<LuaActorMovementComponent<LuaUpdatableComponent<LuaWorldComponent<LuaBaseComponent>>>>> GenericScriptComponent; typedef LuaMessageHandlingComponent<LuaStorableComponent<LuaActorMovementComponent<LuaUpdatableComponent<LuaWorldComponent<LuaBaseComponent>>>>> GenericScriptComponent;
typedef shared_ptr<GenericScriptComponent> GenericScriptComponentPtr; typedef shared_ptr<GenericScriptComponent> GenericScriptComponentPtr;