ObjectsAvatars and ObjectsPrimitives are now ConcurrentDictionary to avoid a rather nasty locking bottleneck.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace OpenMetaverse.TestClient
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class DeRezCommand : Command
|
||||
{
|
||||
@@ -11,34 +13,28 @@
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID)
|
||||
{
|
||||
UUID primID;
|
||||
|
||||
if (args.Length != 1)
|
||||
return "Usage: derez [prim-uuid]";
|
||||
|
||||
if (UUID.TryParse(args[0], out primID))
|
||||
{
|
||||
Primitive target = Client.Network.CurrentSim.ObjectsPrimitives.Find(
|
||||
prim => prim.ID == primID
|
||||
);
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
uint objectLocalID = target.LocalID;
|
||||
Client.Inventory.RequestDeRezToInventory(objectLocalID, DeRezDestination.AgentInventoryTake,
|
||||
Client.Inventory.FindFolderForType(FolderType.Trash),
|
||||
UUID.Random());
|
||||
return "removing " + target;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Could not find prim " + primID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Usage: derez [prim-uuid]";
|
||||
}
|
||||
|
||||
if (!UUID.TryParse(args[0], out var primID))
|
||||
{
|
||||
return $"{args[0]} is not a valid UUID";
|
||||
}
|
||||
|
||||
var kvp = Client.Network.CurrentSim.ObjectsPrimitives.FirstOrDefault(prim => prim.Value.ID == primID);
|
||||
if (kvp.Value == null)
|
||||
{
|
||||
return $"Could not find object {primID}";
|
||||
}
|
||||
var target = kvp.Value;
|
||||
var objectLocalID = target.LocalID;
|
||||
Client.Inventory.RequestDeRezToInventory(objectLocalID, DeRezDestination.AgentInventoryTake,
|
||||
Client.Inventory.FindFolderForType(FolderType.Trash),
|
||||
UUID.Random());
|
||||
return $"Removing {target}";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user