перенос общих файлов из папки White в _White

This commit is contained in:
Remuchi
2024-01-28 18:37:24 +07:00
parent 1e4ad59270
commit 3a08b81d53
370 changed files with 805 additions and 812 deletions

View File

@@ -0,0 +1,37 @@
using Robust.Shared.Containers;
using Robust.Shared.Network;
namespace Content.Shared._White.Jukebox;
public class JukeboxSharedSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly INetManager _netManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<JukeboxComponent, ComponentStartup>(OnJukeboxInit);
}
public void OnJukeboxInit(EntityUid uid, JukeboxComponent component, ComponentStartup args)
{
component.TapeContainer = _containerSystem.EnsureContainer<Container>(uid, JukeboxComponent.JukeboxContainerName);
component.DefaultSongsContainer = _containerSystem.EnsureContainer<Container>(uid, JukeboxComponent.JukeboxDefaultSongsName);
if (_netManager.IsServer)
{
var transform = Transform(component.Owner);
foreach (var tapePrototype in component.DefaultTapes)
{
var tapeUid = EntityManager.SpawnEntity(tapePrototype, transform.MapPosition);
if(!TryComp<TapeComponent>(tapeUid, out _)) continue;
component.DefaultSongsContainer.Insert(tapeUid);
}
}
}
}