Inertia (#3709)
* Some stuff * Fix NaN angular velocity * Optimise a bit * Give throwing a bit of a spin * Reality can be whatever I want * Biffing it * Cleanup * Update submodule Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -31,8 +31,8 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Dynamics.Shapes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
#nullable enable
|
||||
@@ -275,8 +275,9 @@ namespace Content.Server.Commands.Physics
|
||||
new Fixture(box, shape) {
|
||||
CollisionLayer = (int) CollisionGroup.Impassable,
|
||||
CollisionMask = (int) CollisionGroup.Impassable,
|
||||
Hard = true});
|
||||
box.Mass = 5.0f;
|
||||
Hard = true,
|
||||
Mass = 5.0f,
|
||||
});
|
||||
y += deltaY;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
{
|
||||
internal static class ThrowHelper
|
||||
{
|
||||
private const float ThrowAngularImpulse = 3.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Tries to throw the entity if it has a physics component, otherwise does nothing.
|
||||
/// </summary>
|
||||
@@ -41,6 +43,8 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
if (entity.HasComponent<ItemComponent>())
|
||||
{
|
||||
entity.EnsureComponent<ThrownItemComponent>().Thrower = user;
|
||||
// Give it a l'il spin.
|
||||
physicsComponent.ApplyAngularImpulse(ThrowAngularImpulse);
|
||||
|
||||
if (user != null)
|
||||
EntitySystem.Get<InteractionSystem>().ThrownInteraction(user, entity);
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.StationEvents;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Physics.Dynamics.Shapes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Singularity;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -27,9 +21,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
[RegisterComponent]
|
||||
public class ServerSingularityComponent : SharedSingularityComponent, IStartCollide
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
|
||||
public int Energy
|
||||
{
|
||||
get => _energy;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Shared.Audio;
|
||||
@@ -10,9 +9,7 @@ using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.GameObjects.Components.Tag;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Physics.Controllers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -20,7 +17,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -90,7 +87,6 @@ namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
physics = gridEntity.AddComponent<PhysicsComponent>();
|
||||
physics.BodyStatus = BodyStatus.InAir;
|
||||
physics.Mass = 1;
|
||||
physics.CanCollide = true;
|
||||
physics.AddFixture(new Fixture(physics, new PhysShapeGrid(grid)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user