mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-13 00:20:54 +01:00
36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <Events/PacketEvent.h>
|
||
|
|
|
||
|
|
struct World;
|
||
|
|
struct UpdateEvent;
|
||
|
|
struct TransportService;
|
||
|
|
struct RequestActorValueChanges;
|
||
|
|
struct RequestActorMaxValueChanges;
|
||
|
|
struct RequestHealthChangeBroadcast;
|
||
|
|
struct RequestDeathStateChange;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Broadcasts changes in (max) actor values and updates them server side.
|
||
|
|
*/
|
||
|
|
struct ActorValueService
|
||
|
|
{
|
||
|
|
ActorValueService(World& aWorld, entt::dispatcher& aDispatcher) noexcept;
|
||
|
|
~ActorValueService() noexcept = default;
|
||
|
|
|
||
|
|
TP_NOCOPYMOVE(ActorValueService);
|
||
|
|
|
||
|
|
private:
|
||
|
|
World& m_world;
|
||
|
|
|
||
|
|
void OnActorValueChanges(const PacketEvent<RequestActorValueChanges>& acMessage) const noexcept;
|
||
|
|
void OnActorMaxValueChanges(const PacketEvent<RequestActorMaxValueChanges>& acMessage) const noexcept;
|
||
|
|
void OnHealthChangeBroadcast(const PacketEvent<RequestHealthChangeBroadcast>& acMessage) const noexcept;
|
||
|
|
void OnDeathStateChange(const PacketEvent<RequestDeathStateChange>& acMessage) const noexcept;
|
||
|
|
|
||
|
|
entt::scoped_connection m_updateHealthConnection;
|
||
|
|
entt::scoped_connection m_updateMaxValueConnection;
|
||
|
|
entt::scoped_connection m_updateDeltaHealthConnection;
|
||
|
|
entt::scoped_connection m_deathStateConnection;
|
||
|
|
};
|