Example #1
0
        private static ulong UpdateVoxelShape(MySyncVoxel sync, PaintType type, MyShape Shape, byte Material)
        {
            var   voxel = sync.Entity as MyVoxelBase;
            ulong changedVoxelAmount = 0;

            if (voxel != null)
            {
                switch (type)
                {
                case PaintType.Paint:
                    MyVoxelGenerator.PaintInShape(voxel, Shape, Material);
                    break;

                case PaintType.Fill:
                    changedVoxelAmount = MyVoxelGenerator.FillInShape(voxel, Shape, Material);
                    break;

                case PaintType.Cut:
                    changedVoxelAmount = MyVoxelGenerator.CutOutShape(voxel, Shape);
                    break;
                }
            }

            return(changedVoxelAmount);
        }
Example #2
0
        static void VoxelMeteorCraterSuccess(MySyncVoxel sync, ref MeteorCraterMsg msg, MyNetworkClient sender)
        {
            var voxel = sync.Entity as MyVoxelBase;

            if (voxel != null)
            {
                MyVoxelGenerator.MakeCrater(voxel, new BoundingSphere(msg.Center, msg.Radius), msg.Normal, MyDefinitionManager.Static.GetVoxelMaterialDefinition(msg.Material));
            }
        }
Example #3
0
        static void VoxelPaintSphereSuccess(MySyncVoxel sync, ref PaintSphereMessage msg, MyNetworkClient sender)
        {
            m_sphereShape.Center = msg.Center;
            m_sphereShape.Radius = msg.Radius;
            var amountChanged = UpdateVoxelShape(sync, msg.Type, m_sphereShape, msg.Material);

            if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
            {
                MySession.Static.VoxelHandVolumeChanged += amountChanged;
            }
        }
Example #4
0
        static void VoxelPaintEllipsoidSuccess(MySyncVoxel sync, ref PaintEllipsoidMessage msg, MyNetworkClient sender)
        {
            var voxel = sync.Entity as MyVoxelMap;

            if (voxel != null)
            {
                m_ellipsoidShape.Transformation = msg.Transformation;
                m_ellipsoidShape.Radius         = msg.Radius;
                var amountChanged = UpdateVoxelShape(sync, msg.Type, m_ellipsoidShape, msg.Material);
                if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                {
                    MySession.Static.VoxelHandVolumeChanged += amountChanged;
                }
            }
        }
Example #5
0
        static void VoxelPaintBoxSuccess(MySyncVoxel sync, ref PaintBoxMessage msg, MyNetworkClient sender)
        {
            var voxel = sync.Entity as MyVoxelBase;

            if (voxel != null)
            {
                m_boxShape.Transformation = msg.Transformation;
                m_boxShape.Boundaries.Max = msg.Max;
                m_boxShape.Boundaries.Min = msg.Min;
                var amountChanged = UpdateVoxelShape(sync, msg.Type, m_boxShape, msg.Material);
                if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                {
                    MySession.Static.VoxelHandVolumeChanged += amountChanged;
                }
            }
        }
Example #6
0
        static void VoxelPaintEllipsoidRequest(MySyncVoxel sync, ref PaintEllipsoidMessage msg, MyNetworkClient sender)
        {
            var voxel = sync.Entity as MyVoxelMap;

            if (voxel != null)
            {
                m_ellipsoidShape.Transformation = msg.Transformation;
                m_ellipsoidShape.Radius         = msg.Radius;
                if (CanPlaceInArea(msg.Type, m_ellipsoidShape))
                {
                    var amountChanged = UpdateVoxelShape(sync, msg.Type, m_ellipsoidShape, msg.Material);
                    if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                    Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
                }
            }
        }
Example #7
0
        static void VoxelPaintRampRequest(MySyncVoxel sync, ref PaintRampMessage msg, MyNetworkClient sender)
        {
            var voxel = sync.Entity as MyVoxelBase;

            if (voxel != null)
            {
                m_rampShape.Transformation = msg.Transformation;
                m_rampShape.Boundaries.Max = msg.Max;
                m_rampShape.Boundaries.Min = msg.Min;
                m_rampShape.RampNormal     = msg.RampNormal;
                m_rampShape.RampNormalW    = msg.RampNormalW;

                if (CanPlaceInArea(msg.Type, m_rampShape))
                {
                    var amountChanged = UpdateVoxelShape(sync, msg.Type, m_rampShape, msg.Material);
                    if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                    {
                        MySession.Static.VoxelHandVolumeChanged += amountChanged;
                    }
                    Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
                }
            }
        }
 public virtual void SendDrillCutOutRequest(MySyncVoxel voxelSync){ }
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintCapsule(A, B, Radius, Transformation, newMaterialIndex, MySyncVoxel.PaintType.Fill);
 }
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintRamp(Boundaries, RampNormal,RampNormalW,Transformation, newMaterialIndex, MySyncVoxel.PaintType.Paint);
 }
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintSphere(Center, Radius, newMaterialIndex, MySyncVoxel.PaintType.Fill);
 }
 public override void SendDrillCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelCutoutSphere(Center, Radius, false);
 }
Example #13
0
 static void VoxelPaintEllipsoidRequest(MySyncVoxel sync, ref PaintEllipsoidMessage msg, MyNetworkClient sender)
 {
     var voxel = sync.Entity as MyVoxelMap;
     if (voxel != null)
     {
         m_ellipsoidShape.Transformation = msg.Transformation;
         m_ellipsoidShape.Radius = msg.Radius;
         if (CanPlaceInArea(msg.Type, m_ellipsoidShape))
         {
             var amountChanged = UpdateVoxelShape(sync, msg.Type, m_ellipsoidShape, msg.Material);
             if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                 MySession.Static.VoxelHandVolumeChanged += amountChanged;
             Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
         }
     }
 }
