mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Predict Light Replacers * Public once more * Light changes * Introduce an OrderList. * Added Radial Menu * Fix missing Dirty() * Introduce EntityProvider * Migratiooon! * Adress Reviews * Forgot Comments * Test-Fail Fix * Fixes * Update buttons * Revert "Update buttons" This reverts commit f84d8f2502600905a2ab4bce5463af6f2b4b1c3e. * Introduce Dedicated Short String * review * Another review has hit the PR Co-Authored-By: Whatstone <166147148+whatston3@users.noreply.github.com> * Adressing reviews Co-Authored-By: Whatstone <166147148+whatston3@users.noreply.github.com> * Update LightReplacerMenuBoundUserInterface.cs * refactor: do not pass ref type by ref, try not to create impure methods where it is not required * refactor: random xml-doc changes * refactor: more xml-doc, and 1 call per line convention * Small fixes * Iterate through the container * updated xml docs * IReadOnlyfix * refactor: renaming, whitespaces, use deconstructor in foreach, use Enumerable instead of creating additional list when its possible that it will be empty and wont be modified * refactor: fix collction cloning to not throw during modificaiton * Replace popups with sounds. * Added singular sounds * refactor: fix error on moving items from one EntityProvider to another and back when they have some spawned entities in container * Replaced Popup with Sound --------- Co-authored-by: Pok245 <113675512+Pok27@users.noreply.github.com> Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com> Co-authored-by: Fildrance <fildrance@gmail.com>
74 lines
2.8 KiB
C#
74 lines
2.8 KiB
C#
using Content.Shared.Storage.EntitySystems;
|
|
using Content.Shared.Whitelist;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Storage.Components;
|
|
|
|
/// <summary>
|
|
/// A generic entity storage that does not spawn entities in its storage until they're needed to be entities for other systems.
|
|
/// Useful for when an item stores a lot of entities without needing them to be entities in said storage.
|
|
/// Entities that are inserted back into the storage will remain entities, and are prioritized over non-spawned entities.
|
|
/// Refilling other entity providers will not spawn entities, as the end destination is also an entity provider storage.
|
|
/// </summary>
|
|
/// <example>Light replacers don't need their lights to be entities while in storage, but when they are used to replace a light.</example>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(EntityProviderSystem))]
|
|
public sealed partial class EntityProviderComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The counter for what entities are currently stored.
|
|
/// Each EntProtoId key corresponds to an entity, of which the value corresponds to how many are stored.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public Dictionary<EntProtoId, int> EntityCounter = [];
|
|
|
|
/// <summary>
|
|
/// The whitelist that entities have to pass in order to be inserted.
|
|
/// </summary>
|
|
[DataField(required: true)]
|
|
public EntityWhitelist Whitelist;
|
|
|
|
/// <summary>
|
|
/// Whether this provider can transfer its storage to other providers.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool CanTransfer = true;
|
|
|
|
/// <summary>
|
|
/// Whether this provider can receive entities to its storage.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool CanReceive = true;
|
|
|
|
/// <summary>
|
|
/// Whether this provider should be deleted after being emptied.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool DeleteIfEmpty;
|
|
|
|
/// <summary>
|
|
/// The sound played whenever the provider is being refilled by a storage or another provider.
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier? PluralTransferSound = new SoundPathSpecifier("/Audio/Effects/trashbag1.ogg");
|
|
|
|
/// <summary>
|
|
/// The sound played whenever a singular, eligible entity is inserted into the provider.
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier? SingularTransferSound = new SoundPathSpecifier("/Audio/Weapons/click.ogg")
|
|
{
|
|
Params = new AudioParams
|
|
{
|
|
Volume = -4f,
|
|
}
|
|
};
|
|
|
|
/// <summary>
|
|
/// The container where items will be shortly spawned into when being materialized from the counter.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public Container Container;
|
|
}
|