Add commands to delete objects by name, UUID, creator or owner

bulletsim
Melanie 2011-05-09 00:59:32 +02:00
parent 00f10c900a
commit 2b88d8f93f
1 changed files with 67 additions and 0 deletions

View File

@ -587,6 +587,19 @@ namespace OpenSim.Region.Framework.Scenes
"reload estate",
"Reload the estate data", HandleReloadEstate);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner",
"delete object owner <UUID>",
"Delete object by owner", HandleDeleteObject);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator",
"delete object creator <UUID>",
"Delete object by creator", HandleDeleteObject);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid",
"delete object uuid <UUID>",
"Delete object by uuid", HandleDeleteObject);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
"delete object name <UUID>",
"Delete object by name", HandleDeleteObject);
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@ -4852,6 +4865,60 @@ namespace OpenSim.Region.Framework.Scenes
}
}
private void HandleDeleteObject(string module, string[] cmd)
{
if (cmd.Length < 4)
return;
string mode = cmd[2];
string o = cmd[3];
List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
UUID match;
switch (mode)
{
case "owner":
if (!UUID.TryParse(o, out match))
return;
ForEachSOG(delegate (SceneObjectGroup g)
{
if (g.OwnerID == match && !g.IsAttachment)
deletes.Add(g);
});
break;
case "creator":
if (!UUID.TryParse(o, out match))
return;
ForEachSOG(delegate (SceneObjectGroup g)
{
if (g.RootPart.CreatorID == match && !g.IsAttachment)
deletes.Add(g);
});
break;
case "uuid":
if (!UUID.TryParse(o, out match))
return;
ForEachSOG(delegate (SceneObjectGroup g)
{
if (g.UUID == match && !g.IsAttachment)
deletes.Add(g);
});
break;
case "name":
ForEachSOG(delegate (SceneObjectGroup g)
{
if (g.RootPart.Name == o && !g.IsAttachment)
deletes.Add(g);
});
break;
}
foreach (SceneObjectGroup g in deletes)
DeleteSceneObject(g, false);
}
private void HandleReloadEstate(string module, string[] cmd)
{
if (MainConsole.Instance.ConsoleScene == null ||