From e5b1688913d0fb9e72f67d0b476778a733ddb4b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 Aug 2013 18:48:18 +0100 Subject: Add none behaviour to pCampbot when one wants bots to just stand around --- OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs | 43 ++++++++++++++++++++++ OpenSim/Tools/pCampBot/BotManager.cs | 17 +++++---- OpenSim/Tools/pCampBot/pCampBot.cs | 7 ++-- 3 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs (limited to 'OpenSim/Tools') diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs new file mode 100644 index 0000000..9cf8a54 --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; +using System; +using System.Collections.Generic; +using System.Linq; +using pCampBot.Interfaces; + +namespace pCampBot +{ + /// + /// Do nothing + /// + public class NoneBehaviour : AbstractBehaviour + { + public NoneBehaviour() { Name = "None"; } + } +} \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index d615b3f..1a46380 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -177,18 +177,21 @@ namespace pCampBot // We must give each bot its own list of instantiated behaviours since they store state. List behaviours = new List(); - // Hard-coded for now - if (behaviourSwitches.Contains("p")) - behaviours.Add(new PhysicsBehaviour()); - + // Hard-coded for now + if (behaviourSwitches.Contains("c")) + behaviours.Add(new CrossBehaviour()); + if (behaviourSwitches.Contains("g")) behaviours.Add(new GrabbingBehaviour()); + + if (behaviourSwitches.Contains("n")) + behaviours.Add(new NoneBehaviour()); + + if (behaviourSwitches.Contains("p")) + behaviours.Add(new PhysicsBehaviour()); if (behaviourSwitches.Contains("t")) behaviours.Add(new TeleportBehaviour()); - - if (behaviourSwitches.Contains("c")) - behaviours.Add(new CrossBehaviour()); StartBot(this, behaviours, firstName, lastName, password, loginUri); } diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index 9e82577..2707a49 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -123,9 +123,10 @@ namespace pCampBot " -password password for the bots\n" + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" + " current options are:\n" + - " p (physics)\n" + - " g (grab)\n" + - " t (teleport)\n" + + " p (physics - bots constantly move and jump around)\n" + + " g (grab - bots randomly click prims whether set clickable or not)\n" + + " n (none - bots do nothing)\n" + + " t (teleport - bots regularly teleport between regions on the grid)\n" + // " c (cross)" + " -wear set appearance folder to load from (default: no)\n" + " -h, -help show this message"); -- cgit v1.1 From c49ea491a3d081ff788cc33ca29030690db3a939 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 Aug 2013 22:49:17 +0100 Subject: Make show bots pCampbot console command print connected, connecting, etc. bot totals at end. --- OpenSim/Tools/pCampBot/BotManager.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Tools') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 1a46380..74bd36a 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -330,17 +330,30 @@ namespace pCampBot string outputFormat = "{0,-30} {1, -30} {2,-14}"; MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status"); + Dictionary totals = new Dictionary(); + foreach (object o in Enum.GetValues(typeof(ConnectionState))) + totals[(ConnectionState)o] = 0; + lock (m_lBot) { foreach (Bot pb in m_lBot) { Simulator currentSim = pb.Client.Network.CurrentSim; + totals[pb.ConnectionState]++; MainConsole.Instance.OutputFormat( outputFormat, pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState); } } + + ConsoleDisplayList cdl = new ConsoleDisplayList(); + + foreach (KeyValuePair kvp in totals) + cdl.AddRow(kvp.Key, kvp.Value); + + + MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString()); } /* -- cgit v1.1