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

Move common components to shared lib

This commit is contained in:
NGnius (Graham)
2025-03-30 16:22:25 -04:00
parent 610f54e236
commit 0e048a17b1
76 changed files with 284 additions and 1110 deletions

View File

@@ -0,0 +1,19 @@
use polariton::operation::Typed;
pub struct AutoRegenHealthConfig {
pub seconds_to_wait_for_heal: f32,
pub seconds_to_full_heal: f32,
pub threshold_to_start_sound: f32,
pub enable_auto_heal: bool,
}
impl AutoRegenHealthConfig {
pub fn as_transmissible<C>(&self) -> Typed<C> {
let mut bytes = Vec::with_capacity(13);
bytes.extend_from_slice(&self.seconds_to_wait_for_heal.to_le_bytes());
bytes.extend_from_slice(&self.seconds_to_full_heal.to_le_bytes());
bytes.extend_from_slice(&self.threshold_to_start_sound.to_le_bytes());
bytes.push(self.enable_auto_heal as u8);
Typed::Bytes(bytes.into())
}
}