- add: improve system
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
using Content.Shared._Amour.Hole;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server._Amour.Hole;
|
||||
|
||||
public sealed partial class HoleSystem
|
||||
{
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
private void InitializeContainer()
|
||||
{
|
||||
SubscribeLocalEvent<HoleContainerComponent,ComponentInit>(OnContainerInit);
|
||||
}
|
||||
|
||||
private void OnContainerInit(EntityUid uid, HoleContainerComponent component, ComponentInit args)
|
||||
{
|
||||
component.Slot = _containerSystem.EnsureContainer<Container>(uid, HoleContainerComponent.SlotName);
|
||||
foreach (var holePrototype in component.HolePrototypes)
|
||||
{
|
||||
Log.Debug("ADDED " + holePrototype);
|
||||
_containerSystem.Insert(Spawn(holePrototype), component.Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ namespace Content.Server._Amour.Hole;
|
||||
public sealed partial class HoleSystem
|
||||
{
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
public void InitializeInventory()
|
||||
|
||||
private void InitializeInventory()
|
||||
{
|
||||
SubscribeLocalEvent<HoleInventoryComponent,ComponentInit>(OnInventoryInit);
|
||||
}
|
||||
|
||||
@@ -12,14 +12,8 @@ public sealed partial class HoleSystem : SharedHoleSystem
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
InitializeContainer();
|
||||
base.Initialize();
|
||||
InitializeInventory();
|
||||
SubscribeLocalEvent<HoleComponent,EntGotInsertedIntoContainerMessage>(OnInsert);
|
||||
}
|
||||
|
||||
private void OnInsert(EntityUid uid, HoleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
component.Parent = GetNetEntity(args.Container.Owner);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
|
||||
Reference in New Issue
Block a user