mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Removed the Interfaces folder. * All objects inside the GameObjects subfolders are now in the GameObjects namespace. * Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces. * Simplified Robust.client.Graphics namespace. * Automated remove redundant using statements.
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Robust.Shared.GameObjects
|
|
{
|
|
public abstract class SharedContainerManagerComponent : Component, IContainerManager
|
|
{
|
|
public sealed override string Name => "ContainerContainer";
|
|
public sealed override uint? NetID => NetIDs.CONTAINER_MANAGER;
|
|
|
|
public abstract T MakeContainer<T>(string id) where T : IContainer;
|
|
public abstract bool Remove(IEntity entity);
|
|
public abstract IContainer GetContainer(string id);
|
|
public abstract bool HasContainer(string id);
|
|
public abstract bool TryGetContainer(string id, [NotNullWhen(true)] out IContainer? container);
|
|
|
|
/// <inheritdoc />
|
|
public abstract bool TryGetContainer(IEntity entity, [NotNullWhen(true)] out IContainer? container);
|
|
|
|
public abstract bool ContainsEntity(IEntity entity);
|
|
public abstract void ForceRemove(IEntity entity);
|
|
public abstract void InternalContainerShutdown(IContainer container);
|
|
|
|
[Serializable, NetSerializable]
|
|
protected class ContainerManagerComponentState : ComponentState
|
|
{
|
|
public Dictionary<string, ContainerData> Containers { get; }
|
|
|
|
public ContainerManagerComponentState(Dictionary<string, ContainerData> containers) : base(NetIDs.CONTAINER_MANAGER)
|
|
{
|
|
Containers = containers;
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public struct ContainerData
|
|
{
|
|
public bool ShowContents;
|
|
public bool OccludesLight;
|
|
public EntityUid[] ContainedEntities;
|
|
}
|
|
}
|
|
|
|
public IEnumerable<IContainer> GetAllContainers() => GetAllContainersImpl();
|
|
|
|
// Separate impl method to facilitate method hiding in the subclasses.
|
|
protected abstract IEnumerable<IContainer> GetAllContainersImpl();
|
|
}
|
|
}
|