Files
RobustToolbox/Robust.Server/Physics/JointSystem.cs
T
metalgearslothandGitHub 5a343477a9 Joints refactor (#1954)
* feex

* Cleanup

* Remove unneeded matrix

* Fixes

* Fix preprocessor

* localanchor cleanup

* Break this build so I remember to fix it later.

* Fixes

* Woops

* Fixes

* Fixup merge

* Stuff

* Update debug drawing

* Also dis thanks fork

* fren

* More colors

* Default drawing

* Fixes

* reviews
2021-10-04 15:34:15 +11:00

30 lines
878 B
C#

using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics.Joints;
namespace Robust.Server.Physics
{
public sealed class JointSystem : SharedJointSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<JointComponent, ComponentGetState>(GetCompState);
}
private void GetCompState(EntityUid uid, JointComponent component, ref ComponentGetState args)
{
var states = new Dictionary<string, JointState>(component.Joints.Count);
foreach (var (_, joint) in component.Joints)
{
states.Add(joint.ID, joint.GetState());
}
args.State = new JointComponent.JointComponentState(states);
}
}
}