dropping with random rotation on unintentional drop, dropping with reset rotation on intentional

This commit is contained in:
Paul
2021-05-09 10:09:14 +02:00
parent c817165482
commit c136755df2

View File

@@ -26,6 +26,7 @@ using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Players;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.EntitySystems.Click
{
@@ -36,6 +37,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
public sealed class InteractionSystem : SharedInteractionSystem
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
@@ -685,6 +687,10 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return;
}
if(item.TryGetComponent<ITransformComponent>(out var transformComponent))
transformComponent.LocalRotation = intentional ? Angle.Zero : (_random.Next(0, 100) / 100f) * MathHelper.TwoPi;
var comps = item.GetAllComponents<IDropped>().ToList();
// Call Land on all components that implement the interface