Content update for NetEntities (#18935)
This commit is contained in:
@@ -14,7 +14,7 @@ public sealed partial class CartridgeLoaderComponent : Component
|
||||
/// <summary>
|
||||
/// List of programs that come preinstalled with this cartridge loader
|
||||
/// </summary>
|
||||
[DataField("preinstalled")]
|
||||
[DataField("preinstalled")] // TODO remove this and use container fill.
|
||||
public List<string> PreinstalledPrograms = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -29,12 +29,6 @@ public sealed partial class CartridgeLoaderComponent : Component
|
||||
[ViewVariables]
|
||||
public readonly List<EntityUid> BackgroundPrograms = new();
|
||||
|
||||
/// <summary>
|
||||
/// The list of program entities that are spawned into the cartridge loaders program container
|
||||
/// </summary>
|
||||
[DataField("installedCartridges")]
|
||||
public List<EntityUid> InstalledPrograms = new();
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount of programs that can be installed on the cartridge loader entity
|
||||
/// </summary>
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace Content.Shared.CartridgeLoader;
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class CartridgeLoaderUiMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly EntityUid CartridgeUid;
|
||||
public readonly NetEntity CartridgeUid;
|
||||
public readonly CartridgeUiMessageAction Action;
|
||||
|
||||
public CartridgeLoaderUiMessage(EntityUid cartridgeUid, CartridgeUiMessageAction action)
|
||||
public CartridgeLoaderUiMessage(NetEntity cartridgeUid, CartridgeUiMessageAction action)
|
||||
{
|
||||
CartridgeUid = cartridgeUid;
|
||||
Action = action;
|
||||
|
||||
@@ -7,6 +7,12 @@ namespace Content.Shared.CartridgeLoader;
|
||||
[Serializable, NetSerializable]
|
||||
public class CartridgeLoaderUiState : BoundUserInterfaceState
|
||||
{
|
||||
public EntityUid? ActiveUI;
|
||||
public List<EntityUid> Programs = new();
|
||||
public NetEntity? ActiveUI;
|
||||
public List<NetEntity> Programs;
|
||||
|
||||
public CartridgeLoaderUiState(List<NetEntity> programs, NetEntity? activeUI)
|
||||
{
|
||||
Programs = programs;
|
||||
ActiveUI = activeUI;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ public sealed class CartridgeUiMessage : BoundUserInterfaceMessage
|
||||
[Serializable, NetSerializable]
|
||||
public abstract class CartridgeMessageEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid LoaderUid;
|
||||
public NetEntity LoaderUid;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Shared.CartridgeLoader.Cartridges;
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NotekeeperUiState : BoundUserInterfaceState
|
||||
{
|
||||
public List<String> Notes;
|
||||
public List<string> Notes;
|
||||
|
||||
public NotekeeperUiState(List<string> notes)
|
||||
{
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.CartridgeLoader;
|
||||
|
||||
public abstract class SharedCartridgeLoaderSystem : EntitySystem
|
||||
{
|
||||
public const string InstalledContainerId = "program-container";
|
||||
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -36,11 +41,8 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
|
||||
private void OnComponentRemove(EntityUid uid, CartridgeLoaderComponent loader, ComponentRemove args)
|
||||
{
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot);
|
||||
|
||||
foreach (var program in loader.InstalledPrograms)
|
||||
{
|
||||
EntityManager.QueueDeleteEntity(program);
|
||||
}
|
||||
if (_container.TryGetContainer(uid, InstalledContainerId, out var cont))
|
||||
cont.Shutdown(EntityManager, _netMan);
|
||||
}
|
||||
|
||||
protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
|
||||
|
||||
Reference in New Issue
Block a user