Exemplo n.º 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);
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 10
0
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintRamp(Boundaries, RampNormal,RampNormalW,Transformation, newMaterialIndex, MySyncVoxel.PaintType.Paint);
 }
Exemplo n.º 11
0
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintSphere(Center, Radius, newMaterialIndex, MySyncVoxel.PaintType.Fill);
 }
Exemplo n.º 12
0
 public override void SendDrillCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelCutoutSphere(Center, Radius, false);
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 15
0
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelPaintBox(Boundaries, Transformation, 0, MySyncVoxel.PaintType.Cut);
 }
Exemplo n.º 16
0
 public abstract void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio);
Exemplo n.º 17
0
 public override void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio)
 {
     //throw new NotImplementedException();
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 19
0
 public override void SendCutOutRequest(MySyncVoxel voxelSync, float removeRatio)
 {
     voxelSync.RequestVoxelCutoutExplosion(Center, Radius, false, removeRatio);
 }
Exemplo n.º 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;
        }     
Exemplo n.º 21
0
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 22
0
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {       
     voxelSync.RequestVoxelPaintSphere(Center, Radius, 0, MySyncVoxel.PaintType.Cut);
 }
Exemplo n.º 23
0
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex, float fillRatio)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
 public override void SendPaintRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintEllipsoid(Radius, Transformation, newMaterialIndex, MySyncVoxel.PaintType.Paint);
 }
Exemplo n.º 25
0
 static void VoxelCutoutSphereSuccess(MySyncVoxel sync, ref VoxelCutoutMsg msg, MyNetworkClient sender)
 {
     MyExplosion.CutOutVoxelMap(msg.Radius, msg.Center, sync.Entity, msg.CreateDebris && MySession.Ready);
 }
Exemplo n.º 26
0
 public override void SendCutOutRequest(MySyncVoxel voxelSync)
 {
     voxelSync.RequestVoxelPaintCapsule(A, B, Radius, Transformation, 0, MySyncVoxel.PaintType.Cut);
 }
Exemplo n.º 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));
     }
 }
Exemplo n.º 28
0
 public abstract void SendCutOutRequest(MySyncVoxel voxelSync);
Exemplo n.º 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;
 }
Exemplo n.º 30
0
 public abstract void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex);
Exemplo n.º 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;
     }
 }
Exemplo n.º 32
0
 public override void SendFillRequest(MySyncVoxel voxelSync, byte newMaterialIndex)
 {
     voxelSync.RequestVoxelPaintBox(Boundaries,Transformation,newMaterialIndex, MySyncVoxel.PaintType.Fill);
 }
Exemplo n.º 33
0
 static void VoxelCutoutSphereSuccess(MySyncVoxel sync, ref VoxelCutoutMsg msg, MyNetworkClient sender)
 {
     MyExplosion.CutOutVoxelMap(msg.Radius, msg.Center, sync.Entity, msg.CreateDebris && MySession.Ready);
 }