Skip to main content

HealthDepletedEvent.ixx File

Event emitted when an entity dies. More...

Included Headers

#include <optional> #include <helios.engine.ecs.EntityHandle> #include <helios.core.types> #include <helios.engine.common.types.DamageContext> #include <helios.math> #include <helios.util.Guid>

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemechanics

High-level gameplay systems and components for game logic. More...

namespacehealth

Health management system for game entities. More...

namespaceevents

Health-related events. More...

Classes Index

classHealthDepletedEvent

Event emitted when an entity's health reaches zero. More...

Description

Event emitted when an entity dies.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file HealthDepletedEvent.ixx
3 * @brief Event emitted when an entity dies.
4 */
5module;
6
7#include <optional>
8
9export module helios.engine.mechanics.health.events.HealthDepletedEvent;
10
11import helios.util.Guid;
12import helios.math;
13import helios.engine.common.types.DamageContext;
14import helios.core.types;
15
16import helios.engine.ecs.EntityHandle;
17
19
21
22 /**
23 * @brief Event emitted when an entity's health reaches zero.
24 *
25 * Contains the handle of the deceased entity and optionally the
26 * attack context if the death was caused by combat damage.
27 */
29
30 /**
31 * @brief Handle of the entity that died.
32 */
34
35 /**
36 * @brief Attack context if death was caused by combat.
37 */
38 std::optional<DamageContext> damageContext_;
39
40 public:
41
42
43 /**
44 * @brief Constructs a HealthDepletedEvent.
45 *
46 * @param source Handle of the deceased entity.
47 * @param damageContext Optional damage context if death was from damage applied.
48 */
51 std::optional<DamageContext> damageContext = std::nullopt
52 ) : damageContext_(damageContext), source_(source) {}
53
54 /**
55 * @brief Returns the damage context if available.
56 *
57 * @return Optional DamageContext, or nullopt if death was not from combat.
58 */
59 [[nodiscard]] std::optional<DamageContext> damageContext() const noexcept {
60 return damageContext_;
61 }
62
63 /**
64 * @brief Returns the handle of the deceased entity.
65 *
66 * @return The source entity handle.
67 */
68 [[nodiscard]] helios::engine::ecs::EntityHandle source() const noexcept {
69 return source_;
70 }
71
72 };
73
74}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.