2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class TreeCommand: Command
|
|
|
|
|
{
|
|
|
|
|
public TreeCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "tree";
|
|
|
|
|
Description = "Rez a tree.";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Objects;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
if (args.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string treeName = args[0].Trim(new char[] { ' ' });
|
2007-11-30 00:25:08 +00:00
|
|
|
Tree tree = (Tree)Enum.Parse(typeof(Tree), treeName);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
Vector3 treePosition = Client.Self.SimPosition;
|
2007-04-28 20:54:02 +00:00
|
|
|
treePosition.Z += 3.0f;
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
Client.Objects.AddTree(Client.Network.CurrentSim, new Vector3(0.5f, 0.5f, 0.5f),
|
|
|
|
|
Quaternion.Identity, treePosition, tree, Client.GroupID, false);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
|
|
|
|
return "Attempted to rez a " + treeName + " tree";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return "Type !tree for usage";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string usage = "Usage: !tree [";
|
2007-11-30 00:25:08 +00:00
|
|
|
foreach (string value in Enum.GetNames(typeof(Tree)))
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
usage += value + ",";
|
|
|
|
|
}
|
|
|
|
|
usage = usage.TrimEnd(new char[] { ',' });
|
|
|
|
|
usage += "]";
|
|
|
|
|
return usage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|