Example #1
0
 public void EditFaction(long factionId, string tag, string name, string desc, string privateInfo)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyFactionCollection.EditFactionRequest, factionId, tag, name, desc, privateInfo);
 }
Example #2
0
 public void RequestSync()
 {
     MyMultiplayer.RaiseStaticEvent(s => OnSyncCooldownRequest);
 }
 //DELETE:
 public void SendDelete(long identityId, int gpsHash)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyGpsCollection.DeleteRequest, identityId, gpsHash);
 }
 void OnTrashRemoveClicked(MyTrashRemovalOperation operation)
 {
     MyMultiplayer.RaiseStaticEvent(x => RemoveTrash_Implementation, MyTrashRemoval.PreviewSettings, operation);
 }
Example #5
0
 public static void SpawnPlanet(Vector3D pos)
 {
     MyMultiplayer.RaiseStaticEvent(s => SpawnPlanet_Server, m_selectedPlanetName, m_lastAsteroidInfo.ProceduralRadius, m_lastAsteroidInfo.RandomSeed, pos);
 }
Example #6
0
 public static void RemoveEnvironmentItem(long entityId, int itemInstanceId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnRemoveEnvironmentItemMessage, entityId, itemInstanceId);
 }
Example #7
0
 public static void SendBeginBatchAddMessage(long entityId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnBeginBatchAddMessage, entityId);
 }
 void OnCycleClicked(bool reset, bool forward)
 {
     MyMultiplayer.RaiseStaticEvent(x => CycleRequest_Implementation, m_order, reset, forward, m_metricValue, m_entityId, m_cyclingOtions);
 }
 private void RequestJump(Vector3D jumpTarget, long userId)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyGridJumpDriveSystem.OnJumpRequested, m_grid.EntityId, jumpTarget, userId);
 }
Example #10
0
 public void RequestVoxelOperationBox(BoundingBoxD box, MatrixD Transformation, byte material, OperationType Type)
 {
     BeforeContentChanged = true;
     MyMultiplayer.RaiseStaticEvent(s => VoxelOperationBox_Implementation, EntityId, box, Transformation, material, Type);
 }
Example #11
0
        private void RefreshMedicalRooms()
        {
            ulong playerSteamId = MySession.Static.LocalHumanPlayer != null ? MySession.Static.LocalHumanPlayer.Id.SteamId : Sync.MyId;

            MyMultiplayer.RaiseStaticEvent(s => RefreshMedicalRooms_Implementation, MySession.Static.LocalPlayerId, playerSteamId);
        }
Example #12
0
 public void RequestVoxelOperationSphere(Vector3D center, float radius, byte material, OperationType Type)
 {
     BeforeContentChanged = true;
     MyMultiplayer.RaiseStaticEvent(s => VoxelOperationSphere_Implementation, EntityId, center, radius, material, Type);
 }
Example #13
0
 /// <summary>
 /// Use only for cut request
 /// </summary>
 public void SendVoxelCloseRequest()
 {
     MyMultiplayer.RaiseStaticEvent(s => OnVoxelClosedRequest, EntityId);
 }
Example #14
0
 public void RequestVoxelOperationElipsoid(Vector3 radius, MatrixD Transformation, byte material, OperationType Type)
 {
     BeforeContentChanged = true;
     MyMultiplayer.RaiseStaticEvent(s => VoxelOperationElipsoid_Implementation, EntityId, radius, Transformation, material, Type);
 }
Example #15
0
 public static void SendBatchModifyItemMessage(long entityId, int localId, MyStringHash subtypeId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnBatchModifyItemMessage, entityId, localId, subtypeId);
 }
 private void SendJumpSuccess(Vector3D jumpTarget, long userId)
 {
     Debug.Assert(Sync.IsServer);
     MyMultiplayer.RaiseStaticEvent(s => MyGridJumpDriveSystem.OnJumpSuccess, m_grid.EntityId, jumpTarget, userId);
 }
Example #17
0
 public static void SendBatchRemoveItemMessage(long entityId, int localId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnBatchRemoveItemMessage, entityId, localId);
 }
 private void SendPerformJump(Vector3D jumpTarget)
 {
     Debug.Assert(Sync.IsServer);
     MyMultiplayer.RaiseStaticEvent(s => MyGridJumpDriveSystem.OnPerformJump, m_grid.EntityId, jumpTarget);
 }
Example #19
0
 public static void SendModifyModelMessage(long entityId, int instanceId, MyStringHash subtypeId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnModifyModelMessage, entityId, instanceId, subtypeId);
 }
 private void SendAbortJump()
 {
     Debug.Assert(Sync.IsServer);
     MyMultiplayer.RaiseStaticEvent(s => MyGridJumpDriveSystem.OnAbortJump, m_grid.EntityId);
 }
