Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MountedElectricElement.cs
浏览该文件的文档.
1using Engine;
2
3namespace Game {
4 public abstract class MountedElectricElement : ElectricElement {
5 public MountedElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace) : base(subsystemElectricity, cellFace) { }
6
7 public override void OnNeighborBlockChanged(CellFace cellFace, int neighborX, int neighborY, int neighborZ) {
8 Point3 point = CellFace.FaceToPoint3(cellFace.Face);
9 int x = cellFace.X - point.X;
10 int y = cellFace.Y - point.Y;
11 int z = cellFace.Z - point.Z;
12 if (SubsystemElectricity.SubsystemTerrain.Terrain.IsCellValid(x, y, z)) {
13 int cellValue = SubsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(x, y, z);
14 int elementCellValue = SubsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(point.X, point.Y, point.Z);
16 if (block.IsFaceNonAttachable(SubsystemElectricity.SubsystemTerrain, cellFace.Face, cellValue, elementCellValue)
17 && (cellFace.Face != 4 || !(block is FenceBlock))) {
18 SubsystemElectricity.SubsystemTerrain.DestroyCell(
19 0,
20 cellFace.X,
21 cellFace.Y,
22 cellFace.Z,
23 0,
24 false,
25 false
26 );
27 }
28 }
29 }
30 }
31}
virtual bool IsFaceNonAttachable(SubsystemTerrain subsystemTerrain, int face, int value, int attachBlockValue)
SubsystemElectricity SubsystemElectricity
ElectricElement(SubsystemElectricity subsystemElectricity, IEnumerable< CellFace > cellFaces)
override void OnNeighborBlockChanged(CellFace cellFace, int neighborX, int neighborY, int neighborZ)
MountedElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
static int ExtractContents(int value)
static Point3 FaceToPoint3(int face)