1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00
Files
ojrc/rc_social_room/src/events/platoon_member_update.rs
NG (Graham) 50b396f34a Platoons social functionality (#91)
### Description

This implements and completes #87 (to the best of my knowledge)

### Game

Robocraft

### Please confirm

- [x] I am the legal owner or represent the owner of all work submitted
- [x] I consent to my submission being added to this FOSS project
- [ ] This PR used LLMs to generate some or all of the code changes

Reviewed-on: https://git.ngram.ca/OpenJam/rc-servers/pulls/91
Co-authored-by: NG (Graham) <ngniusness@gmail.com>
Co-committed-by: NG (Graham) <ngniusness@gmail.com>
2026-02-19 01:57:03 +00:00

32 lines
1.1 KiB
Rust

#[derive(Clone)]
pub struct PlatoonMemberStatusUpdate {
pub member_public_id: String,
pub member_display_name: String,
pub member_status: crate::data::platoon::MemberStatus,
}
impl PlatoonMemberStatusUpdate {
pub const CODE: u8 = 18;
pub fn as_event_params<C>(&self) -> polariton::operation::ParameterTable<C> {
let mut params = std::collections::HashMap::with_capacity(2);
params.insert(1, polariton::operation::Typed::Str(self.member_public_id.clone().into()));
params.insert(75, polariton::operation::Typed::Str(self.member_display_name.clone().into()));
params.insert(3, polariton::operation::Typed::Int(self.member_status.as_u8() as i32));
params.into()
}
}
impl <C: Send + 'static> polariton_server::events::IntoEvent<C> for PlatoonMemberStatusUpdate {
const CHANNEL: u8 = 0;
const ENCRYPT: bool = true;
const RELIABLE: bool = true;
fn into_event(self) -> polariton::operation::Event<C> {
polariton::operation::Event {
code: Self::CODE,
params: self.as_event_params(),
}
}
}