public void AttachRotor(MyMotorRotor rotor) { AttachMsg msg = new AttachMsg(); msg.EntityId = this.Entity.EntityId; msg.AttachableEntityId = rotor.EntityId; Sync.Layer.SendMessageToAll(ref msg); }
private static void OnAttach(MySyncMotorBase block, ref AttachMsg msg, MyNetworkClient sender) { MyMotorBase stator = (MyMotorBase)block.Entity; MyEntity rotorEntity = null; if (!MyEntities.TryGetEntityById(msg.AttachableEntityId, out rotorEntity)) { Debug.Assert(false, "Could not find rotor entity to attach to stator"); return; } MyMotorRotor rotor = (MyMotorRotor)rotorEntity; Debug.Assert(stator.CubeGrid != rotor.CubeGrid, "Trying to attach rotor to stator on the same grid"); stator.Attach(rotor); }