2025-05-27 14:16:03 -05:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenMetaverse.TestClient
|
2009-07-10 01:58:39 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class DeRezCommand : Command
|
|
|
|
|
|
{
|
|
|
|
|
|
public DeRezCommand(TestClient testClient)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "derez";
|
|
|
|
|
|
Description = "De-Rezes a specified prim. " + "Usage: derez [prim-uuid]";
|
|
|
|
|
|
Category = CommandCategory.Objects;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (args.Length != 1)
|
2025-05-27 14:16:03 -05:00
|
|
|
|
{
|
2009-07-10 01:58:39 +00:00
|
|
|
|
return "Usage: derez [prim-uuid]";
|
2025-05-27 14:16:03 -05:00
|
|
|
|
}
|
2009-07-10 01:58:39 +00:00
|
|
|
|
|
2025-05-27 14:16:03 -05:00
|
|
|
|
if (!UUID.TryParse(args[0], out var primID))
|
2009-07-10 01:58:39 +00:00
|
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
|
return $"{args[0]} is not a valid UUID";
|
2009-07-10 01:58:39 +00:00
|
|
|
|
}
|
2025-05-27 14:16:03 -05:00
|
|
|
|
|
|
|
|
|
|
var kvp = Client.Network.CurrentSim.ObjectsPrimitives.FirstOrDefault(prim => prim.Value.ID == primID);
|
|
|
|
|
|
if (kvp.Value == null)
|
2009-07-10 01:58:39 +00:00
|
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
|
return $"Could not find object {primID}";
|
2009-07-10 01:58:39 +00:00
|
|
|
|
}
|
2025-05-27 14:16:03 -05:00
|
|
|
|
var target = kvp.Value;
|
|
|
|
|
|
var objectLocalID = target.LocalID;
|
|
|
|
|
|
Client.Inventory.RequestDeRezToInventory(objectLocalID, DeRezDestination.AgentInventoryTake,
|
|
|
|
|
|
Client.Inventory.FindFolderForType(FolderType.Trash),
|
|
|
|
|
|
UUID.Random());
|
|
|
|
|
|
return $"Removing {target}";
|
|
|
|
|
|
|
2009-07-10 01:58:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|