Add the ability to respawn and improve controller port mapping (#72)
CI / build-and-test (push) Successful in 2m2s
CI / production-build (push) Successful in 12m18s

Reviewed-on: #72
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #72.
This commit is contained in:
2026-09-27 11:54:08 +00:00
committed by EIREXE
parent bb238d2cbc
commit 6f1d8a7706
15 changed files with 438 additions and 85 deletions
+29 -2
View File
@@ -65,7 +65,10 @@ impl MenuMatchConfig {
let stage = self.stage.ok_or(MenuMatchConfigErrors::StageNotSelected)?;
for player in self.players.iter() {
let mut players = self.players.iter().collect::<Vec<_>>();
players.sort_unstable_by_key(|player| player.slot);
for (handle, player) in players.into_iter().enumerate() {
let fighter_id =
player
.fighter
@@ -74,7 +77,8 @@ impl MenuMatchConfig {
))?;
match_players.push(MatchPlayer {
fighter: fighter_id,
handle: player.slot,
handle,
controller_port: player.slot,
});
}
@@ -102,4 +106,27 @@ mod tests {
assert_eq!(menu.to_match_config().unwrap().rules, MatchRules::default());
}
#[test]
fn sparse_controller_ports_get_dense_ggrs_handles() {
let menu = MenuMatchConfig {
stage: Some(StageId::TestStage),
players: vec![
MenuMatchPlayerSlot {
slot: 3,
fighter: Some(FighterId::TestFighter),
},
MenuMatchPlayerSlot {
slot: 0,
fighter: Some(FighterId::TestFighter),
},
],
};
let config = menu.to_match_config().unwrap();
assert_eq!(config.players[0].handle, 0);
assert_eq!(config.players[0].controller_port, 0);
assert_eq!(config.players[1].handle, 1);
assert_eq!(config.players[1].controller_port, 3);
}
}