private void RemoveSim(Simulator simulator)
 {
     lock (_AllSimulators)
     {
         _AllSimulators.Remove(simulator);
     }
 }
Exemple #2
0
 static public void DeregisterThread(NativeThread systhread)
 {
     AllThreads.Remove(systhread);
     if (ThreadRemoved != null)
     {
         ThreadRemoved(systhread);
     }
 }
 public void SelectedRemove(SimPosition o)
 {
     if (!SelectedObjects.Remove(o) || !_SelectedBeam)
     {
         return;
     }
     _SelectedBeam = false;
     SelectedBeam  = true;
 }
Exemple #4
0
        public SimObject GetNextInterestingObject()
        {
            SimObject mostInteresting = null;

            if (InterestingObjects.Count < 2)
            {
                InterestingObjects = Actor.GetKnownObjects();
                lock (InterestingObjects) InterestingObjects.Remove(Actor);
            }
            int count = InterestingObjects.Count - 2;

            foreach (BotMentalAspect cAspect in InterestingObjects)
            {
                if (cAspect is SimObject)
                {
                    if (mostInteresting == null)
                    {
                        mostInteresting = (SimObject)cAspect;
                        ///  break;
                    }
                    else
                    {
                        mostInteresting = (SimObject)CompareTwo(mostInteresting, cAspect);
                    }
                    count--;
                    if (count < 0)
                    {
                        break;
                    }
                }
            }
            lock (InterestingObjects)
            {
                InterestingObjects.Remove(mostInteresting);
                InterestingObjects.Add(mostInteresting);
            }
            return(mostInteresting);
        }
 public void RemoveObject(SimObject O)
 {
     KnownSimObjects.Remove(O);
 }
 public SimObject GetNextInterestingObject()
 {
     SimObject mostInteresting = null;
     if (InterestingObjects.Count < 2)
     {
         InterestingObjects = Actor.GetKnownObjects();
         lock (InterestingObjects) InterestingObjects.Remove(Actor);
     }
     int count = InterestingObjects.Count - 2;
     foreach (BotMentalAspect cAspect in InterestingObjects)
     {
         if (cAspect is SimObject)
         {
             if (mostInteresting == null)
             {
                 mostInteresting = (SimObject)cAspect;
                 ///  break;
             }
             else
             {
                 mostInteresting = (SimObject)CompareTwo(mostInteresting, cAspect);
             }
             count--;
             if (count < 0) break;
         }
     }
     lock (InterestingObjects)
     {
         InterestingObjects.Remove(mostInteresting);
         InterestingObjects.Add(mostInteresting);
     }
     return mostInteresting;
 }
        public void Network_OnSimConnectedHook(object sender, SimConnectedEventArgs e)
        {
            Simulator simulator = e.Simulator;

            ///base.Network_OnSimConnected(simulator);
            lock (WorldObjectsMasterLock)
            {
                if (simulator.Handle == 0)
                {
                    Debug("Simulator Handle==0 for " + simulator);
                    return;
                }
                EnsureSimulator(simulator);
                IsConnected = true;
                if (SimRegion.IsMaster(simulator, client.gridClient))
                {
                    Debug("---SIMMASTER---------" + client + " region: " + simulator);
                    SetWorldMaster(true);
                    SimMaster[simulator.Handle] = this;
                    //client.Grid.RequestMapRegion(simulator.Name, GridLayerType.Objects);
                    if (simulator.Name.Length > 0)
                    {
                        client.Grid.RequestMapRegion(simulator.Name, GridLayerType.Terrain);
                    }
                    else
                    {
                        Debug("no sim bname " + simulator);
                    }
                    client.Estate.RequestInfo();
                    //client.Grid.RequestMapRegion(simulator.Name, GridLayerType.LandForSale);
                    //client.Grid.RequestMapItems(simulator.Handle,OpenMetaverse.GridItemType.Classified,GridLayerType.Terrain);
                    MasteringRegions.Add(simulator.Handle);
                    var MaintainSimCollisionsList = WorldPathSystem.MaintainSimCollisionsList;
                    if (simulator == client.Network.CurrentSim)
                    {
                        lock (MaintainSimCollisionsList)
                        {
                            if (!MaintainSimCollisionsList.Contains(simulator.Handle))
                            {
                                MaintainSimCollisionsList.Add(simulator.Handle);
                            }
                        }
                    }
                    //RequestGridInfos(simulator.Handle);
                }
                else
                {
                    Debug("-----NOT SIMMASTER-------" + client + " region: " + simulator);
                    MasteringRegions.Remove(simulator.Handle);
                    if (MasteringRegions.Count == 0)
                    {
                        SetWorldMaster(false);
                        Debug("------UNREGISTERING------" + client);
                    }
                }
            }
            if (simulator == client.Network.CurrentSim)
            {
                StartupPostLoginQueues();
                // new Thread(() => client.Appearance.SetPreviousAppearance(true)).Start();
            }
            //if (simulator == client.Network.CurrentSim) { new Thread(() => { Thread.Sleep(30000); client.Appearance.SetPreviousAppearance(true); }).Start(); }
        }