Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
LightBulbElectricElement.cs
浏览该文件的文档.
1using Engine;
2
3namespace Game {
5 public int m_intensity;
6
8
9 public LightBulbElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace, int value) : base(
10 subsystemElectricity,
11 cellFace
12 ) {
14 int data = Terrain.ExtractData(value);
16 }
17
18 public override bool Simulate() {
20 float num2 = 0f;
21 foreach (ElectricConnection connection in Connections) {
22 if (connection.ConnectorType != ElectricConnectorType.Output
23 && connection.NeighborConnectorType != 0) {
25 }
26 }
27 int intensity = m_intensity;
28 m_intensity = Math.Clamp((int)MathF.Round((num2 - 0.5f) * 30f), 0, 15);
29 if (m_intensity != intensity) {
31 }
32 if (num >= 10) {
33 CellFace cellFace = CellFaces[0];
34 int cellValue = SubsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(cellFace.X, cellFace.Y, cellFace.Z);
36 int value = Terrain.ReplaceData(cellValue, data);
37 SubsystemElectricity.SubsystemTerrain.ChangeCell(cellFace.X, cellFace.Y, cellFace.Z, value);
38 }
39 else {
41 }
42 return false;
43 }
44 }
45}
static int Max(int x1, int x2)
ElectricConnectorType ConnectorType
ElectricConnectorType NeighborConnectorType
virtual float GetOutputVoltage(int face)
List< ElectricConnection > Connections
ReadOnlyList< CellFace > CellFaces
LightBulbElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace, int value)
static int SetLightIntensity(int data, int intensity)
static int GetLightIntensity(int data)
MountedElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
void QueueElectricElementForSimulation(ElectricElement electricElement, int circuitStep)
virtual void ChangeCell(int x, int y, int z, int value, bool updateModificationCounter=true, MovingBlock movingBlock=null)
static int ReplaceData(int value, int data)
virtual int GetCellValue(int x, int y, int z)
static int ExtractData(int value)