@@ -1,5 +1,6 @@
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Shared.Containers;
|
namespace Content.Shared.Containers;
|
||||||
|
|
||||||
@@ -8,6 +9,7 @@ namespace Content.Shared.Containers;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ContainerCompSystem : EntitySystem
|
public sealed class ContainerCompSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -19,21 +21,18 @@ public sealed class ContainerCompSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnConRemove(Entity<ContainerCompComponent> ent, ref EntRemovedFromContainerMessage args)
|
private void OnConRemove(Entity<ContainerCompComponent> ent, ref EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID != ent.Comp.Container)
|
if (args.Container.ID != ent.Comp.Container || _timing.ApplyingState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_proto.TryIndex(ent.Comp.Container, out var entProto))
|
if (_proto.TryIndex(ent.Comp.Proto, out var entProto))
|
||||||
{
|
{
|
||||||
foreach (var entry in entProto.Components.Values)
|
EntityManager.RemoveComponents(args.Entity, entProto.Components);
|
||||||
{
|
|
||||||
RemComp(args.Entity, entry.Component);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnConInsert(Entity<ContainerCompComponent> ent, ref EntInsertedIntoContainerMessage args)
|
private void OnConInsert(Entity<ContainerCompComponent> ent, ref EntInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID != ent.Comp.Container)
|
if (args.Container.ID != ent.Comp.Container || _timing.ApplyingState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_proto.TryIndex(ent.Comp.Proto, out var entProto))
|
if (_proto.TryIndex(ent.Comp.Proto, out var entProto))
|
||||||
|
|||||||
Reference in New Issue
Block a user