Example #14
0
 static void VoxelPaintRampRequest(MySyncVoxel sync, ref PaintRampMessage msg, MyNetworkClient sender)
 {
     var voxel = sync.Entity as MyVoxelBase;
     if (voxel != null)
     {
         m_rampShape.Transformation = msg.Transformation;
         m_rampShape.Boundaries.Max = msg.Max;
         m_rampShape.Boundaries.Min = msg.Min;
         m_rampShape.RampNormal = msg.RampNormal;
         m_rampShape.RampNormalW = msg.RampNormalW;
         
         if (CanPlaceInArea(msg.Type, m_rampShape))
         {
             var amountChanged = UpdateVoxelShape(sync, msg.Type, m_rampShape, msg.Material);
             if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
                 MySession.Static.VoxelHandVolumeChanged += amountChanged;
             Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
         }
     }
 }
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelPaintBox(Boundaries, Transformation, 0, MySyncVoxel.PaintType.Cut);
 }
 public abstract void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio);
 public override void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio)
 {
     //throw new NotImplementedException();
 }
Example #18
0
 static void VoxelPaintEllipsoidSuccess(MySyncVoxel sync, ref PaintEllipsoidMessage msg, MyNetworkClient sender)
 {
     var voxel = sync.Entity as MyVoxelMap;
     if (voxel != null)
     {
         m_ellipsoidShape.Transformation = msg.Transformation;
         m_ellipsoidShape.Radius = msg.Radius;
         var amountChanged = UpdateVoxelShape(sync, msg.Type, m_ellipsoidShape, msg.Material);
         if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
             MySession.Static.VoxelHandVolumeChanged += amountChanged;
     }
 }
 public override void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio)
 {
     voxelSync.RequestVoxelCutoutExplosion(Center, Radius, false, removeRatio);
 }
Example #20
0
        private static ulong UpdateVoxelShape(MySyncVoxel sync, PaintType type, MyShape Shape, byte Material)
        {
            var voxel = sync.Entity as MyVoxelBase;
            ulong changedVoxelAmount = 0;
            if (voxel != null)
            {
                switch (type)
                {
                    case PaintType.Paint:
                        MyVoxelGenerator.PaintInShape(voxel, Shape, Material);
                        break;
                    case PaintType.Fill:
                        changedVoxelAmount = MyVoxelGenerator.FillInShape(voxel, Shape, Material);
                        break;
                    case PaintType.Cut:
                        changedVoxelAmount = MyVoxelGenerator.CutOutShape(voxel, Shape);
                        break;
                }
            }

            return changedVoxelAmount;
        }     
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     throw new NotImplementedException();
 }
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {       
     voxelSync.RequestVoxelPaintSphere(Center, Radius, 0, MySyncVoxel.PaintType.Cut);
 }
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex, float fillRatio)
 {
     throw new NotImplementedException();
 }
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintEllipsoid(Radius, Transformation, newMaterialIndex, MySyncVoxel.PaintType.Paint);
 }
Example #25
0
 static void VoxelCutoutSphereSuccess(MySyncVoxel sync, ref VoxelCutoutMsg msg, MyNetworkClient sender)
 {
     MyExplosion.CutOutVoxelMap(msg.Radius, msg.Center, sync.Entity, msg.CreateDebris && MySession.Ready);
 }
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelPaintCapsule(A, B, Radius, Transformation, 0, MySyncVoxel.PaintType.Cut);
 }
Example #27
0
 static void VoxelMeteorCraterSuccess(MySyncVoxel sync, ref MeteorCraterMsg msg, MyNetworkClient sender)
 {
     var voxel = sync.Entity as MyVoxelBase;
     if (voxel != null)
     {
         MyVoxelGenerator.MakeCrater(voxel, new BoundingSphere(msg.Center, msg.Radius), msg.Normal, MyDefinitionManager.Static.GetVoxelMaterialDefinition(msg.Material));
     }
 }
 public abstract void SendCutOutRequest(MySyncVoxel voxelSync);
Example #29
0
 static void VoxelPaintSphereSuccess(MySyncVoxel sync, ref PaintSphereMessage msg, MyNetworkClient sender)
 {
     m_sphereShape.Center = msg.Center;
     m_sphereShape.Radius = msg.Radius;
     var amountChanged = UpdateVoxelShape(sync, msg.Type, m_sphereShape, msg.Material);
     if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
         MySession.Static.VoxelHandVolumeChanged += amountChanged;
 }
 public abstract void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex);
Example #31
0
 static void VoxelPaintRampSuccess(MySyncVoxel sync, ref PaintRampMessage msg, MyNetworkClient sender)
 {
     var voxel = sync.Entity as MyVoxelBase;
     if (voxel != null)
     {
         m_rampShape.Transformation = msg.Transformation;
         m_rampShape.Boundaries.Max = msg.Max;
         m_rampShape.Boundaries.Min = msg.Min;
         m_rampShape.RampNormal = msg.RampNormal;
         m_rampShape.RampNormalW = msg.RampNormalW;
         var amountChanged = UpdateVoxelShape(sync, msg.Type, m_rampShape, msg.Material);
         if (msg.Type == PaintType.Cut || msg.Type == PaintType.Fill)
             MySession.Static.VoxelHandVolumeChanged += amountChanged;
     }
 }
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintBox(Boundaries,Transformation,newMaterialIndex, MySyncVoxel.PaintType.Fill);
 }
Example #33
0
 static void VoxelCutoutSphereSuccess(MySyncVoxel sync, ref VoxelCutoutMsg msg, MyNetworkClient sender)
 {
     MyExplosion.CutOutVoxelMap(msg.Radius, msg.Center, sync.Entity, msg.CreateDebris && MySession.Ready);
 }