diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index b53806c651..1c1afd033f 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs @@ -148,7 +148,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests Rest.main.SceneManager.ForEachScene(delegate(Scene s) { - s.ForEachScenePresence(delegate(ScenePresence sp) + s.ForEachRootScenePresence(delegate(ScenePresence sp) { if (sp.Firstname == names[0] && sp.Lastname == names[1]) { diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index b16ca53a8b..4d8fb90eb0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat private const int DEBUG_CHANNEL = 2147483647; private bool m_enabled = true; - private int m_saydistance = 30; + private int m_saydistance = 20; private int m_shoutdistance = 100; private int m_whisperdistance = 10; private List m_scenes = new List(); @@ -242,7 +242,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat foreach (Scene s in m_scenes) { - s.ForEachScenePresence( + // This should use ForEachClient, but clients don't have a position. + // If camera is moved into client, then camera position can be used + s.ForEachRootScenePresence( delegate(ScenePresence presence) { ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); @@ -306,12 +308,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (c.Scene != null) { - ((Scene)c.Scene).ForEachRootScenePresence + ((Scene)c.Scene).ForEachRootClient ( - delegate(ScenePresence presence) + delegate(IClientAPI client) { - IClientAPI client = presence.ControllingClient; - // don't forward SayOwner chat from objects to // non-owner agents if ((c.Type == ChatTypeEnum.Owner) && @@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, (byte)sourceType, (byte)ChatAudibleLevel.Fully); - receiverIDs.Add(presence.UUID); + receiverIDs.Add(client.AgentId); } ); (c.Scene as Scene).EventManager.TriggerOnChatToClients( diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 00556c4808..bb2cd1fa52 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -98,9 +98,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog public void SendGeneralAlert(string message) { - m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) + m_scene.ForEachRootClient(delegate(IClientAPI client) { - presence.ControllingClient.SendAlertMessage(message); + client.SendAlertMessage(message); }); } @@ -162,9 +162,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog public void SendNotificationToUsersInRegion( UUID fromAvatarID, string fromAvatarName, string message) { - m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) + m_scene.ForEachRootClient(delegate(IClientAPI client) { - presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); + client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); }); } diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 93e65c36f6..41a80ce820 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -145,58 +145,39 @@ namespace OpenSim.Region.CoreModules.World.LightShare param.Add(mBlock); return param; } - public void SendProfileToClient(ScenePresence presence) + + public void SendProfileToClient(IClientAPI client) + { + SendProfileToClient(client, m_scene.RegionInfo.WindlightSettings); + } + + public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) { - IClientAPI client = presence.ControllingClient; if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); - } - } - public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) - { - IClientAPI client = presence.ControllingClient; - if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) - { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(wl); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); + List param = compileWindlightSettings(wl); + client.SendGenericMessage("Windlight", param); } } + private void EventManager_OnMakeRootAgent(ScenePresence presence) { if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); - SendProfileToClient(presence); + SendProfileToClient(presence.ControllingClient); } + private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) { - ScenePresence Sc; - if (m_scene.TryGetScenePresence(pUUID,out Sc)) - { - SendProfileToClient(Sc,wl); - } + IClientAPI client; + m_scene.TryGetClient(pUUID, out client); + SendProfileToClient(client, wl); } + private void EventManager_OnSaveNewWindlightProfile() { if (m_scene.RegionInfo.WindlightSettings.valid) - m_scene.ForEachScenePresence(SendProfileToClient); + m_scene.ForEachRootClient(SendProfileToClient); } public void PostInitialise() diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index a14a84b42a..640a60be04 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private Queue m_pendingQ; private Scene m_scene; private int m_whisperdistance = 10; - private int m_saydistance = 30; + private int m_saydistance = 20; private int m_shoutdistance = 100; #region IRegionModule Members diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1471bc9ae6..00676158c3 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -678,13 +678,14 @@ namespace OpenSim.Region.CoreModules.World.Estate if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) return; - Scene.ForEachRootScenePresence(delegate(ScenePresence p) + Scene.ForEachRootClient(delegate(IClientAPI client) { - if (p.UUID != senderID) + if (client.AgentId != senderID) { // make sure they are still there, we could be working down a long list // Also make sure they are actually in the region - if (p != null && !p.IsChildAgent) + ScenePresence p; + if(Scene.TryGetScenePresence(client.AgentId, out p)) { if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) { @@ -952,9 +953,9 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - Scene.ForEachRootScenePresence(delegate(ScenePresence sp) + Scene.ForEachRootClient(delegate(IClientAPI client) { - HandleRegionInfoRequest(sp.ControllingClient); + HandleRegionInfoRequest(client); }); } diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index d2c128922b..a838e1e4b3 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -488,9 +488,9 @@ namespace OpenSim.Region.CoreModules private void SunUpdateToAllClients() { - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + m_scene.ForEachRootClient(delegate(IClientAPI client) { - SunToClient(sp.ControllingClient); + SunToClient(client); }); } diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index bea5db1cac..a488725570 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -435,9 +435,9 @@ namespace OpenSim.Region.CoreModules m_frameLastUpdateClientArray = m_frame; } - m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + m_scene.ForEachRootClient(delegate(IClientAPI client) { - sp.ControllingClient.SendWindData(windSpeeds); + client.SendWindData(windSpeeds); }); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cd5ac6c494..1a3e3bb980 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1460,12 +1460,10 @@ namespace OpenSim.Region.Framework.Scenes /// Stats on the Simulator's performance private void SendSimStatsPackets(SimStats stats) { - ForEachRootScenePresence( - delegate(ScenePresence agent) - { - agent.ControllingClient.SendSimStats(stats); - } - ); + ForEachRootClient(delegate(IClientAPI client) + { + client.SendSimStats(stats); + }); } /// @@ -4387,35 +4385,32 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.GetScenePresence(localID); } + /// + /// Returns true if scene presence is a child (no avatar in this scene) + /// + /// + /// public override bool PresenceChildStatus(UUID avatarID) { - ScenePresence cp = GetScenePresence(avatarID); - - // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing - // This needs to be fixed properly by cleaning up the logout code. - //if (cp != null) - // return cp.IsChildAgent; - - //return false; - - return cp.IsChildAgent; + ScenePresence sp; + return TryGetScenePresence(avatarID, out sp) && sp.IsChildAgent; } /// - /// Performs action on all ROOT (not child) scene presences. - /// This is just a shortcut function since frequently actions only appy to root SPs + /// Performs action on all avatars in the scene (root scene presences) + /// Avatars may be an NPC or a 'real' client. /// /// public void ForEachRootScenePresence(Action action) { if(m_sceneGraph != null) { - m_sceneGraph.ForEachRootScenePresence(action); + m_sceneGraph.ForEachAvatar(action); } } /// - /// Performs action on all scene presences. + /// Performs action on all scene presences (root and child) /// /// public void ForEachScenePresence(Action action) @@ -4426,25 +4421,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Perform the given action for each object - /// - /// - // public void ForEachObject(Action action) - // { - // List presenceList; - // - // lock (m_sceneObjects) - // { - // presenceList = new List(m_sceneObjects.Values); - // } - // - // foreach (SceneObjectGroup presence in presenceList) - // { - // action(presence); - // } - // } - /// /// Get a group via its UUID /// @@ -4517,6 +4493,22 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar); } + /// + /// Perform an action on all clients with an avatar in this scene (root only) + /// + /// + public void ForEachRootClient(Action action) + { + ForEachRootScenePresence(delegate(ScenePresence presence) + { + action(presence.ControllingClient); + }); + } + + /// + /// Perform an action on all clients connected to the region (root and child) + /// + /// public void ForEachClient(Action action) { m_clientManager.ForEachSync(action); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e1fde64889..d780fb3cca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1265,7 +1265,7 @@ namespace OpenSim.Region.Framework.Scenes /// This is just a shortcut function since frequently actions only appy to root SPs /// /// - public void ForEachRootScenePresence(Action action) + public void ForEachAvatar(Action action) { ForEachScenePresence(delegate(ScenePresence sp) { diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 3bfd8669e6..eeb087f1d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -458,16 +458,16 @@ namespace OpenSim.Region.Framework.Scenes ForEachCurrentScene( delegate(Scene scene) { - scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) + scene.ForEachRootClient(delegate(IClientAPI client) { - if (name == null || scenePresence.Name == name) + if (name == null || client.Name == name) { m_log.DebugFormat("Packet debug for {0} {1} set to {2}", - scenePresence.Firstname, - scenePresence.Lastname, + client.FirstName, + client.LastName, newDebug); - scenePresence.ControllingClient.DebugPacketLevel = newDebug; + client.DebugPacketLevel = newDebug; } }); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6204b4fabd..84d0e71521 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1473,7 +1473,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; - Scene.ForEachScenePresence(delegate(ScenePresence avatar) + Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) { if (avatar.ParentID == LocalId) avatar.StandUp(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 948518a5cc..c8f28c7c07 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1025,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes public PrimitiveBaseShape Shape { get { return m_shape; } - set { m_shape = value; } + set { m_shape = value;} } /// @@ -1389,12 +1389,12 @@ namespace OpenSim.Region.Framework.Scenes /// private void SendRootPartPropertiesToClient(UUID AgentID) { - m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) + m_parentGroup.Scene.ForEachClient(delegate(IClientAPI client) { // Ugly reference :( - if (avatar.UUID == AgentID) + if (client.AgentId == AgentID) { - m_parentGroup.SendPropertiesToClient(avatar.ControllingClient); + m_parentGroup.SendPropertiesToClient(client); } }); } @@ -1514,9 +1514,9 @@ namespace OpenSim.Region.Framework.Scenes if (volume < 0) volume = 0; - m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) + m_parentGroup.Scene.ForEachRootClient(delegate(IClientAPI client) { - sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); + client.SendAttachedSoundGainChange(UUID, (float)volume); }); } @@ -2270,7 +2270,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) + m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) { if (av.LocalId == localId) { @@ -2401,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) + m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) { if (av.LocalId == localId) { @@ -2524,7 +2524,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) + m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av) { if (av.LocalId == localId) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aa1c15e60e..9bf5bea36b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1072,7 +1072,7 @@ namespace OpenSim.Region.Framework.Scenes } // send the animations of the other presences to me - m_scene.ForEachScenePresence(delegate(ScenePresence presence) + m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) { if (presence != this) presence.Animator.SendAnimPackToClient(ControllingClient); diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index f8120aaa39..28f04b31bd 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -123,15 +123,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance { foreach (Scene scene in m_scenes.Values) { - scene.ForEachScenePresence( + scene.ForEachRootScenePresence( delegate(ScenePresence sp) { - if (sp.ControllingClient is LLClientView && !((LLClientView)sp.ControllingClient).ChildAgentStatus()) - { - bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); - MainConsole.Instance.OutputFormat( - "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); - } + bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp); + MainConsole.Instance.OutputFormat( + "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); }); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 45a5f9a782..ff91cfa9d0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1827,7 +1827,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (flexi) { part.Shape.FlexiEntry = true; // this setting flexi true isn't working, but the below parameters do - // work once the prim is already flexi + // work once the prim is already flexi part.Shape.FlexiSoftness = softness; part.Shape.FlexiGravity = gravity; part.Shape.FlexiDrag = friction; @@ -1837,10 +1837,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.Shape.FlexiForceY = (float)Force.y; part.Shape.FlexiForceZ = (float)Force.z; part.Shape.PathCurve = 0x80; + part.ParentGroup.HasGroupChanged = true; + part.ScheduleFullUpdate(); } - - part.ParentGroup.HasGroupChanged = true; - part.ScheduleFullUpdate(); } /// @@ -11199,7 +11198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (checkAgents) { - World.ForEachScenePresence(delegate(ScenePresence sp) + World.ForEachRootScenePresence(delegate(ScenePresence sp) { if (sp.AbsolutePosition.ApproxEquals(posToCheck, sp.PhysicsActor.Size.X)) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 6de0773cff..ed5a2fe049 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -510,7 +510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins senseEntity(sp); if ((ts.type & AGENT_BY_USERNAME) != 0) { - m_CmdManager.m_ScriptEngine.World.ForEachScenePresence( + m_CmdManager.m_ScriptEngine.World.ForEachRootScenePresence( delegate (ScenePresence ssp) { if (ssp.Lastname == "Resident") @@ -529,7 +529,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins } else { - m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(senseEntity); + m_CmdManager.m_ScriptEngine.World.ForEachRootScenePresence(senseEntity); } return sensedEntities; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 30d3147aa4..d8089ac8b1 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -473,7 +473,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // Grab the asset data from the response stream using (MemoryStream stream = new MemoryStream()) { - responseStream.CopyTo(stream, Int32.MaxValue); + responseStream.CopyTo(stream, 4096); asset.Data = stream.ToArray(); } } diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs new file mode 100644 index 0000000000..7084ab41de --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs @@ -0,0 +1,56 @@ +/* + * 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 +{ + /// + /// Click (grab) on random objects in the scene. + /// + /// + /// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable. + /// + public class GrabbingBehaviour : IBehaviour + { + public void Action(Bot bot) + { + Dictionary objects = bot.Objects; + + 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); + } + } +} \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs new file mode 100644 index 0000000000..3ce08bf617 --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs @@ -0,0 +1,95 @@ +/* + * 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 System; +using System.IO; +using System.Threading; +using OpenMetaverse; +using OpenSim.Framework; +using pCampBot.Interfaces; + +namespace pCampBot +{ + /// + /// Stress physics by moving and bouncing around bots a whole lot. + /// + /// + /// TODO: talkarray should be in a separate behaviour. + /// + public class PhysicsBehaviour : IBehaviour + { + private string[] talkarray; + + public PhysicsBehaviour() + { + talkarray = readexcuses(); + } + + public void Action(Bot bot) + { + int walkorrun = bot.Random.Next(4); // Randomize between walking and running. The greater this number, + // the greater the bot's chances to walk instead of run. + bot.Client.Self.Jump(false); + if (walkorrun == 0) + { + bot.Client.Self.Movement.AlwaysRun = true; + } + else + { + bot.Client.Self.Movement.AlwaysRun = false; + } + + // TODO: unused: Vector3 pos = client.Self.SimPosition; + Vector3 newpos = new Vector3(bot.Random.Next(1, 254), bot.Random.Next(1, 254), bot.Random.Next(1, 254)); + bot.Client.Self.Movement.TurnToward(newpos); + + bot.Client.Self.Movement.AtPos = true; + Thread.Sleep(bot.Random.Next(3000, 13000)); + bot.Client.Self.Movement.AtPos = false; + bot.Client.Self.Jump(true); + + string randomf = talkarray[bot.Random.Next(talkarray.Length)]; + if (talkarray.Length > 1 && randomf.Length > 1) + bot.Client.Self.Chat(randomf, 0, ChatType.Normal); + } + + private string[] readexcuses() + { + string allexcuses = ""; + + string file = Path.Combine(Util.configDir(), "pCampBotSentences.txt"); + if (File.Exists(file)) + { + StreamReader csr = File.OpenText(file); + allexcuses = csr.ReadToEnd(); + csr.Close(); + } + + return allexcuses.Split(Environment.NewLine.ToCharArray()); + } + } +} \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/Bot.cs similarity index 76% rename from OpenSim/Tools/pCampBot/PhysicsBot.cs rename to OpenSim/Tools/pCampBot/Bot.cs index a8b24266a2..1b30766ef0 100644 --- a/OpenSim/Tools/pCampBot/PhysicsBot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -38,19 +38,44 @@ using OpenMetaverse.Assets; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; +using pCampBot.Interfaces; using Timer = System.Timers.Timer; namespace pCampBot { - public class PhysicsBot + public class Bot { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events + public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events public BotManager BotManager { get; private set; } private IConfig startupConfig; // bot config, passed from BotManager + /// + /// Behaviours implemented by this bot. + /// + /// + /// Lock this list before manipulating it. + /// + public List Behaviours { get; private set; } + + /// + /// Objects that the bot has discovered. + /// + /// + /// Returns a list copy. Inserting new objects manually will have no effect. + /// + public Dictionary Objects + { + get + { + lock (m_objects) + return new Dictionary(m_objects); + } + } + private Dictionary m_objects = new Dictionary(); + /// /// Is this bot connected to the grid? /// @@ -74,25 +99,33 @@ namespace pCampBot protected List objectIDs = new List(); - protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here + /// + /// Random number generator. + /// + public Random Random { get; private set; } /// /// New instance of a SecondLife client /// - public GridClient client = new GridClient(); - - protected string[] talkarray; + public GridClient Client { get; private set; } /// /// Constructor /// /// + /// Behaviours for this bot to perform /// /// /// /// - public PhysicsBot(BotManager bm, string firstName, string lastName, string password, string loginUri) + /// + public Bot( + BotManager bm, List behaviours, + string firstName, string lastName, string password, string loginUri) { + Client = new GridClient(); + + Random = new Random(Environment.TickCount);// We do stuff randomly here FirstName = firstName; LastName = lastName; Name = string.Format("{0} {1}", FirstName, LastName); @@ -102,7 +135,8 @@ namespace pCampBot BotManager = bm; startupConfig = bm.Config; readconfig(); - talkarray = readexcuses(); + + Behaviours = behaviours; } //We do our actions here. This is where one would @@ -110,34 +144,16 @@ namespace pCampBot private void Action() { while (true) - { - int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number, - // the greater the bot's chances to walk instead of run. - client.Self.Jump(false); - if (walkorrun == 0) - { - client.Self.Movement.AlwaysRun = true; - } - else - { - client.Self.Movement.AlwaysRun = false; - } + lock (Behaviours) + Behaviours.ForEach( + b => + { + // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); + b.Action(this); - // TODO: unused: Vector3 pos = client.Self.SimPosition; - Vector3 newpos = new Vector3(somthing.Next(1, 254), somthing.Next(1, 254), somthing.Next(1, 254)); - client.Self.Movement.TurnToward(newpos); - - client.Self.Movement.AtPos = true; - Thread.Sleep(somthing.Next(3000, 13000)); - client.Self.Movement.AtPos = false; - client.Self.Jump(true); - - string randomf = talkarray[somthing.Next(talkarray.Length)]; - if (talkarray.Length > 1 && randomf.Length > 1) - client.Self.Chat(randomf, 0, ChatType.Normal); - - Thread.Sleep(somthing.Next(1000, 10000)); - } + Thread.Sleep(Random.Next(1000, 10000)); + } + ); } /// @@ -145,7 +161,7 @@ namespace pCampBot /// public void readconfig() { - wear = startupConfig.GetString("wear","no"); + wear = startupConfig.GetString("wear", "no"); } /// @@ -156,7 +172,7 @@ namespace pCampBot if (m_actionThread != null) m_actionThread.Abort(); - client.Network.Logout(); + Client.Network.Logout(); } /// @@ -164,50 +180,50 @@ namespace pCampBot /// public void startup() { - client.Settings.LOGIN_SERVER = LoginUri; - client.Settings.ALWAYS_DECODE_OBJECTS = false; - client.Settings.AVATAR_TRACKING = false; - client.Settings.OBJECT_TRACKING = false; - client.Settings.SEND_AGENT_THROTTLE = true; - client.Settings.SEND_PINGS = true; - client.Settings.STORE_LAND_PATCHES = false; - client.Settings.USE_ASSET_CACHE = false; - client.Settings.MULTIPLE_SIMS = true; - client.Throttle.Asset = 100000; - client.Throttle.Land = 100000; - client.Throttle.Task = 100000; - client.Throttle.Texture = 100000; - client.Throttle.Wind = 100000; - client.Throttle.Total = 400000; - client.Network.LoginProgress += this.Network_LoginProgress; - client.Network.SimConnected += this.Network_SimConnected; - client.Network.Disconnected += this.Network_OnDisconnected; - client.Objects.ObjectUpdate += Objects_NewPrim; + Client.Settings.LOGIN_SERVER = LoginUri; + Client.Settings.ALWAYS_DECODE_OBJECTS = false; + Client.Settings.AVATAR_TRACKING = false; + Client.Settings.OBJECT_TRACKING = false; + Client.Settings.SEND_AGENT_THROTTLE = true; + Client.Settings.SEND_PINGS = true; + Client.Settings.STORE_LAND_PATCHES = false; + Client.Settings.USE_ASSET_CACHE = false; + Client.Settings.MULTIPLE_SIMS = true; + Client.Throttle.Asset = 100000; + Client.Throttle.Land = 100000; + Client.Throttle.Task = 100000; + Client.Throttle.Texture = 100000; + Client.Throttle.Wind = 100000; + Client.Throttle.Total = 400000; + Client.Network.LoginProgress += this.Network_LoginProgress; + Client.Network.SimConnected += this.Network_SimConnected; + Client.Network.Disconnected += this.Network_OnDisconnected; + Client.Objects.ObjectUpdate += Objects_NewPrim; - if (client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) + if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) { IsConnected = true; - Thread.Sleep(somthing.Next(1000, 10000)); + Thread.Sleep(Random.Next(1000, 10000)); m_actionThread = new Thread(Action); m_actionThread.Start(); // OnConnected(this, EventType.CONNECTED); if (wear == "save") { - client.Appearance.SetPreviousAppearance(); + Client.Appearance.SetPreviousAppearance(); SaveDefaultAppearance(); } else if (wear != "no") { MakeDefaultAppearance(wear); } - client.Self.Jump(true); + Client.Self.Jump(true); } else { MainConsole.Instance.OutputFormat( - "{0} {1} cannot login: {2}", FirstName, LastName, client.Network.LoginMessage); + "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage); if (OnDisconnected != null) { @@ -227,11 +243,11 @@ namespace pCampBot Array wtypes = Enum.GetValues(typeof(WearableType)); foreach (WearableType wtype in wtypes) { - UUID wearable = client.Appearance.GetWearableAsset(wtype); + UUID wearable = Client.Appearance.GetWearableAsset(wtype); if (wearable != UUID.Zero) { - client.Assets.RequestAsset(wearable, AssetType.Clothing, false, Asset_ReceivedCallback); - client.Assets.RequestAsset(wearable, AssetType.Bodypart, false, Asset_ReceivedCallback); + Client.Assets.RequestAsset(wearable, AssetType.Clothing, false, Asset_ReceivedCallback); + Client.Assets.RequestAsset(wearable, AssetType.Bodypart, false, Asset_ReceivedCallback); } } } @@ -306,11 +322,11 @@ namespace pCampBot UUID assetID = UUID.Random(); AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i])); asset.Decode(); - asset.Owner = client.Self.AgentID; + asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(clothing[i]); asset.Encode(); - transid = client.Assets.RequestUpload(asset,true); - client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing, + transid = Client.Assets.RequestUpload(asset,true); + Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing, transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) @@ -328,11 +344,11 @@ namespace pCampBot UUID assetID = UUID.Random(); AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i])); asset.Decode(); - asset.Owner = client.Self.AgentID; + asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(bodyparts[i]); asset.Encode(); - transid = client.Assets.RequestUpload(asset,true); - client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart, + transid = Client.Assets.RequestUpload(asset,true); + Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart, transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) @@ -352,7 +368,7 @@ namespace pCampBot else { MainConsole.Instance.Output(String.Format("Sending {0} wearables...",listwearables.Count)); - client.Appearance.WearOutfit(listwearables, false); + Client.Appearance.WearOutfit(listwearables, false); } } catch (Exception ex) @@ -363,8 +379,8 @@ namespace pCampBot public InventoryFolder FindClothingFolder() { - UUID rootfolder = client.Inventory.Store.RootFolder.UUID; - List listfolders = client.Inventory.Store.GetContents(rootfolder); + UUID rootfolder = Client.Inventory.Store.RootFolder.UUID; + List listfolders = Client.Inventory.Store.GetContents(rootfolder); InventoryFolder clothfolder = new InventoryFolder(UUID.Random()); foreach (InventoryBase folder in listfolders) { @@ -419,6 +435,9 @@ namespace pCampBot if (prim != null) { + lock (m_objects) + m_objects[prim.ID] = prim; + if (prim.Textures != null) { if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) @@ -430,10 +449,8 @@ namespace pCampBot { UUID textureID = prim.Textures.FaceTextures[i].TextureID; - if (textureID != null && textureID != UUID.Zero) - { + if (textureID != UUID.Zero) GetTexture(textureID); - } } } @@ -453,10 +470,9 @@ namespace pCampBot return; BotManager.AssetsReceived[textureID] = false; - client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture); + Client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture); } } - public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture) { @@ -473,20 +489,5 @@ namespace pCampBot // SaveAsset((AssetWearable) asset); // } } - - public string[] readexcuses() - { - string allexcuses = ""; - - string file = Path.Combine(Util.configDir(), "pCampBotSentences.txt"); - if (File.Exists(file)) - { - StreamReader csr = File.OpenText(file); - allexcuses = csr.ReadToEnd(); - csr.Close(); - } - - return allexcuses.Split(Environment.NewLine.ToCharArray()); - } } } diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index b05bd6d958..704770a960 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -37,6 +37,7 @@ using log4net.Repository; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; +using pCampBot.Interfaces; namespace pCampBot { @@ -48,7 +49,7 @@ namespace pCampBot private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected CommandConsole m_console; - protected List m_lBot; + protected List m_lBot; protected Random somthing = new Random(Environment.TickCount); protected int numbots = 0; public IConfig Config { get; private set; } @@ -102,7 +103,7 @@ namespace pCampBot // "add bots ", // "Add more bots", HandleAddBots); - m_lBot = new List(); + m_lBot = new List(); } /// @@ -119,10 +120,24 @@ namespace pCampBot string password = cs.GetString("password"); string loginUri = cs.GetString("loginuri"); + HashSet behaviourSwitches = new HashSet(); + Array.ForEach( + cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); + for (int i = 0; i < botcount; i++) { string lastName = string.Format("{0}_{1}", lastNameStem, i); - startupBot(i, this, firstName, lastName, password, loginUri); + + List behaviours = new List(); + + // Hard-coded for now + if (behaviourSwitches.Contains("p")) + behaviours.Add(new PhysicsBehaviour()); + + if (behaviourSwitches.Contains("g")) + behaviours.Add(new GrabbingBehaviour()); + + startupBot(i, this, behaviours, firstName, lastName, password, loginUri); } } @@ -150,14 +165,17 @@ namespace pCampBot /// This starts up the bot and stores the thread for the bot in the thread array /// /// The position in the thread array to stick the bot's thread - /// Configuration of the bot + /// + /// Behaviours for this bot to perform. /// First name /// Last name /// Password /// Login URI - public void startupBot(int pos, BotManager bm, string firstName, string lastName, string password, string loginUri) + public void startupBot( + int pos, BotManager bm, List behaviours, + string firstName, string lastName, string password, string loginUri) { - PhysicsBot pb = new PhysicsBot(bm, firstName, lastName, password, loginUri); + Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri); pb.OnConnected += handlebotEvent; pb.OnDisconnected += handlebotEvent; @@ -176,7 +194,7 @@ namespace pCampBot /// /// /// - private void handlebotEvent(PhysicsBot callbot, EventType eventt) + private void handlebotEvent(Bot callbot, EventType eventt) { switch (eventt) { @@ -201,7 +219,7 @@ namespace pCampBot public void doBotShutdown() { lock (m_lBot) - foreach (PhysicsBot pb in m_lBot) + foreach (Bot pb in m_lBot) pb.shutdown(); } @@ -227,7 +245,7 @@ namespace pCampBot lock (m_lBot) { - foreach (PhysicsBot pb in m_lBot) + foreach (Bot pb in m_lBot) { MainConsole.Instance.OutputFormat( outputFormat, pb.Name, (pb.IsConnected ? "Connected" : "Disconnected")); diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs new file mode 100644 index 0000000000..d4ae0f064b --- /dev/null +++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs @@ -0,0 +1,36 @@ +/* + * 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 System; + +namespace pCampBot.Interfaces +{ + public interface IBehaviour + { + void Action(Bot bot); + } +} \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index a69fbf03c9..4d3b06d5bf 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -26,6 +26,8 @@ */ using System; +using System.Reflection; +using log4net; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; @@ -44,6 +46,8 @@ namespace pCampBot public class pCampBot { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + [STAThread] public static void Main(string[] args) { @@ -60,9 +64,17 @@ namespace pCampBot //startup specified number of bots. 1 is the default bm.dobotStartup(botcount, config); + while (true) { - MainConsole.Instance.Prompt(); + try + { + MainConsole.Instance.Prompt(); + } + catch (Exception e) + { + m_log.ErrorFormat("Command error: {0}", e); + } } } } @@ -72,12 +84,13 @@ namespace pCampBot //Set up our nifty config.. thanks to nini ArgvConfigSource cs = new ArgvConfigSource(args); - cs.AddSwitch("Startup", "botcount","n"); - cs.AddSwitch("Startup", "loginuri","l"); + cs.AddSwitch("Startup", "botcount", "n"); + cs.AddSwitch("Startup", "loginuri", "l"); cs.AddSwitch("Startup", "firstname"); cs.AddSwitch("Startup", "lastname"); cs.AddSwitch("Startup", "password"); - cs.AddSwitch("Startup", "help","h"); + cs.AddSwitch("Startup", "behaviours", "b"); + cs.AddSwitch("Startup", "help", "h"); cs.AddSwitch("Startup", "wear"); IConfig ol = cs.Configs["Startup"]; @@ -98,6 +111,7 @@ namespace pCampBot " -firstname first name for the bots\n" + " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" + " -password password for the bots\n" + + " -b, behaviours behaviours for bots. Current options p (physics), g (grab). Comma separated, e.g. p,g. Default is p", " -wear set appearance folder to load from (default: no)\n" + " -h, -help show this message" ); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 80f4c0ed92..e71fb05e13 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -339,9 +339,9 @@ ;; Distance in meters that whispers should travel. ; whisper_distance = 10 - ;# {say_distance} {} {Distance at which normal chat is heard, in meters? (SL uses 20 here)} {} 30 + ;# {say_distance} {} {Distance at which normal chat is heard, in meters?} {} 20 ;; Distance in meters that ordinary chat should travel. - ; say_distance = 30 + ; say_distance = 20 ;# {shout_distance} {Distance at which a shout is heard, in meters?} {} 100 ;; Distance in meters that shouts should travel. diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index e9d871717f..a02de72750 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -563,8 +563,8 @@ ; Distance in meters that whispers should travel. Default is 10m whisper_distance = 10 - ; Distance in meters that ordinary chat should travel. Default is 30m - say_distance = 30 + ; Distance in meters that ordinary chat should travel. Default is 20m + say_distance = 20 ; Distance in meters that shouts should travel. Default is 100m shout_distance = 100 diff --git a/prebuild.xml b/prebuild.xml index a6f11c4114..ecc60fb04e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2519,6 +2519,7 @@ ../../../bin/ +