mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/logic/mod.rs')
-rw-r--r--src/logic/mod.rs85
1 files changed, 62 insertions, 23 deletions
diff --git a/src/logic/mod.rs b/src/logic/mod.rs
index 1ac1e3b..cd9ba52 100644
--- a/src/logic/mod.rs
+++ b/src/logic/mod.rs
@@ -1,14 +1,13 @@
use crate::content::numeric_enum;
-numeric_enum!
-{
- pub enum LogicField for u8 | TryFromU8Error
- {
- TotalItems, FirstItem, TotalLiquids, TotalPower, ItemCapacity, LiquidCapacity, PowerCapacity, PowerNetCapacity, PowerNetStored, PowerNetIn,
- PowerNetOut, Ammo, AmmoCapacity, Health, MaxHealth, Heat, Efficiency, Progress, Timescale, Rotation, PosX, PosY, ShootX, ShootY, Size, Dead, Range,
- Shooting, Boosting, MineX, MineY, Mining, Speed, Team, Type, Flag, Controlled, Controller, Name, PayloadCount, PayloadType, Enabled, Shoot, ShootP,
- Config, Color
- }
+numeric_enum! {
+ pub enum LogicField for u8 | TryFromU8Error
+ {
+ TotalItems, FirstItem, TotalLiquids, TotalPower, ItemCapacity, LiquidCapacity, PowerCapacity, PowerNetCapacity, PowerNetStored, PowerNetIn,
+ PowerNetOut, Ammo, AmmoCapacity, Health, MaxHealth, Heat, Efficiency, Progress, Timescale, Rotation, PosX, PosY, ShootX, ShootY, Size, Dead, Range,
+ Shooting, Boosting, MineX, MineY, Mining, Speed, Team, Type, Flag, Controlled, Controller, Name, PayloadCount, PayloadType, Enabled, Shoot, ShootP,
+ Config, Color
+ }
}
macro_rules!match_select
@@ -23,18 +22,58 @@ macro_rules!match_select
};
}
-impl LogicField
-{
- pub fn is_readable(&self) -> bool
- {
- match_select!(self, LogicField, TotalItems, FirstItem, TotalLiquids, TotalPower, ItemCapacity, LiquidCapacity, PowerCapacity, PowerNetCapacity,
- PowerNetStored, PowerNetIn, PowerNetOut, Ammo, AmmoCapacity, Health, MaxHealth, Heat, Efficiency, Progress, Timescale, Rotation, PosX, PosY,
- ShootX, ShootY, Size, Dead, Range, Shooting, Boosting, MineX, MineY, Mining, Speed, Team, Type, Flag, Controlled, Controller, Name, PayloadCount,
- PayloadType, Enabled, Color)
- }
-
- pub fn is_writable(&self) -> bool
- {
- match_select!(self, LogicField, Enabled, Shoot, ShootP, Config, Color)
- }
+impl LogicField {
+ pub fn is_readable(&self) -> bool {
+ match_select!(
+ self,
+ LogicField,
+ TotalItems,
+ FirstItem,
+ TotalLiquids,
+ TotalPower,
+ ItemCapacity,
+ LiquidCapacity,
+ PowerCapacity,
+ PowerNetCapacity,
+ PowerNetStored,
+ PowerNetIn,
+ PowerNetOut,
+ Ammo,
+ AmmoCapacity,
+ Health,
+ MaxHealth,
+ Heat,
+ Efficiency,
+ Progress,
+ Timescale,
+ Rotation,
+ PosX,
+ PosY,
+ ShootX,
+ ShootY,
+ Size,
+ Dead,
+ Range,
+ Shooting,
+ Boosting,
+ MineX,
+ MineY,
+ Mining,
+ Speed,
+ Team,
+ Type,
+ Flag,
+ Controlled,
+ Controller,
+ Name,
+ PayloadCount,
+ PayloadType,
+ Enabled,
+ Color
+ )
+ }
+
+ pub fn is_writable(&self) -> bool {
+ match_select!(self, LogicField, Enabled, Shoot, ShootP, Config, Color)
+ }
}