Client LuaCsForBarotrauma
NotComponent.cs
2 {
4  {
5  private bool signalReceived;
6 
7  private bool continuousOutput;
8  [InGameEditable, Serialize(false, IsPropertySaveable.Yes, description: "When enabled, the component continuously outputs \"1\" when it's not receiving a signal.", alwaysUseInstanceValues: true)]
9  public bool ContinuousOutput
10  {
11  get { return continuousOutput; }
12  set { continuousOutput = IsActive = value; }
13  }
14 
16  : base (item, element)
17  {
18  }
19 
20  public override void Update(float deltaTime, Camera cam)
21  {
22  base.Update(deltaTime, cam);
23  if (!signalReceived)
24  {
25  item.SendSignal("1", "signal_out");
26  }
27  signalReceived = false;
28  }
29 
30  public override void ReceiveSignal(Signal signal, Connection connection)
31  {
32  if (connection.Name != "signal_in") { return; }
33 
34  signal.value = signal.value == "0" || string.IsNullOrEmpty(signal.value) ? "1" : "0";
35  signal.power = 0.0f;
36  item.SendSignal(signal, "signal_out");
37  signalReceived = true;
38  }
39  }
40 }
void SendSignal(string signal, string connectionName)
The base class for components holding the different functionalities of the item
override void Update(float deltaTime, Camera cam)
Definition: NotComponent.cs:20
NotComponent(Item item, ContentXElement element)
Definition: NotComponent.cs:15
override void ReceiveSignal(Signal signal, Connection connection)
Definition: NotComponent.cs:30