Files
Blitz/include/blitz/protocol/packets/UpdateHealthPacket.h
2025-02-23 22:33:50 +01:00

49 lines
1.1 KiB
C++

#pragma once
/**
* \file UpdateHealthPacket.h
* \brief File containing the blitz::protocol::UpdateHealthPacket class
*/
#include <sp/default/DefaultPacket.h>
#include <sp/protocol/Field.h>
#include <sp/protocol/MessageBase.h>
namespace blitz {
namespace protocol {
enum class UpdateHealthFieldsE {
m_NewHealth = 0,
};
using UpdateHealthFields = std::tuple<
float //<- m_NewHealth
>;
/**
* \class UpdateHealthPacket
* \brief Packet for updating the health of a player.
* %Packet structure :
* | PacketType |
* |--------------------------|
* | PacketType::UpdateHealth |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_NewHealth | float | The new health value |
*/
DeclarePacket(UpdateHealth){
public:
PacketConstructor(UpdateHealth)
/**
* \brief Get the ID of the player that left.
* \return The ID of the player that left.
*/
game::PlayerID GetNewHealth() const {
return GetField<UpdateHealthFieldsE, UpdateHealthFieldsE::m_NewHealth>();
}
};
} // namespace protocol
} // namespace blitz