Пример #1
0
        static void OnMessageSpawnGrid(ref SpawnGridMsg msg, MyNetworkClient sender)
        {
            Debug.Assert(MyCubeBuilder.BuildComponent != null, "The build component was not set in cube builder!");

            MyEntity builder = null;

            MyEntities.TryGetEntityById(msg.BuilderEntityId, out builder);

            var     definition  = Definitions.MyDefinitionManager.Static.GetCubeBlockDefinition(msg.Definition);
            MatrixD worldMatrix = MatrixD.CreateWorld(msg.Position, msg.Forward, msg.Up);

            var reply = new SpawnGridReplyMsg();

            MyCubeBuilder.BuildComponent.GetGridSpawnMaterials(definition, worldMatrix, msg.Static);
            bool canSpawn = MyCubeBuilder.BuildComponent.HasBuildingMaterials(builder);

            MySession.Static.SyncLayer.SendMessage(ref reply, sender.SteamUserId, canSpawn ? MyTransportMessageEnum.Success : MyTransportMessageEnum.Failure);

            if (!canSpawn)
            {
                return;
            }

            MyCubeBuilder.SpawnGrid(definition, worldMatrix, builder, msg.Static);
        }
Пример #2
0
 static void OnMessageSpawnGridSuccess(ref SpawnGridReplyMsg msg, MyNetworkClient sender)
 {
     MyGuiAudio.PlaySound(MyGuiSounds.HudPlaceBlock);
 }
Пример #3
0
 static void OnMessageSpawnGridFailure(ref SpawnGridReplyMsg msg, MyNetworkClient sender)
 {
     MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
 }
Пример #4
0
        static void OnMessageSpawnGrid(ref SpawnGridMsg msg, MyNetworkClient sender)
        {
            Debug.Fail("Use replication instead of this!");
            Debug.Assert(MyCubeBuilder.BuildComponent != null, "The build component was not set in cube builder!");

            MyEntity builder = null;
            MyEntities.TryGetEntityById(msg.BuilderEntityId, out builder);

            var definition = Definitions.MyDefinitionManager.Static.GetCubeBlockDefinition(msg.Definition);
            MatrixD worldMatrix = MatrixD.CreateWorld(msg.Position, msg.Forward, msg.Up);

            var reply = new SpawnGridReplyMsg();

            MyCubeBuilder.BuildComponent.GetGridSpawnMaterials(definition, worldMatrix, msg.Static);
            bool canSpawn = MyCubeBuilder.BuildComponent.HasBuildingMaterials(builder);

            MySession.Static.SyncLayer.SendMessage(ref reply, sender.SteamUserId, canSpawn ? MyTransportMessageEnum.Success : MyTransportMessageEnum.Failure);

            if (!canSpawn) return;

            MyCubeBuilder.SpawnGrid(definition, worldMatrix, builder, msg.Static);
        }
Пример #5
0
 static void OnMessageSpawnGridSuccess(ref SpawnGridReplyMsg msg, MyNetworkClient sender)
 {
     MyGuiAudio.PlaySound(MyGuiSounds.HudPlaceBlock);
 }
Пример #6
0
 static void OnMessageSpawnGridFailure(ref SpawnGridReplyMsg msg, MyNetworkClient sender)
 {
     MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
 }