mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/data/schematic.rs')
| -rw-r--r-- | src/data/schematic.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/schematic.rs b/src/data/schematic.rs index 86c6348..be7c0ff 100644 --- a/src/data/schematic.rs +++ b/src/data/schematic.rs @@ -10,6 +10,7 @@ use flate2::{ Compress, CompressError, Compression, Decompress, DecompressError, FlushCompress, FlushDecompress, Status, }; +use image::RgbaImage; use crate::block::{self, Block, BlockRegistry, Rotation}; use crate::data::base64; @@ -22,8 +23,8 @@ pub const MAX_DIMENSION: u16 = 128; pub const MAX_BLOCKS: u32 = 128 * 128; pub struct Placement<'l> { - pos: GridPos, - block: &'l Block, + pub pos: GridPos, + pub block: &'l Block, state: Option<Box<dyn Any>>, rot: Rotation, } @@ -50,6 +51,10 @@ impl<'l> Placement<'l> { } } + pub fn image(&self) -> RgbaImage { + self.block.image(self.get_state()) + } + pub fn set_state( &mut self, data: DynData, |