diff --git a/Gigavolt/Block/Output/Piston/SubsystemGVPistonBlockBehavior.cs b/Gigavolt/Block/Output/Piston/SubsystemGVPistonBlockBehavior.cs index ccb50263..23332c1e 100644 --- a/Gigavolt/Block/Output/Piston/SubsystemGVPistonBlockBehavior.cs +++ b/Gigavolt/Block/Output/Piston/SubsystemGVPistonBlockBehavior.cs @@ -24,11 +24,11 @@ public class QueuedAction { public bool m_allowPistonHeadRemove; - public Dictionary m_actions = new Dictionary(); + public Dictionary m_actions = new(); - public List> m_tmpActions = new List>(); + public List> m_tmpActions = new(); - public DynamicArray m_movingBlocks = new DynamicArray(); + public DynamicArray m_movingBlocks = new(); public const string IdString = "GVPiston"; @@ -177,8 +177,8 @@ public override void OnBlockRemoved(int value, int newValue, int x, int y, int z } public override void OnChunkDiscarding(TerrainChunk chunk) { - BoundingBox boundingBox = new BoundingBox(chunk.BoundingBox.Min - new Vector3(16f), chunk.BoundingBox.Max + new Vector3(16f)); - DynamicArray dynamicArray = new DynamicArray(); + BoundingBox boundingBox = new(chunk.BoundingBox.Min - new Vector3(16f), chunk.BoundingBox.Max + new Vector3(16f)); + DynamicArray dynamicArray = new(); m_subsystemMovingBlocks.FindMovingBlocks(boundingBox, false, dynamicArray); foreach (IMovingBlockSet item in dynamicArray) { if (item.Id == IdString) { @@ -349,7 +349,7 @@ public bool MovePiston(Point3 position, int length) { m_movingBlocks.Clear(); Point3 offset = point; MovingBlock item; - while (m_movingBlocks.Count < maxExtension + 1) { + while (true) { int cellValue = terrain.GetCellValue(position.X + offset.X, position.Y + offset.Y, position.Z + offset.Z); int num2 = Terrain.ExtractContents(cellValue); int face2 = GVPistonHeadBlock.GetFace(Terrain.ExtractData(cellValue)); diff --git a/Gigavolt/Block/Source/CounterGVElectricElement.cs b/Gigavolt/Block/Source/CounterGVElectricElement.cs index 56288367..6701c553 100644 --- a/Gigavolt/Block/Source/CounterGVElectricElement.cs +++ b/Gigavolt/Block/Source/CounterGVElectricElement.cs @@ -31,9 +31,7 @@ public CounterGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, C m_counter = num.Value; } } - CounterGVElectricElement electricElement = (CounterGVElectricElement)SubsystemGVElectricity.GetGVElectricElement(cellFace.X, cellFace.Y, cellFace.Z, cellFace.Face); - if (electricElement != null - && electricElement.m_edited) { + if (SubsystemGVElectricity.GetGVElectricElement(cellFace.X, cellFace.Y, cellFace.Z, cellFace.Face) is CounterGVElectricElement { m_edited: true } electricElement) { m_counter = electricElement.m_counter; m_edited = true; }