fixes heaps of build warnings (#3329)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Paul Ritter
2022-10-20 14:36:32 +02:00
committed by GitHub
parent d3adcb83db
commit 8fad4d291f
17 changed files with 58 additions and 53 deletions

View File

@@ -46,6 +46,7 @@ public sealed class SoundPathSpecifier : SoundSpecifier
Params = @params.Value;
}
[Obsolete("Use SharedAudioSystem.GetSound(), or just pass sound specifier directly into SharedAudioSystem.")]
public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null)
{
return Path == null ? string.Empty : Path.ToString();
@@ -70,6 +71,7 @@ public sealed class SoundCollectionSpecifier : SoundSpecifier
Params = @params.Value;
}
[Obsolete("Use SharedAudioSystem.GetSound(), or just pass sound specifier directly into SharedAudioSystem.")]
public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null)
{
if (Collection == null)

View File

@@ -149,7 +149,7 @@ namespace Robust.Shared.Containers
physicsSys.SetCanCollide(physics, false, false);
if (jointQuery.TryGetComponent(xform.Owner, out var joint))
jointSys.ClearJoints(joint);
jointSys.ClearJoints(xform.Owner, joint);
}
foreach (var child in xform.ChildEntities)

View File

@@ -28,7 +28,6 @@ namespace Robust.Shared.GameObjects
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ISerializationManager _serManager = default!;
[Dependency] private readonly INetManager _netMan = default!;
[Dependency] private readonly ProfManager _prof = default!;
#endregion Dependencies
@@ -201,7 +200,7 @@ namespace Robust.Shared.GameObjects
// For whatever reason, tests create and expect null-space to have a map entity, and it does on the client, but it
// intentionally doesn't on the server??
if (coordinates.MapId == MapId.Nullspace &&
mapXform == null)
mapXform == null)
{
transform._parent = EntityUid.Invalid;
transform.Anchored = false;

View File

@@ -1,9 +1,13 @@
using Robust.Shared.IoC;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
namespace Robust.Shared.GameObjects
{
public sealed class CollideOnAnchorSystem : EntitySystem
{
[Dependency] private SharedPhysicsSystem _physics = default!;
public override void Initialize()
{
base.Initialize();
@@ -35,7 +39,7 @@ namespace Robust.Shared.GameObjects
enabled ^= true;
}
body.CanCollide = enabled;
_physics.SetCanCollide(body, enabled);
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Robust.Shared.GameObjects
if (component.Enabled)
UpdateCanCollide(uid, component);
else if (TryComp(uid, out PhysicsComponent? physics))
physics.CanCollide = true;
_physics.SetCanCollide(physics, true);
Dirty(component);
}
@@ -65,7 +65,7 @@ namespace Robust.Shared.GameObjects
&& !Terminating(uid)
&& TryComp(uid, out PhysicsComponent? physics))
{
physics.CanCollide = true;
_physics.SetCanCollide(physics, true);
}
}

View File

@@ -307,10 +307,10 @@ namespace Robust.Shared.Physics.Dynamics
if (contact.Manifold.PointCount > 0 && contact.FixtureA?.Hard == true && contact.FixtureB?.Hard == true)
{
if (bodyA.CanCollide)
contact.FixtureA.Body.Awake = true;
_physics.SetAwake(contact.FixtureA.Body, true);
if (bodyB.CanCollide)
contact.FixtureB.Body.Awake = true;
_physics.SetAwake(contact.FixtureB.Body, true);
}
// Remove from the world
@@ -417,8 +417,8 @@ namespace Robust.Shared.Physics.Dynamics
var xformA = xformQuery.GetComponent(bodyA.Owner);
var xformB = xformQuery.GetComponent(bodyB.Owner);
var gridABounds = fixtureA.Shape.ComputeAABB(bodyA.GetTransform(xformA), 0);
var gridBBounds = fixtureB.Shape.ComputeAABB(bodyB.GetTransform(xformB), 0);
var gridABounds = fixtureA.Shape.ComputeAABB(_physics.GetPhysicsTransform(bodyA.Owner, xformA, xformQuery), 0);
var gridBBounds = fixtureB.Shape.ComputeAABB(_physics.GetPhysicsTransform(bodyB.Owner, xformB, xformQuery), 0);
if (!gridABounds.Intersects(gridBBounds))
{
@@ -574,8 +574,8 @@ namespace Robust.Shared.Physics.Dynamics
var bodyA = contact.FixtureA!.Body;
var bodyB = contact.FixtureB!.Body;
bodyA.Awake = true;
bodyB.Awake = true;
_physics.SetAwake(bodyA, true);
_physics.SetAwake(bodyB, true);
}
ArrayPool<bool>.Shared.Return(wake);

View File

@@ -146,8 +146,7 @@ namespace Robust.Shared.Physics.Dynamics
}
}
[DataField("hard")]
private bool _hard = true;
[DataField("hard")] private bool _hard = true;
// MassData
// The reason these aren't a struct is because Serv3 + doing MassData in yaml everywhere would suck.

View File

