Skip to main content

types Namespace

Type definitions for the health system. More...

Definition

namespace helios::engine::mechanics::health::types { ... }

Classes Index

structHealthChangeContext

Describes a health modification applied to an entity. More...

Enumerations Index

enum classHealthDepletedBehavior : uint16_t { ... }

Bitmask enum describing what happens when an entity's health is depleted. More...

Operators Index

constexpr HealthDepletedBehavioroperator| (HealthDepletedBehavior lhs, HealthDepletedBehavior rhs) noexcept

Bitwise OR operator for combining flags. More...

constexpr HealthDepletedBehavioroperator& (HealthDepletedBehavior lhs, HealthDepletedBehavior rhs) noexcept

Bitwise AND operator for testing flags. More...

Functions Index

constexpr boolhasHealthDepletedFlag (const HealthDepletedBehavior mask, const HealthDepletedBehavior flag) noexcept

Tests whether a specific flag is set in a mask. More...

Description

Type definitions for the health system.

Contains a bitmask enum for health depletion behaviour and a context struct for health updates.

Enumerations

HealthDepletedBehavior

enum class helios::engine::mechanics::health::types::HealthDepletedBehavior : uint16_t
strong

Bitmask enum describing what happens when an entity's health is depleted.

Enumeration values
NoneNo action on depletion (= 0)
DespawnQueue the entity for despawning (= 1 << 0)
DeadTagAttach a DeadTagComponent to the entity (= 1 << 1)

Flags can be combined with the bitwise OR operator to trigger multiple effects simultaneously.

Definition at line 20 of file HealthDepletedBehavior.ixx.

20 enum class HealthDepletedBehavior : uint16_t {
21
22 /**
23 * @brief No action on depletion.
24 */
25 None = 0,
26
27 /**
28 * @brief Queue the entity for despawning.
29 */
30 Despawn = 1 << 0,
31
32 /**
33 * @brief Attach a DeadTagComponent to the entity.
34 */
35 DeadTag = 1 << 1
36 };

Operators

operator&()

HealthDepletedBehavior helios::engine::mechanics::health::types::operator& (HealthDepletedBehavior lhs, HealthDepletedBehavior rhs)
nodiscard constexpr noexcept

Bitwise AND operator for testing flags.

Parameters
lhs

Left-hand side flag.

rhs

Right-hand side flag.

Returns

Intersection of both flags.

Definition at line 62 of file HealthDepletedBehavior.ixx.

63 return static_cast<HealthDepletedBehavior>(
64 static_cast<uint16_t>(lhs) & static_cast<uint16_t>(rhs)
65 );
66 }

operator|()

HealthDepletedBehavior helios::engine::mechanics::health::types::operator| (HealthDepletedBehavior lhs, HealthDepletedBehavior rhs)
nodiscard constexpr noexcept

Bitwise OR operator for combining flags.

Parameters
lhs

Left-hand side flag.

rhs

Right-hand side flag.

Returns

Combined flags.

Definition at line 47 of file HealthDepletedBehavior.ixx.

48 return static_cast<HealthDepletedBehavior>(
49 static_cast<uint16_t>(lhs) | static_cast<uint16_t>(rhs)
50 );
51 }

Functions

hasHealthDepletedFlag()

bool helios::engine::mechanics::health::types::hasHealthDepletedFlag (const HealthDepletedBehavior mask, const HealthDepletedBehavior flag)
nodiscard constexpr noexcept

Tests whether a specific flag is set in a mask.

Parameters
mask

The bitmask to test.

flag

The flag to check for.

Returns

True if the flag is set.

Definition at line 76 of file HealthDepletedBehavior.ixx.

76 [[nodiscard]] constexpr bool hasHealthDepletedFlag(const HealthDepletedBehavior mask, const HealthDepletedBehavior flag) noexcept {
77 return (mask & flag) == flag;
78 }

Referenced by helios::engine::mechanics::health::HealthManager::flush and helios::engine::mechanics::lifecycle::systems::GameObjectLifecycleSystem::update.


The documentation for this namespace was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.