예제 #1
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;

            if (!WorldPathSystem.MaintainMeshes)
            {
                return(Success("WorldObjects.MaintainMeshes = false for " + Name));
            }
            IEnumerable <SimObject> objs;

            if (!args.TryGetValue("targets", out objs))
            {
                objs = WorldSystem.GetAllSimObjects();
            }
            //if (argsUsed == 0)
            {
                int meshed          = 0;
                int unmeshed        = 0;
                int notNeedBeMEshed = 0;
                foreach (var o2 in objs)
                {
                    SimObjectPathFinding o = o2.PathFinding;
                    if (o.IsMeshed)
                    {
                        meshed++;
                        continue;
                    }
                    if (o.IsWorthMeshing)
                    {
                        unmeshed++;
                        continue;
                    }
                    notNeedBeMEshed++;
                }
                float total    = meshed + unmeshed;
                float totalAll = meshed + unmeshed + notNeedBeMEshed;

                return
                    (Success(
                         string.Format("IsMeshed/UnMeshed/UnNeeded = {0}/{1}/{2} {3:0%} complete for {4:0%} of Sim {5}",
                                       meshed, unmeshed, notNeedBeMEshed,
                                       meshed / total,
                                       total / totalAll,
                                       Name)));
            }
            foreach (SimObject o in objs)
            {
                WriteLine("MeshInfo: " + o);
                WriteLine(o.PathFinding.Mesh.DebugString());
            }
            return(Success("Ran " + Name));
        }
예제 #2
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            var keyargs = args.GetProperty("targets");
            ICollection <SimObject> objs = WorldSystem.GetPrimitives(keyargs, out argsUsed);
            bool rightNow = true;

            if (argsUsed == 0)
            {
                objs     = (ICollection <SimObject>)WorldSystem.GetAllSimObjects();
                rightNow = false;
            }
            WriteLine("Meshing " + objs.Count);
            foreach (SimObject o2 in objs)
            {
                SimObjectPathFinding o = o2.PathFinding;
                o.IsWorthMeshing = true;
                if (rightNow)
                {
                    o.AddCollisionsNow();
                }
                else
                {
                    o.AddCollisions();
                }
            }
            if (rightNow)
            {
                SimRegion.BakeRegions();
            }
            else
            {
                Cogbot.WorldPathSystem.MeshingQueue.Enqueue(SimRegion.BakeRegions);
            }

            return(TheBotClient.ExecuteCommand("meshinfo", args.CallerAgent, args.Output, args.CmdFlags));
        }
예제 #3
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            ICollection <SimObject> objs;
            bool rightNow = true;

            if (!args.TryGetValue("targets", out objs))
            {
                objs     = (ICollection <SimObject>)WorldSystem.GetAllSimObjects();
                rightNow = false;
            }
            WriteLine("Unmeshing " + objs.Count);
            foreach (SimObject o2 in objs)
            {
                SimObjectPathFinding o = o2.PathFinding;

                o.IsWorthMeshing = true;
                if (rightNow)
                {
                    o.RemoveCollisions();
                }
                else
                {
                    o.RemoveCollisions();
                }
            }
            if (rightNow)
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }
            else
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }

            return(TheBotClient.ExecuteCommand("meshinfo", args.CallerAgent, args.Output, args.CmdFlags));
        }
예제 #4
0
        static void TrackPaths()
        {
            Thread.Sleep(30000);
            int lastCount = 0;

            while (!(IsDisposing))
            {
                Thread.Sleep(10000);
                if (!MaintainCollisions && !MaintainCollisionsForeground)
                {
                    continue;
                }
                int thisCount = SimObjects.Count;

                if (thisCount == lastCount)
                {
                    Thread.Sleep(20000);
                    lastCount--;

                    continue;
                }

                Debug("\nTrackPaths Started: " + lastCount + "->" + thisCount);

                lastCount = thisCount;
                int occUpdate   = 0;
                int realUpdates = 0;
                foreach (SimObject O in SimObjects.CopyOf())
                {
                    if (!MaintainSimCollisions(O.RegionHandle))
                    {
                        continue;
                    }
                    if (O.IsRegionAttached)
                    {
                        SimObjectPathFinding o = O.PathFinding;
                        if (o.IsWorthMeshing)
                        {
                            bool didIt = false;
                            if (MaintainCollisionsForeground)
                            {
                                didIt = o.AddCollisionsNow();
                            }
                            else
                            {
                                didIt = o.AddCollisions();
                            }
                            if (didIt)
                            {
                                RealMeshes++;
                                realUpdates++;
                            }
                        }
                        else
                        {
                            if (MaintainCollisionsForeground)
                            {
                                if (O.IsPhantom || O.IsPassable)
                                {
                                    continue;
                                }
                                continue;
                                var p = O.PathFinding;
                                WorldPathSystem.MeshingQueue.Enqueue(() => p.AddCollisionsNow());
                            }
                        }
                    }
                    occUpdate++;
                    if (occUpdate % 100 == 0 && DebugPathSystem)
                    {
                        DLRConsole.DebugWrite("." + occUpdate);
                        DLRConsole.SystemFlush();
                    }
                    if (RealMeshes >= MaxMeshes || !MaintainCollisions)
                    {
                        break;
                    }
                }

                Debug("\nTrackPaths Completed: " + thisCount + " realUpdates=" + realUpdates);

                //SimRegion.BakeRegions();
            }
        }