diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-09-04 20:41:39 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-09-04 20:41:39 +0200 | 
| commit | 619c2b27f26e596c8bffc4ffb5b5b94e5bbe72da (patch) | |
| tree | b6d9cd0932dd8a3b48ce0edf126a0ea6314b7388 /server/protocol | |
| parent | eaae75ef73a2d3cafda300ab63b67a9cfcb64955 (diff) | |
| download | hurrycurry-619c2b27f26e596c8bffc4ffb5b5b94e5bbe72da.tar hurrycurry-619c2b27f26e596c8bffc4ffb5b5b94e5bbe72da.tar.bz2 hurrycurry-619c2b27f26e596c8bffc4ffb5b5b94e5bbe72da.tar.zst | |
precompute recipe speed
Diffstat (limited to 'server/protocol')
| -rw-r--r-- | server/protocol/src/lib.rs | 18 | 
1 files changed, 8 insertions, 10 deletions
| diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index 68af0e63..055b41c6 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -258,15 +258,15 @@ pub struct Score {  #[serde(rename_all = "snake_case")]  pub enum Recipe {      Passive { -        duration: f32, -        revert_duration: Option<f32>, +        speed: f32, +        revert_speed: Option<f32>,          tile: Option<TileIndex>,          input: ItemIndex,          output: Option<ItemIndex>,          warn: bool,      },      Active { -        duration: f32, +        speed: f32,          tile: Option<TileIndex>,          input: ItemIndex,          outputs: [Option<ItemIndex>; 2], @@ -323,18 +323,16 @@ impl Recipe {              Recipe::Instant { tile, .. } => *tile,          }      } -    pub fn duration(&self) -> Option<f32> { +    pub fn speed(&self) -> Option<f32> {          match self { -            Recipe::Passive { duration, .. } => Some(*duration), -            Recipe::Active { duration, .. } => Some(*duration), +            Recipe::Passive { speed, .. } => Some(*speed), +            Recipe::Active { speed, .. } => Some(*speed),              _ => None,          }      } -    pub fn revert_duration(&self) -> Option<f32> { +    pub fn revert_speed(&self) -> Option<f32> {          match self { -            Recipe::Passive { -                revert_duration, .. -            } => *revert_duration, +            Recipe::Passive { revert_speed, .. } => *revert_speed,              _ => None,          }      } | 
