Print out what behaviours are active when pCampBot starts up
parent
d145750e87
commit
ed7ddeecf2
|
@ -41,6 +41,8 @@ namespace pCampBot
|
|||
/// </remarks>
|
||||
public class GrabbingBehaviour : IBehaviour
|
||||
{
|
||||
public string Name { get { return "Grabbing"; } }
|
||||
|
||||
public void Action(Bot bot)
|
||||
{
|
||||
Dictionary<UUID, Primitive> objects = bot.Objects;
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace pCampBot
|
|||
/// </remarks>
|
||||
public class PhysicsBehaviour : IBehaviour
|
||||
{
|
||||
public string Name { get { return "Physics"; } }
|
||||
|
||||
private string[] talkarray;
|
||||
|
||||
public PhysicsBehaviour()
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace pCampBot
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string Name { get { return "Teleport"; } }
|
||||
|
||||
public void Action(Bot bot)
|
||||
{
|
||||
Random rng = bot.Manager.Rng;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
|
@ -48,7 +49,14 @@ namespace pCampBot
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Command console
|
||||
/// </summary>
|
||||
protected CommandConsole m_console;
|
||||
|
||||
/// <summary>
|
||||
/// Created bots, whether active or inactive.
|
||||
/// </summary>
|
||||
protected List<Bot> m_lBot;
|
||||
|
||||
/// <summary>
|
||||
|
@ -56,6 +64,9 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
public Random Rng { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Overall configuration.
|
||||
/// </summary>
|
||||
public IConfig Config { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -140,22 +151,26 @@ namespace pCampBot
|
|||
Array.ForEach<string>(
|
||||
cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
|
||||
|
||||
List<IBehaviour> behaviours = new List<IBehaviour>();
|
||||
|
||||
// Hard-coded for now
|
||||
if (behaviourSwitches.Contains("p"))
|
||||
behaviours.Add(new PhysicsBehaviour());
|
||||
|
||||
if (behaviourSwitches.Contains("g"))
|
||||
behaviours.Add(new GrabbingBehaviour());
|
||||
|
||||
if (behaviourSwitches.Contains("t"))
|
||||
behaviours.Add(new TeleportBehaviour());
|
||||
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"[BOT MANAGER]: Bots configured for behaviours {0}",
|
||||
string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
|
||||
|
||||
for (int i = 0; i < botcount; i++)
|
||||
{
|
||||
string lastName = string.Format("{0}_{1}", lastNameStem, i);
|
||||
|
||||
List<IBehaviour> behaviours = new List<IBehaviour>();
|
||||
|
||||
// Hard-coded for now
|
||||
if (behaviourSwitches.Contains("p"))
|
||||
behaviours.Add(new PhysicsBehaviour());
|
||||
|
||||
if (behaviourSwitches.Contains("g"))
|
||||
behaviours.Add(new GrabbingBehaviour());
|
||||
|
||||
if (behaviourSwitches.Contains("t"))
|
||||
behaviours.Add(new TeleportBehaviour());
|
||||
|
||||
StartBot(this, behaviours, firstName, lastName, password, loginUri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,15 @@ namespace pCampBot.Interfaces
|
|||
{
|
||||
public interface IBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of this behaviour.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Action to take when this behaviour is invoked.
|
||||
/// </summary>
|
||||
/// <param name="bot"></param>
|
||||
void Action(Bot bot);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue