示例#1
0
        private void SendGps(HashSet <MyGps> gpsSet, GridsBroadcastConfig config)
        {
            MyGpsCollection gpsCollection = (MyGpsCollection)MyAPIGateway.Session?.GPS;

            if (gpsCollection == null)
            {
                return;
            }

            bool followGrids = config.GpsFollowGrids;
            bool playSound   = config.PlayGpsSound;

            foreach (MyPlayer player in MySession.Static.Players.GetOnlinePlayers())
            {
                Log.Trace($"Sending biggest grid GPS to player '{player.DisplayName}'");
                foreach (MyGps gps in gpsSet)
                {
                    MyGps gpsRef = gps;

                    long entityId = 0L;
                    if (followGrids)
                    {
                        _gpsSendClient.AddOrModifyGps(player.Identity.IdentityId, ref gpsRef, playSound);
                        continue;
                    }

                    gpsCollection.SendAddGps(player.Identity.IdentityId, ref gpsRef, entityId, playSound);
                }
            }
        }
        private void SendGps(HashSet <MyGps> gpsSet, GridsBroadcastConfig config)
        {
            MyGpsCollection gpsCollection = (MyGpsCollection)MyAPIGateway.Session?.GPS;

            if (gpsCollection == null)
            {
                return;
            }

            bool followGrids = config.GpsFollowGrids;
            bool playSound   = config.PlayGpsSound;

            foreach (MyPlayer player in MySession.Static.Players.GetOnlinePlayers())
            {
                foreach (MyGps gps in gpsSet)
                {
                    MyGps gpsRef = gps;

                    long entityId = 0L;
                    if (followGrids)
                    {
                        entityId = gps.EntityId;
                    }

                    gpsCollection.SendAddGps(player.Identity.IdentityId, ref gpsRef, entityId, playSound);
                }
            }
        }