Beispiel #1
0
 public void BuildBlocks(Vector3 colorMaskHsv, HashSet<MyCubeGrid.MyBlockLocation> locations, long builderEntityId)
 {
     var msg = new BuildBlocksMsg();
     msg.GridEntityId = Entity.EntityId;
     msg.Locations = locations;
     msg.ColorMaskHsv = colorMaskHsv.PackHSVToUint();
     msg.BuilderEntityId = builderEntityId;
     Sync.Layer.SendMessageToServer(ref msg);
 }
Beispiel #2
0
        public void ColorBlocks(Vector3I min, Vector3I max, Vector3 newHSV, bool playSound)
        {
            var msg = new ColorBlocksMsg();
            msg.GridEntityId = Entity.EntityId;
            msg.HSV = newHSV.PackHSVToUint();
            msg.Min = min;
            msg.Max = max;
            msg.PlaySound = playSound;

            Sync.Layer.SendMessageToServer(ref msg);
        }
Beispiel #3
0
        //interface IBlockMessage : IEntityMessage
        //{
        //    Vector3I GetBlockPosition();
        //}

        //delegate void BlockMessageCallback<TBlock, TMsg>(TBlock block, ref TMsg message, MyPlayer sender)
        //     where TBlock : MyCubeBlock
        //    where TMsg : struct, IBlockMessage;

        //class MyCallback<TBlock, TMsg> : MySyncLayer.MyCallbackBase<TMsg>
        //    where TBlock : MyCubeBlock
        //    where TMsg : struct, IBlockMessage
        //{
        //    public readonly BlockMessageCallback<TBlock, TMsg> Callback;

        //    public MyCallback(MySyncLayer layer, BlockMessageCallback<TBlock, TMsg> callback, MyMessagePermissions permission, ISerializer<TMsg> serializer)
        //        : base(layer, permission, serializer)
        //    {
        //        Callback = callback;
        //    }

        //    protected override void OnHandle(ref TMsg msg, MyPlayer player)
        //    {
        //        MySyncGrid sync = Layer.GetSyncEntity<MySyncGrid, TMsg>(msg.GetEntityId());
        //        if (sync != null)
        //        {
        //            var block = sync.Entity.GetBlock(msg.GetBlockPosition());
        //            if (block != null)
        //            {
        //                var fatBlock = block.FatBlock as TBlock;
        //                if (fatBlock != null)
        //                {
        //                    Callback(fatBlock, ref msg, player);
        //                }
        //            }
        //        }
        //    }
        //}

        public void BuildBlock(Vector3 colorMaskHsv, MyCubeGrid.MyBlockLocation location, MyObjectBuilder_CubeBlock blockObjectBuilder, long builderEntityId)
        {
            var msg = new BuildBlockMsg();
            msg.GridEntityId = Entity.EntityId;
            msg.Location = location;
            msg.ColorMaskHsv = colorMaskHsv.PackHSVToUint();
            msg.BlockObjectBuilder = blockObjectBuilder;
            msg.BuilderEntityId = builderEntityId;
            Sync.Layer.SendMessageToServer(ref msg);
        }