Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::ecs::TryAddComponentsCmd< Ts > Class Template Reference

Command to try add multiple components (only missing ones). More...

#include <builtin_commands.hpp>

Public Member Functions

template<ComponentTrait... Us>
requires (sizeof...(Us) == sizeof...(Ts)) && (std::same_as<Ts, std::remove_cvref_t<Us>> && ...)
constexpr TryAddComponentsCmd (Entity entity, Us &&... components) noexcept
 Constructs try add components command.
constexpr TryAddComponentsCmd (const TryAddComponentsCmd &) noexcept=default
constexpr TryAddComponentsCmd (TryAddComponentsCmd &&) noexcept=default
constexpr ~TryAddComponentsCmd () noexcept=default
constexpr TryAddComponentsCmdoperator= (const TryAddComponentsCmd &) noexcept=default
constexpr TryAddComponentsCmdoperator= (TryAddComponentsCmd &&) noexcept=default
void Execute (World &world)
 Executes components addition if entity is missing them.

Detailed Description

template<ComponentTrait... Ts>
requires utils::UniqueTypes<Ts...> && (sizeof...(Ts) > 0)
class helios::ecs::TryAddComponentsCmd< Ts >

Command to try add multiple components (only missing ones).

Adds multiple components to the specified entity during execution only if it doesn't already have them. If entity already has any of the components, they will be left unchanged.

Warning
Will trigger assertion if the entity does not exist in the world (when world updated).
Template Parameters
TsComponent types (must be unique)

Definition at line 299 of file builtin_commands.hpp.

Constructor & Destructor Documentation

◆ TryAddComponentsCmd() [1/3]

template<ComponentTrait... Ts>
template<ComponentTrait... Us>
requires (sizeof...(Us) == sizeof...(Ts)) && (std::same_as<Ts, std::remove_cvref_t<Us>> && ...)
helios::ecs::TryAddComponentsCmd< Ts >::TryAddComponentsCmd ( Entity entity,
Us &&... components )
inlineconstexprnoexcept

Constructs try add components command.

Warning
Triggers assertion if entity is invalid.
Template Parameters
UsComponent types to add (must match Ts)
Parameters
entityEntity to add components to
componentsComponents to add

Definition at line 311 of file builtin_commands.hpp.

◆ TryAddComponentsCmd() [2/3]

template<ComponentTrait... Ts>
helios::ecs::TryAddComponentsCmd< Ts >::TryAddComponentsCmd ( const TryAddComponentsCmd< Ts > & )
constexprdefaultnoexcept

◆ TryAddComponentsCmd() [3/3]

template<ComponentTrait... Ts>
helios::ecs::TryAddComponentsCmd< Ts >::TryAddComponentsCmd ( TryAddComponentsCmd< Ts > && )
constexprdefaultnoexcept

◆ ~TryAddComponentsCmd()

template<ComponentTrait... Ts>
helios::ecs::TryAddComponentsCmd< Ts >::~TryAddComponentsCmd ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Execute()

template<ComponentTrait... Ts>
void helios::ecs::TryAddComponentsCmd< Ts >::Execute ( World & world)
inline

Executes components addition if entity is missing them.

Warning
Triggers assertion if the entity does not exist in the world.
Parameters
worldWorld to add components in

Definition at line 330 of file builtin_commands.hpp.

◆ operator=() [1/2]

template<ComponentTrait... Ts>
TryAddComponentsCmd & helios::ecs::TryAddComponentsCmd< Ts >::operator= ( const TryAddComponentsCmd< Ts > & )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<ComponentTrait... Ts>
TryAddComponentsCmd & helios::ecs::TryAddComponentsCmd< Ts >::operator= ( TryAddComponentsCmd< Ts > && )
constexprdefaultnoexcept