[FIX] JukeboxSyncFIX
Co-authored-by: Mona Hmiza <>
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
using Content.Shared.White.Jukebox;
|
using Content.Server.GameTicking;
|
||||||
|
using Content.Shared.White.Jukebox;
|
||||||
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -7,6 +10,7 @@ namespace Content.Server.White.Jukebox;
|
|||||||
public sealed class ServerJukeboxSongsSyncManager : JukeboxSongsSyncManager
|
public sealed class ServerJukeboxSongsSyncManager : JukeboxSongsSyncManager
|
||||||
{
|
{
|
||||||
[Dependency] private readonly INetManager _netManager = default!;
|
[Dependency] private readonly INetManager _netManager = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -49,7 +53,6 @@ public sealed class ServerJukeboxSongsSyncManager : JukeboxSongsSyncManager
|
|||||||
|
|
||||||
public override void OnSongUploaded(JukeboxSongUploadNetMessage message)
|
public override void OnSongUploaded(JukeboxSongUploadNetMessage message)
|
||||||
{
|
{
|
||||||
|
|
||||||
ContentRoot.AddOrUpdateFile(message.RelativePath, message.Data);
|
ContentRoot.AddOrUpdateFile(message.RelativePath, message.Data);
|
||||||
|
|
||||||
foreach (var channel in _netManager.Channels)
|
foreach (var channel in _netManager.Channels)
|
||||||
@@ -57,4 +60,14 @@ public sealed class ServerJukeboxSongsSyncManager : JukeboxSongsSyncManager
|
|||||||
channel.SendMessage(message);
|
channel.SendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CleanUp()
|
||||||
|
{
|
||||||
|
var files = ContentRoot.GetAllFiles();
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
ContentRoot.RemoveFile(file.relPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
Content.Server/White/Jukebox/ServerJukeboxSongsSyncSystem.cs
Normal file
16
Content.Server/White/Jukebox/ServerJukeboxSongsSyncSystem.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Content.Shared.GameTicking;
|
||||||
|
|
||||||
|
namespace Content.Server.White.Jukebox;
|
||||||
|
|
||||||
|
public sealed class ServerJukeboxSongsSyncSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly ServerJukeboxSongsSyncManager _jukeboxManager = default!;
|
||||||
|
|
||||||
|
public event Action? PostRoundCleanUp;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(_ => _jukeboxManager?.CleanUp());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user