mindustry logic execution, map- and schematic- parsing and rendering
custom exit commands
| -rw-r--r-- | mindus/Cargo.toml | 2 | ||||
| -rw-r--r-- | mindus/src/block/units.rs | 6 | ||||
| -rw-r--r-- | mindus/src/content.rs | 2 | ||||
| -rw-r--r-- | mindus/src/data/command.rs | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/mindus/Cargo.toml b/mindus/Cargo.toml index be1ca28..6610afc 100644 --- a/mindus/Cargo.toml +++ b/mindus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mindus" -version = "5.0.31" +version = "5.0.32" edition = "2021" description = "A library for working with mindustry data formats (eg schematics and maps) (fork of plandustry)" authors = [ diff --git a/mindus/src/block/units.rs b/mindus/src/block/units.rs index 97e3b98..6e1bb0f 100644 --- a/mindus/src/block/units.rs +++ b/mindus/src/block/units.rs @@ -128,6 +128,12 @@ impl BlockLogic for ConstructorBlock { fn deserialize_state(&self, data: DynData) -> Result<Option<State>, DeserializeError> { match data { DynData::Empty => Ok(Some(Self::create_state(None))), + DynData::Content(crate::content::Type::UnitCommand, n) => { + Ok(Some(Self::create_state(Some( + UnitCommand::try_from(n as u8) + .map_err(|x| DeserializeError::Custom(Box::new(x)))?, + )))) + } DynData::UnitCommand(u) => Ok(Some(Self::create_state(Some(u)))), _ => Err(DeserializeError::InvalidType { have: data.get_type(), diff --git a/mindus/src/content.rs b/mindus/src/content.rs index 13cc5eb..60e1ca3 100644 --- a/mindus/src/content.rs +++ b/mindus/src/content.rs @@ -146,6 +146,8 @@ numeric_enum! { Planet = 13, // Ammo = 14, Team = 15, + UnitCommand = 16, + UnitStance = 17, } } diff --git a/mindus/src/data/command.rs b/mindus/src/data/command.rs index 7d5298c..f4d679d 100644 --- a/mindus/src/data/command.rs +++ b/mindus/src/data/command.rs @@ -2,6 +2,6 @@ use crate::content::numeric_enum; numeric_enum! { pub enum UnitCommand for u8 | TryFromU8Error { - Move, Repair, Rebuild, Assist, Mine, Boost, + Move, Repair, Rebuild, Assist, Mine, Boost, EnterPayload, LoadUnits, LoadBlocks, UnloadPayload, LoopPayload } } |