@@ -172,8 +172,7 @@ namespace Robust.Shared.Physics.Dynamics.Joints
}
}
[DataField("collideConnected")]
protected bool _collideConnected = true;
[DataField("collideConnected")] protected bool _collideConnected = true;
/// <summary>
/// The Breakpoint simply indicates the maximum Value the JointError can be before it breaks.

View File

@@ -54,7 +54,7 @@ namespace Robust.Shared.Physics.Systems
_broadphaseSystem.RemoveBody(body, component);
// TODO im 99% sure _broadphaseSystem.RemoveBody(body, component) gets triggered by this as well, so is this even needed?
body.CanCollide = false;
_physics.SetCanCollide(body, false);
}
#region Public
@@ -132,11 +132,14 @@ namespace Robust.Shared.Physics.Systems
/// </summary>
public void CreateFixture(PhysicsComponent body, IPhysShape shape, float density, int collisionLayer, int collisionMask)
{
var fixture = new Fixture(body, shape) {
Density = density,
CollisionLayer = collisionLayer,
CollisionMask = collisionMask
var fixture = new Fixture(body, shape)
{
Density = density
};
FixturesComponent? manager = null;
_physics.SetCollisionLayer(fixture, collisionLayer, manager);
_physics.SetCollisionMask(fixture, collisionMask, manager);
CreateFixture(body, fixture);
}
@@ -218,7 +221,7 @@ namespace Robust.Shared.Physics.Systems
if (updates)
{
FixtureUpdate(manager, body);
body.ResetMassData(manager);
_physics.ResetMassData(body, manager);
Dirty(manager);
}
}
@@ -371,7 +374,7 @@ namespace Robust.Shared.Physics.Systems
if (computeProperties)
{
physics.ResetMassData(component);
_physics.ResetMassData(physics, component);
}
}

View File

@@ -232,7 +232,7 @@ namespace Robust.Shared.Physics.Systems
// TODO: Need to handle grids colliding with non-grid entities with the same layer
// (nothing in SS14 does this yet).
var transform = bodyQuery.GetComponent(grid.GridEntityId).GetTransform(xform);
var transform = _physicsSystem.GetPhysicsTransform(grid.GridEntityId, xformQuery: xformQuery);
gridsPool.Clear();
foreach (var colliding in _mapManager.FindGridsIntersecting(mapId, aabb, gridsPool, xformQuery, bodyQuery, true))
@@ -242,7 +242,7 @@ namespace Robust.Shared.Physics.Systems
var otherGrid = (MapGrid)colliding;
var otherGridBounds = colliding.WorldAABB;
var otherGridInvMatrix = colliding.InvWorldMatrix;
var otherTransform = bodyQuery.GetComponent(colliding.GridEntityId).GetTransform(xformQuery.GetComponent(colliding.GridEntityId));
var otherTransform = _physicsSystem.GetPhysicsTransform(colliding.GridEntityId, xformQuery: xformQuery);
// Get Grid2 AABB in grid1 ref
var aabb1 = grid.LocalAABB.Intersect(invWorldMatrix.TransformBox(otherGridBounds));

View File

@@ -460,16 +460,16 @@ namespace Robust.Shared.Physics.Systems
MetaData(bodyAUid).EntityLifeStage < EntityLifeStage.Terminating &&
!_container.IsEntityInContainer(bodyAUid))
{
bodyA.CanCollide = true;
bodyA.Awake = true;
_physics.SetCanCollide(bodyA, true);
_physics.SetAwake(bodyA, true);
}
if (EntityManager.TryGetComponent<PhysicsComponent>(bodyBUid, out var bodyB) &&
MetaData(bodyBUid).EntityLifeStage < EntityLifeStage.Terminating &&
!_container.IsEntityInContainer(bodyBUid))
{
bodyB.CanCollide = true;
bodyB.Awake = true;
_physics.SetCanCollide(bodyB, true);
_physics.SetAwake(bodyB, true);
}
if (!jointComponentA.Deleted)

View File

@@ -55,7 +55,7 @@ public partial class SharedPhysicsSystem
{
if (component.BodyType != BodyType.Static)
{
component.Awake = true;
SetAwake(component, true);
}
}
@@ -95,21 +95,21 @@ public partial class SharedPhysicsSystem
if (args.Current is not PhysicsComponentState newState)
return;
component.SleepingAllowed = newState.SleepingAllowed;
component.FixedRotation = newState.FixedRotation;
component.CanCollide = newState.CanCollide;
SetSleepingAllowed(component, newState.SleepingAllowed);
SetFixedRotation(component, newState.FixedRotation);
SetCanCollide(component, newState.CanCollide);
component.BodyStatus = newState.Status;
// So transform doesn't apply MapId in the HandleComponentState because ??? so MapId can still be 0.
// Fucking kill me, please. You have no idea deep the rabbit hole of shitcode goes to make this work.
Dirty(component);
component.LinearVelocity = newState.LinearVelocity;
component.AngularVelocity = newState.AngularVelocity;
component.BodyType = newState.BodyType;
component.Friction = newState.Friction;
component.LinearDamping = newState.LinearDamping;
component.AngularDamping = newState.AngularDamping;
SetLinearVelocity(component, newState.LinearVelocity);
SetAngularVelocity(component, newState.AngularVelocity);
SetBodyType(component, newState.BodyType);
SetFriction(component, newState.Friction);
SetLinearDamping(component, newState.LinearDamping);
SetAngularDamping(component, newState.AngularDamping);
component.Predict = false;
}
@@ -376,7 +376,7 @@ public partial class SharedPhysicsSystem
}
if (updateSleepTime)
body.SleepTime = 0.0f;
SetSleepTime(body, 0);
Dirty(body);
}

