1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add team death match support #33

This commit is contained in:
NG (Graham)
2025-09-14 12:08:52 -04:00
parent d194e29ff7
commit 525fa8b87e
13 changed files with 565 additions and 65 deletions

View File

@@ -225,7 +225,7 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
users: tokio::sync::RwLock::new(std::collections::HashMap::new()),
user_id_map: tokio::sync::RwLock::new(std::collections::HashMap::new()),
is_complete: std::sync::atomic::AtomicBool::new(false),
game_start: std::sync::atomic::AtomicI64::new(-1),
game_start: std::sync::atomic::AtomicI64::new(i64::MIN),
map_config: std::sync::Arc::new(map),
game_descriptor: game,
game_duration: std::time::Duration::from_secs((config.game_time_minutes as u64) * 60),
@@ -322,6 +322,12 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
self.game_start.load(std::sync::atomic::Ordering::Relaxed) + self.game_duration.as_secs() as i64
}
pub(super) fn is_game_past_end_time(&self) -> bool {
let game_start = self.game_start.load(std::sync::atomic::Ordering::Relaxed);
let game_end = self.game_end();
game_start != i64::MIN && game_end <= chrono::Utc::now().timestamp()
}
/*pub(super) async fn send_to_player<T: byteserde::ser_heap::ByteSerializeHeap + ?Sized>(&self, player_id: u8, code: rlnl::event_code::NetworkEvent, property: literustlib::packet::Property, data: &T) {
if let Some(player) = self.users.read().await.get(&player_id) {
crate::events::log_lnl_send_failure(player.connection.rlnl().send_data(
@@ -1214,8 +1220,6 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
literustlib::packet::Property::ReliableOrdered,
&connection.connection)
.await?;*/
// TODO
Ok(())
}