Client LuaCsForBarotrauma
CircuitBoxSelectable.cs
1 #nullable enable
2 
3 using System;
4 
5 namespace Barotrauma
6 {
7  internal class CircuitBoxSelectable
8  {
9  public bool IsSelected;
10  public ushort SelectedBy;
11 
12  public bool IsSelectedByMe
13  {
14  get
15  {
16  if (GameMain.NetworkMember is { IsServer: true })
17  {
18  throw new Exception("CircuitBoxSelectable.IsSelectedByMe should never be used by the server.");
19  }
20 
21  if (Character.Controlled is { } controlled)
22  {
23  return SelectedBy == controlled.ID;
24  }
25 
26  return false;
27  }
28  }
29 
30  public void SetSelected(Option<ushort> selectedBy)
31  {
32  if (selectedBy.TryUnwrap(out ushort id))
33  {
34  SelectedBy = id;
35  IsSelected = true;
36  return;
37  }
38 
39  IsSelected = false;
40  SelectedBy = 0;
41  }
42  }
43 }
@ Character
Characters only