using System; using Robust.Shared.GameStates; using Robust.Shared.Network; using Robust.Shared.Players; using Robust.Shared.Timing; namespace Robust.Shared.GameObjects { /// /// Base component for the ECS system. /// All discoverable implementations of IComponent must override the . /// Instances are dynamically instantiated by a ComponentFactory, and will have their IoC Dependencies resolved. /// public interface IComponent { /// /// Name that this component is represented with in prototypes. /// /// string Name { get; } /// /// The current lifetime stage of this component. You can use this to check /// if the component is initialized or being deleted. /// ComponentLifeStage LifeStage { get; } /// /// Whether this component should be synchronized with clients when modified. /// If this is true, the server will synchronize all client instances with the data in this instance. /// If this is false, clients can modify the data in their instances without being overwritten by the server. /// This flag has no effect if is not defined on the component. /// This is enabled by default. /// bool NetSyncEnabled { get; } /// /// Entity that this component is attached to. /// EntityUid Owner { get; } /// /// Component has been properly initialized. /// bool Initialized { get; } /// /// This is true when the component is active. /// bool Running { get; } /// /// True if the component has been removed from its owner, AKA deleted. /// bool Deleted { get; } /// /// Marks the component as dirty so that the network will re-sync it with clients. /// void Dirty(IEntityManager? entManager = null); /// /// This is the tick the component was created. /// GameTick CreationTick { get; } /// /// This is the last game tick Dirty() was called. /// GameTick LastModifiedTick { get; } /// /// Get the component's state for replicating on the client. /// /// ComponentState object ComponentState GetComponentState(); /// /// Handles an incoming component state from the server. /// /// /// This function should only be called on the client. /// Both, one, or neither of the two states can be null. /// On the next tick, curState will be nextState. /// Passing null for both arguments should do nothing. /// /// Current component state for this tick. /// Next component state for the next tick. void HandleComponentState(ComponentState? curState, ComponentState? nextState); } }