mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/block/walls.rs')
| -rw-r--r-- | src/block/walls.rs | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/src/block/walls.rs b/src/block/walls.rs index 25dc4f2..1b6f25a 100644 --- a/src/block/walls.rs +++ b/src/block/walls.rs @@ -1,42 +1,46 @@ //! walls -use super::State; -use crate::block::simple::{cost, state_impl, BuildCost, SimpleBlock}; -use crate::block::{ - impl_block, make_register, BlockLogic, DataConvertError, DeserializeError, SerializeError, -}; -use crate::data::dynamic::{DynData, DynType}; -use crate::data::GridPos; -use crate::item::storage::Storage; +use crate::block::make_register; +use crate::block::simple::{cost, make_simple, state_impl}; +use crate::data::dynamic::DynType; +use crate::data::renderer::{load, read_with, TOP}; + +make_simple!(WallBlock, |_, _, name, _| { + if name == "thruster" { + const SFX: &[&str; 1] = &[TOP]; + return Some(read_with("turrets", "thruster", SFX, 4u32)); + } + Some(load("walls", name).unwrap()) +}); make_register! { - "copper-wall" => SimpleBlock::new(1, true, cost!(Copper: 6)); - "copper-wall-large" => SimpleBlock::new(2, true, cost!(Copper: 6 * 4)); - "titanium-wall" => SimpleBlock::new(1, true, cost!(Titanium: 6)); - "titanium-wall-large" => SimpleBlock::new(2, true, cost!(Titanium: 6 * 4)); - "plastanium-wall" => SimpleBlock::new(1, true, cost!(Metaglass: 2, Plastanium: 5)); - "plastanium-wall-large" => SimpleBlock::new(2, true, cost!(Metaglass: 2 * 4, Plastanium: 5 * 4)); - "thorium-wall" => SimpleBlock::new(1, true, cost!(Thorium: 6)); - "thorium-wall-large" => SimpleBlock::new(2, true, cost!(Thorium: 6 * 4)); - "phase-wall" => SimpleBlock::new(1, true, cost!(PhaseFabric: 6)); - "phase-wall-large" => SimpleBlock::new(2, true, cost!(PhaseFabric: 6 * 4)); - "surge-wall" => SimpleBlock::new(1, true, cost!(SurgeAlloy: 6)); - "surge-wall-large" => SimpleBlock::new(2, true, cost!(SurgeAlloy: 6 * 4)); + "copper-wall" => WallBlock::new(1, true, cost!(Copper: 6)); + "copper-wall-large" => WallBlock::new(2, true, cost!(Copper: 6 * 4)); + "titanium-wall" => WallBlock::new(1, true, cost!(Titanium: 6)); + "titanium-wall-large" => WallBlock::new(2, true, cost!(Titanium: 6 * 4)); + "plastanium-wall" => WallBlock::new(1, true, cost!(Metaglass: 2, Plastanium: 5)); + "plastanium-wall-large" => WallBlock::new(2, true, cost!(Metaglass: 2 * 4, Plastanium: 5 * 4)); + "thorium-wall" => WallBlock::new(1, true, cost!(Thorium: 6)); + "thorium-wall-large" => WallBlock::new(2, true, cost!(Thorium: 6 * 4)); + "phase-wall" => WallBlock::new(1, true, cost!(PhaseFabric: 6)); + "phase-wall-large" => WallBlock::new(2, true, cost!(PhaseFabric: 6 * 4)); + "surge-wall" => WallBlock::new(1, true, cost!(SurgeAlloy: 6)); + "surge-wall-large" => WallBlock::new(2, true, cost!(SurgeAlloy: 6 * 4)); "door" => DoorBlock::new(1, true, cost!(Titanium: 6, Silicon: 4)); "door-large" => DoorBlock::new(2, true, cost!(Titanium: 6 * 4, Silicon: 4 * 4)); - "tungsten-wall" => SimpleBlock::new(1, true, cost!(Tungsten: 6)); - "large-tungsten-wall" => SimpleBlock::new(2, true, cost!(Tungsten: 6 * 4)); + "tungsten-wall" => WallBlock::new(1, true, cost!(Tungsten: 6)); + "large-tungsten-wall" => WallBlock::new(2, true, cost!(Tungsten: 6 * 4)); "blast-door" => DoorBlock::new(2, true, cost!(Tungsten: 24, Silicon: 24)); - "reinforced-surge-wall" => SimpleBlock::new(1, true, cost!(SurgeAlloy: 6, Tungsten: 2)); - "reinforced-surge-wall-large" => SimpleBlock::new(2, true, cost!(SurgeAlloy: 6 * 4, Tungsten: 2 * 4)); - "carbide-wall" => SimpleBlock::new(1, true, cost!(Thorium: 6, Carbide: 6)); - "carbide-wall-large" => SimpleBlock::new(2, true, cost!(Thorium: 6 * 4, Carbide: 6 * 4)); - "shielded-wall" => SimpleBlock::new(2, true, cost!(PhaseFabric: 20, SurgeAlloy: 12, Beryllium: 12)); + "reinforced-surge-wall" => WallBlock::new(1, true, cost!(SurgeAlloy: 6, Tungsten: 2)); + "reinforced-surge-wall-large" => WallBlock::new(2, true, cost!(SurgeAlloy: 6 * 4, Tungsten: 2 * 4)); + "carbide-wall" => WallBlock::new(1, true, cost!(Thorium: 6, Carbide: 6)); + "carbide-wall-large" => WallBlock::new(2, true, cost!(Thorium: 6 * 4, Carbide: 6 * 4)); + "shielded-wall" => WallBlock::new(2, true, cost!(PhaseFabric: 20, SurgeAlloy: 12, Beryllium: 12)); // sandbox only - "scrap-wall" => SimpleBlock::new(1, true, cost!(Scrap: 6)); - "scrap-wall-large" => SimpleBlock::new(2, true, cost!(Scrap: 24)); - "scrap-wall-huge" => SimpleBlock::new(3, true, cost!(Scrap: 54)); - "scrap-wall-gigantic" => SimpleBlock::new(4, true, cost!(Scrap: 96)); - "thruster" => SimpleBlock::new(4, false, cost!(Scrap: 96)); + "scrap-wall" => WallBlock::new(1, true, cost!(Scrap: 6)); + "scrap-wall-large" => WallBlock::new(2, true, cost!(Scrap: 24)); + "scrap-wall-huge" => WallBlock::new(3, true, cost!(Scrap: 54)); + "scrap-wall-gigantic" => WallBlock::new(4, true, cost!(Scrap: 96)); + "thruster" => WallBlock::new(4, false, cost!(Scrap: 96)); } pub struct DoorBlock { |