private async void OnServerUpdateRadioTowers(string radioTowersStr) { Configuration.RadioTowers = JsonConvert.DeserializeObject <Vector3[]>(radioTowersStr); AltAsync.EmitAllClients("SaltyChat:UpdateRadioTowers", Configuration.RadioTowers); await Task.CompletedTask; }
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; }
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; }
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; }
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; }
public static async Task RemoveGlobalMarker(string uniqueID) => await AltAsync.Do(() => { AltAsync.EmitAllClients("marker:remove", uniqueID); });
public static async Task CreateGlobalMarker(MarkerModel marker) => await AltAsync.Do(() => { AltAsync.EmitAllClients("marker:create", marker); });
public static async Task UpdateGlobalBlip(string uniqueID, int sprite, string name, int color) => await AltAsync.Do(() => { AltAsync.EmitAllClients("blip:updateBlip", uniqueID, sprite, name, color); });
public static async Task DeleteGlobalBlip(string uniqueID) => await AltAsync.Do(() => { AltAsync.EmitAllClients("blip:delete", uniqueID); });
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); });