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

Add map ping support #30

This commit is contained in:
NG (Graham)
2025-08-03 16:39:16 -04:00
parent 721922c4ea
commit 580ce69839
4 changed files with 50 additions and 0 deletions

View File

@@ -535,6 +535,18 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
).await;
}
},
super::GameMessage::MapPing { user_id: _, ping } => {
for (id, conn) in self.users.read().await.iter() {
if (*id as i32) != ping.sender && (conn.descriptor.team as i32) == ping.team_id {
crate::events::log_lnl_send_failure(conn.connection.rlnl().send_data(
&ping,
rlnl::event_code::NetworkEvent::PlayerQuitRequestComplete,
literustlib::packet::Property::ReliableOrdered,
&conn.connection.connection
).await);
}
}
}
super::GameMessage::BroadcastRlnl { user_id, event, event_in, property, data } => {
if self.custom_logic_handler.on_broadcast(&self, user_id, event, event_in, property, &data, false).await {
if let Some(data) = data {

View File

@@ -45,6 +45,10 @@ pub enum GameMessage {
FlippingStarted { // flip yeah!
user_id: i32,
},
MapPing {
user_id: i32,
ping: rlnl::events::ingame::MapPing,
},
BroadcastRlnl {
user_id: i32,
event: rlnl::event_code::NetworkEvent,
@@ -82,6 +86,7 @@ impl GameMessage {
Self::DestroyVehicle { user_id, .. } => *user_id,
Self::SelfDestruct { user_id, .. } => *user_id,
Self::FlippingStarted { user_id, .. } => *user_id,
Self::MapPing { user_id, .. } => *user_id,
Self::BroadcastRlnl { user_id, .. } => *user_id,
Self::RebroadcastRlnl { skip_user_id, .. } => *skip_user_id,
Self::Motion { user_id, .. } => *user_id,