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:
19
rc_core/src/data/auto_regen.rs
Normal file
19
rc_core/src/data/auto_regen.rs
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user