mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Diagnostics;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Network.Messages;
|
|
using Robust.Shared.Physics;
|
|
|
|
namespace Robust.Server.Debugging
|
|
{
|
|
[UsedImplicitly]
|
|
internal class DebugDrawingManager : IDebugDrawingManager
|
|
{
|
|
[Dependency] private readonly IServerNetManager _net = default!;
|
|
|
|
public void Initialize()
|
|
{
|
|
_net.RegisterNetMessage<MsgRay>();
|
|
// TODO _physics.DebugDrawRay += data => PhysicsOnDebugDrawRay(data);
|
|
}
|
|
|
|
[Conditional("DEBUG")]
|
|
private void PhysicsOnDebugDrawRay(DebugRayData data)
|
|
{
|
|
var msg = _net.CreateNetMessage<MsgRay>();
|
|
msg.RayOrigin = data.Ray.Position;
|
|
if (data.Results != null)
|
|
{
|
|
msg.DidHit = true;
|
|
msg.RayHit = data.Results.Value.HitPos;
|
|
}
|
|
else
|
|
{
|
|
msg.RayHit = data.Ray.Position + data.Ray.Direction * data.MaxLength;
|
|
}
|
|
|
|
_net.ServerSendToAll(msg);
|
|
}
|
|
}
|
|
}
|