private static void OnApproach(ref ApproachMsg msg, MyNetworkClient sender) { MyEntity entity1, entity2; MyEntities.TryGetEntityById(msg.EntityId, out entity1); MyEntities.TryGetEntityById(msg.OtherEntityId, out entity2); if (entity1 is MyShipConnector && entity2 is MyShipConnector) { var connector1 = entity1 as MyShipConnector; var connector2 = entity2 as MyShipConnector; var posA = connector1.ConstraintPositionInGridSpace(); var axisA = connector1.ConstraintAxisGridSpace(); var posB = connector2.ConstraintPositionInGridSpace(); var axisB = -connector2.ConstraintAxisGridSpace(); connector1.CreateConstraintNosync(connector2, ref posA, ref posB, ref axisA, ref axisB); } }
public static void AnnounceApproach(MyShipConnector thisConnector, MyShipConnector otherConnector) { var msg = new ApproachMsg(); msg.EntityId = thisConnector.EntityId; msg.OtherEntityId = otherConnector.EntityId; Sync.Layer.SendMessageToAll(msg); }