Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Networking/NetEntityEvent/NetEntityEvent.cs
1 using System;
2 
3 namespace Barotrauma.Networking
4 {
5  abstract class NetEntityEvent
6  {
7  public interface IData { }
8 
9  public readonly Entity Entity;
10  public readonly UInt16 ID;
11 
12  public UInt16 EntityID => Entity.ID;
13 
14  //arbitrary extra data that will be passed to the Write method of the serializable entity
15  //(the index of an itemcomponent for example)
16  public IData Data { get; private set; }
17 
18  public bool Sent;
19 
20  protected NetEntityEvent(INetSerializable serializableEntity, UInt16 id)
21  {
22  this.ID = id;
23  this.Entity = serializableEntity as Entity;
24  }
25 
26  public void SetData(IData data)
27  {
28  this.Data = data;
29  }
30 
31  public bool IsDuplicate(NetEntityEvent other)
32  {
33  if (other.Entity != this.Entity) { return false; }
34 
35  return Equals(Data, other.Data);
36  }
37  }
38 }
Entity(Submarine submarine, ushort id)
Definition: Entity.cs:90
readonly ushort ID
Unique, but non-persistent identifier. Stays the same if the entities are created in the exactly same...
Definition: Entity.cs:43