Skip to content

Commit

Permalink
解决二极管输出错误的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaofengdiZhu committed Dec 29, 2023
1 parent e2a07bf commit ee97c96
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gigavolt/BaseBlock/RotateableElectricGVElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public int Rotation {
}

public RotateableGVElectricElement(SubsystemGVElectricity subsystemGVElectric, CellFace cellFace) : base(subsystemGVElectric, cellFace) { }
public RotateableGVElectricElement(SubsystemGVElectricity subsystemGVElectric, GVCellFace cellFace) : base(subsystemGVElectric, cellFace) { }

public override bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner) {
++Rotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class AdjustableDelayGateGVElectricElement : BaseDelayGateGVElectricEleme

public override int DelaySteps => m_delaySteps;

public AdjustableDelayGateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, CellFace cellFace) : base(subsystemGVElectricity, cellFace) {
public AdjustableDelayGateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, GVCellFace cellFace) : base(subsystemGVElectricity, cellFace) {
int data = Terrain.ExtractData(subsystemGVElectricity.SubsystemTerrain.Terrain.GetCellValue(cellFace.X, cellFace.Y, cellFace.Z));
m_delaySteps = GVAdjustableDelayGateBlock.GetDelay(data);
}
Expand Down
3 changes: 2 additions & 1 deletion Gigavolt/Block/Gate/BaseDelayGateGVElectricElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ public abstract class BaseDelayGateGVElectricElement : RotateableGVElectricEleme

public uint m_lastStoredVoltage;

public Dictionary<int, uint> m_voltagesHistory = new Dictionary<int, uint>();
public Dictionary<int, uint> m_voltagesHistory = new();

public abstract int DelaySteps { get; }

public BaseDelayGateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, CellFace cellFace) : base(subsystemGVElectricity, cellFace) { }
public BaseDelayGateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, GVCellFace cellFace) : base(subsystemGVElectricity, cellFace) { }

public override uint GetOutputVoltage(int face) => m_voltage;

Expand Down
11 changes: 10 additions & 1 deletion Gigavolt/Block/Gate/GVAdjustableDelayGateBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,16 @@ public override void GenerateTerrainVertices(BlockGeometryGenerator generator, T
}
}

public override GVElectricElement CreateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, int value, int x, int y, int z) => new AdjustableDelayGateGVElectricElement(subsystemGVElectricity, new CellFace(x, y, z, GetFace(value)));
public override GVElectricElement CreateGVElectricElement(SubsystemGVElectricity subsystemGVElectricity, int value, int x, int y, int z) => new AdjustableDelayGateGVElectricElement(
subsystemGVElectricity,
new GVCellFace(
x,
y,
z,
GetFace(value),
GetConnectionMask(value)
)
);

public override GVElectricConnectorType? GetGVConnectorType(SubsystemTerrain terrain, int value, int face, int connectorFace, int x, int y, int z) {
int data = Terrain.ExtractData(value);
Expand Down

0 comments on commit ee97c96

Please sign in to comment.