Skip to content

Commit

Permalink
解决变体计数器覆盖其他电路板后无法使用、活塞伸长后调短留下活塞头的bug
Browse files Browse the repository at this point in the history
感谢把红色赋予黑海排查bug
  • Loading branch information
XiaofengdiZhu committed Nov 5, 2023
1 parent 326a335 commit 8bc8381
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Gigavolt/Block/Output/Piston/SubsystemGVPistonBlockBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class QueuedAction {

public bool m_allowPistonHeadRemove;

public Dictionary<Point3, QueuedAction> m_actions = new Dictionary<Point3, QueuedAction>();
public Dictionary<Point3, QueuedAction> m_actions = new();

public List<KeyValuePair<Point3, QueuedAction>> m_tmpActions = new List<KeyValuePair<Point3, QueuedAction>>();
public List<KeyValuePair<Point3, QueuedAction>> m_tmpActions = new();

public DynamicArray<MovingBlock> m_movingBlocks = new DynamicArray<MovingBlock>();
public DynamicArray<MovingBlock> m_movingBlocks = new();

public const string IdString = "GVPiston";

Expand Down Expand Up @@ -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<IMovingBlockSet> dynamicArray = new DynamicArray<IMovingBlockSet>();
BoundingBox boundingBox = new(chunk.BoundingBox.Min - new Vector3(16f), chunk.BoundingBox.Max + new Vector3(16f));
DynamicArray<IMovingBlockSet> dynamicArray = new();
m_subsystemMovingBlocks.FindMovingBlocks(boundingBox, false, dynamicArray);
foreach (IMovingBlockSet item in dynamicArray) {
if (item.Id == IdString) {
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 1 addition & 3 deletions Gigavolt/Block/Source/CounterGVElectricElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8bc8381

Please sign in to comment.