mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Added a basic server simulation framework for help with tests. * Moved as much as possible to Robust.Shared/Containers. Moved ContainerSlot from content to engine. * Moved ClientContainer to shared. * Merged client/server ContainerManagerComponents into a single shared version. * ContainerManagerComponent is now implicitly registered with the attributes. * Migrated to 2021 serialization technology. * Existing Unit Tests work. * More tests coverage. Fixed bug with transferring items between containers. * Container Type info is now sent over the network. * Merge client/server container systems. * Code cleanup. * Attempted to fix dictionary serialization. Logs warning when trying to check if an unknown GridId is paused. * Remove OldCode.
26 lines
811 B
C#
26 lines
811 B
C#
using Robust.Shared.GameObjects;
|
|
|
|
namespace Robust.Shared.Containers
|
|
{
|
|
public class ContainerSystem : EntitySystem
|
|
{
|
|
/// <inheritdoc />
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<EntParentChangedMessage>(HandleParentChanged);
|
|
}
|
|
|
|
// Eject entities from their parent container if the parent change is done by the transform only.
|
|
private static void HandleParentChanged(EntParentChangedMessage message)
|
|
{
|
|
var oldParentEntity = message.OldParent;
|
|
|
|
if (oldParentEntity == null || !oldParentEntity.IsValid())
|
|
return;
|
|
|
|
if (oldParentEntity.TryGetComponent(out IContainerManager? containerManager))
|
|
containerManager.ForceRemove(message.Entity);
|
|
}
|
|
}
|
|
}
|