Example #1
0
            private static void OnNewBlueprintRequest(ref NewBlueprintMsg msg, MyNetworkClient sender)
            {
                //Send to all and self but one
                Sync.Layer.SendMessageToAllButOne(ref msg, sender.SteamUserId, MyTransportMessageEnum.Success);
                Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Success);

                var ack = new NewBlueprintAckMsg();
                ack.EntityId = msg.EntityId;
                Sync.Layer.SendMessage(ref ack, sender.SteamUserId, MyTransportMessageEnum.Success);
            }
Example #2
0
 private static void OnNewBlueprintAck(ref NewBlueprintAckMsg msg, MyNetworkClient sender)
 {
     MyEntity projectorEntity;
     MyEntities.TryGetEntityById(msg.EntityId, out projectorEntity);
     var projector = projectorEntity as MyProjector;
     if (projector != null)
     {
         projector.SetNewBlueprint(projector.SyncObject.m_lastSentCubeGrid);
     }
 }
Example #3
0
            public void SendNewBlueprint(MyObjectBuilder_CubeGrid projectedGrid)
            {
                var msg = new NewBlueprintMsg();
                msg.EntityId = m_projector.EntityId;
                msg.ProjectedGrid = projectedGrid;

                var ack = new NewBlueprintAckMsg();
                ack.EntityId = m_projector.EntityId;

                m_lastSentCubeGrid = projectedGrid;

                if (Sync.IsServer)
                {
                    Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
                    OnNewBlueprintAck(ref ack, null);
                }
                else
                {
                    Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
                }
            }