Example #21
0
 public static void SendBatchAddItemMessage(long entityId, Vector3D position, MyStringHash subtypeId)
 {
     MyMultiplayer.RaiseStaticEvent(s => OnBatchAddItemMessage, entityId, position, subtypeId);
 }
Example #22
0
        public static void RaiseStaticEvent <T1, T2>(MethodInfo method, T1 arg1, T2 arg2, EndpointId target = default(EndpointId), Vector3D?position = null)
        {
            var del = GetDelegate <IMyEventOwner, Action <T1, T2> >(method);

            MyMultiplayer.RaiseStaticEvent(del, arg1, arg2, target, position);
        }
Example #23
0
 void OnReplicateEverything(MyGuiControlButton button)
 {
     MyMultiplayer.RaiseStaticEvent(x => ReplicateEverything_Implementation);
 }
Example #24
0
        private void UpdateRecording()
        {
            uint size   = 0;
            var  result = (m_VoIP.GetAvailableVoice(out size));

            if (result == VoiceResult.OK)
            {
                result = m_VoIP.GetVoice(m_compressedVoiceBuffer, out size);
                Debug.Assert(result == VoiceResult.OK, "Get voice failed: " + result.ToString());

                if (MyFakes.ENABLE_VOICE_CHAT_DEBUGGING)
                {
                    ProcessBuffer(m_compressedVoiceBuffer, (int)size, Sync.MyId);
                }

                foreach (var player in Sync.Players.GetOnlinePlayers())
                {
                    if (player.Id.SerialId == 0 &&
                        player.Id.SteamId != MySession.Static.LocalHumanPlayer.Id.SteamId &&
                        IsCharacterValid(player.Character) &&
                        m_voiceChatLogic.ShouldSendVoice(player) &&
                        !MySandboxGame.Config.DontSendVoicePlayers.Contains(player.Id.SteamId))   // check if that user wants messages from this user
                    {
                        SendBuffer buffer = new SendBuffer {
                            CompressedVoiceBuffer = m_compressedVoiceBuffer,
                            NumElements           = (int)(size / sizeof(byte)),
                            SenderUserId          = (long)MySession.Static.LocalHumanPlayer.Id.SteamId
                        };

                        if (Sync.IsServer)
                        {
                            MyMultiplayer.RaiseStaticEvent(x => SendVoicePlayer, player.Id.SteamId, (BitReaderWriter)buffer, new EndpointId(player.Id.SteamId));
                        }
                        else
                        {
                            MyMultiplayer.RaiseStaticEvent(x => SendVoice, player.Id.SteamId, (BitReaderWriter)buffer);
                        }

                        if (MyFakes.ENABLE_VOICE_CHAT_DEBUGGING)
                        {
                            m_debugSentVoice[player.Id.SteamId] = true;
                        }
                    }
                    else
                    {
                        if (MyFakes.ENABLE_VOICE_CHAT_DEBUGGING)
                        {
                            m_debugSentVoice[player.Id.SteamId] = false;
                        }
                    }
                }
            }
            else if (result == VoiceResult.NotRecording)
            {
                m_recording = false;

                if (MyFakes.ENABLE_VOICE_CHAT_DEBUGGING)
                {
                    var localUser = Sync.MyId;
                    if (!m_voices.ContainsKey(localUser))
                    {
                        var player = Sync.Players.GetPlayerById(new MyPlayer.PlayerId(localUser));
                        m_voices[localUser] = new MyEntity3DSoundEmitter(player.Character);
                    }

                    var emitter = m_voices[localUser];
                    if (m_receivedVoiceData.ContainsKey(localUser))
                    {
                        var data = m_receivedVoiceData[localUser];
                        emitter.PlaySound(data.UncompressedBuffer.ToArray(), (int)data.UncompressedBuffer.Count, m_VoIP.SampleRate);
                        data.ClearData();
                        data.ClearSpeakerTimestamp();
                        m_receivedVoiceData[localUser] = data;
                    }
                }
            }
        }
 private static void SendScriptRequest(MyStringHash stringId)
 {
     MyMultiplayer.RaiseStaticEvent(x => RunScriptRequest, stringId);
 }
Example #26
0
 public static void MutePlayerRequest(ulong mutedPlayerId, bool mute)
 {
     MyMultiplayer.RaiseStaticEvent(x => MutePlayerRequest_Implementation, mutedPlayerId, mute);
 }
