Added console command "delete object outside" to delete all objects outside region boundaries. This is especiyll useful in cases where physical objects outside regions boundaries cause much physics engine lag.

bulletsim
Snoopy Pfeffer 2011-08-15 17:46:51 +02:00
parent 70ea625447
commit 9a6ad1535e
1 changed files with 37 additions and 2 deletions

View File

@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes
"delete object name <name>",
"Delete object by name", HandleDeleteObject);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
"delete object outside",
"Delete all objects outside boundaries", HandleDeleteObject);
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes
private void HandleDeleteObject(string module, string[] cmd)
{
if (cmd.Length < 4)
if (cmd.Length < 3)
return;
string mode = cmd[2];
string o = cmd[3];
string o = "";
if (mode != "outside")
{
if (cmd.Length < 4)
return;
o = cmd[3];
}
List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes
deletes.Add(g);
});
break;
case "outside":
ForEachSOG(delegate (SceneObjectGroup g)
{
SceneObjectPart rootPart = g.RootPart;
bool delete = false;
if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
{
delete = true;
} else {
ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
if (parcel == null || parcel.LandData.Name == "NO LAND")
delete = true;
}
if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
deletes.Add(g);
});
break;
}
foreach (SceneObjectGroup g in deletes)
{
m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
DeleteSceneObject(g, false);
}
}
private void HandleReloadEstate(string module, string[] cmd)