Пример #1
0
        private async void OnServerUpdateRadioTowers(string radioTowersStr)
        {
            Configuration.RadioTowers = JsonConvert.DeserializeObject <Vector3[]>(radioTowersStr);
            AltAsync.EmitAllClients("SaltyChat:UpdateRadioTowers", Configuration.RadioTowers);

            await Task.CompletedTask;
        }
Пример #2
0
        private async void OnClientIsUsingMegaphone(IPlayer player, bool state)
        {
            lock (_voiceClients)
            {
                if (!_voiceClients.TryGetValue(player, out _))
                {
                    return;
                }
                AltAsync.EmitAllClients("SaltyChat:IsUsingMegaphone", player, Configuration.MegaphoneRange, state, player.Position);
            }

            await Task.CompletedTask;
        }
Пример #3
0
        private async void OnServerSetPlayerAlive(IPlayer player, bool isAlive)
        {
            lock (_voiceClients)
            {
                if (!_voiceClients.TryGetValue(player, out var voiceClient))
                {
                    return;
                }
                voiceClient.IsAlive = isAlive;
                AltAsync.EmitAllClients("Voice:UpdateClientAlive", voiceClient.Player, isAlive);
            }

            await Task.CompletedTask;
        }
Пример #4
0
        private async void OnClientSetRange(IPlayer player, float range)
        {
            VoiceClient voiceClient;

            lock (_voiceClients)
            {
                if (!_voiceClients.TryGetValue(player, out voiceClient))
                {
                    return;
                }
            }

            if (Array.IndexOf(Configuration.VoiceRanges, range) == -1)
            {
                return;
            }
            voiceClient.VoiceRange = range;
            AltAsync.EmitAllClients("SaltyChat:UpdateClientRange", player, range);

            await Task.CompletedTask;
        }
Пример #5
0
        private async Task OnServerPlayerDisconnect(IPlayer player, string reason)
        {
            lock (player)
            {
                AltAsync.EmitAllClients("SaltyChat:RemoveClient", player.Id);
                lock (_voiceClients)
                {
                    if (!_voiceClients.TryGetValue(player, out var voiceClient))
                    {
                        return;
                    }
                    foreach (var radioChannel in _radioChannels)
                    {
                        radioChannel.RemoveMember(voiceClient);
                    }

                    _voiceClients.TryRemove(player, out _);
                }
            }

            await Task.CompletedTask;
        }
Пример #6
0
 public static async Task RemoveGlobalMarker(string uniqueID) => await AltAsync.Do(() =>
 {
     AltAsync.EmitAllClients("marker:remove", uniqueID);
 });
Пример #7
0
 public static async Task CreateGlobalMarker(MarkerModel marker) => await AltAsync.Do(() =>
 {
     AltAsync.EmitAllClients("marker:create", marker);
 });
Пример #8
0
 public static async Task UpdateGlobalBlip(string uniqueID, int sprite, string name, int color) => await AltAsync.Do(() =>
 {
     AltAsync.EmitAllClients("blip:updateBlip", uniqueID, sprite, name, color);
 });
Пример #9
0
 public static async Task DeleteGlobalBlip(string uniqueID) => await AltAsync.Do(() =>
 {
     AltAsync.EmitAllClients("blip:delete", uniqueID);
 });
Пример #10
0
 public static async Task CreateGlobalBlip(BlipModel blipModel) => await AltAsync.Do(() =>
 {
     AltAsync.EmitAllClients("blip:create", blipModel.PosX, blipModel.PosY, blipModel.PosZ, (int)blipModel.Blip, (int)blipModel.Color, blipModel.Size, blipModel.Name, blipModel.ShortRange, blipModel.UniqueID);
 });