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

avinationmerge
Melanie 2011-05-09 00:59:32 +02:00
parent 7cc5286f2d
commit dbf623a3d2
1 changed files with 67 additions and 0 deletions

View File

@ -610,6 +610,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);
@ -5042,6 +5055,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 ||