From 35b43264c09405c987b48de78b6ca19f29dc7849 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Thu, 14 Feb 2019 12:05:57 -0600 Subject: simplified receive pattern even more and moved all controls to the module --- src/modules/construction.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/modules/construction.rs') diff --git a/src/modules/construction.rs b/src/modules/construction.rs index 20f1688..6c27db5 100644 --- a/src/modules/construction.rs +++ b/src/modules/construction.rs @@ -2,6 +2,7 @@ use std::time::SystemTime; use crate::constants; use crate::modules::types::ModuleType; +use crate::server::construction::ConstructionData; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub enum ConstructionStatus { @@ -43,6 +44,14 @@ impl Construction { } } + pub fn give_recv(&mut self, recv: String, construction_data: &ConstructionData) { + if let "c" = recv.as_str() { + if construction_data.has_enough { + self.toggle() + } + } + } + pub fn toggle(&mut self) { match self.status { ConstructionStatus::None => self.on(), -- cgit v1.2.3