using System.Diagnostics.CodeAnalysis;
using Robust.Shared.GameStates;
namespace Content.Shared.Mind.Components;
///
/// This component indicates that this entity may have mind, which is simply an entity with a .
/// The mind entity is not actually stored in a "container", but is simply stored in nullspace.
///
[RegisterComponent, Access(typeof(SharedMindSystem)), NetworkedComponent, AutoGenerateComponentState]
public sealed partial class MindContainerComponent : Component
{
///
/// The mind controlling this mob. Can be null.
///
[DataField, AutoNetworkedField]
public EntityUid? Mind;
///
/// DeltaV: The first mind to control this mob. Will only be null if the mob never had a mind at all.
///
[DataField, AutoNetworkedField]
public EntityUid? OriginalMind;
///
/// True if we have a mind, false otherwise.
///
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadOnly)]
public bool HasMind;
///
/// Whether the mind will be put on a ghost after this component is shutdown.
///
[DataField]
public bool GhostOnShutdown = true;
}
///
/// Base event for all other mind related events.
///
public abstract class MindEvent : EntityEventArgs
{
///
/// entity currently being handled by the event.
///
public readonly Entity Mind;
///
/// entity currently being handled by the event.
///
public readonly Entity Container;
///
/// The target entity in case the mind is being transferred. In it means the entity that is being transferred to, and in it means the previous entity.
/// Null if the mind is being added for the first time or fully removed from entities.
///
public readonly EntityUid? TransferEntity;
public MindEvent(Entity mind, Entity container, EntityUid? transferEntity)
{
Mind = mind;
Container = container;
TransferEntity = transferEntity;
}
}
///
/// Event raised directed at a mind-container when a mind gets removed.
///
///
/// Called after the owned entity is already set to null. TransferEntity is the entity this mind will be added to afterward, if any.
///
public sealed class MindRemovedMessage : MindEvent
{
public MindRemovedMessage(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}
///
/// Event raised directed at a mind when it gets removed from a mind-container.
///
///
/// Called after the owned entity is already set to null. TransferEntity is the entity this mind will be added to afterward, if any.
///
public sealed class MindGotRemovedEvent : MindEvent
{
public MindGotRemovedEvent(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}
///
/// Event raised directed at a mind-container before a mind gets removed.
///
///
/// Called before the OwnedEntity is set to null. TransferEntity is the entity this mind will be added to afterward, if any.
///
public sealed class BeforeMindRemovedMessage : MindEvent
{
public BeforeMindRemovedMessage(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}
///
/// Event raised directed at a mind before it gets removed from a mind-container.
///
///
/// Called before the OwnedEntity is set to null. TransferEntity is the entity this mind will be added to afterward, if any.
///
public sealed class BeforeMindGotRemovedEvent : MindEvent
{
public BeforeMindGotRemovedEvent(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}
///
/// Event raised directed at a mind-container when a mind gets added.
///
///
/// Called after the owned entity is already set to the new entity. TransferEntity is the previous entity that this mind owned, if any.
///
public sealed class MindAddedMessage : MindEvent
{
public MindAddedMessage(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}
///
/// Event raised directed at a mind when it gets added to a mind-container.
///
///
/// Called after the owned entity is already set to the new entity. TransferEntity is the previous entity that this mind owned, if any.
///
public sealed class MindGotAddedEvent : MindEvent
{
public MindGotAddedEvent(Entity mind, Entity container, EntityUid? transferEntity)
: base(mind, container, transferEntity)
{
}
}