Change seat selection to time-based.

This commit is contained in:
yukirij 2024-09-06 11:01:50 -07:00
parent 69af74102d
commit 18343799a3

View File

@ -657,11 +657,7 @@ pub async fn thread_system(mut app:App, bus:Bus<protocol::QRPacket>)
let chain_id = app.session_time.add(token);
// Choose player seats.
let mut seats = [0u8; 8];
if rng.fill(&mut seats).is_err() {
println!("RNG error");
}
println!("rng {}", seats[0]);
let time = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_millis() as u64;
// Build session.
let mut session = Session {
@ -670,11 +666,11 @@ pub async fn thread_system(mut app:App, bus:Bus<protocol::QRPacket>)
secret,
game:game::Game::new(),
p_dawn:Player {
user:if (seats[0] & 2) == 0 { user_id } else { chal_id },
user:if (time & 1) == 0 { user_id } else { chal_id },
connections:Vec::new(),
},
p_dusk:Player {
user:if (seats[0] & 2) == 0 { chal_id } else { user_id },
user:if (time & 1) == 0 { chal_id } else { user_id },
connections:Vec::new(),
},
connections:Vec::new(),