diff options
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index b448182..e7ae7bd 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -343,6 +343,10 @@ namespace OpenSim | |||
343 | "Add-InventoryHost <host>", | 343 | "Add-InventoryHost <host>", |
344 | String.Empty, RunCommand); | 344 | String.Empty, RunCommand); |
345 | 345 | ||
346 | m_console.Commands.AddCommand("region", false, "killuuid", | ||
347 | "killuuid <UUID>", | ||
348 | "kill an object by UUID", KillUUID); | ||
349 | |||
346 | if (ConfigurationSettings.Standalone) | 350 | if (ConfigurationSettings.Standalone) |
347 | { | 351 | { |
348 | m_console.Commands.AddCommand("region", false, "create user", | 352 | m_console.Commands.AddCommand("region", false, "create user", |
@@ -1332,6 +1336,60 @@ namespace OpenSim | |||
1332 | return result; | 1336 | return result; |
1333 | } | 1337 | } |
1334 | 1338 | ||
1339 | /// <summary> | ||
1340 | /// Kill an object given its UUID. | ||
1341 | /// </summary> | ||
1342 | /// <param name="cmdparams"></param> | ||
1343 | protected void KillUUID(string module, string[] cmdparams) | ||
1344 | { | ||
1345 | if (cmdparams.Length > 1) | ||
1346 | { | ||
1347 | UUID id = UUID.Zero; | ||
1348 | SceneObjectGroup grp = null; | ||
1349 | Scene sc = null; | ||
1350 | |||
1351 | try | ||
1352 | { | ||
1353 | Guid x = new Guid((string)cmdparams[1]); | ||
1354 | id = (UUID)(string)cmdparams[1]; | ||
1355 | } | ||
1356 | catch (Exception) | ||
1357 | { | ||
1358 | m_log.Error("[KillUUID]: Error bad UUID formating !"); | ||
1359 | return; | ||
1360 | } | ||
1361 | |||
1362 | m_sceneManager.ForEachScene( | ||
1363 | delegate(Scene scene) | ||
1364 | { | ||
1365 | if (scene.Entities[id] != null) | ||
1366 | { | ||
1367 | grp = (SceneObjectGroup) scene.Entities[id]; | ||
1368 | sc = scene; | ||
1369 | } | ||
1370 | }); | ||
1371 | |||
1372 | if (grp == null) | ||
1373 | m_log.ErrorFormat("[KillUUID]: Given UUID {0} not found !", id); | ||
1374 | else | ||
1375 | { | ||
1376 | m_log.InfoFormat("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName); | ||
1377 | try | ||
1378 | { | ||
1379 | sc.DeleteSceneObject(grp, false); | ||
1380 | } | ||
1381 | catch (Exception e) | ||
1382 | { | ||
1383 | m_log.ErrorFormat("[KillUUID]: Error while removing objects from scene: " + e); | ||
1384 | } | ||
1385 | } | ||
1386 | } | ||
1387 | else | ||
1388 | { | ||
1389 | m_log.Error("[KillUUID]: Usage: killuuid <UUID>"); | ||
1390 | } | ||
1391 | } | ||
1392 | |||
1335 | #endregion | 1393 | #endregion |
1336 | } | 1394 | } |
1337 | } | 1395 | } |