Files
shinespark/src/player.rs
T
EIREXE 6f1d8a7706
CI / build-and-test (push) Successful in 2m2s
CI / production-build (push) Successful in 12m18s
Add the ability to respawn and improve controller port mapping (#72)
Reviewed-on: #72
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
2026-09-27 11:54:08 +00:00

18 lines
766 B
Rust

use bevy::prelude::*;
use bevy_ggrs::prelude::*;
// #[require(Rollback)] is the idiomatic way to ensure an entity is always included in
// the rollback system. Whenever a Player is spawned, Rollback (and its RollbackId) will
// be added automatically — no need to add it manually in the spawn bundle.
/// Ties an entity to one of the session's input streams. Lives at the crate
/// root rather than in `netcode` because "which player is this" is a game
/// concept; `netcode` only decides where the inputs come from.
#[derive(Default, Component)]
#[require(Rollback, Transform)]
pub struct Player {
/// Dense GGRS session index.
pub handle: usize,
/// Port used for port-dependent gameplay such as respawn placement.
pub controller_port: usize,
}