dropping with random rotation on unintentional drop, dropping with reset rotation on intentional
This commit is contained in:
@@ -26,6 +26,7 @@ using Robust.Shared.Log;
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems.Click
|
namespace Content.Server.GameObjects.EntitySystems.Click
|
||||||
{
|
{
|
||||||
@@ -36,6 +37,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
public sealed class InteractionSystem : SharedInteractionSystem
|
public sealed class InteractionSystem : SharedInteractionSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -685,6 +687,10 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
return;
|
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();
|
var comps = item.GetAllComponents<IDropped>().ToList();
|
||||||
|
|
||||||
// Call Land on all components that implement the interface
|
// Call Land on all components that implement the interface
|
||||||
|
|||||||
Reference in New Issue
Block a user