Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SubsystemElectricBlockBehavior.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
7
8 public override int[] HandledBlocks => [
9 133,
10 140,
11 137,
12 143,
13 156,
14 134,
15 135,
16 145,
17 224,
18 146,
19 157,
20 180,
21 181,
22 183,
23 138,
24 139,
25 141,
26 142,
27 184,
28 187,
29 186,
30 188,
31 144,
32 151,
33 179,
34 152,
35 254,
36 253,
37 182,
38 185,
39 56,
40 57,
41 58,
42 83,
43 84,
44 166,
45 194,
46 86,
47 63,
48 97,
49 98,
50 210,
51 211,
52 105,
53 106,
54 107,
55 234,
56 235,
57 236,
58 147,
59 153,
60 154,
61 223,
62 155,
63 243,
64 120,
65 121,
66 199,
67 216,
68 227,
69 237
70 ];
71
72 public override void OnBlockGenerated(int value, int x, int y, int z, bool isLoaded) {
73 m_subsystemElectricity.OnElectricElementBlockGenerated(x, y, z);
74 }
75
76 public override void OnBlockAdded(int value, int oldValue, int x, int y, int z) {
77 m_subsystemElectricity.OnElectricElementBlockAdded(x, y, z);
78 }
79
80 public override void OnBlockRemoved(int value, int newValue, int x, int y, int z) {
81 m_subsystemElectricity.OnElectricElementBlockRemoved(x, y, z);
82 }
83
84 public override void OnBlockModified(int value, int oldValue, int x, int y, int z) {
85 m_subsystemElectricity.OnElectricElementBlockModified(x, y, z);
86 }
87
88 public override void OnBlockStartMoving(int value, int newValue, int x, int y, int z, MovingBlock movingBlock) {
89 m_subsystemElectricity.m_pointsToUpdate[new Point3(x, y, z)] = true;
90 }
91
92 public override void OnBlockStopMoving(int value, int oldValue, int x, int y, int z, MovingBlock movingBlock) {
93 m_subsystemElectricity.m_pointsToUpdate[new Point3(x, y, z)] = true;
94 }
95
96 public override void OnChunkDiscarding(TerrainChunk chunk) {
97 m_subsystemElectricity.OnChunkDiscarding(chunk);
98 }
99
100 public override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ) {
101 for (int i = 0; i < 6; i++) {
102 m_subsystemElectricity.GetElectricElement(x, y, z, i)
103 ?.OnNeighborBlockChanged(new CellFace(x, y, z, i), neighborX, neighborY, neighborZ);
104 }
105 }
106
107 public override bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner) {
108 int x = raycastResult.CellFace.X;
109 int y = raycastResult.CellFace.Y;
110 int z = raycastResult.CellFace.Z;
111 for (int i = 0; i < 6; i++) {
112 ElectricElement electricElement = m_subsystemElectricity.GetElectricElement(x, y, z, i);
113 if (electricElement != null) {
114 return electricElement.OnInteract(raycastResult, componentMiner);
115 }
116 }
117 return false;
118 }
119
120 public override void OnCollide(CellFace cellFace, float velocity, ComponentBody componentBody) {
121 int x = cellFace.X;
122 int y = cellFace.Y;
123 int z = cellFace.Z;
124 int num = 0;
125 ElectricElement electricElement;
126 while (true) {
127 if (num < 6) {
128 electricElement = m_subsystemElectricity.GetElectricElement(x, y, z, num);
129 if (electricElement != null) {
130 break;
131 }
132 num++;
133 continue;
134 }
135 return;
136 }
137 electricElement.OnCollide(cellFace, velocity, componentBody);
138 }
139
140 public override void OnHitByProjectile(CellFace cellFace, WorldItem worldItem) {
141 int x = cellFace.X;
142 int y = cellFace.Y;
143 int z = cellFace.Z;
144 int num = 0;
145 ElectricElement electricElement;
146 while (true) {
147 if (num < 6) {
148 electricElement = m_subsystemElectricity.GetElectricElement(x, y, z, num);
149 if (electricElement != null) {
150 break;
151 }
152 num++;
153 continue;
154 }
155 return;
156 }
157 electricElement.OnHitByProjectile(cellFace, worldItem);
158 }
159
160 public override void Load(ValuesDictionary valuesDictionary) {
161 base.Load(valuesDictionary);
163 }
164 }
165}
virtual void OnCollide(CellFace cellFace, float velocity, ComponentBody componentBody)
virtual bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner)
virtual void OnHitByProjectile(CellFace cellFace, WorldItem worldItem)
override void OnBlockGenerated(int value, int x, int y, int z, bool isLoaded)
override void OnHitByProjectile(CellFace cellFace, WorldItem worldItem)
override void OnBlockAdded(int value, int oldValue, int x, int y, int z)
override bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner)
override void OnBlockModified(int value, int oldValue, int x, int y, int z)
override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ)
override void OnBlockStartMoving(int value, int newValue, int x, int y, int z, MovingBlock movingBlock)
override void OnBlockStopMoving(int value, int oldValue, int x, int y, int z, MovingBlock movingBlock)
override void OnCollide(CellFace cellFace, float velocity, ComponentBody componentBody)
override void Load(ValuesDictionary valuesDictionary)
override void OnBlockRemoved(int value, int newValue, int x, int y, int z)
ValuesDictionary ValuesDictionary