mindustry logic execution, map- and schematic- parsing and rendering
reduce number of block types
bendn 2023-08-08
parent 924e79c · commit 6224367
-rw-r--r--src/block/campaign.rs7
-rw-r--r--src/block/defense.rs21
-rw-r--r--src/block/distribution.rs14
-rw-r--r--src/block/drills.rs7
-rw-r--r--src/block/environment.rs6
-rw-r--r--src/block/liquid.rs29
-rw-r--r--src/block/logic.rs7
-rw-r--r--src/block/mod.rs18
-rw-r--r--src/block/power.rs5
-rw-r--r--src/block/production.rs7
-rw-r--r--src/block/simple.rs2
-rw-r--r--src/block/storage.rs26
-rw-r--r--src/block/units.rs3
-rw-r--r--src/data/renderer.rs11
14 files changed, 65 insertions, 98 deletions
diff --git a/src/block/campaign.rs b/src/block/campaign.rs
index 46ff605..1283f3e 100644
--- a/src/block/campaign.rs
+++ b/src/block/campaign.rs
@@ -1,8 +1,7 @@
//! campaign blocks
use crate::block::make_register;
-use crate::block::simple::{cost, make_simple};
-make_simple!(CampaignBlock);
+use crate::block::simple::{cost, BasicBlock};
make_register! {
- "launch-pad" -> CampaignBlock::new(3, true, cost!(Copper: 350, Lead: 200, Titanium: 150, Silicon: 140));
- "interplanetary-accelerator" -> CampaignBlock::new(7, true, cost!(Copper: 16000, Silicon: 11000, Thorium: 13000, Titanium: 12000, SurgeAlloy: 6000, PhaseFabric: 5000));
+ "launch-pad" -> BasicBlock::new(3, true, cost!(Copper: 350, Lead: 200, Titanium: 150, Silicon: 140));
+ "interplanetary-accelerator" -> BasicBlock::new(7, true, cost!(Copper: 16000, Silicon: 11000, Thorium: 13000, Titanium: 12000, SurgeAlloy: 6000, PhaseFabric: 5000));
}
diff --git a/src/block/defense.rs b/src/block/defense.rs
index 73c290b..0dae9aa 100644
--- a/src/block/defense.rs
+++ b/src/block/defense.rs
@@ -1,24 +1,23 @@
//! defense
-use crate::block::simple::{cost, make_simple};
+use crate::block::simple::{cost, make_simple, BasicBlock};
use crate::block::*;
-make_simple!(DefenseBlock);
make_simple!(HeatedBlock => |_, _, _, buff: &mut DataRead| read_heated(buff));
make_register! {
"mender" -> HeatedBlock::new(1, true, cost!(Copper: 25, Lead: 30));
"mend-projector" -> HeatedBlock::new(2, true, cost!(Copper: 50, Lead: 100, Titanium: 25, Silicon: 40));
"overdrive-projector" -> HeatedBlock::new(2, true, cost!(Lead: 100, Titanium: 75, Silicon: 75, Plastanium: 30));
"overdrive-dome" -> HeatedBlock::new(3, true, cost!(Lead: 200, Titanium: 130, Silicon: 130, Plastanium: 80, SurgeAlloy: 120));
- "force-projector" -> DefenseBlock::new(3, true, cost!(Lead: 100, Titanium: 75, Silicon: 125));
- "regen-projector" -> DefenseBlock::new(3, true, cost!(Silicon: 80, Tungsten: 60, Oxide: 40, Beryllium: 80));
- "shock-mine" -> DefenseBlock::new(1, true, cost!(Lead: 25, Silicon: 12));
- "radar" -> DefenseBlock::new(1, true, cost!(Silicon: 60, Graphite: 50, Beryllium: 10));
- "build-tower" -> DefenseBlock::new(3, true, cost!(Silicon: 150, Oxide: 40, Thorium: 60));
- "shockwave-tower" -> DefenseBlock::new(3, true, cost!(SurgeAlloy: 50, Silicon: 150, Oxide: 30, Tungsten: 100));
+ "force-projector" -> BasicBlock::new(3, true, cost!(Lead: 100, Titanium: 75, Silicon: 125));
+ "regen-projector" -> BasicBlock::new(3, true, cost!(Silicon: 80, Tungsten: 60, Oxide: 40, Beryllium: 80));
+ "shock-mine" -> BasicBlock::new(1, true, cost!(Lead: 25, Silicon: 12));
+ "radar" -> BasicBlock::new(1, true, cost!(Silicon: 60, Graphite: 50, Beryllium: 10));
+ "build-tower" -> BasicBlock::new(3, true, cost!(Silicon: 150, Oxide: 40, Thorium: 60));
+ "shockwave-tower" -> BasicBlock::new(3, true, cost!(SurgeAlloy: 50, Silicon: 150, Oxide: 30, Tungsten: 100));
// barrier projector
// editor only
- "barrier-projector" -> DefenseBlock::new(3, true, &[]);
- "shield-projector" -> DefenseBlock::new(3, true, &[]);
- "large-shield-projector" -> DefenseBlock::new(4, true, &[]);
+ "barrier-projector" -> BasicBlock::new(3, true, &[]);
+ "shield-projector" -> BasicBlock::new(3, true, &[]);
+ "large-shield-projector" -> BasicBlock::new(4, true, &[]);
}
/// format:
diff --git a/src/block/distribution.rs b/src/block/distribution.rs
index abf6433..aa64a13 100644
--- a/src/block/distribution.rs
+++ b/src/block/distribution.rs
@@ -115,7 +115,6 @@ make_simple!(
|_, _, _, buff: &mut DataRead| buff.skip(8),
true
);
-make_simple!(ControlBlock);
make_simple!(
SurgeRouter
/ |s| {
@@ -137,10 +136,11 @@ make_register! {
"phase-conveyor" -> BridgeBlock::new(1, false, cost!(Lead: 10, Graphite: 10, Silicon: 7, PhaseFabric: 5), 12, true);
"sorter" => ItemBlock::new(1, true, cost!(Copper: 2, Lead: 2));
"inverted-sorter" => ItemBlock::new(1, true, cost!(Copper: 2, Lead: 2));
- "router" -> ControlBlock::new(1, true, cost!(Copper: 3));
- "distributor" -> ControlBlock::new(2, true, cost!(Copper: 4, Lead: 4));
- "overflow-gate" -> ControlBlock::new(1, true, cost!(Copper: 4, Lead: 2));
- "underflow-gate" -> ControlBlock::new(1, true, cost!(Copper: 4, Lead: 2));
+ "unloader" -> ItemBlock::new(1, true, cost!(Titanium: 25, Silicon: 30));
+ "router" -> BasicBlock::new(1, true, cost!(Copper: 3));
+ "distributor" -> BasicBlock::new(2, true, cost!(Copper: 4, Lead: 4));
+ "overflow-gate" -> BasicBlock::new(1, true, cost!(Copper: 4, Lead: 2));
+ "underflow-gate" -> BasicBlock::new(1, true, cost!(Copper: 4, Lead: 2));
"mass-driver" => BridgeBlock::new(3, true, cost!(Lead: 125, Titanium: 125, Thorium: 50, Silicon: 75), 55, false);
"duct" => DuctBlock::new(1, false, cost!(Beryllium: 1));
"armored-duct" => DuctBlock::new(1, false, cost!(Beryllium: 2, Tungsten: 1));
@@ -151,11 +151,11 @@ make_register! {
"duct-unloader" => ItemBlock::new(1, true, cost!(Graphite: 20, Silicon: 20, Tungsten: 10));
"surge-conveyor" => StackConveyor::new(1, false, cost!(SurgeAlloy: 1, Tungsten: 1));
"surge-router" => SurgeRouter::new(1, false, cost!(SurgeAlloy: 5, Tungsten: 1)); // not symmetric
- "unit-cargo-loader" -> UnitCargoLoader::new(3, true, cost!(Silicon: 80, SurgeAlloy: 50, Oxide: 20));
+ "unit-cargo-loader" -> BasicBlock::new(3, true, cost!(Silicon: 80, SurgeAlloy: 50, Oxide: 20));
"unit-cargo-unload-point" => ItemBlock::new(2, true, cost!(Silicon: 60, Tungsten: 60));
// sandbox only
"item-source" -> ItemBlock::new(1, true, &[]);
- "item-void" -> ControlBlock::new(1, true, &[]);
+ "item-void" -> BasicBlock::new(1, true, &[]);
}
pub struct ItemBlock {
diff --git a/src/block/drills.rs b/src/block/drills.rs
index 01332b4..ceffc70 100644
--- a/src/block/drills.rs
+++ b/src/block/drills.rs
@@ -1,6 +1,6 @@
//! extraction of raw resources (mine part)
use super::production::ProductionBlock;
-use crate::block::simple::{cost, make_simple};
+use crate::block::simple::{cost, make_simple, BasicBlock};
use crate::block::*;
make_simple!(
@@ -13,7 +13,6 @@ make_simple!(
},
|_, _, _, buff: &mut DataRead| read_drill(buff)
);
-make_simple!(ExtractorBlock);
make_simple!(WallDrillBlock, |_, _, _, _, rot: Rotation, scl| {
let mut base = load!("cliff-crusher", scl);
base.overlay(load!("cliff-crusher-top", scl).rotate(rot.rotated(false).count()));
@@ -25,8 +24,8 @@ make_register! {
"pneumatic-drill" -> DrillBlock::new(2, true, cost!(Copper: 18, Graphite: 10));
"laser-drill" -> DrillBlock::new(3, true, cost!(Copper: 35, Graphite: 30, Titanium: 20, Silicon: 30));
"blast-drill" -> DrillBlock::new(4, true, cost!(Copper: 65, Titanium: 50, Thorium: 75, Silicon: 60));
- "water-extractor" -> ExtractorBlock::new(2, true, cost!(Copper: 30, Lead: 30, Metaglass: 30, Graphite: 30));
- "oil-extractor" -> ExtractorBlock::new(3, true, cost!(Copper: 150, Lead: 115, Graphite: 175, Thorium: 115, Silicon: 75));
+ "water-extractor" -> BasicBlock::new(2, true, cost!(Copper: 30, Lead: 30, Metaglass: 30, Graphite: 30));
+ "oil-extractor" -> BasicBlock::new(3, true, cost!(Copper: 150, Lead: 115, Graphite: 175, Thorium: 115, Silicon: 75));
"vent-condenser" -> ProductionBlock::new(3, true, cost!(Graphite: 20, Beryllium: 60));
"cliff-crusher" -> WallDrillBlock::new(2, false, cost!(Beryllium: 100, Graphite: 40));
"plasma-bore" => DrillBlock::new(2, false, cost!(Beryllium: 40));
diff --git a/src/block/environment.rs b/src/block/environment.rs
index efa7803..267ebcd 100644
--- a/src/block/environment.rs
+++ b/src/block/environment.rs
@@ -1,17 +1,15 @@
//! grass
use crate::block::make_register;
-use crate::block::simple::make_simple;
+use crate::block::simple::BasicBlock;
macro_rules! register_env {
($($field:literal: $size:literal;)+) => {
make_register!(
- $($field -> EnvironmentBlock::new($size, true, &[]);)*
+ $($field -> BasicBlock::new($size, true, &[]);)*
);
};
}
-make_simple!(EnvironmentBlock);
-
register_env! {
"darksand": 1;
"sand-floor": 1;
diff --git a/src/block/liquid.rs b/src/block/liquid.rs
index 5044e3a..98cc65c 100644
--- a/src/block/liquid.rs
+++ b/src/block/liquid.rs
@@ -10,14 +10,13 @@ use crate::data::renderer::load;
use crate::fluid;
use crate::utils::ImageUtils;
-make_simple!(LiquidBlock);
make_simple!(
ConduitBlock,
|_, name, _, ctx: Option<&RenderingContext>, rot, s| {
let ctx = ctx.unwrap();
let mask = mask(ctx, rot, name);
let (index, rot, flip) = mask2rotations(mask, rot);
-
+
// TODO caps. stopped trying bcz too complex
rotations2tile((index, rot, flip), "conduit", s)
},
@@ -25,28 +24,28 @@ make_simple!(
);
make_register! {
- "reinforced-pump" -> LiquidBlock::new(2, true, cost!(Beryllium: 40, Tungsten: 30, Silicon: 20));
- "mechanical-pump" -> LiquidBlock::new(1, true, cost!(Copper: 15, Metaglass: 10));
- "rotary-pump" -> LiquidBlock::new(2, true, cost!(Copper: 70, Metaglass: 50, Titanium: 35, Silicon: 20));
- "impulse-pump" -> LiquidBlock::new(3, true, cost!(Copper: 80, Metaglass: 90, Titanium: 40, Thorium: 35, Silicon: 30));
+ "reinforced-pump" -> BasicBlock::new(2, true, cost!(Beryllium: 40, Tungsten: 30, Silicon: 20));
+ "mechanical-pump" -> BasicBlock::new(1, true, cost!(Copper: 15, Metaglass: 10));
+ "rotary-pump" -> BasicBlock::new(2, true, cost!(Copper: 70, Metaglass: 50, Titanium: 35, Silicon: 20));
+ "impulse-pump" -> BasicBlock::new(3, true, cost!(Copper: 80, Metaglass: 90, Titanium: 40, Thorium: 35, Silicon: 30));
"conduit" => ConduitBlock::new(1, false, cost!(Metaglass: 1));
"pulse-conduit" => ConduitBlock::new(1, false, cost!(Metaglass: 1, Titanium: 2));
"plated-conduit" => ConduitBlock::new(1, false, cost!(Metaglass: 1, Thorium: 2, Plastanium: 1));
- "liquid-router" -> LiquidBlock::new(1, true, cost!(Metaglass: 2, Graphite: 4));
- "liquid-container" -> LiquidBlock::new(2, true, cost!(Metaglass: 15, Titanium: 10));
- "liquid-tank" -> LiquidBlock::new(3, true, cost!(Metaglass: 40, Titanium: 30));
- "liquid-junction" -> LiquidBlock::new(1, true, cost!(Metaglass: 8, Graphite: 4));
+ "liquid-router" -> BasicBlock::new(1, true, cost!(Metaglass: 2, Graphite: 4));
+ "liquid-container" -> BasicBlock::new(2, true, cost!(Metaglass: 15, Titanium: 10));
+ "liquid-tank" -> BasicBlock::new(3, true, cost!(Metaglass: 40, Titanium: 30));
+ "liquid-junction" -> BasicBlock::new(1, true, cost!(Metaglass: 8, Graphite: 4));
"bridge-conduit" -> BridgeBlock::new(1, true, cost!(Metaglass: 8, Graphite: 4), 4, true);
"phase-conduit" -> BridgeBlock::new(1, true, cost!(Metaglass: 20, Titanium: 10, Silicon: 7, PhaseFabric: 5), 12, true);
"reinforced-conduit" => ConduitBlock::new(1, false, cost!(Beryllium: 2));
- "reinforced-liquid-junction" -> LiquidBlock::new(1, true, cost!(Graphite: 4, Beryllium: 8));
+ "reinforced-liquid-junction" -> BasicBlock::new(1, true, cost!(Graphite: 4, Beryllium: 8));
"reinforced-bridge-conduit" => BridgeBlock::new(1, true, cost!(Graphite: 8, Beryllium: 20), 4, true);
- "reinforced-liquid-router" -> LiquidBlock::new(1, true, cost!(Graphite: 8, Beryllium: 4));
- "reinforced-liquid-container" -> LiquidBlock::new(2, true, cost!(Tungsten: 10, Beryllium: 16));
- "reinforced-liquid-tank" -> LiquidBlock::new(3, true, cost!(Tungsten: 40, Beryllium: 50));
+ "reinforced-liquid-router" -> BasicBlock::new(1, true, cost!(Graphite: 8, Beryllium: 4));
+ "reinforced-liquid-container" -> BasicBlock::new(2, true, cost!(Tungsten: 10, Beryllium: 16));
+ "reinforced-liquid-tank" -> BasicBlock::new(3, true, cost!(Tungsten: 40, Beryllium: 50));
// sandbox only
"liquid-source" => FluidBlock::new(1, true, &[]);
- "liquid-void" -> LiquidBlock::new(1, true, &[]);
+ "liquid-void" -> BasicBlock::new(1, true, &[]);
}
pub struct FluidBlock {
diff --git a/src/block/logic.rs b/src/block/logic.rs
index 0320fb6..ebdda1e 100644
--- a/src/block/logic.rs
+++ b/src/block/logic.rs
@@ -10,7 +10,6 @@ use crate::{block::*, Serializer};
use crate::data::{self, CompressError, DataRead, DataWrite};
-make_simple!(LogicBlock);
make_simple!(
MemoryBlock =>
|_, _, _, buff: &mut DataRead| {
@@ -31,11 +30,11 @@ make_register! {
"hyper-processor" -> ProcessorLogic::new(3, true, cost!(Lead: 450, Thorium: 75, Silicon: 150, SurgeAlloy: 50));
"memory-cell" -> MemoryBlock::new(1, true, cost!(Copper: 30, Graphite: 30, Silicon: 30));
"memory-bank" -> MemoryBlock::new(2, true, cost!(Copper: 30, Graphite: 80, Silicon: 80, PhaseFabric: 30));
- "logic-display" -> LogicBlock::new(3, true, cost!(Lead: 100, Metaglass: 50, Silicon: 50));
- "large-logic-display" -> LogicBlock::new(6, true, cost!(Lead: 200, Metaglass: 100, Silicon: 150, PhaseFabric: 75));
+ "logic-display" -> BasicBlock::new(3, true, cost!(Lead: 100, Metaglass: 50, Silicon: 50));
+ "large-logic-display" -> BasicBlock::new(6, true, cost!(Lead: 200, Metaglass: 100, Silicon: 150, PhaseFabric: 75));
"canvas" => CanvasBlock::new(2, true, cost!(Silicon: 30, Beryllium: 10), 12);
// editor only
- "world-processor" -> LogicBlock::new(1, true, &[]);
+ "world-processor" -> BasicBlock::new(1, true, &[]);
"world-message" -> MessageLogic::new(1, true, &[]);
"world-cell" -> MemoryBlock::new(1, true, &[]);
}
diff --git a/src/block/mod.rs b/src/block/mod.rs
index efdc1ba..8f27516 100644
--- a/src/block/mod.rs
+++ b/src/block/mod.rs
@@ -22,6 +22,7 @@ macro_rules! mods {
pub mod all {
$(pub use crate::block::$mod::*;)*
+ pub use super::simple::BasicBlock;
}
}
}
@@ -41,7 +42,7 @@ macro_rules! disp {
}
#[const_trait]
pub trait ConstFrom<T>: Sized {
- fn fro(value: T) -> Self;
+ fn fro(value: T) -> Self;
}
$(
impl const ConstFrom<$k> for BlockLogicEnum {
@@ -62,20 +63,16 @@ macro_rules! disp {
}
disp! {
- EnvironmentBlock,
+ BasicBlock,
WallBlock,
DuctBlock,
BridgeBlock,
ItemBlock,
- BatteryBlock,
ProductionBlock,
StackConveyor,
HeatCrafter,
ConnectorBlock,
ItemTurret,
- ExtractorBlock,
- ControlBlock,
- LiquidBlock,
ConveyorBlock,
WallDrillBlock,
DrillBlock,
@@ -85,7 +82,6 @@ disp! {
HeatedBlock,
PointDefenseTurret,
JunctionBlock,
- DefenseBlock,
Turret,
MemoryBlock,
MessageLogic,
@@ -93,19 +89,14 @@ disp! {
AssemblerBlock,
SimpleDuctBlock,
SurgeRouter,
- UnitCargoLoader,
- LogicBlock,
SimplePayloadBlock,
PayloadConveyor,
ImpactReactorBlock,
Neoplasia,
DiodeBlock,
HeatConduit,
- Incinerator,
- StorageBlock,
ContinousTurret,
TractorBeamTurret,
- UnitRepairTower,
AssemblerModule,
RepairTurret,
FluidBlock,
@@ -115,7 +106,6 @@ disp! {
PayloadBlock,
LampBlock,
DoorBlock,
- CampaignBlock,
}
pub type State = Box<dyn Any + Sync + Send>;
@@ -251,7 +241,7 @@ impl SerializeError {
pub struct Block {
image: Option<[&'static LazyLock<RgbaImage>; 3]>,
name: &'static str,
- pub(crate) logic: BlockLogicEnum,
+ logic: BlockLogicEnum,
}
impl PartialEq for Block {
diff --git a/src/block/power.rs b/src/block/power.rs
index a46a0ab..e04481d 100644
--- a/src/block/power.rs
+++ b/src/block/power.rs
@@ -18,7 +18,6 @@ make_simple!(
},
|_, _, _, buff: &mut DataRead| read_heater(buff)
);
-make_simple!(BatteryBlock);
make_simple!(DiodeBlock, |_, _, _, _, rot: Rotation, s| {
let mut base = load!("diode", s);
if rot == Rotation::Right {
@@ -37,8 +36,8 @@ make_register! {
"power-node-large" -> ConnectorBlock::new(2, true, cost!(Lead: 10, Titanium: 5, Silicon: 3), 15);
"surge-tower" -> ConnectorBlock::new(2, true, cost!(Lead: 10, Titanium: 7, Silicon: 15, SurgeAlloy: 15), 2);
"diode" => DiodeBlock::new(1, false, cost!(Metaglass: 10, Silicon: 10, Plastanium: 5));
- "battery" -> BatteryBlock::new(1, true, cost!(Copper: 5, Lead: 20));
- "battery-large" -> BatteryBlock::new(3, true, cost!(Lead: 50, Titanium: 20, Silicon: 30));
+ "battery" -> BasicBlock::new(1, true, cost!(Copper: 5, Lead: 20));
+ "battery-large" -> BasicBlock::new(3, true, cost!(Lead: 50, Titanium: 20, Silicon: 30));
"combustion-generator" -> GeneratorBlock::new(1, true, cost!(Copper: 25, Lead: 15));
"thermal-generator" -> GeneratorBlock::new(2, true, cost!(Copper: 40, Lead: 50, Metaglass: 40, Graphite: 35, Silicon: 35));
"steam-generator" -> GeneratorBlock::new(2, true, cost!(Copper: 35, Lead: 40, Graphite: 25, Silicon: 30));
diff --git a/src/block/production.rs b/src/block/production.rs
index 9954669..c8d435f 100644
--- a/src/block/production.rs
+++ b/src/block/production.rs
@@ -1,5 +1,5 @@
//! the industry part of mindustry
-use crate::block::simple::{cost, make_simple};
+use crate::block::simple::*;
use crate::block::*;
use crate::data::DataRead;
@@ -22,7 +22,7 @@ make_register! {
"spore-press" -> ProductionBlock::new(2, true, cost!(Lead: 35, Silicon: 30));
"pulverizer" -> ProductionBlock::new(1, true, cost!(Copper: 30, Lead: 25));
"coal-centrifuge" -> ProductionBlock::new(2, true, cost!(Lead: 30, Graphite: 40, Titanium: 20));
- "incinerator" -> Incinerator::new(1, true, cost!(Lead: 15, Graphite: 5));
+ "incinerator" -> BasicBlock::new(1, true, cost!(Lead: 15, Graphite: 5));
"silicon-arc-furnace" -> ProductionBlock::new(3, true, cost!(Beryllium: 70, Graphite: 80));
"electrolyzer" -> ProductionBlock::new(3, true, cost!(Silicon: 50, Graphite: 40, Beryllium: 130, Tungsten: 80));
"atmospheric-concentrator" -> ProductionBlock::new(3, true, cost!(Oxide: 60, Beryllium: 180, Silicon: 150));
@@ -32,7 +32,7 @@ make_register! {
"phase-heater" => HeatCrafter::new(2, false, cost!(Oxide: 30, Carbide: 30, Beryllium: 30));
"heat-redirector" => HeatConduit::new(3, false, cost!(Tungsten: 10, Graphite: 10));
"heat-router" => HeatConduit::new(3, false, cost!(Tungsten: 15, Graphite: 10));
- "slag-incinerator" -> Incinerator::new(1, true, cost!(Tungsten: 15));
+ "slag-incinerator" -> BasicBlock::new(1, true, cost!(Tungsten: 15));
"carbide-crucible" -> ProductionBlock::new(3, true, cost!(Tungsten: 110, Thorium: 150, Oxide: 60));
// slag centrifuge
"surge-crucible" -> ProductionBlock::new(3, true, cost!(Silicon: 100, Graphite: 80, Tungsten: 80, Oxide: 80));
@@ -91,4 +91,3 @@ make_simple!(HeatConduit, |_, n, _, _, r: Rotation, s| {
}.rotate(r.rotated(false).count()));
base
});
-make_simple!(Incinerator);
diff --git a/src/block/simple.rs b/src/block/simple.rs
index aa7f398..a07a6ea 100644
--- a/src/block/simple.rs
+++ b/src/block/simple.rs
@@ -148,3 +148,5 @@ macro_rules! cost {
};
}
pub(crate) use cost;
+
+make_simple!(BasicBlock);
diff --git a/src/block/storage.rs b/src/block/storage.rs
index f3a9089..c28b7bd 100644
--- a/src/block/storage.rs
+++ b/src/block/storage.rs
@@ -1,20 +1,16 @@
//! cores, vaults, containers
-use crate::block::distribution::ItemBlock;
use crate::block::make_register;
-use crate::block::simple::{cost, make_simple};
+use crate::block::simple::*;
make_register! {
- "core-shard" -> StorageBlock::new(3, true, cost!(Copper: 1000, Lead: 800));
- "core-foundation" -> StorageBlock::new(4, true, cost!(Copper: 3000, Lead: 3000, Silicon: 2000));
- "core-nucleus" -> StorageBlock::new(5, true, cost!(Copper: 8000, Lead: 8000, Thorium: 4000, Silicon: 5000));
- "core-bastion" -> StorageBlock::new(4, true, cost!(Graphite: 1000, Silicon: 1000, Beryllium: 800));
- "core-citadel" -> StorageBlock::new(5, true, cost!(Silicon: 4000, Beryllium: 4000, Tungsten: 3000, Oxide: 1000));
- "core-acropolis" -> StorageBlock::new(6, true, cost!(Beryllium: 6000, Silicon: 5000, Tungsten: 5000, Carbide: 3000, Oxide: 3000));
- "container" -> StorageBlock::new(2, true, cost!(Titanium: 100));
- "vault" -> StorageBlock::new(3, true, cost!(Titanium: 250, Thorium: 125));
- "unloader" -> ItemBlock::new(1, true, cost!(Titanium: 25, Silicon: 30));
- "reinforced-container" -> StorageBlock::new(2, true, cost!(Tungsten: 30, Graphite: 40));
- "reinforced-vault" -> StorageBlock::new(3, true, cost!(Tungsten: 125, Thorium: 70, Beryllium: 100));
+ "core-shard" -> BasicBlock::new(3, true, cost!(Copper: 1000, Lead: 800));
+ "core-foundation" -> BasicBlock::new(4, true, cost!(Copper: 3000, Lead: 3000, Silicon: 2000));
+ "core-nucleus" -> BasicBlock::new(5, true, cost!(Copper: 8000, Lead: 8000, Thorium: 4000, Silicon: 5000));
+ "core-bastion" -> BasicBlock::new(4, true, cost!(Graphite: 1000, Silicon: 1000, Beryllium: 800));
+ "core-citadel" -> BasicBlock::new(5, true, cost!(Silicon: 4000, Beryllium: 4000, Tungsten: 3000, Oxide: 1000));
+ "core-acropolis" -> BasicBlock::new(6, true, cost!(Beryllium: 6000, Silicon: 5000, Tungsten: 5000, Carbide: 3000, Oxide: 3000));
+ "container" -> BasicBlock::new(2, true, cost!(Titanium: 100));
+ "vault" -> BasicBlock::new(3, true, cost!(Titanium: 250, Thorium: 125));
+ "reinforced-container" -> BasicBlock::new(2, true, cost!(Tungsten: 30, Graphite: 40));
+ "reinforced-vault" -> BasicBlock::new(3, true, cost!(Tungsten: 125, Thorium: 70, Beryllium: 100));
}
-
-make_simple!(StorageBlock);
diff --git a/src/block/units.rs b/src/block/units.rs
index dcd15de..708902d 100644
--- a/src/block/units.rs
+++ b/src/block/units.rs
@@ -102,7 +102,6 @@ make_simple!(ConstructorBlock, |_, name, _, _, rot: Rotation, s| {
}
base
});
-make_simple!(UnitRepairTower);
make_simple!(AssemblerModule, |_, _, _, _, rot: Rotation, scl| {
let mut base = load!("basic-assembler-module", scl);
base.overlay(
@@ -153,7 +152,7 @@ make_register! {
"ship-assembler" => ConstructorBlock::new(5, true, cost!(Carbide: 100, Oxide: 200, Tungsten: 500, Silicon: 800, Thorium: 400));
"mech-assembler" => ConstructorBlock::new(5, true, cost!(Carbide: 200, Thorium: 600, Oxide: 200, Tungsten: 500, Silicon: 900)); // smh collaris
"basic-assembler-module" => AssemblerModule::new(5, true, cost!(Carbide: 300, Thorium: 500, Oxide: 200, PhaseFabric: 400)); // the dummy block
- "unit-repair-tower" -> UnitRepairTower::new(2, true, cost!(Graphite: 90, Silicon: 90, Tungsten: 80));
+ "unit-repair-tower" -> BasicBlock::new(2, true, cost!(Graphite: 90, Silicon: 90, Tungsten: 80));
}
diff --git a/src/data/renderer.rs b/src/data/renderer.rs
index bd101e5..05067cf 100644
--- a/src/data/renderer.rs
+++ b/src/data/renderer.rs
@@ -148,17 +148,6 @@ macro_rules! load {
n => unreachable!("{n:?}"),
}
} };
- // (concat $x:expr, to $v:ident which is [$($k:literal $(|)?)+], $scale: ident) => { paste::paste! {
- // match $v {
- // $($k =>
- // ImageHolder::from(**match $scale {
- // crate::data::renderer::Scale::Quarter => crate::data::renderer::quar::[<$k:snake:upper $x:snake:upper>],
- // crate::data::renderer::Scale::Eigth => crate::data::renderer::eigh::[<$k:snake:upper $x:snake:upper>],
- // crate::data::renderer::Scale::Full => crate::data::renderer::full::[<$k:snake:upper $x:snake:upper>],
- // }),
- // )+
- // }
- // } }
}
pub(crate) use load;