Convert StorageSystem comp messages into network events (#7351)
This commit is contained in:
@@ -14,13 +14,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Input;
|
using Robust.Shared.Input;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Network;
|
|
||||||
using Robust.Shared.Players;
|
|
||||||
using static Robust.Client.UserInterface.Control;
|
using static Robust.Client.UserInterface.Control;
|
||||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
@@ -86,35 +80,11 @@ namespace Content.Client.Storage
|
|||||||
_storedEntities = state.StoredEntities.ToList();
|
_storedEntities = state.StoredEntities.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Component Messages are deprecated, use Entity Events instead.")]
|
|
||||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
|
|
||||||
{
|
|
||||||
base.HandleNetworkMessage(message, channel, session);
|
|
||||||
|
|
||||||
switch (message)
|
|
||||||
{
|
|
||||||
//Updates what we are storing for the UI
|
|
||||||
case StorageHeldItemsMessage msg:
|
|
||||||
HandleStorageMessage(msg);
|
|
||||||
break;
|
|
||||||
//Opens the UI
|
|
||||||
case OpenStorageUIMessage _:
|
|
||||||
ToggleUI();
|
|
||||||
break;
|
|
||||||
case CloseStorageUIMessage _:
|
|
||||||
CloseUI();
|
|
||||||
break;
|
|
||||||
case AnimateInsertingEntitiesMessage msg:
|
|
||||||
HandleAnimatingInsertingEntities(msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies received values from server about contents of storage container
|
/// Copies received values from server about contents of storage container
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="storageState"></param>
|
/// <param name="storageState"></param>
|
||||||
private void HandleStorageMessage(StorageHeldItemsMessage storageState)
|
public void HandleStorageMessage(StorageHeldItemsEvent storageState)
|
||||||
{
|
{
|
||||||
_storedEntities = storageState.StoredEntities.ToList();
|
_storedEntities = storageState.StoredEntities.ToList();
|
||||||
StorageSizeUsed = storageState.StorageSizeUsed;
|
StorageSizeUsed = storageState.StorageSizeUsed;
|
||||||
@@ -126,7 +96,7 @@ namespace Content.Client.Storage
|
|||||||
/// Animate the newly stored entities in <paramref name="msg"/> flying towards this storage's position
|
/// Animate the newly stored entities in <paramref name="msg"/> flying towards this storage's position
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg"></param>
|
/// <param name="msg"></param>
|
||||||
private void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesMessage msg)
|
public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg)
|
||||||
{
|
{
|
||||||
for (var i = 0; msg.StoredEntities.Count > i; i++)
|
for (var i = 0; msg.StoredEntities.Count > i; i++)
|
||||||
{
|
{
|
||||||
@@ -143,7 +113,7 @@ namespace Content.Client.Storage
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the storage UI if closed. Closes it if opened.
|
/// Opens the storage UI if closed. Closes it if opened.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ToggleUI()
|
public void ToggleUI()
|
||||||
{
|
{
|
||||||
var window = GetOrCreateWindow();
|
var window = GetOrCreateWindow();
|
||||||
|
|
||||||
@@ -153,7 +123,7 @@ namespace Content.Client.Storage
|
|||||||
window.OpenCentered();
|
window.OpenCentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseUI()
|
public void CloseUI()
|
||||||
{
|
{
|
||||||
_window?.Close();
|
_window?.Close();
|
||||||
}
|
}
|
||||||
@@ -162,13 +132,11 @@ namespace Content.Client.Storage
|
|||||||
/// Function for clicking one of the stored entity buttons in the UI, tells server to remove that entity
|
/// Function for clicking one of the stored entity buttons in the UI, tells server to remove that entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
private void Interact(ButtonEventArgs args, EntityUid entity)
|
public void Interact(ButtonEventArgs args, EntityUid entity)
|
||||||
{
|
{
|
||||||
if (args.Event.Function == EngineKeyFunctions.UIClick)
|
if (args.Event.Function == EngineKeyFunctions.UIClick)
|
||||||
{
|
{
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(new RemoveEntityEvent(Owner, entity));
|
||||||
SendNetworkMessage(new RemoveEntityMessage(entity));
|
|
||||||
#pragma warning restore 618
|
|
||||||
args.Event.Handle();
|
args.Event.Handle();
|
||||||
}
|
}
|
||||||
else if (_entityManager.EntityExists(entity))
|
else if (_entityManager.EntityExists(entity))
|
||||||
@@ -191,7 +159,7 @@ namespace Content.Client.Storage
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Button created for each entity that represents that item in the storage UI, with a texture, and name and size label
|
/// Button created for each entity that represents that item in the storage UI, with a texture, and name and size label
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void GenerateButton(EntityUid entity, EntityContainerButton button)
|
public void GenerateButton(EntityUid entity, EntityContainerButton button)
|
||||||
{
|
{
|
||||||
if (!_entityManager.EntityExists(entity))
|
if (!_entityManager.EntityExists(entity))
|
||||||
return;
|
return;
|
||||||
@@ -269,9 +237,7 @@ namespace Content.Client.Storage
|
|||||||
|
|
||||||
if (entities.HasComponent<HandsComponent>(controlledEntity))
|
if (entities.HasComponent<HandsComponent>(controlledEntity))
|
||||||
{
|
{
|
||||||
#pragma warning disable 618
|
entities.EntityNetManager?.SendSystemNetworkMessage(new InsertEntityEvent(storageEntity.Owner));
|
||||||
StorageEntity.SendNetworkMessage(new InsertEntityMessage());
|
|
||||||
#pragma warning restore 618
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,9 +272,7 @@ namespace Content.Client.Storage
|
|||||||
|
|
||||||
public override void Close()
|
public override void Close()
|
||||||
{
|
{
|
||||||
#pragma warning disable 618
|
IoCManager.Resolve<IEntityManager>().EntityNetManager?.SendSystemNetworkMessage(new CloseStorageUIEvent(StorageEntity.Owner));
|
||||||
StorageEntity.SendNetworkMessage(new CloseStorageUIMessage());
|
|
||||||
#pragma warning restore 618
|
|
||||||
base.Close();
|
base.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
49
Content.Client/Storage/StorageSystem.cs
Normal file
49
Content.Client/Storage/StorageSystem.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Content.Shared.Storage;
|
||||||
|
|
||||||
|
namespace Content.Client.Storage;
|
||||||
|
|
||||||
|
// TODO kill this is all horrid.
|
||||||
|
public sealed class StorageSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeNetworkEvent<StorageHeldItemsEvent>(OnStorageHeldItems);
|
||||||
|
SubscribeNetworkEvent<OpenStorageUIEvent>(OnOpenStorageUI);
|
||||||
|
SubscribeNetworkEvent<CloseStorageUIEvent>(OnCloseStorageUI);
|
||||||
|
SubscribeNetworkEvent<AnimateInsertingEntitiesEvent>(OnAnimateInsertingEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStorageHeldItems(StorageHeldItemsEvent ev)
|
||||||
|
{
|
||||||
|
if (TryComp<ClientStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.HandleStorageMessage(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOpenStorageUI(OpenStorageUIEvent ev)
|
||||||
|
{
|
||||||
|
if (TryComp<ClientStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.ToggleUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCloseStorageUI(CloseStorageUIEvent ev)
|
||||||
|
{
|
||||||
|
if (TryComp<ClientStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.CloseUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAnimateInsertingEntities(AnimateInsertingEntitiesEvent ev)
|
||||||
|
{
|
||||||
|
if (TryComp<ClientStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.HandleAnimatingInsertingEntities(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -302,9 +302,7 @@ namespace Content.Server.Storage.Components
|
|||||||
Logger.DebugS(LoggerName, $"Storage (UID {Owner}) \"used\" by player session (UID {userSession.AttachedEntity}).");
|
Logger.DebugS(LoggerName, $"Storage (UID {Owner}) \"used\" by player session (UID {userSession.AttachedEntity}).");
|
||||||
|
|
||||||
SubscribeSession(userSession);
|
SubscribeSession(userSession);
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(new OpenStorageUIEvent(Owner), userSession.ConnectedClient);
|
||||||
SendNetworkMessage(new OpenStorageUIMessage(), userSession.ConnectedClient);
|
|
||||||
#pragma warning restore 618
|
|
||||||
UpdateClientInventory(userSession);
|
UpdateClientInventory(userSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,9 +347,7 @@ namespace Content.Server.Storage.Components
|
|||||||
|
|
||||||
var stored = StoredEntities.Select(e => e).ToArray();
|
var stored = StoredEntities.Select(e => e).ToArray();
|
||||||
|
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(new StorageHeldItemsEvent(Owner, StorageCapacityMax,StorageUsed, stored), session.ConnectedClient);
|
||||||
SendNetworkMessage(new StorageHeldItemsMessage(stored, StorageUsed, StorageCapacityMax), session.ConnectedClient);
|
|
||||||
#pragma warning restore 618
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -385,9 +381,8 @@ namespace Content.Server.Storage.Components
|
|||||||
Logger.DebugS(LoggerName, $"Storage (UID {Owner}) unsubscribed player session (UID {session.AttachedEntity}).");
|
Logger.DebugS(LoggerName, $"Storage (UID {Owner}) unsubscribed player session (UID {session.AttachedEntity}).");
|
||||||
|
|
||||||
SubscribedSessions.Remove(session);
|
SubscribedSessions.Remove(session);
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(new CloseStorageUIEvent(Owner),
|
||||||
SendNetworkMessage(new CloseStorageUIMessage(), session.ConnectedClient);
|
session.ConnectedClient);
|
||||||
#pragma warning restore 618
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseNestedInterfaces(session);
|
CloseNestedInterfaces(session);
|
||||||
@@ -444,73 +439,57 @@ namespace Content.Server.Storage.Components
|
|||||||
EnsureInitialCalculated();
|
EnsureInitialCalculated();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Component Messages are deprecated, use Entity Events instead.")]
|
public void HandleRemoveEntity(RemoveEntityEvent remove, ICommonSession session)
|
||||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
|
|
||||||
{
|
{
|
||||||
base.HandleNetworkMessage(message, channel, session);
|
EnsureInitialCalculated();
|
||||||
|
|
||||||
if (session == null)
|
if (session.AttachedEntity is not {Valid: true} player)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(session));
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (message)
|
var ownerTransform = _entityManager.GetComponent<TransformComponent>(Owner);
|
||||||
|
var playerTransform = _entityManager.GetComponent<TransformComponent>(player);
|
||||||
|
|
||||||
|
if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) ||
|
||||||
|
Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform))
|
||||||
{
|
{
|
||||||
case RemoveEntityMessage remove:
|
return;
|
||||||
{
|
|
||||||
EnsureInitialCalculated();
|
|
||||||
|
|
||||||
if (session.AttachedEntity is not {Valid: true} player)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ownerTransform = _entityManager.GetComponent<TransformComponent>(Owner);
|
|
||||||
var playerTransform = _entityManager.GetComponent<TransformComponent>(player);
|
|
||||||
|
|
||||||
if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) ||
|
|
||||||
Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!remove.EntityUid.Valid || Storage?.Contains(remove.EntityUid) == false)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_sysMan.GetEntitySystem<SharedHandsSystem>().TryPickupAnyHand(player, remove.EntityUid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InsertEntityMessage _:
|
|
||||||
{
|
|
||||||
EnsureInitialCalculated();
|
|
||||||
|
|
||||||
if (session.AttachedEntity is not {Valid: true} player)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(player, Owner, popup: true))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerInsertHeldEntity(player);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CloseStorageUIMessage _:
|
|
||||||
{
|
|
||||||
if (session is not IPlayerSession playerSession)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
UnsubscribeSession(playerSession);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!remove.EntityUid.Valid || Storage?.Contains(remove.EntityUid) == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sysMan.GetEntitySystem<SharedHandsSystem>().TryPickupAnyHand(player, remove.EntityUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleInsertEntity(ICommonSession session)
|
||||||
|
{
|
||||||
|
EnsureInitialCalculated();
|
||||||
|
|
||||||
|
if (session.AttachedEntity is not {Valid: true} player)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(player, Owner, popup: true))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerInsertHeldEntity(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleCloseUI(ICommonSession session)
|
||||||
|
{
|
||||||
|
if (session is not IPlayerSession playerSession)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnsubscribeSession(playerSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -604,14 +583,8 @@ namespace Content.Server.Storage.Components
|
|||||||
if (successfullyInserted.Count > 0)
|
if (successfullyInserted.Count > 0)
|
||||||
{
|
{
|
||||||
PlaySoundCollection();
|
PlaySoundCollection();
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(
|
||||||
SendNetworkMessage(
|
new AnimateInsertingEntitiesEvent(Owner, successfullyInserted, successfullyInsertedPositions));
|
||||||
#pragma warning restore 618
|
|
||||||
new AnimateInsertingEntitiesMessage(
|
|
||||||
successfullyInserted,
|
|
||||||
successfullyInsertedPositions
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -632,12 +605,9 @@ namespace Content.Server.Storage.Components
|
|||||||
_entityManager.GetComponent<TransformComponent>(target).MapPosition);
|
_entityManager.GetComponent<TransformComponent>(target).MapPosition);
|
||||||
if (PlayerInsertEntityInWorld(eventArgs.User, target))
|
if (PlayerInsertEntityInWorld(eventArgs.User, target))
|
||||||
{
|
{
|
||||||
#pragma warning disable 618
|
_entityManager.EntityNetManager?.SendSystemNetworkMessage(new AnimateInsertingEntitiesEvent(Owner,
|
||||||
SendNetworkMessage(new AnimateInsertingEntitiesMessage(
|
new List<EntityUid> { target },
|
||||||
#pragma warning restore 618
|
new List<EntityCoordinates> { position }));
|
||||||
new List<EntityUid> {target},
|
|
||||||
new List<EntityCoordinates> {position}
|
|
||||||
));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Disposal.Unit.Components;
|
using Content.Server.Disposal.Unit.Components;
|
||||||
using Content.Server.Disposal.Unit.EntitySystems;
|
using Content.Server.Disposal.Unit.EntitySystems;
|
||||||
@@ -6,6 +5,7 @@ using Content.Server.Hands.Components;
|
|||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
|
using Content.Shared.Storage;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -40,6 +40,34 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
SubscribeLocalEvent<ServerStorageComponent, GetVerbsEvent<UtilityVerb>>(AddTransferVerbs);
|
SubscribeLocalEvent<ServerStorageComponent, GetVerbsEvent<UtilityVerb>>(AddTransferVerbs);
|
||||||
|
|
||||||
SubscribeLocalEvent<StorageFillComponent, MapInitEvent>(OnStorageFillMapInit);
|
SubscribeLocalEvent<StorageFillComponent, MapInitEvent>(OnStorageFillMapInit);
|
||||||
|
|
||||||
|
SubscribeNetworkEvent<RemoveEntityEvent>(OnRemoveEntity);
|
||||||
|
SubscribeNetworkEvent<InsertEntityEvent>(OnInsertEntity);
|
||||||
|
SubscribeNetworkEvent<CloseStorageUIEvent>(OnCloseStorageUI);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRemoveEntity(RemoveEntityEvent ev, EntitySessionEventArgs args)
|
||||||
|
{
|
||||||
|
if (TryComp<ServerStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.HandleRemoveEntity(ev, args.SenderSession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInsertEntity(InsertEntityEvent ev, EntitySessionEventArgs args)
|
||||||
|
{
|
||||||
|
if (TryComp<ServerStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.HandleInsertEntity(args.SenderSession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCloseStorageUI(CloseStorageUIEvent ev, EntitySessionEventArgs args)
|
||||||
|
{
|
||||||
|
if (TryComp<ServerStorageComponent>(ev.Storage, out var storage))
|
||||||
|
{
|
||||||
|
storage.HandleCloseUI(args.SenderSession);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args)
|
private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args)
|
||||||
|
|||||||
@@ -74,98 +74,96 @@ namespace Content.Shared.Storage
|
|||||||
/// Updates the client component about what entities this storage is holding
|
/// Updates the client component about what entities this storage is holding
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class StorageHeldItemsEvent : EntityEventArgs
|
||||||
public sealed class StorageHeldItemsMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
|
public readonly EntityUid Storage;
|
||||||
public readonly int StorageSizeMax;
|
public readonly int StorageSizeMax;
|
||||||
public readonly int StorageSizeUsed;
|
public readonly int StorageSizeUsed;
|
||||||
public readonly EntityUid[] StoredEntities;
|
public readonly EntityUid[] StoredEntities;
|
||||||
|
|
||||||
public StorageHeldItemsMessage(EntityUid[] storedEntities, int storageUsed, int storageMaxSize)
|
public StorageHeldItemsEvent(EntityUid storage, int storageSizeMax, int storageSizeUsed, EntityUid[] storedEntities)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
StorageSizeMax = storageMaxSize;
|
StorageSizeMax = storageSizeMax;
|
||||||
StorageSizeUsed = storageUsed;
|
StorageSizeUsed = storageSizeUsed;
|
||||||
StoredEntities = storedEntities;
|
StoredEntities = storedEntities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component message for adding an entity to the storage entity.
|
/// Network event for adding an entity to the storage entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class InsertEntityEvent : EntityEventArgs
|
||||||
public sealed class InsertEntityMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
public InsertEntityMessage()
|
public readonly EntityUid Storage;
|
||||||
|
|
||||||
|
public InsertEntityEvent(EntityUid storage)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component message for displaying an animation of entities flying into a storage entity
|
/// Network event for displaying an animation of entities flying into a storage entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class AnimateInsertingEntitiesEvent : EntityEventArgs
|
||||||
public sealed class AnimateInsertingEntitiesMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
|
public readonly EntityUid Storage;
|
||||||
public readonly List<EntityUid> StoredEntities;
|
public readonly List<EntityUid> StoredEntities;
|
||||||
public readonly List<EntityCoordinates> EntityPositions;
|
public readonly List<EntityCoordinates> EntityPositions;
|
||||||
public AnimateInsertingEntitiesMessage(List<EntityUid> storedEntities, List<EntityCoordinates> entityPositions)
|
|
||||||
|
public AnimateInsertingEntitiesEvent(EntityUid storage, List<EntityUid> storedEntities, List<EntityCoordinates> entityPositions)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
StoredEntities = storedEntities;
|
StoredEntities = storedEntities;
|
||||||
EntityPositions = entityPositions;
|
EntityPositions = entityPositions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component message for removing a contained entity from the storage entity
|
/// Network event for removing a contained entity from the storage entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class RemoveEntityEvent : EntityEventArgs
|
||||||
public sealed class RemoveEntityMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
|
public EntityUid Storage;
|
||||||
public EntityUid EntityUid;
|
public EntityUid EntityUid;
|
||||||
|
|
||||||
public RemoveEntityMessage(EntityUid entityuid)
|
public RemoveEntityEvent(EntityUid storage, EntityUid entityUid)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
EntityUid = entityuid;
|
EntityUid = entityUid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component message for opening the storage UI
|
/// Network event for opening the storage UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class OpenStorageUIEvent : EntityEventArgs
|
||||||
public sealed class OpenStorageUIMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
public OpenStorageUIMessage()
|
public readonly EntityUid Storage;
|
||||||
|
|
||||||
|
public OpenStorageUIEvent(EntityUid storage)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component message for closing the storage UI.
|
/// Network event for closing the storage UI.
|
||||||
/// E.g when the player moves too far away from the container.
|
/// E.g when the player moves too far away from the container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
#pragma warning disable 618
|
public sealed class CloseStorageUIEvent : EntityEventArgs
|
||||||
public sealed class CloseStorageUIMessage : ComponentMessage
|
|
||||||
#pragma warning restore 618
|
|
||||||
{
|
{
|
||||||
public CloseStorageUIMessage()
|
public readonly EntityUid Storage;
|
||||||
|
|
||||||
|
public CloseStorageUIEvent(EntityUid storage)
|
||||||
{
|
{
|
||||||
Directed = true;
|
Storage = storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user