diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-21 00:12:13 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:24:39 +0200 | 
| commit | a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7 (patch) | |
| tree | b928cf5ae7b8179f029fbd36f46487dedf582fc7 /server/src/interaction.rs | |
| parent | 10aaa4f56642e30b2886735363eb12dfa88e2b70 (diff) | |
| download | hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar.bz2 hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar.zst | |
show bad passive recipes in red
Diffstat (limited to 'server/src/interaction.rs')
| -rw-r--r-- | server/src/interaction.rs | 15 | 
1 files changed, 11 insertions, 4 deletions
| diff --git a/server/src/interaction.rs b/server/src/interaction.rs index 7f694ad8..ef6d5bf7 100644 --- a/server/src/interaction.rs +++ b/server/src/interaction.rs @@ -13,6 +13,7 @@ pub enum Recipe {          tile: Option<TileIndex>,          input: ItemIndex,          output: Option<ItemIndex>, +        warn: bool,      },      Active {          duration: f32, @@ -42,6 +43,12 @@ impl Recipe {              _ => None,          }      } +    pub fn warn(&self) -> bool { +        match self { +            Recipe::Passive { warn, .. } => *warn, +            _ => false, +        } +    }      pub fn inputs(&self) -> Vec<ItemIndex> {          match self {              Recipe::Passive { input, .. } => vec![*input], @@ -189,7 +196,7 @@ pub fn interact(  }  pub enum TickEffect { -    Progress, +    Progress(bool),      Produce,  }  pub fn tick_tile(dt: f32, data: &Gamedata, tile: &mut Tile) -> Option<TickEffect> { @@ -205,7 +212,7 @@ pub fn tick_tile(dt: f32, data: &Gamedata, tile: &mut Tile) -> Option<TickEffect                      };                      a.progress = 1.;                  } -                return Some(TickEffect::Progress); +                return Some(TickEffect::Progress(r.warn()));              }          } else {              for (ri, recipe) in data.recipes() { @@ -220,11 +227,11 @@ pub fn tick_tile(dt: f32, data: &Gamedata, tile: &mut Tile) -> Option<TickEffect                              recipe: ri,                              progress: 0.,                              working: 1, -                        }) +                        }); +                        return Some(TickEffect::Progress(recipe.warn()));                      }                  }              } -            return Some(TickEffect::Progress);          }      }      None | 
