Defining System Events
System events are plain Go structs that implement theSystemEvent interface. This interface requires a single Name() method that returns a unique string identifier:
Using System Events
Just like with components and commands, you must declare the system events a system can access in its state struct.Emitting System Events
Add acardinal.WithSystemEventEmitter[T] field to your system state type, where T is your system event type:
Emit to send a system event:
A system cannot have multiple
WithSystemEventEmitter fields with the same system event type.Receiving System Events
Add acardinal.WithSystemEventReceiver[T] field to your system state type:
Iter to loop through all system events of that type received this tick:
A system cannot have multiple
WithSystemEventReceiver fields with the same system event type.
However, different systems can receive the same system event type.