Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Traitors/TraitorManager.cs
1 #nullable enable
2 
4 using System.Linq;
5 
6 namespace Barotrauma
7 {
8  sealed partial class TraitorManager
9  {
10  public struct TraitorResults : INetSerializableStruct
11  {
14 
16  public bool VotedCorrectTraitor;
17 
19  public bool ObjectiveSuccessful;
20 
22  public int MoneyPenalty;
23 
25  public Identifier TraitorEventIdentifier;
26 
27  public TraitorResults(Client? votedAsTraitor, TraitorEvent traitorEvent)
28  {
29  VotedAsTraitorClientSessionId = votedAsTraitor?.SessionId ?? 0;
30  VotedCorrectTraitor = votedAsTraitor == traitorEvent.Traitor;
32  {
33  VotedCorrectTraitor = traitorEvent.SecondaryTraitors.Contains(votedAsTraitor);
34  }
35  ObjectiveSuccessful = traitorEvent.CurrentState == TraitorEvent.State.Completed;
36  MoneyPenalty = votedAsTraitor != null && !VotedCorrectTraitor ?
38  0;
40  }
41 
43  {
44  int sessionId = VotedAsTraitorClientSessionId;
45  return GameMain.NetworkMember?.ConnectedClients?.FirstOrDefault(c => c.SessionId == sessionId);
46  }
47  }
48  }
49 }
static NetworkMember NetworkMember
Definition: GameMain.cs:190
Marks fields and properties as to be serialized and deserialized by INetSerializableStruct....
readonly byte SessionId
An ID for this client for the current session. THIS IS NOT A PERSISTENT VALUE. DO NOT STORE THIS LONG...
readonly Identifier Identifier
Definition: Prefab.cs:34
IEnumerable< Client > SecondaryTraitors
Definition: TraitorEvent.cs:44
new TraitorEventPrefab Prefab
Definition: TraitorEvent.cs:22
readonly int MoneyPenaltyForUnfoundedTraitorAccusation
Money penalty if the crew votes a wrong player as the traitor
readonly bool AllowAccusingSecondaryTraitor
Does accusing a secondary traitor count as correctly identifying the traitor?
TraitorResults(Client? votedAsTraitor, TraitorEvent traitorEvent)