private void OnAttachClick(MyGuiControlBase button) { if (MyEditorVoxelHand.DetachedVoxelHand == null) { foreach (MyEntity e in MyEntities.GetEntities()) { if (e is MyDummyPoint && ((int)(((MyDummyPoint)e).DummyFlags & CommonLIB.AppCode.ObjectBuilders.SubObjects.MyDummyPointFlags.VOXEL_HAND)) > 0) { e.WorldMatrix = MyEditorVoxelHand.UpdateShapePosition(); MyEditorVoxelHand.DetachedVoxelHand = (MyDummyPoint)e; } } if (MyEditorVoxelHand.DetachedVoxelHand == null) { var ob = MinerWars.CommonLIB.AppCode.ObjectBuilders.MyMwcObjectBuilder_Base.CreateNewObject(MinerWars.CommonLIB.AppCode.ObjectBuilders.MyMwcObjectBuilderTypeEnum.DummyPoint, null) as MinerWars.CommonLIB.AppCode.ObjectBuilders.SubObjects.MyMwcObjectBuilder_DummyPoint; MyDummyPoint voxelHand = new MyDummyPoint(); voxelHand.Init(null, ob, Matrix.Identity); voxelHand.DummyFlags |= CommonLIB.AppCode.ObjectBuilders.SubObjects.MyDummyPointFlags.VOXEL_HAND; voxelHand.Size = new Vector3(20, 20, 20); voxelHand.Save = false; voxelHand.WorldMatrix = MyEditorVoxelHand.UpdateShapePosition(); MyEntities.Add(voxelHand); MyEditorVoxelHand.DetachedVoxelHand = voxelHand; } MyEditorVoxelHand.DetachedVoxelHand.Enabled = true; MyEditorGizmo.SelectedEntities.Clear(); MyEditorGizmo.SelectedEntities.Add(MyEditorVoxelHand.DetachedVoxelHand); m_detachLabel.Text = MyTextsWrapperEnum.AttachVoxelHand; } else { if (MyEditorVoxelHand.DetachedVoxelHand != null) { MyEditorVoxelHand.DetachedVoxelHand.MarkForClose(); } MyEditorVoxelHand.DetachedVoxelHand = null; MyEditorGizmo.SelectedEntities.Clear(); m_detachLabel.Text = MyTextsWrapperEnum.DetachVoxelHand; } }