Files
RobustToolbox/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponentState.cs
T
AcruidandGitHub dadd7b4cc3 Remove Static Component NetIds (#1842)
* ComponentNames are not sent over the network when components are created.

* Removed ComponentStates array from EntityState, now the state is stored directly inside the CompChange struct.

* Remove the unnecessary NetID property from ComponentState.

* Remove Component.NetworkSynchronizeExistence.

* Change GetNetComponents to return both the component and the component NetId.

* Remove public usages of the Component.NetID property.

* Adds the NetIDAttribute that can be applied to components.

* Removed Component.NetID.

* Revert changes to GetComponentState and how prediction works.

* Adds component netID automatic generation.

* Modifies ClientConsoleHost so that commands can be called before Initialize().

* Completely remove static NetIds.

* Renamed NetIDAttribute to NetworkedComponentAttribute.

* Fixing unit tests.
2021-07-12 10:23:13 +02:00

61 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Dynamics.Joints;
using Robust.Shared.Serialization;
namespace Robust.Shared.GameObjects
{
[Serializable, NetSerializable]
public class PhysicsComponentState : ComponentState
{
public readonly bool CanCollide;
public readonly bool SleepingAllowed;
public readonly bool FixedRotation;
public readonly BodyStatus Status;
public readonly List<Fixture> Fixtures;
public readonly List<Joint> Joints;
public readonly Vector2 LinearVelocity;
public readonly float AngularVelocity;
public readonly BodyType BodyType;
/// <summary>
///
/// </summary>
/// <param name="canCollide"></param>
/// <param name="sleepingAllowed"></param>
/// <param name="fixedRotation"></param>
/// <param name="status"></param>
/// <param name="fixtures"></param>
/// <param name="joints"></param>
/// <param name="linearVelocity">Current linear velocity of the entity in meters per second.</param>
/// <param name="angularVelocity">Current angular velocity of the entity in radians per sec.</param>
/// <param name="bodyType"></param>
public PhysicsComponentState(
bool canCollide,
bool sleepingAllowed,
bool fixedRotation,
BodyStatus status,
List<Fixture> fixtures,
List<Joint> joints,
Vector2 linearVelocity,
float angularVelocity,
BodyType bodyType)
{
CanCollide = canCollide;
SleepingAllowed = sleepingAllowed;
FixedRotation = fixedRotation;
Status = status;
Fixtures = fixtures;
Joints = joints;
LinearVelocity = linearVelocity;
AngularVelocity = angularVelocity;
BodyType = bodyType;
}
}
}