mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System.Diagnostics;
|
|
using Robust.Server.Console;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Network.Messages;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Robust.Server.Prototypes
|
|
{
|
|
public sealed class ServerPrototypeManager : PrototypeManager
|
|
{
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
[Dependency] private readonly IConGroupController _conGroups = default!;
|
|
[Dependency] private readonly INetManager _netManager = default!;
|
|
|
|
public ServerPrototypeManager()
|
|
{
|
|
RegisterIgnore("shader");
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_netManager.RegisterNetMessage<MsgReloadPrototypes>(HandleReloadPrototypes, NetMessageAccept.Server);
|
|
}
|
|
|
|
private void HandleReloadPrototypes(MsgReloadPrototypes msg)
|
|
{
|
|
#if !FULL_RELEASE
|
|
if (!_playerManager.TryGetSessionByChannel(msg.MsgChannel, out var player) ||
|
|
!_conGroups.CanAdminReloadPrototypes(player))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var sw = Stopwatch.StartNew();
|
|
|
|
ReloadPrototypes(msg.Paths);
|
|
|
|
Logger.Info($"Reloaded prototypes in {sw.ElapsedMilliseconds} ms");
|
|
#endif
|
|
}
|
|
|
|
}
|
|
}
|