On pCampBot, add bot as a property on behaviours instead of passing it in every time

This commit is contained in:
Justin Clark-Casey (justincc)
2011-11-24 22:36:45 +00:00
parent cbbd992df4
commit 2ae5b40ca6
7 changed files with 115 additions and 56 deletions

View File

@@ -39,20 +39,20 @@ namespace pCampBot
/// <remarks>
/// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
/// </remarks>
public class GrabbingBehaviour : IBehaviour
public class GrabbingBehaviour : AbstractBehaviour
{
public string Name { get { return "Grabbing"; } }
public GrabbingBehaviour() { Name = "Grabbing"; }
public void Action(Bot bot)
public override void Action()
{
Dictionary<UUID, Primitive> objects = bot.Objects;
Dictionary<UUID, Primitive> objects = Bot.Objects;
Primitive prim = objects.ElementAt(bot.Random.Next(0, objects.Count)).Value;
Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count)).Value;
// This appears to be a typical message sent when a viewer user clicks a clickable object
bot.Client.Self.Grab(prim.LocalID);
bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
bot.Client.Self.DeGrab(prim.LocalID);
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
}
}
}