@@ 78,10 78,34 @@ impl Face {
}
}
+/// Blocks can belong to multiple categories
+/// and may be displayed by category in inventory
+#[derive(Clone, PartialEq, Eq, DeJson, SerJson)]
+pub enum Category {
+ /// Everything releated to buildings
+ /// i.e. walls, levels, roofs
+ Building,
+ /// floor tiling
+ /// i.e grass, dirt
+ Blocks,
+ /// category containing roofs for buildings
+ Roofs,
+ /// Trees & Bushes
+ Plants,
+ /// River, Lake and water
+ Water,
+ /// blocks made from wood
+ /// i.e bridges
+ Wood,
+ /// all items
+ All
+}
+
/// rust macro to autogenerate the Block enum
/// and the texture maps from a set of variant names and paths
+/// the macro also generated the category-blocks mappings
macro_rules! auto_gen_blocks {
- ( $(($name:ident, $file:literal)),* ) => {
+ ( $(( $name:ident, $file:literal, [$($cat:ident), *] )),* ) => {
static mut CACHE: Option<HashMap<Block, DirectionalTexture>> = None;
#[derive(Eq, Hash, Clone, PartialEq, SerJson, DeJson)]
@@ 122,197 146,190 @@ macro_rules! auto_gen_blocks {
return dt;
}
}
+ impl Category {
+ /// get blocks belonging to category
+ pub fn get_blocks(&self) -> Vec<Block> {
+ if let Category::All = self {
+ return Block::all();
+ }
+
+ let mut builder = Vec::new();
+
+ $(if false $(|| &Category::$cat == self)* {
+ builder.push(Block::$name);
+ })*
+
+ builder
+ }
+ }
}
}
auto_gen_blocks!(
- ( BalconyStone, "exp/Tiles/balcony_stone" ),
- ( BalconyWood, "exp/Tiles/balcony_wood" ),
- ( Bridge, "base/Tiles/bridge" ),
- ( BuildingCenter, "base/Tiles/building_center" ),
- ( BuildingCenterBeige, "base/Tiles/building_centerBeige" ),
- ( BuildingCorner, "base/Tiles/building_corner" ),
- ( BuildingCornerBeige, "base/Tiles/building_cornerBeige" ),
- ( BuildingDoor, "base/Tiles/building_door" ),
- ( BuildingDoorBeige, "base/Tiles/building_doorBeige" ),
- ( BuildingDoorWindows, "base/Tiles/building_doorWindows" ),
- ( BuildingDoorWindowsBeige, "base/Tiles/building_doorWindowsBeige" ),
- ( BuildingWindow, "base/Tiles/building_window" ),
- ( BuildingWindowBeige, "base/Tiles/building_windowBeige" ),
- ( BuildingWindows, "base/Tiles/building_windows" ),
- ( BuildingWindowsBeige, "base/Tiles/building_windowsBeige" ),
- ( BuildingStack, "exp/Tiles/building_stack" ),
- ( BuildingStackBeige, "exp/Tiles/building_stackBeige" ),
- ( BuildingStackCorner, "exp/Tiles/building_stackCorner" ),
- ( BuildingStackCornerBeige, "exp/Tiles/building_stackCornerBeige" ),
-
- ( CastleBend, "base/Tiles/castle_bend" ),
- ( CastleCenter, "base/Tiles/castle_center" ),
- ( CastleCorner, "base/Tiles/castle_corner" ),
- ( CastleEnd, "exp/Tiles/castle_end" ),
- ( CastleEndRound, "exp/Tiles/castle_endRound" ),
- ( CastleEndRuined, "exp/Tiles/castle_endRuined" ),
- ( CastleGate, "base/Tiles/castle_gate" ),
- ( CastleGateOpen, "base/Tiles/castle_gateOpen" ),
- ( CastleSlope, "base/Tiles/castle_slope" ),
- ( CastleTower, "base/Tiles/castle_tower" ),
- ( CastleTowerCenter, "exp/Tiles/castle_towerCenter" ),
- ( CastleTowerBeige, "base/Tiles/castle_towerBeige" ),
- ( CastleTowerBeigeBase, "exp/Tiles/castle_towerBeigeBase" ),
- ( CastleTowerBeigeTop, "exp/Tiles/castle_towerBeigeTop" ),
- ( CastleTowerBrown, "base/Tiles/castle_towerBrown" ),
- ( CastleTowerBrownBase, "exp/Tiles/castle_towerBrownBase" ),
- ( CastleTowerBrownTop, "exp/Tiles/castle_towerBrownTop" ),
- ( CastleTowerGreen, "base/Tiles/castle_towerGreen" ),
- ( CastleTowerGreenBase, "exp/Tiles/castle_towerGreenBase" ),
- ( CastleTowerGreenTop, "exp/Tiles/castle_towerGreenTop" ),
- ( CastleTowerPurple, "base/Tiles/castle_towerPurple" ),
- ( CastleTowerPurpleBase, "exp/Tiles/castle_towerPurpleBase" ),
- ( CastleTowerPurpleTop, "exp/Tiles/castle_towerPurpleTop" ),
- ( CastleWall, "base/Tiles/castle_wall" ),
- ( CastleWindow, "base/Tiles/castle_window" ),
-
- ( Cliff, "exp/Tiles/cliff"),
- ( CliffCorner, "exp/Tiles/cliff"),
- ( CliffCornerInner, "exp/Tiles/cliff"),
- ( CliffEntrance, "exp/Tiles/cliff"),
- ( CliffTop, "exp/Tiles/cliff_top"),
- ( CliffTopEntrance, "exp/Tiles/cliff_topEntrance"),
- ( CliffTopCorner, "exp/Tiles/cliff_topCorner"),
- ( CliffTopCornerInner, "exp/Tiles/cliff_topCornerInner"),
-
- ( DirtCenter, "base/Tiles/dirt_center" ),
- ( DirtCorner, "exp/Tiles/dirt_corner" ),
- ( DirtLow, "base/Tiles/dirt_low" ),
-
- (Fence, "exp/Tiles/fence_wood"),
- (FenceCorner, "exp/Tiles/fence_woodCorner"),
- (FenceCurve, "exp/Tiles/fence_woodCurve"),
- (FenceEnd, "exp/Tiles/fence_woodEnd"),
- (FenceDouble, "exp/Tiles/fence_woodDouble"),
- (FenceDoubleCorner, "exp/Tiles/fence_woodDoubleCorner"),
- (FenceDoubleCurve, "exp/Tiles/fence_woodDoubleCurve"),
- (FenceDoubleEnd, "exp/Tiles/fence_woodDoubleEnd"),
-
- ( Furrow, "exp/Tiles/furrow" ),
- ( FurrowCropWheat, "exp/Tiles/furrow_cropWheat" ),
- ( FurrowCrop, "exp/Tiles/furrow_crop" ),
- ( FurrowEnd, "exp/Tiles/furrow_end" ),
-
- ( Grass, "exp/Tiles/grass_block" ),
- ( GrassCenter, "base/Tiles/grass_center" ),
- ( GrassCorner, "base/Tiles/grass_corner" ),
- ( GrassPath, "base/Tiles/grass_path" ),
- ( GrassPathBend, "base/Tiles/grass_pathBend" ),
- ( GrassPathCorner, "base/Tiles/grass_pathCorner" ),
- ( GrassPathCrossing, "base/Tiles/grass_pathCrossing" ),
- ( GrassPathEnd, "base/Tiles/grass_pathEnd" ),
- ( GrassPathEndSquare, "base/Tiles/grass_pathEndSquare" ),
- ( GrassPathSlope, "base/Tiles/grass_pathSlope" ),
- ( GrassPathSplit, "base/Tiles/grass_pathSplit" ),
- ( GrassRiver, "base/Tiles/grass_river" ),
- ( GrassRiverBend, "base/Tiles/grass_riverBend" ),
- ( GrassRiverBridge, "base/Tiles/grass_riverBridge" ),
- ( GrassRiverCorner, "base/Tiles/grass_riverCorner" ),
- ( GrassRiverCrossing, "base/Tiles/grass_riverCrossing" ),
- ( GrassRiverEnd, "base/Tiles/grass_riverEnd" ),
- ( GrassRiverEndSquare, "base/Tiles/grass_riverEndSquare" ),
- ( GrassRiverSlope, "base/Tiles/grass_riverSlope" ),
- ( GrassRiverSplit, "base/Tiles/grass_riverSplit" ),
- ( GrassSlope, "base/Tiles/grass_slope" ),
- ( GrassSlopeConcave, "base/Tiles/grass_slopeConcave" ),
- ( GrassSlopeConvex, "base/Tiles/grass_slopeConvex" ),
- ( GrassWater, "base/Tiles/grass_water" ),
- ( GrassWaterConcave, "base/Tiles/grass_waterConcave" ),
- ( GrassWaterConvex, "base/Tiles/grass_waterConvex" ),
- ( GrassWaterRiver, "base/Tiles/grass_waterRiver" ),
-
- ( RocksDirt, "base/Tiles/rocks_dirt" ),
- ( RocksGrass, "base/Tiles/rocks_grass" ),
-
- ( RoofChurchBeige, "base/Tiles/roof_churchBeige" ),
- ( RoofChuchBrown, "base/Tiles/roof_churchBrown" ),
- ( RoofChurchGreen, "base/Tiles/roof_churchGreen" ),
- ( RoofChurchPurple, "base/Tiles/roof_churchPurple" ),
- ( RoofGableBeige, "base/Tiles/roof_gableBeige" ),
- ( RoofGableCornerBeige, "exp/Tiles/roof_gableCornerBeige" ),
- ( RoofGableBrown, "base/Tiles/roof_gableBrown" ),
- ( RoofGableCornerBrown, "exp/Tiles/roof_gableCornerBrown" ),
- ( RoofGableGreen, "base/Tiles/roof_gableGreen" ),
- ( RoofGableCornerGreen, "exp/Tiles/roof_gableCornerGreen" ),
- ( RoofGablePurple, "base/Tiles/roof_gablePurple" ),
- ( RoofGableCornerPurple, "exp/Tiles/roof_gableCornerPurple" ),
- ( RoofPointBeige, "base/Tiles/roof_pointBeige" ),
- ( RoofPointBrown, "base/Tiles/roof_pointBrown" ),
- ( RoofPointGreen, "base/Tiles/roof_pointGreen" ),
- ( RoofPointPurple, "base/Tiles/roof_pointPurple" ),
- ( RoofRoundBeige, "base/Tiles/roof_roundBeige" ),
- ( RoofRoundCornerBeige, "exp/Tiles/roof_roundCornerBeige" ),
- ( RoofRoundBrown, "base/Tiles/roof_roundBrown" ),
- ( RoofRoundCornerBrown, "exp/Tiles/roof_roundCornerBrown" ),
- ( RoofRoundGreen, "base/Tiles/roof_roundGreen" ),
- ( RoofRoundCornerGreen, "exp/Tiles/roof_roundCornerGreen" ),
- ( RoofRoundPurple, "base/Tiles/roof_roundPurple" ),
- ( RoofRoundCornerPurple, "exp/Tiles/roof_roundCornerPurple" ),
- ( RoofRoundedBeige, "base/Tiles/roof_roundedBeige" ),
- ( RoofRoundedBrown, "base/Tiles/roof_roundedBrown" ),
- ( RoofRoundedGreen, "base/Tiles/roof_roundedGreen" ),
- ( RoofRoundedPurple, "base/Tiles/roof_roundedPurple" ),
- ( RoofSlantBeige, "base/Tiles/roof_slantBeige" ),
- ( RoofSlantCornerBeige, "exp/Tiles/roof_slantCornerBeige" ),
- ( RoofSlantCornerInnerBeige, "exp/Tiles/roof_slantCornerInnerBeige" ),
- ( RoofSlantBrown, "base/Tiles/roof_slantBrown" ),
- ( RoofSlantCornerBrown, "exp/Tiles/roof_slantCornerBrown" ),
- ( RoofSlantCornerInnerBrown, "exp/Tiles/roof_slantCornerInnerBrown" ),
- ( RoofSlantGreen, "base/Tiles/roof_slantGreen" ),
- ( RoofSlantCornerGreen, "exp/Tiles/roof_slantCornerGreen" ),
- ( RoofSlantCornerInnerGreen, "exp/Tiles/roof_slantCornerInnerGreen" ),
- ( RoofSlantPurple, "base/Tiles/roof_slantPurple" ),
- ( RoofSlantCornerPurple, "exp/Tiles/roof_slantCornerPurple" ),
- ( RoofSlantCornerInnerPurple, "exp/Tiles/roof_slantCornerInnerPurple" ),
-
- ( StructureArch, "base/Tiles/structure_arch" ),
- ( StructureHigh, "base/Tiles/structure_high" ),
- ( StructureLow, "base/Tiles/structure_low" ),
-
- ( Trees, "base/Tiles/tree_multiple" ),
- ( Tree, "base/Tiles/tree_single" ),
- (Pine, "exp/Tiles/tree_pine"),
- (PineLarge, "exp/Tiles/tree_pineLarge"),
-
- ( WaterCenter, "base/Tiles/water_center" ),
- ( WaterFall, "base/Tiles/water_fall" ),
- (Well, "exp/Tiles/well")
+ ( BalconyStone, "exp/Tiles/balcony_stone", [Building] ),
+ ( BalconyWood, "exp/Tiles/balcony_wood", [Building] ),
+ ( Bridge, "base/Tiles/bridge", [Wood] ),
+ ( BuildingCenter, "base/Tiles/building_center", [Building] ),
+ ( BuildingCenterBeige, "base/Tiles/building_centerBeige", [Building] ),
+ ( BuildingCorner, "base/Tiles/building_corner", [Building] ),
+ ( BuildingCornerBeige, "base/Tiles/building_cornerBeige", [Building] ),
+ ( BuildingDoor, "base/Tiles/building_door", [Building] ),
+ ( BuildingDoorBeige, "base/Tiles/building_doorBeige", [Building] ),
+ ( BuildingDoorWindows, "base/Tiles/building_doorWindows", [Building] ),
+ ( BuildingDoorWindowsBeige, "base/Tiles/building_doorWindowsBeige", [Building] ),
+ ( BuildingWindow, "base/Tiles/building_window", [Building] ),
+ ( BuildingWindowBeige, "base/Tiles/building_windowBeige", [Building] ),
+ ( BuildingWindows, "base/Tiles/building_windows", [Building] ),
+ ( BuildingWindowsBeige, "base/Tiles/building_windowsBeige", [Building] ),
+ ( BuildingStack, "exp/Tiles/building_stack", [Building] ),
+ ( BuildingStackBeige, "exp/Tiles/building_stackBeige", [Building] ),
+ ( BuildingStackCorner, "exp/Tiles/building_stackCorner", [Building] ),
+ ( BuildingStackCornerBeige, "exp/Tiles/building_stackCornerBeige", [Building] ),
+
+ ( CastleBend, "base/Tiles/castle_bend", [Building] ),
+ ( CastleCenter, "base/Tiles/castle_center", [Building] ),
+ ( CastleCorner, "base/Tiles/castle_corner", [Building] ),
+ ( CastleEnd, "exp/Tiles/castle_end", [Building] ),
+ ( CastleEndRound, "exp/Tiles/castle_endRound", [Building] ),
+ ( CastleEndRuined, "exp/Tiles/castle_endRuined", [Building] ),
+ ( CastleGate, "base/Tiles/castle_gate", [Building] ),
+ ( CastleGateOpen, "base/Tiles/castle_gateOpen", [Building] ),
+ ( CastleSlope, "base/Tiles/castle_slope", [Building] ),
+ ( CastleTower, "base/Tiles/castle_tower", [Building] ),
+ ( CastleTowerCenter, "exp/Tiles/castle_towerCenter", [Building] ),
+ ( CastleTowerBeige, "base/Tiles/castle_towerBeige", [Building] ),
+ ( CastleTowerBeigeBase, "exp/Tiles/castle_towerBeigeBase", [Building] ),
+ ( CastleTowerBeigeTop, "exp/Tiles/castle_towerBeigeTop", [Building, Roofs] ),
+ ( CastleTowerBrown, "base/Tiles/castle_towerBrown", [Building] ),
+ ( CastleTowerBrownBase, "exp/Tiles/castle_towerBrownBase", [Building] ),
+ ( CastleTowerBrownTop, "exp/Tiles/castle_towerBrownTop", [Building, Roofs] ),
+ ( CastleTowerGreen, "base/Tiles/castle_towerGreen", [Building] ),
+ ( CastleTowerGreenBase, "exp/Tiles/castle_towerGreenBase", [Building] ),
+ ( CastleTowerGreenTop, "exp/Tiles/castle_towerGreenTop", [Building, Roofs] ),
+ ( CastleTowerPurple, "base/Tiles/castle_towerPurple", [Building] ),
+ ( CastleTowerPurpleBase, "exp/Tiles/castle_towerPurpleBase", [Building] ),
+ ( CastleTowerPurpleTop, "exp/Tiles/castle_towerPurpleTop", [Building, Roofs] ),
+ ( CastleWall, "base/Tiles/castle_wall", [Building] ),
+ ( CastleWindow, "base/Tiles/castle_window", [Building] ),
+
+ ( Cliff, "exp/Tiles/cliff", [Blocks] ),
+ ( CliffCorner, "exp/Tiles/cliff", [Blocks] ),
+ ( CliffCornerInner, "exp/Tiles/cliff", [Blocks] ),
+ ( CliffEntrance, "exp/Tiles/cliff", [Blocks] ),
+ ( CliffTop, "exp/Tiles/cliff_top", [Blocks] ),
+ ( CliffTopEntrance, "exp/Tiles/cliff_topEntrance", [Blocks] ),
+ ( CliffTopCorner, "exp/Tiles/cliff_topCorner", [Blocks] ),
+ ( CliffTopCornerInner, "exp/Tiles/cliff_topCornerInner", [Blocks] ),
+
+ ( DirtCenter, "base/Tiles/dirt_center", [Blocks] ),
+ ( DirtCorner, "exp/Tiles/dirt_corner", [Blocks] ),
+ ( DirtLow, "base/Tiles/dirt_low", [Blocks] ),
+
+ (Fence, "exp/Tiles/fence_wood", [Wood] ),
+ (FenceCorner, "exp/Tiles/fence_woodCorner", [Wood] ),
+ (FenceCurve, "exp/Tiles/fence_woodCurve", [Wood] ),
+ (FenceEnd, "exp/Tiles/fence_woodEnd", [Wood] ),
+ (FenceDouble, "exp/Tiles/fence_woodDouble", [Wood] ),
+ (FenceDoubleCorner, "exp/Tiles/fence_woodDoubleCorner", [Wood] ),
+ (FenceDoubleCurve, "exp/Tiles/fence_woodDoubleCurve", [Wood] ),
+ (FenceDoubleEnd, "exp/Tiles/fence_woodDoubleEnd", [Wood]),
+
+ ( Furrow, "exp/Tiles/furrow", [Plants] ),
+ ( FurrowCropWheat, "exp/Tiles/furrow_cropWheat", [Plants] ),
+ ( FurrowCrop, "exp/Tiles/furrow_crop", [Plants] ),
+ ( FurrowEnd, "exp/Tiles/furrow_end", [Plants] ),
+
+ ( Grass, "exp/Tiles/grass_block", [Blocks] ),
+ ( GrassCenter, "base/Tiles/grass_center", [Blocks] ),
+ ( GrassCorner, "base/Tiles/grass_corner", [Blocks] ),
+ ( GrassPath, "base/Tiles/grass_path", [Blocks] ),
+ ( GrassPathBend, "base/Tiles/grass_pathBend", [Blocks] ),
+ ( GrassPathCorner, "base/Tiles/grass_pathCorner", [Blocks] ),
+ ( GrassPathCrossing, "base/Tiles/grass_pathCrossing", [Blocks] ),
+ ( GrassPathEnd, "base/Tiles/grass_pathEnd", [Blocks] ),
+ ( GrassPathEndSquare, "base/Tiles/grass_pathEndSquare", [Blocks] ),
+ ( GrassPathSlope, "base/Tiles/grass_pathSlope", [Blocks] ),
+ ( GrassPathSplit, "base/Tiles/grass_pathSplit", [Blocks] ),
+ ( GrassRiver, "base/Tiles/grass_river", [Blocks, Water] ),
+ ( GrassRiverBend, "base/Tiles/grass_riverBend", [Blocks, Water] ),
+ ( GrassRiverBridge, "base/Tiles/grass_riverBridge", [Blocks, Water] ),
+ ( GrassRiverCorner, "base/Tiles/grass_riverCorner", [Blocks, Water] ),
+ ( GrassRiverCrossing, "base/Tiles/grass_riverCrossing", [Blocks, Water] ),
+ ( GrassRiverEnd, "base/Tiles/grass_riverEnd", [Blocks, Water] ),
+ ( GrassRiverEndSquare, "base/Tiles/grass_riverEndSquare", [Blocks, Water] ),
+ ( GrassRiverSlope, "base/Tiles/grass_riverSlope", [Blocks, Water] ),
+ ( GrassRiverSplit, "base/Tiles/grass_riverSplit", [Blocks, Water] ),
+ ( GrassSlope, "base/Tiles/grass_slope", [Blocks] ),
+ ( GrassSlopeConcave, "base/Tiles/grass_slopeConcave", [Blocks] ),
+ ( GrassSlopeConvex, "base/Tiles/grass_slopeConvex", [Blocks] ),
+ ( GrassWater, "base/Tiles/grass_water", [Blocks, Water] ),
+ ( GrassWaterConcave, "base/Tiles/grass_waterConcave", [Blocks, Water] ),
+ ( GrassWaterConvex, "base/Tiles/grass_waterConvex", [Blocks, Water] ),
+ ( GrassWaterRiver, "base/Tiles/grass_waterRiver", [Blocks, Water] ),
+
+ ( RocksDirt, "base/Tiles/rocks_dirt", [Plants] ),
+ ( RocksGrass, "base/Tiles/rocks_grass", [Plants] ),
+
+ ( RoofChurchBeige, "base/Tiles/roof_churchBeige", [Building, Roofs] ),
+ ( RoofChuchBrown, "base/Tiles/roof_churchBrown", [Building, Roofs] ),
+ ( RoofChurchGreen, "base/Tiles/roof_churchGreen", [Building, Roofs] ),
+ ( RoofChurchPurple, "base/Tiles/roof_churchPurple", [Building, Roofs] ),
+ ( RoofGableBeige, "base/Tiles/roof_gableBeige", [Building, Roofs] ),
+ ( RoofGableCornerBeige, "exp/Tiles/roof_gableCornerBeige", [Building, Roofs] ),
+ ( RoofGableBrown, "base/Tiles/roof_gableBrown", [Building, Roofs] ),
+ ( RoofGableCornerBrown, "exp/Tiles/roof_gableCornerBrown", [Building, Roofs] ),
+ ( RoofGableGreen, "base/Tiles/roof_gableGreen", [Building, Roofs] ),
+ ( RoofGableCornerGreen, "exp/Tiles/roof_gableCornerGreen", [Building, Roofs] ),
+ ( RoofGablePurple, "base/Tiles/roof_gablePurple", [Building, Roofs] ),
+ ( RoofGableCornerPurple, "exp/Tiles/roof_gableCornerPurple", [Building, Roofs] ),
+ ( RoofPointBeige, "base/Tiles/roof_pointBeige", [Building, Roofs] ),
+ ( RoofPointBrown, "base/Tiles/roof_pointBrown", [Building, Roofs] ),
+ ( RoofPointGreen, "base/Tiles/roof_pointGreen", [Building, Roofs] ),
+ ( RoofPointPurple, "base/Tiles/roof_pointPurple", [Building, Roofs] ),
+ ( RoofRoundBeige, "base/Tiles/roof_roundBeige", [Building, Roofs] ),
+ ( RoofRoundCornerBeige, "exp/Tiles/roof_roundCornerBeige", [Building, Roofs] ),
+ ( RoofRoundBrown, "base/Tiles/roof_roundBrown", [Building, Roofs] ),
+ ( RoofRoundCornerBrown, "exp/Tiles/roof_roundCornerBrown", [Building, Roofs] ),
+ ( RoofRoundGreen, "base/Tiles/roof_roundGreen", [Building, Roofs] ),
+ ( RoofRoundCornerGreen, "exp/Tiles/roof_roundCornerGreen", [Building, Roofs] ),
+ ( RoofRoundPurple, "base/Tiles/roof_roundPurple", [Building, Roofs] ),
+ ( RoofRoundCornerPurple, "exp/Tiles/roof_roundCornerPurple", [Building, Roofs] ),
+ ( RoofRoundedBeige, "base/Tiles/roof_roundedBeige", [Building, Roofs] ),
+ ( RoofRoundedBrown, "base/Tiles/roof_roundedBrown", [Building, Roofs] ),
+ ( RoofRoundedGreen, "base/Tiles/roof_roundedGreen", [Building, Roofs] ),
+ ( RoofRoundedPurple, "base/Tiles/roof_roundedPurple", [Building, Roofs] ),
+ ( RoofSlantBeige, "base/Tiles/roof_slantBeige", [Building, Roofs] ),
+ ( RoofSlantCornerBeige, "exp/Tiles/roof_slantCornerBeige", [Building, Roofs] ),
+ ( RoofSlantCornerInnerBeige, "exp/Tiles/roof_slantCornerInnerBeige", [Building, Roofs] ),
+ ( RoofSlantBrown, "base/Tiles/roof_slantBrown", [Building, Roofs] ),
+ ( RoofSlantCornerBrown, "exp/Tiles/roof_slantCornerBrown", [Building, Roofs] ),
+ ( RoofSlantCornerInnerBrown, "exp/Tiles/roof_slantCornerInnerBrown", [Building, Roofs] ),
+ ( RoofSlantGreen, "base/Tiles/roof_slantGreen", [Building, Roofs] ),
+ ( RoofSlantCornerGreen, "exp/Tiles/roof_slantCornerGreen", [Building, Roofs] ),
+ ( RoofSlantCornerInnerGreen, "exp/Tiles/roof_slantCornerInnerGreen", [Building, Roofs] ),
+ ( RoofSlantPurple, "base/Tiles/roof_slantPurple", [Building, Roofs] ),
+ ( RoofSlantCornerPurple, "exp/Tiles/roof_slantCornerPurple", [Building, Roofs] ),
+ ( RoofSlantCornerInnerPurple, "exp/Tiles/roof_slantCornerInnerPurple", [Building, Roofs] ),
+
+ ( StructureArch, "base/Tiles/structure_arch", [Wood] ),
+ ( StructureHigh, "base/Tiles/structure_high", [Wood] ),
+ ( StructureLow, "base/Tiles/structure_low", [Wood] ),
+
+ ( Trees, "base/Tiles/tree_multiple", [Plants] ),
+ ( Tree, "base/Tiles/tree_single", [Plants] ),
+ (Pine, "exp/Tiles/tree_pine", [Plants] ),
+ (PineLarge, "exp/Tiles/tree_pineLarge", [Plants] ),
+
+ ( WaterCenter, "base/Tiles/water_center", [Blocks, Water] ),
+ ( WaterFall, "base/Tiles/water_fall", [Blocks, Water] ),
+ ( Well, "exp/Tiles/well", [Water] )
);
-
impl Default for Block {
fn default() -> Self {
Block::StructureHigh
}
}
-/// Blocks can belong to multiple categories
-/// and may be displayed by category in inventory
-#[derive(Clone, PartialEq, Eq, DeJson, SerJson)]
-pub enum Category {
- /// Everything releated to buildings
- /// i.e. walls, levels, roofs
- Building,
- /// floor tiling
- /// i.e grass, dirt
- Blocks,
- /// category containing roofs for buildings
- Roofs,
- /// Trees & Bushes
- Plants,
- /// River, Lake and water
- Water,
- /// blocks made from wood
- /// i.e bridges
- Wood,
- /// all items
- All
-}
impl Category {
/// get a list of all categories
pub fn all() -> Vec<Category> {
@@ 338,217 355,6 @@ impl Category {
Category::All => "All"
}
}
- /// get a list of all blocks from this category
- pub fn get_blocks(&self) -> Vec<Block> {
- match self {
- Category::Building => vec![
- Block::BalconyStone,
- Block::BalconyWood,
- Block::Bridge,
- Block::BuildingCenter,
- Block::BuildingCenterBeige,
- Block::BuildingCorner,
- Block::BuildingCornerBeige,
- Block::BuildingDoor,
- Block::BuildingDoorBeige,
- Block::BuildingDoorWindows,
- Block::BuildingDoorWindowsBeige,
- Block::BuildingStack,
- Block::BuildingStackBeige,
- Block::BuildingStackCorner,
- Block::BuildingStackCornerBeige,
- Block::BuildingWindow,
- Block::BuildingWindowBeige,
- Block::BuildingWindows,
- Block::BuildingWindowsBeige,
- Block::CastleBend,
- Block::CastleCenter,
- Block::CastleCorner,
- Block::CastleEnd,
- Block::CastleEndRound,
- Block::CastleEndRuined,
- Block::CastleGate,
- Block::CastleGateOpen,
- Block::CastleSlope,
- Block::CastleTower,
- Block::CastleTowerCenter,
- Block::CastleTowerBeige,
- Block::CastleTowerBeigeBase,
- Block::CastleTowerBeigeTop,
- Block::CastleTowerBrown,
- Block::CastleTowerBrownBase,
- Block::CastleTowerBrownTop,
- Block::CastleTowerGreen,
- Block::CastleTowerGreenBase,
- Block::CastleTowerGreenTop,
- Block::CastleTowerPurple,
- Block::CastleTowerPurpleBase,
- Block::CastleTowerPurpleTop,
- Block::CastleWall,
- Block::CastleWindow,
- Block::RoofChurchBeige,
- Block::RoofChuchBrown,
- Block::RoofChurchGreen,
- Block::RoofChurchPurple,
- Block::RoofGableBeige,
- Block::RoofGableCornerBeige,
- Block::RoofGableBrown,
- Block::RoofGableCornerBrown,
- Block::RoofGableGreen,
- Block::RoofGableCornerGreen,
- Block::RoofGablePurple,
- Block::RoofGableCornerPurple,
- Block::RoofPointBeige,
- Block::RoofPointBrown,
- Block::RoofPointGreen,
- Block::RoofPointPurple,
- Block::RoofRoundBeige,
- Block::RoofRoundCornerBeige,
- Block::RoofRoundBrown,
- Block::RoofRoundCornerBrown,
- Block::RoofRoundGreen,
- Block::RoofRoundCornerGreen,
- Block::RoofRoundPurple,
- Block::RoofRoundCornerPurple,
- Block::RoofRoundedBeige,
- Block::RoofRoundedBrown,
- Block::RoofRoundedGreen,
- Block::RoofRoundedPurple,
- Block::RoofSlantBeige,
- Block::RoofSlantCornerBeige,
- Block::RoofSlantCornerInnerBeige,
- Block::RoofSlantBrown,
- Block::RoofSlantCornerBrown,
- Block::RoofSlantCornerInnerBrown,
- Block::RoofSlantGreen,
- Block::RoofSlantCornerGreen,
- Block::RoofSlantCornerInnerGreen,
- Block::RoofSlantPurple,
- Block::RoofSlantCornerPurple,
- Block::RoofSlantCornerInnerPurple,
- ],
- Category::Blocks => vec![
- Block::DirtCenter,
- Block::DirtLow,
- Block::Grass,
- Block::GrassCenter,
- Block::GrassCorner,
- Block::GrassPath,
- Block::GrassPathBend,
- Block::GrassPathCorner,
- Block::GrassPathCrossing,
- Block::GrassPathEnd,
- Block::GrassPathEndSquare,
- Block::GrassPathSlope,
- Block::GrassPathSplit,
- Block::GrassRiver,
- Block::GrassRiverBend,
- Block::GrassRiverBridge,
- Block::GrassRiverCorner,
- Block::GrassRiverCrossing,
- Block::GrassRiverEnd,
- Block::GrassRiverEndSquare,
- Block::GrassRiverSlope,
- Block::GrassRiverSplit,
- Block::GrassSlope,
- Block::GrassSlopeConcave,
- Block::GrassSlopeConvex,
- Block::GrassWater,
- Block::GrassWaterConcave,
- Block::GrassWaterConvex,
- Block::GrassWaterRiver,
- Block::WaterCenter,
- Block::WaterFall,
- ],
- Category::Roofs => vec![
- Block::RoofChurchBeige,
- Block::RoofChuchBrown,
- Block::RoofChurchGreen,
- Block::RoofChurchPurple,
- Block::RoofGableBeige,
- Block::RoofGableCornerBeige,
- Block::RoofGableBrown,
- Block::RoofGableCornerBrown,
- Block::RoofGableGreen,
- Block::RoofGableCornerGreen,
- Block::RoofGablePurple,
- Block::RoofGableCornerPurple,
- Block::RoofPointBeige,
- Block::RoofPointBrown,
- Block::RoofPointGreen,
- Block::RoofPointPurple,
- Block::RoofRoundBeige,
- Block::RoofRoundCornerBeige,
- Block::RoofRoundBrown,
- Block::RoofRoundCornerBrown,
- Block::RoofRoundGreen,
- Block::RoofRoundCornerGreen,
- Block::RoofRoundPurple,
- Block::RoofRoundCornerPurple,
- Block::RoofRoundedBeige,
- Block::RoofRoundedBrown,
- Block::RoofRoundedGreen,
- Block::RoofRoundedPurple,
- Block::RoofSlantBeige,
- Block::RoofSlantCornerBeige,
- Block::RoofSlantCornerInnerBeige,
- Block::RoofSlantBrown,
- Block::RoofSlantCornerBrown,
- Block::RoofSlantCornerInnerBrown,
- Block::RoofSlantGreen,
- Block::RoofSlantCornerGreen,
- Block::RoofSlantCornerInnerGreen,
- Block::RoofSlantPurple,
- Block::RoofSlantCornerPurple,
- Block::RoofSlantCornerInnerPurple,
- ],
- Category::Plants => vec![
- Block::RocksDirt,
- Block::RocksGrass,
- Block::Trees,
- Block::Tree,
- Block::Pine,
- Block::PineLarge,
- Block::Furrow,
- Block::FurrowCropWheat,
- Block::FurrowCrop,
- Block::FurrowEnd,
- ],
- Category::Water => vec![
- Block::GrassRiver,
- Block::GrassRiverBend,
- Block::GrassRiverBridge,
- Block::GrassRiverCorner,
- Block::GrassRiverCrossing,
- Block::GrassRiverEnd,
- Block::GrassRiverEndSquare,
- Block::GrassRiverSlope,
- Block::GrassRiverSplit,
- Block::GrassWater,
- Block::GrassWaterConcave,
- Block::GrassWaterConvex,
- Block::GrassWaterRiver,
- Block::WaterCenter,
- Block::WaterFall,
- Block::Well
- ],
- Category::Wood => vec![
- Block::Bridge,
- Block::StructureArch,
- Block::StructureHigh,
- Block::StructureLow,
- Block::Fence,
- Block::FenceCorner,
- Block::FenceCurve,
- Block::FenceEnd,
- Block::FenceDouble,
- Block::FenceDoubleCorner,
- Block::FenceDoubleCurve,
- Block::FenceDoubleEnd,
- ],
- Category::All => Block::all()
- }
- }
}
impl Default for Category {
fn default() -> Self {