Skip to main content

MatchFlowSystem.ixx File

System that drives the match state flow automatically. More...

Included Headers

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...

namespacematch

Match state management for the helios engine. More...

namespacesystems

Systems for match state management. More...

Classes Index

classMatchFlowSystem

Automatically advances the match through its state phases. More...

Description

System that drives the match state flow automatically.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file MatchFlowSystem.ixx
3 * @brief System that drives the match state flow automatically.
4 */
5module;
6
7export module helios.engine.mechanics.match.systems.MatchFlowSystem;
8
9import helios.engine.mechanics.match.types;
10
11import helios.engine.state.Bindings;
12import helios.engine.runtime.messaging.command.EngineCommandBuffer;
13
14import helios.engine.mechanics.match.types.MatchState;
15import helios.engine.mechanics.match.types.MatchStateTransitionId;
16
17import helios.engine.state.commands;
18import helios.engine.state.types.StateTransitionRequest;
19
20import helios.engine.state.types;
21import helios.engine.mechanics.gamestate.types;
22
23import helios.engine.ecs;
24import helios.engine.runtime;
25
27using namespace helios::engine::state::types;
30
31import helios.engine.common.tags.SystemRole;
32
34
35 /**
36 * @brief Automatically advances the match through its state phases.
37 *
38 * This system checks the current match state and issues appropriate
39 * transition commands to progress through: Undefined -> Warmup ->
40 * PlayerSpawn -> Playing.
41 */
43
44 MatchState prevMatchState_ = MatchState::Undefined;
46
47
48 public:
49
51
52 /**
53 * @brief Processes match state and issues transition commands.
54 *
55 * @param updateContext The current update context.
56 */
58
59 auto& session = updateContext.session();
60
61 const auto matchState = session.state<MatchState>();
62 auto matchStateTransitionId = session.stateTransitionId<MatchState>();
63
64 if (matchState != MatchState::Undefined && prevMatchState_ == matchState && prevMatchStateTransitionId_ == matchStateTransitionId) {
65 return;
66 }
67
68 prevMatchState_= matchState;
69 prevMatchStateTransitionId_ = matchStateTransitionId;
70
71 switch (matchState) {
72
73
75 updateContext.queueCommand<StateCommand<MatchState>>(
77 );
78 break;
79 }
80
82 updateContext.queueCommand<StateCommand<MatchState>>(
84 );
85 break;
86 }
87
89 updateContext.queueCommand<StateCommand<MatchState>>(
91 );
92 break;
93 }
94
95
96
97
98 default:
99 break;
100 }
101 }
102 };
103}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.