mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/item/mod.rs')
| -rw-r--r-- | src/item/mod.rs | 72 |
1 files changed, 26 insertions, 46 deletions
diff --git a/src/item/mod.rs b/src/item/mod.rs index 6a4f8fc..863d3b0 100644 --- a/src/item/mod.rs +++ b/src/item/mod.rs @@ -1,49 +1,29 @@ //! the different kinds of items -use image::Rgb; - pub mod storage; - -macro_rules! item_enum { - ($($val:literal: $col:literal),* $(,)?) => - { - paste::paste! { - $crate::content::content_enum!(pub enum Type / Item for u16 | TryFromU16Error { - $($val),*, - }); - - impl Type { - pub fn color(&self) -> Rgb<u8> { - match &self { - $(Self::[<$val:camel>] => { - Rgb(color_hex::color_from_hex!($col)) - },)* - } - } - } - }} -} - -item_enum! { - "copper": "d99d73", - "lead": "8c7fa9", - "metaglass": "ebeef5", - "graphite": "b2c6d2", - "sand": "f7cba4", - "coal": "272727", - "titanium": "8da1e3", - "thorium": "f9a3c7", - "scrap": "777777", - "silicon": "53565c", - "plastanium": "cbd97f", - "phase-fabric": "f4ba6e", - "surge-alloy": "f3e979", - "spore-pod": "7457ce", - "blast-compound": "ff795e", - "pyratite": "ffaa5f", - "beryllium": "3a8f64", - "tungsten": "768a9a", - "oxide": "e4ffd6", - "carbide": "89769a", - "fissile-matter": "5e988d", - "dormant-cyst": "df824d", +use crate::content::color_content_enum; +color_content_enum! { + pub enum Type / Item for u16 | TryFromU16Error { + "copper": "d99d73", + "lead": "8c7fa9", + "metaglass": "ebeef5", + "graphite": "b2c6d2", + "sand": "f7cba4", + "coal": "272727", + "titanium": "8da1e3", + "thorium": "f9a3c7", + "scrap": "777777", + "silicon": "53565c", + "plastanium": "cbd97f", + "phase-fabric": "f4ba6e", + "surge-alloy": "f3e979", + "spore-pod": "7457ce", + "blast-compound": "ff795e", + "pyratite": "ffaa5f", + "beryllium": "3a8f64", + "tungsten": "768a9a", + "oxide": "e4ffd6", + "carbide": "89769a", + "fissile-matter": "5e988d", + "dormant-cyst": "df824d", + } } |