void ISerializer <StockpileChangedMsg> .Serialize(VRage.ByteStream destination, ref StockpileChangedMsg data)
            {
                BlitSerializer <long> .Default.Serialize(destination, ref data.GridEntityId);

                BlitSerializer <ushort> .Default.Serialize(destination, ref data.SubBlockId);

                BlitSerializer <Vector3I> .Default.Serialize(destination, ref data.BlockPosition);

                Debug.Assert(data.Changes.Count() <= 255, "Too many component types in a block stockpile");
                byte size = (byte)data.Changes.Count(); // There shouldn't be so many component types on a single block so as to exceed one byte

                BlitSerializer <byte> .Default.Serialize(destination, ref size);

                foreach (var change in data.Changes)
                {
                    MyStockpileItem item = change;
                    BlitSerializer <int> .Default.Serialize(destination, ref item.Amount);

                    int subtypeId = (int)item.Content.SubtypeId;
                    BlitSerializer <int> .Default.Serialize(destination, ref subtypeId);

                    byte flags = (byte)item.Content.Flags;
                    BlitSerializer <byte> .Default.Serialize(destination, ref flags);

                    MyRuntimeObjectBuilderId typeId = (MyRuntimeObjectBuilderId)change.Content.TypeId;
                    BlitSerializer <MyRuntimeObjectBuilderId> .Default.Serialize(destination, ref typeId);
                }
            }
Exemple #2
0
 public DefinitionIdBlit(MyObjectBuilderType type, MyStringHash subtypeId)
 {
     TypeId    = (MyRuntimeObjectBuilderId)type;
     SubtypeId = subtypeId;
 }
Exemple #3
0
 public DefinitionIdBlit(MyRuntimeObjectBuilderId typeId, MyStringHash subtypeId)
 {
     TypeId    = typeId;
     SubtypeId = subtypeId;
 }
Exemple #4
0
 public MyDefinitionId(MyRuntimeObjectBuilderId type, MyStringHash subtypeId)
 {
     TypeId    = (MyObjectBuilderType)type;
     SubtypeId = subtypeId;
 }