make clickobject cleaner and more likely to work
This commit is contained in:
parent
7b3b0f07e5
commit
29c80a18c7
1 changed files with 14 additions and 12 deletions
|
|
@ -4,6 +4,7 @@ using OpenMetaverse.ImportExport.Collada14;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using static NRedisStack.Search.Schema;
|
using static NRedisStack.Search.Schema;
|
||||||
|
|
||||||
namespace SecondBotEvents.Commands
|
namespace SecondBotEvents.Commands
|
||||||
|
|
@ -160,21 +161,22 @@ namespace SecondBotEvents.Commands
|
||||||
return Failure("Invaild object UUID", [target]);
|
return Failure("Invaild object UUID", [target]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetClient().Self.PointAtEffect(GetClient().Self.AgentID, objectuuid, new Vector3d(0, 0, 0), PointAtType.Select, new UUID("1df9eb92-62fa-15e5-4bfb-5931f1525274"));
|
|
||||||
|
|
||||||
Dictionary<uint, Primitive> objectsentrys = GetClient().Network.CurrentSim.ObjectsPrimitives.Copy();
|
Dictionary<uint, Primitive> objectsentrys = GetClient().Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||||
|
var found = objectsentrys.FirstOrDefault(kv => kv.Value.ID == objectuuid);
|
||||||
|
if (found.Value == null)
|
||||||
|
{
|
||||||
|
GetClient().Objects.RequestObjectPropertiesFamily(GetClient().Network.CurrentSim, objectuuid);
|
||||||
|
Thread.Sleep(500); // Wait for the sim to respond
|
||||||
|
objectsentrys = GetClient().Network.CurrentSim.ObjectsPrimitives.Copy();
|
||||||
|
found = objectsentrys.FirstOrDefault(kv => kv.Value.ID == objectuuid);
|
||||||
|
}
|
||||||
|
|
||||||
bool found_object = false;
|
GetClient().Self.PointAtEffect(GetClient().Self.AgentID, objectuuid, new Vector3d(0, 0, 0), PointAtType.Select, new UUID("1df9eb92-62fa-15e5-4bfb-5931f1525274"));
|
||||||
foreach (KeyValuePair<uint, Primitive> entry in objectsentrys)
|
if (found.Value != null)
|
||||||
{
|
{
|
||||||
if (entry.Value.ID == objectuuid)
|
GetClient().Objects.ClickObject(GetClient().Network.CurrentSim, found.Key);
|
||||||
{
|
|
||||||
GetClient().Objects.ClickObject(GetClient().Network.CurrentSim, entry.Key);
|
|
||||||
found_object = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return BasicReply(found.ToString(), [target]);
|
||||||
return BasicReply(found_object.ToString(), [target]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Makes the bot kill itself you monster")]
|
[About("Makes the bot kill itself you monster")]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue