66 .killer = kill.killer,
67 .position = detail::position_of(registry, kill.victim)});
89using shmup::ShotFired;
Lets systems react to events without knowing who sends them.
Definition event_bus.hpp:31
void publish(const Event &event)
Calls every handler of type Event with event, before returning.
Definition event_bus.hpp:66
Handle to an entity: 32 bits made of a 24-bit index and an 8-bit generation.
Definition entity.hpp:23
Entry point of the ECS: creates entities and stores their components.
Definition registry.hpp:34
std::optional< std::reference_wrapper< Component > > try_get(Entity entity)
Component of an entity, if it has one.
Definition registry.hpp:147
Damage on hit: turns collision contacts into lost health, kills and spent missiles.
Components shared by the client and the server.
Generational entity handle: an index into the component pools plus a generation.
Typed publish/subscribe event bus with immediate dispatch.
Player deaths: lives, respawn and game over.
Vector and matrix types of the engine (GLM behind engine names).
Entity-Component-System used by client and server.
Definition animation.hpp:13
void publish_deaths(core::EventBus &events, std::span< const LifeLost > lost)
Publishes each player's death of the tick.
Definition events.hpp:76
void publish_explosions(core::EventBus &events, const Registry ®istry, const DamageReport &report)
Publishes an Explosion for each kill of the tick, in the order of the kills.
Definition events.hpp:62
void publish_shots(core::EventBus &events, const ecs::Registry ®istry, std::span< const ecs::Entity > shooters)
Publishes a ShotFired for each entity that fires during the tick.
Definition weapons.hpp:105
glm::vec2 Vec2
2D vector of floats: positions, velocities, sizes (glm::vec2).
Definition math.hpp:19
Registry: owns the entities and one component pool per component type.
Weapons: fire rate enforced by the server, for players and for enemies that fire on their own,...
What apply_damage() did during one tick, in the order of the contacts.
Definition damage.hpp:45
std::vector< Kill > kills
Entities whose health reached zero or less during the tick, once each.
Definition damage.hpp:49
An entity whose health reached zero blows up: an enemy shot down, or a player that loses a life.
Definition events.hpp:31
friend bool operator==(const Explosion &, const Explosion &)=default
Compares the events.
Vec2 position
Where the entity was hit (its Transform), the origin if it has none.
Definition events.hpp:37
Entity entity
Entity that was killed (Kill::victim).
Definition events.hpp:33
Entity killer
Attacker of the last hit (Kill::killer), e.g. the missile.
Definition events.hpp:35
An entity whose health reached zero, and the hit that did it.
Definition damage.hpp:32
A player who lost a life during the tick.
Definition lives.hpp:17