mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/block/simple.rs')
| -rw-r--r-- | src/block/simple.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/block/simple.rs b/src/block/simple.rs index ebbcc92..330ee7f 100644 --- a/src/block/simple.rs +++ b/src/block/simple.rs @@ -1,4 +1,33 @@ +use std::any::{Any, type_name}; + use crate::block::BlockLogic; +use crate::data::dynamic::DynData; + +macro_rules!gen_state_empty +{ + () => + { + fn data_from_i32(&self, _: i32) -> DynData + { + DynData::Empty + } + + fn deserialize_state(&self, _: DynData) -> Option<Box<dyn Any>> + { + None + } + + fn clone_state(&self, _: &dyn Any) -> Box<dyn Any> + { + panic!("{} has no custom state", type_name::<Self>()) + } + + fn serialize_state(&self, _: &dyn Any) -> DynData + { + DynData::Empty + } + }; +} pub struct SimpleBlock { @@ -25,4 +54,6 @@ impl BlockLogic for SimpleBlock { self.symmetric } + + gen_state_empty!(); } |