Example #27
0
        public override bool HandleRespawnRequest(bool joinGame, bool newIdentity, long medicalRoomId, string respawnShipId, MyPlayer.PlayerId playerId, Vector3D?spawnPosition, VRage.ObjectBuilders.SerializableDefinitionId?botDefinitionId)
        {
            MyPlayer player = Sync.Players.GetPlayerById(playerId);

            bool spawnAsNewPlayer = newIdentity || player == null;

            Debug.Assert(player == null || player.Identity != null, "Respawning player has no identity!");

            if (!MySessionComponentMissionTriggers.CanRespawn(playerId))
            {
                return(false);
            }

            Vector3D currentPosition = Vector3D.Zero;

            if (player != null && player.Character != null)
            {
                currentPosition = player.Character.PositionComp.GetPosition();
            }

            // Send postback message to a client that there was new identity created
            MyMultiplayer.RaiseStaticEvent(s => NewIdentityCreated_Response, playerId, joinGame, new EndpointId(playerId.SteamId));

            if (TryFindCryoChamberCharacter(player))
            {
                //Player found in chamber;
                return(true);
            }

            MyBotDefinition botDefinition = null;

            if (botDefinitionId != null)
            {
                MyDefinitionManager.Static.TryGetBotDefinition((MyDefinitionId)botDefinitionId, out botDefinition);
            }

            if (!spawnAsNewPlayer)
            {
                if (spawnPosition.HasValue)
                {
                    Vector3D gravity = MyGravityProviderSystem.CalculateTotalGravityInPoint(spawnPosition.Value);
                    if (Vector3D.IsZero(gravity))
                    {
                        gravity = Vector3D.Down;
                    }
                    else
                    {
                        gravity.Normalize();
                    }
                    Vector3D perpendicular;
                    gravity.CalculatePerpendicularVector(out perpendicular);
                    player.SpawnAt(MatrixD.CreateWorld(spawnPosition.Value, perpendicular, -gravity), Vector3.Zero, null, botDefinition, true);

                    return(true);
                }

                // Find respawn block to spawn at
                MyRespawnComponent foundRespawn = null;
                if (medicalRoomId == 0 || !MyFakes.SHOW_FACTIONS_GUI)
                {
                    List <MyRespawnComponent> respawns = null;
                    var nearestRespawn = GetNearestRespawn(currentPosition, out respawns, MySession.Static.CreativeMode ? (long?)null : player.Identity.IdentityId);
                    if (joinGame && respawns.Count > 0)
                    {
                        foundRespawn = respawns[MyRandom.Instance.Next(0, respawns.Count)];
                    }
                }
                else
                {
                    foundRespawn = FindRespawnById(medicalRoomId, player);
                    if (foundRespawn == null)
                    {
                        return(false);
                    }
                }

                // If spawning in respawn block fails, we will spawn as a new player
                if (foundRespawn != null)
                {
                    SpawnInRespawn(player, foundRespawn, botDefinition);
                }
                else
                {
                    spawnAsNewPlayer = true;
                }
            }

            if (spawnAsNewPlayer)
            {
                bool resetIdentity = MySession.Static.Settings.PermanentDeath.Value;
                if (player == null)
                {
                    var identity = Sync.Players.CreateNewIdentity(player.DisplayName);
                    player        = Sync.Players.CreateNewPlayer(identity, playerId, player.DisplayName);
                    resetIdentity = false;
                }

                if (MySession.Static.CreativeMode)
                {
                    Vector3D?correctedPos = MyEntities.FindFreePlace(currentPosition, 2, 200);
                    if (correctedPos.HasValue)
                    {
                        currentPosition = correctedPos.Value;
                    }
                    player.SpawnAt(Matrix.CreateTranslation(currentPosition), Vector3.Zero, null, botDefinition);
                }
                else
                {
                    SpawnAsNewPlayer(player, currentPosition, respawnShipId, resetIdentity, botDefinition);
                }
            }

            return(true);
        }
Example #28
0
 private static void MutePlayerRequest_Implementation(ulong mutedPlayerId, bool mute)
 {
     // Event now arrived to server, server looks who sent the message (thus sender), and sends this ID to muted player
     MyMultiplayer.RaiseStaticEvent(x => MutePlayer_Implementation, MyEventContext.Current.Sender.Value, mute, new EndpointId(mutedPlayerId));
 }
 void SendChangeShowOnHud(long identityId, int gpsHash, bool show)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyGpsCollection.ShowOnHudRequest, identityId, gpsHash, show);
 }
Example #30
0
 public void ChangeAutoAccept(long factionId, long playerId, bool autoAcceptMember, bool autoAcceptPeace)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyFactionCollection.ChangeAutoAcceptRequest, factionId, playerId, autoAcceptMember, autoAcceptPeace);
 }