View File

@@ -189,8 +189,8 @@ public abstract partial class SharedPhysicsSystem
if (args.OldParent is not EntityUid { Valid: true } parent)
{
// no previous parent --> simple
physics.LinearVelocity += physics.LinearVelocity - newLinear;
physics.AngularVelocity += physics.AngularVelocity - newAngular;
SetLinearVelocity(physics, physics.LinearVelocity - newLinear);
SetAngularVelocity(physics, physics.AngularVelocity - newAngular);
return;
}
@@ -225,7 +225,7 @@ public abstract partial class SharedPhysicsSystem
// Finally we can update the Velocities. linear velocity is already in terms of map-coordinates, so no
// world-rotation is required
physics.LinearVelocity += oldLinear - newLinear;
physics.AngularVelocity += oldAngular - newAngular;
SetLinearVelocity(physics, oldLinear - newLinear);
SetAngularVelocity(physics, oldAngular - newAngular);
}
}

View File

@@ -47,7 +47,6 @@ namespace Robust.Shared.Physics.Systems
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
[Dependency] private readonly SharedJointSystem _joints = default!;
[Dependency] private readonly SharedGridTraversalSystem _traversal = default!;
[Dependency] private readonly IManifoldManager _collision = default!;
[Dependency] protected readonly IMapManager MapManager = default!;
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
@@ -91,7 +90,7 @@ namespace Robust.Shared.Physics.Systems
private void OnPhysicsRemove(EntityUid uid, PhysicsComponent component, ComponentRemove args)
{
component.CanCollide = false;
SetCanCollide(component, false);
DebugTools.Assert(!component.Awake);
}
@@ -217,7 +216,7 @@ namespace Robust.Shared.Physics.Systems
EntityQuery<JointComponent> jointQuery,
EntityQuery<BroadphaseComponent> broadQuery)
{
EntityUid? uid = xform.Owner;
var uid = xform.Owner;
DebugTools.Assert(!Deleted(uid));
@@ -239,7 +238,7 @@ namespace Robust.Shared.Physics.Systems
DebugTools.Assert(body.Contacts.Count == 0);
// TODO: When we cull sharedphysicsmapcomponent we can probably remove this grid check.
if (!MapManager.IsGrid(uid.Value) && fixturesQuery.TryGetComponent(uid, out var fixtures) && body._canCollide)
if (!MapManager.IsGrid(uid) && fixturesQuery.TryGetComponent(uid, out var fixtures) && body._canCollide)
{
// TODO If not deleting, update world position+rotation while iterating through children and pass into UpdateBodyBroadphase
_broadphase.UpdateBodyBroadphase(body, fixtures, xform, newBroadphase, xformQuery, oldMoveBuffer);
@@ -247,7 +246,7 @@ namespace Robust.Shared.Physics.Systems
}
if (jointQuery.TryGetComponent(uid, out var joint))
_joints.ClearJoints(joint);
_joints.ClearJoints(uid, joint);
if (newMapId != MapId.Nullspace && broadQuery.TryGetComponent(uid, out var parentBroadphase))
newBroadphase = parentBroadphase;
@@ -269,7 +268,7 @@ namespace Robust.Shared.Physics.Systems
if (!EntityManager.EntityExists(ev.EntityUid)) return;
// Yes this ordering matters
var collideComp = EntityManager.EnsureComponent<PhysicsComponent>(ev.EntityUid);
collideComp.BodyType = BodyType.Static;
SetBodyType(collideComp, BodyType.Static);
EntityManager.EnsureComponent<FixturesComponent>(ev.EntityUid);
}

View File

@@ -53,7 +53,7 @@ namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Pro
IReadOnlyCollection<string> value,
IDependencyCollection dependencies,
bool alwaysWrite,
ISerializationContext? context = null)
ISerializationContext? context)
{
return WriteInternal(serializationManager, value, dependencies, alwaysWrite, context);
}

View File

@@ -19,7 +19,7 @@ namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Pro
IReadOnlyList<string> value,
IDependencyCollection dependencies,
bool alwaysWrite,
ISerializationContext? context = null)
ISerializationContext? context)
{
return WriteInternal(serializationManager, value, dependencies, alwaysWrite, context);
}

View File

@@ -93,7 +93,7 @@ namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Pro
List<string> value,
IDependencyCollection dependencies,
bool alwaysWrite,
ISerializationContext? context = null)
ISerializationContext? context)
{
return WriteInternal(serializationManager, value, dependencies, alwaysWrite, context);
}