Add gravitycomponent support to maps (#9857)
* Add gravitycomponent support to maps The alert still needs fixing if you want planets. * move
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Tag;
|
||||
@@ -16,6 +17,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
/// </summary>
|
||||
public const float FlyTime = 0.15f;
|
||||
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly ThrownItemSystem _thrownSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
@@ -23,7 +25,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Tries to throw the entity if it has a physics component, otherwise does nothing.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity being thrown.</param>
|
||||
/// <param name="uid">The entity being thrown.</param>
|
||||
/// <param name="direction">A vector pointing from the entity to its destination.</param>
|
||||
/// <param name="strength">How much the direction vector should be multiplied for velocity.</param>
|
||||
/// <param name="user"></param>
|
||||
@@ -97,10 +99,10 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
if (user != null &&
|
||||
pushbackRatio > 0.0f &&
|
||||
physicsQuery.Value.TryGetComponent(user.Value, out var userPhysics) &&
|
||||
user.Value.IsWeightless(userPhysics, entityManager: EntityManager))
|
||||
_gravity.IsWeightless(user.Value, userPhysics))
|
||||
{
|
||||
var msg = new ThrowPushbackAttemptEvent();
|
||||
RaiseLocalEvent(physics.Owner, msg, false);
|
||||
RaiseLocalEvent(physics.Owner, msg);
|
||||
|
||||
if (!msg.Cancelled)
|
||||
userPhysics.ApplyLinearImpulse(-impulseVector * pushbackRatio);
|
||||
|
||||
Reference in New Issue
Block a user