Removes all dependencies on engine component events. (#4199)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using Content.Client.Construction;
|
||||
using Content.Client.Construction;
|
||||
using Content.Client.DragDrop;
|
||||
using Content.Shared.Input;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
@@ -66,6 +67,9 @@ namespace Content.Client.Actions
|
||||
.BindBefore(EngineKeyFunctions.Use, new PointerInputCmdHandler(TargetingOnUse),
|
||||
typeof(ConstructionSystem), typeof(DragDropSystem))
|
||||
.Register<ActionsSystem>();
|
||||
|
||||
SubscribeLocalEvent<ClientActionsComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<ClientActionsComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Actions.Assignments;
|
||||
using Content.Client.Actions.UI;
|
||||
using Content.Client.Hands;
|
||||
@@ -51,20 +51,6 @@ namespace Content.Client.Actions
|
||||
PlayerDetached();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
PlayerAttached();
|
||||
break;
|
||||
case PlayerDetachedMsg _:
|
||||
PlayerDetached();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
@@ -77,7 +63,7 @@ namespace Content.Client.Actions
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void PlayerAttached()
|
||||
public void PlayerAttached()
|
||||
{
|
||||
if (!CurrentlyControlled || _ui != null)
|
||||
{
|
||||
@@ -89,7 +75,7 @@ namespace Content.Client.Actions
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void PlayerDetached()
|
||||
public void PlayerDetached()
|
||||
{
|
||||
if (_ui == null) return;
|
||||
IoCManager.Resolve<IUserInterfaceManager>().StateRoot.RemoveChild(_ui);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Alerts.UI;
|
||||
using Content.Shared.Alert;
|
||||
@@ -41,20 +41,6 @@ namespace Content.Client.Alerts
|
||||
PlayerDetached();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
PlayerAttached();
|
||||
break;
|
||||
case PlayerDetachedMsg _:
|
||||
PlayerDetached();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
@@ -67,7 +53,7 @@ namespace Content.Client.Alerts
|
||||
UpdateAlertsControls();
|
||||
}
|
||||
|
||||
private void PlayerAttached()
|
||||
public void PlayerAttached()
|
||||
{
|
||||
if (!CurrentlyControlled || _ui != null)
|
||||
{
|
||||
@@ -86,7 +72,7 @@ namespace Content.Client.Alerts
|
||||
UpdateAlertsControls();
|
||||
}
|
||||
|
||||
private void PlayerDetached()
|
||||
public void PlayerDetached()
|
||||
{
|
||||
foreach (var alertControl in _alertControls.Values)
|
||||
{
|
||||
|
||||
16
Content.Client/Alerts/ClientAlertsSystem.cs
Normal file
16
Content.Client/Alerts/ClientAlertsSystem.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Alerts
|
||||
{
|
||||
internal class ClientAlertsSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ClientAlertsComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<ClientAlertsComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,16 +76,21 @@ namespace Content.Client.CharacterInterface
|
||||
inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, null);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
public void PlayerDetached()
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
if (Window != null)
|
||||
{
|
||||
_gameHud.CharacterButtonVisible = false;
|
||||
Window.Close();
|
||||
}
|
||||
}
|
||||
|
||||
switch (message)
|
||||
public void PlayerAttached()
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
if (Window != null)
|
||||
{
|
||||
_gameHud.CharacterButtonVisible = true;
|
||||
|
||||
_gameHud.CharacterButtonToggled = b =>
|
||||
{
|
||||
if (b)
|
||||
@@ -98,18 +103,6 @@ namespace Content.Client.CharacterInterface
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PlayerDetachedMsg _:
|
||||
if (Window != null)
|
||||
{
|
||||
_gameHud.CharacterButtonVisible = false;
|
||||
Window.Close();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Client.HUD;
|
||||
using Content.Shared.Input;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -23,6 +24,9 @@ namespace Content.Client.CharacterInterface
|
||||
.Bind(ContentKeyFunctions.OpenCharacterMenu,
|
||||
InputCmdHandler.FromDelegate(s => HandleOpenCharacterMenu()))
|
||||
.Register<CharacterInterfaceSystem>();
|
||||
|
||||
SubscribeLocalEvent<CharacterInterfaceComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<CharacterInterfaceComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.HUD;
|
||||
using Content.Client.HUD;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Targeting;
|
||||
using Robust.Client.GameObjects;
|
||||
@@ -35,21 +35,12 @@ namespace Content.Client.CombatMode
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
public void PlayerDetached() { _gameHud.CombatPanelVisible = false; }
|
||||
|
||||
switch (message)
|
||||
public void PlayerAttached()
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
_gameHud.CombatPanelVisible = true;
|
||||
UpdateHud();
|
||||
break;
|
||||
|
||||
case PlayerDetachedMsg _:
|
||||
_gameHud.CombatPanelVisible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateHud()
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace Content.Client.CombatMode
|
||||
base.Initialize();
|
||||
|
||||
_gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;
|
||||
|
||||
SubscribeLocalEvent<CombatModeComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<CombatModeComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
|
||||
@@ -210,22 +210,6 @@ namespace Content.Client.Hands
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
if (_gui == null)
|
||||
{
|
||||
_gui = new HandsGui();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gui.Parent?.RemoveChild(_gui);
|
||||
}
|
||||
|
||||
_gameHud.HandsContainer.AddChild(_gui);
|
||||
_gui.UpdateHandIcons();
|
||||
break;
|
||||
case PlayerDetachedMsg _:
|
||||
_gui?.Parent?.RemoveChild(_gui);
|
||||
break;
|
||||
case HandEnabledMsg msg:
|
||||
{
|
||||
var hand = GetHand(msg.Name);
|
||||
@@ -255,6 +239,23 @@ namespace Content.Client.Hands
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerDetached() { _gui?.Parent?.RemoveChild(_gui); }
|
||||
|
||||
public void PlayerAttached()
|
||||
{
|
||||
if (_gui == null)
|
||||
{
|
||||
_gui = new HandsGui();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gui.Parent?.RemoveChild(_gui);
|
||||
}
|
||||
|
||||
_gameHud.HandsContainer.AddChild(_gui);
|
||||
_gui.UpdateHandIcons();
|
||||
}
|
||||
|
||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null)
|
||||
{
|
||||
base.HandleNetworkMessage(message, netChannel, session);
|
||||
|
||||
16
Content.Client/Hands/HandsSystem.cs
Normal file
16
Content.Client/Hands/HandsSystem.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Hands
|
||||
{
|
||||
internal class HandsSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<HandsComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.Clothing;
|
||||
@@ -252,22 +252,16 @@ namespace Content.Client.Inventory
|
||||
SendNetworkMessage(new OpenSlotStorageUIMessage(slot));
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
public void PlayerDetached()
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
InterfaceController.PlayerAttached();
|
||||
_playerAttached = true;
|
||||
break;
|
||||
|
||||
case PlayerDetachedMsg _:
|
||||
InterfaceController.PlayerDetached();
|
||||
_playerAttached = false;
|
||||
break;
|
||||
}
|
||||
|
||||
public void PlayerAttached()
|
||||
{
|
||||
InterfaceController.PlayerAttached();
|
||||
_playerAttached = true;
|
||||
}
|
||||
|
||||
public bool TryGetSlot(Slots slot, [NotNullWhen(true)] out IEntity? item)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Client.HUD;
|
||||
using Content.Shared.Input;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,7 +12,6 @@ namespace Content.Client.Inventory
|
||||
public sealed class ClientInventorySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -22,6 +21,9 @@ namespace Content.Client.Inventory
|
||||
.Bind(ContentKeyFunctions.OpenInventoryMenu,
|
||||
InputCmdHandler.FromDelegate(_ => HandleOpenInventoryMenu()))
|
||||
.Register<ClientInventorySystem>();
|
||||
|
||||
SubscribeLocalEvent<ClientInventoryComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<ClientInventoryComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
|
||||
@@ -102,13 +102,14 @@ namespace Content.Client.Suspicion
|
||||
Allies.AddRange(state.Allies);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
public void PlayerDetached()
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
_gui?.Parent?.RemoveChild(_gui);
|
||||
RemoveTraitorOverlay();
|
||||
}
|
||||
|
||||
switch (message)
|
||||
public void PlayerAttached()
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
if (_gui == null)
|
||||
{
|
||||
_gui = new SuspicionGui();
|
||||
@@ -125,13 +126,6 @@ namespace Content.Client.Suspicion
|
||||
{
|
||||
AddTraitorOverlay();
|
||||
}
|
||||
|
||||
break;
|
||||
case PlayerDetachedMsg _:
|
||||
_gui?.Parent?.RemoveChild(_gui);
|
||||
RemoveTraitorOverlay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
|
||||
16
Content.Client/Suspicion/SuspicionRoleSystem.cs
Normal file
16
Content.Client/Suspicion/SuspicionRoleSystem.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Suspicion
|
||||
{
|
||||
class SuspicionRoleSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ using Content.Shared.Configurable;
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Anchor;
|
||||
using Content.Server.Disposal.Unit.Components;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Throwing;
|
||||
|
||||
@@ -60,17 +60,7 @@ namespace Content.Server.Inventory.Components
|
||||
return flagsCheck;
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case ContainerContentsModifiedMessage contentsModified:
|
||||
Owner.SpawnTimer(0, DropIdAndPocketsIfWeNoLongerHaveAUniform);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void CheckUniformExists() { Owner.SpawnTimer(0, DropIdAndPocketsIfWeNoLongerHaveAUniform); }
|
||||
|
||||
// Hey, it's descriptive.
|
||||
private void DropIdAndPocketsIfWeNoLongerHaveAUniform()
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace Content.Server.Inventory.Components
|
||||
/// The underlying Container System just notified us that an entity was removed from it.
|
||||
/// We need to make sure we process that removed entity as being unequipped from the slot.
|
||||
/// </summary>
|
||||
private void ForceUnequip(IContainer container, IEntity entity)
|
||||
public void ForceUnequip(IContainer container, IEntity entity)
|
||||
{
|
||||
// make sure this is one of our containers.
|
||||
// Technically the correct way would be to enumerate the possible slot names
|
||||
@@ -572,23 +572,6 @@ namespace Content.Server.Inventory.Components
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case ContainerContentsModifiedMessage msg:
|
||||
if (msg.Removed)
|
||||
ForceUnequip(msg.Container, msg.Entity);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel,
|
||||
ICommonSession? session = null)
|
||||
|
||||
27
Content.Server/Inventory/InventorySystem.cs
Normal file
27
Content.Server/Inventory/InventorySystem.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Content.Server.Inventory.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Inventory
|
||||
{
|
||||
class InventorySystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HumanInventoryControllerComponent, EntRemovedFromContainerMessage>(HandleRemovedFromContainer);
|
||||
SubscribeLocalEvent<InventoryComponent, EntRemovedFromContainerMessage>(HandleInvRemovedFromContainer);
|
||||
}
|
||||
|
||||
private static void HandleInvRemovedFromContainer(EntityUid uid, InventoryComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
component.ForceUnequip(args.Container, args.Entity);
|
||||
}
|
||||
|
||||
private static void HandleRemovedFromContainer(EntityUid uid, HumanInventoryControllerComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
component.CheckUniformExists();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MedicalScanner;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Preferences;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Acts;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Physics;
|
||||
|
||||
@@ -47,25 +47,18 @@ namespace Content.Server.Storage.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
public void ContainerUpdateAppearance(IContainer container)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
if(_appearanceComponent is null)
|
||||
return;
|
||||
|
||||
if (_appearanceComponent != null)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case ContainerContentsModifiedMessage msg:
|
||||
var actual = Count(msg.Container.ContainedEntities);
|
||||
var actual = Count(container.ContainedEntities);
|
||||
_appearanceComponent.SetData(StackVisuals.Actual, actual);
|
||||
|
||||
if (_maxAmount != null)
|
||||
{
|
||||
_appearanceComponent.SetData(StackVisuals.MaxCount, _maxAmount);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int Count(IReadOnlyList<IEntity> containerContainedEntities)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Server.Storage.Components;
|
||||
using JetBrains.Annotations;
|
||||
@@ -39,6 +39,11 @@ namespace Content.Server.Storage
|
||||
{
|
||||
storageComp.HandleEntityMaybeRemoved(message);
|
||||
}
|
||||
|
||||
if (oldParentEntity.TryGetComponent<StorageCounterComponent>(out var newStorageComp))
|
||||
{
|
||||
newStorageComp.ContainerUpdateAppearance(message.Container);
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleEntityInsertedIntoContainer(EntInsertedIntoContainerMessage message)
|
||||
@@ -49,6 +54,11 @@ namespace Content.Server.Storage
|
||||
{
|
||||
storageComp.HandleEntityMaybeInserted(message);
|
||||
}
|
||||
|
||||
if (oldParentEntity.TryGetComponent<StorageCounterComponent>(out var newStorageComp))
|
||||
{
|
||||
newStorageComp.ContainerUpdateAppearance(message.Container);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckSubscribedEntities(ServerStorageComponent storageComp)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.GameTicking;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Suspicion.EntitySystems
|
||||
@@ -12,6 +13,28 @@ namespace Content.Server.Suspicion.EntitySystems
|
||||
|
||||
public IReadOnlyCollection<SuspicionRoleComponent> Traitors => _traitors;
|
||||
|
||||
#region Overrides of EntitySystem
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerAttachedEvent>((HandlePlayerAttached));
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerDetachedEvent>((HandlePlayerDetached));
|
||||
}
|
||||
|
||||
private void HandlePlayerDetached(EntityUid uid, SuspicionRoleComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
component.SyncRoles();
|
||||
}
|
||||
|
||||
private void HandlePlayerAttached(EntityUid uid, SuspicionRoleComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
component.SyncRoles();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void AddTraitor(SuspicionRoleComponent role)
|
||||
{
|
||||
if (!_traitors.Add(role))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -168,10 +168,6 @@ namespace Content.Server.Suspicion
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg:
|
||||
case PlayerDetachedMsg:
|
||||
SyncRoles();
|
||||
break;
|
||||
case RoleAddedMessage {Role: SuspicionRole role}:
|
||||
Role = role;
|
||||
break;
|
||||
|
||||
18
Content.Shared/Movement/RelayMovementEntityMessage.cs
Normal file
18
Content.Shared/Movement/RelayMovementEntityMessage.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Movement
|
||||
{
|
||||
[Obsolete("Component Messages are deprecated, use Entity Events instead.")]
|
||||
public class RelayMovementEntityMessage : ComponentMessage
|
||||
{
|
||||
[PublicAPI]
|
||||
public readonly IEntity Entity;
|
||||
|
||||
public RelayMovementEntityMessage(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user