Esempio n. 1
0
        private void PlayerDisconnected(long l)
        {
            try
            {
                PlayerEventId++;
                IMyPlayer removedPlayer;
                if (Players.TryRemove(l, out removedPlayer))
                {
                    long playerId;

                    SteamToPlayer.TryRemove(removedPlayer.SteamUserId, out playerId);
                    PlayerEntityIdInRange.Remove(removedPlayer.SteamUserId);
                    PlayerMouseStates.Remove(playerId);
                    PlayerDummyTargets.Remove(playerId);
                    PlayerMIds.Remove(removedPlayer.SteamUserId);

                    if (IsServer && MpActive)
                    {
                        SendPlayerConnectionUpdate(l, false);
                    }

                    if (AuthorIds.Contains(removedPlayer.SteamUserId))
                    {
                        ConnectedAuthors.Remove(playerId);
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in PlayerDisconnected: {ex}"); }
        }
        private void PlayerDisconnected(long l)
        {
            try
            {
                PlayerEventId++;
                IMyPlayer removedPlayer;
                if (Players.TryRemove(l, out removedPlayer))
                {
                    long playerId;
                    SteamToPlayer.TryRemove(removedPlayer.SteamUserId, out playerId);
                    PlayerMouseStates.Remove(playerId);

                    if (IsServer && MpActive)
                    {
                        SendPlayerConnectionUpdate(l, false);
                    }

                    if (removedPlayer.SteamUserId == AuthorSteamId)
                    {
                        AuthorPlayerId = 0;
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in PlayerDisconnected: {ex}"); }
        }