diff --git a/dGame/dComponents/Activity/ActivityComponent.cpp b/dGame/dComponents/Activity/ActivityComponent.cpp index d727cf1d2..aedf42625 100644 --- a/dGame/dComponents/Activity/ActivityComponent.cpp +++ b/dGame/dComponents/Activity/ActivityComponent.cpp @@ -275,6 +275,10 @@ float_t ActivityComponent::GetActivityValue(LWOOBJID playerID, uint32_t index) c return value; } +LWOOBJID ActivityComponent::GetActivityUser() const { + return m_ActivityPlayers.empty() ? LWOOBJID_EMPTY : m_ActivityPlayers.begin()->first; +} + void ActivityComponent::SetActivityValue(LWOOBJID playerID, uint32_t index, float_t value) { auto& data = m_ActivityPlayers[playerID]; data[std::min(index, static_cast(9))] = value; diff --git a/dGame/dComponents/Activity/ActivityComponent.h b/dGame/dComponents/Activity/ActivityComponent.h index 324ff2382..32916d2a0 100644 --- a/dGame/dComponents/Activity/ActivityComponent.h +++ b/dGame/dComponents/Activity/ActivityComponent.h @@ -268,6 +268,11 @@ public: */ float_t GetActivityValue(LWOOBJID playerID, uint32_t index) const; + /** + * The activity's user (GetActivityUser): the first player with activity data, or LWOOBJID_EMPTY when none has any + */ + LWOOBJID GetActivityUser() const; + /** * Removes activity score tracking for some entity * @param playerID the entity to remove score for