diff options
Diffstat (limited to 'OpenSim/Tools/pCampBot/Behaviours')
9 files changed, 387 insertions, 5 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs index 9a9371d..c1ba36b 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | |||
@@ -29,21 +29,36 @@ using OpenMetaverse; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
35 | { | 36 | { |
36 | public class AbstractBehaviour : IBehaviour | 37 | public abstract class AbstractBehaviour : IBehaviour |
37 | { | 38 | { |
39 | /// <summary> | ||
40 | /// Abbreviated name of this behaviour. | ||
41 | /// </summary> | ||
42 | public string AbbreviatedName { get; protected set; } | ||
43 | |||
38 | public string Name { get; protected set; } | 44 | public string Name { get; protected set; } |
39 | 45 | ||
40 | public Bot Bot { get; protected set; } | 46 | public Bot Bot { get; protected set; } |
41 | 47 | ||
42 | public virtual void Action() {} | 48 | public abstract void Action(); |
49 | |||
50 | public virtual void Interrupt() {} | ||
51 | |||
52 | protected AutoResetEvent m_interruptEvent = new AutoResetEvent(false); | ||
43 | 53 | ||
44 | public virtual void Initialize(Bot bot) | 54 | public virtual void Initialize(Bot bot) |
45 | { | 55 | { |
46 | Bot = bot; | 56 | Bot = bot; |
47 | } | 57 | } |
58 | |||
59 | public virtual void Close() | ||
60 | { | ||
61 | Interrupt(); | ||
62 | } | ||
48 | } | 63 | } |
49 | } | 64 | } |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs index 1e01c64..4d806fc 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs | |||
@@ -47,7 +47,11 @@ namespace pCampBot | |||
47 | 47 | ||
48 | public const int m_regionCrossingTimeout = 1000 * 60; | 48 | public const int m_regionCrossingTimeout = 1000 * 60; |
49 | 49 | ||
50 | public CrossBehaviour() { Name = "Cross"; } | 50 | public CrossBehaviour() |
51 | { | ||
52 | AbbreviatedName = "c"; | ||
53 | Name = "Cross"; | ||
54 | } | ||
51 | 55 | ||
52 | public override void Action() | 56 | public override void Action() |
53 | { | 57 | { |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs index 66a336a..59f6244 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | |||
@@ -29,6 +29,7 @@ using OpenMetaverse; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
@@ -41,7 +42,11 @@ namespace pCampBot | |||
41 | /// </remarks> | 42 | /// </remarks> |
42 | public class GrabbingBehaviour : AbstractBehaviour | 43 | public class GrabbingBehaviour : AbstractBehaviour |
43 | { | 44 | { |
44 | public GrabbingBehaviour() { Name = "Grabbing"; } | 45 | public GrabbingBehaviour() |
46 | { | ||
47 | AbbreviatedName = "g"; | ||
48 | Name = "Grabbing"; | ||
49 | } | ||
45 | 50 | ||
46 | public override void Action() | 51 | public override void Action() |
47 | { | 52 | { |
@@ -56,6 +61,8 @@ namespace pCampBot | |||
56 | Bot.Client.Self.Grab(prim.LocalID); | 61 | Bot.Client.Self.Grab(prim.LocalID); |
57 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); | 62 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); |
58 | Bot.Client.Self.DeGrab(prim.LocalID); | 63 | Bot.Client.Self.DeGrab(prim.LocalID); |
64 | |||
65 | Thread.Sleep(1000); | ||
59 | } | 66 | } |
60 | } | 67 | } |
61 | } \ No newline at end of file | 68 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs new file mode 100644 index 0000000..521415c --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Diagnostics; | ||
32 | using System.Threading; | ||
33 | using System.Linq; | ||
34 | using pCampBot.Interfaces; | ||
35 | |||
36 | namespace pCampBot | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Do nothing | ||
40 | /// </summary> | ||
41 | public class InventoryDownloadBehaviour : AbstractBehaviour | ||
42 | { | ||
43 | private bool m_initialized; | ||
44 | private int m_Requests = 2; | ||
45 | private Stopwatch m_StopWatch = new Stopwatch(); | ||
46 | private List<UUID> m_processed = new List<UUID>(); | ||
47 | |||
48 | public InventoryDownloadBehaviour() | ||
49 | { | ||
50 | AbbreviatedName = "inv"; | ||
51 | Name = "Inventory"; | ||
52 | } | ||
53 | |||
54 | public override void Action() | ||
55 | { | ||
56 | if (!m_initialized) | ||
57 | { | ||
58 | m_initialized = true; | ||
59 | Bot.Client.Settings.HTTP_INVENTORY = true; | ||
60 | Bot.Client.Settings.FETCH_MISSING_INVENTORY = true; | ||
61 | Bot.Client.Inventory.FolderUpdated += Inventory_FolderUpdated; | ||
62 | Console.WriteLine("Lib owner is " + Bot.Client.Inventory.Store.LibraryRootNode.Data.OwnerID); | ||
63 | m_StopWatch.Start(); | ||
64 | Bot.Client.Inventory.RequestFolderContents(Bot.Client.Inventory.Store.RootFolder.UUID, Bot.Client.Self.AgentID, true, true, InventorySortOrder.ByDate); | ||
65 | Bot.Client.Inventory.RequestFolderContents(Bot.Client.Inventory.Store.LibraryRootNode.Data.UUID, Bot.Client.Inventory.Store.LibraryRootNode.Data.OwnerID, true, true, InventorySortOrder.ByDate); | ||
66 | } | ||
67 | |||
68 | Thread.Sleep(1000); | ||
69 | Console.WriteLine("Total items: " + Bot.Client.Inventory.Store.Items.Count + "; Total requests: " + m_Requests + "; Time: " + m_StopWatch.Elapsed); | ||
70 | |||
71 | } | ||
72 | |||
73 | void Inventory_FolderUpdated(object sender, FolderUpdatedEventArgs e) | ||
74 | { | ||
75 | if (e.Success) | ||
76 | { | ||
77 | //Console.WriteLine("Folder " + e.FolderID + " updated"); | ||
78 | bool fetch = false; | ||
79 | lock (m_processed) | ||
80 | { | ||
81 | if (!m_processed.Contains(e.FolderID)) | ||
82 | { | ||
83 | m_processed.Add(e.FolderID); | ||
84 | fetch = true; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | if (fetch) | ||
89 | { | ||
90 | List<InventoryFolder> m_foldersToFetch = new List<InventoryFolder>(); | ||
91 | foreach (InventoryBase item in Bot.Client.Inventory.Store.GetContents(e.FolderID)) | ||
92 | { | ||
93 | if (item is InventoryFolder) | ||
94 | { | ||
95 | InventoryFolder f = new InventoryFolder(item.UUID); | ||
96 | f.OwnerID = item.OwnerID; | ||
97 | m_foldersToFetch.Add(f); | ||
98 | } | ||
99 | } | ||
100 | if (m_foldersToFetch.Count > 0) | ||
101 | { | ||
102 | m_Requests += 1; | ||
103 | Bot.Client.Inventory.RequestFolderContentsCap(m_foldersToFetch, Bot.Client.Network.CurrentSim.Caps.CapabilityURI("FetchInventoryDescendents2"), true, true, InventorySortOrder.ByDate); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | if (Bot.Client.Inventory.Store.Items.Count >= 15739) | ||
108 | { | ||
109 | m_StopWatch.Stop(); | ||
110 | Console.WriteLine("Stop! Total items: " + Bot.Client.Inventory.Store.Items.Count + "; Total requests: " + m_Requests + "; Time: " + m_StopWatch.Elapsed); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | } | ||
115 | |||
116 | public override void Interrupt() | ||
117 | { | ||
118 | m_interruptEvent.Set(); | ||
119 | } | ||
120 | } | ||
121 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs new file mode 100644 index 0000000..0d43781 --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Linq; | ||
32 | using pCampBot.Interfaces; | ||
33 | |||
34 | namespace pCampBot | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Do nothing | ||
38 | /// </summary> | ||
39 | public class NoneBehaviour : AbstractBehaviour | ||
40 | { | ||
41 | public NoneBehaviour() | ||
42 | { | ||
43 | AbbreviatedName = "n"; | ||
44 | Name = "None"; | ||
45 | } | ||
46 | |||
47 | public override void Action() | ||
48 | { | ||
49 | Bot.Client.Self.Jump(false); | ||
50 | Bot.Client.Self.Movement.Stop = true; | ||
51 | m_interruptEvent.WaitOne(); | ||
52 | Bot.Client.Self.Movement.Stop = false; | ||
53 | } | ||
54 | |||
55 | public override void Interrupt() | ||
56 | { | ||
57 | m_interruptEvent.Set(); | ||
58 | } | ||
59 | } | ||
60 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs index daa7485..98ab931 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | |||
@@ -46,6 +46,7 @@ namespace pCampBot | |||
46 | 46 | ||
47 | public PhysicsBehaviour() | 47 | public PhysicsBehaviour() |
48 | { | 48 | { |
49 | AbbreviatedName = "p"; | ||
49 | Name = "Physics"; | 50 | Name = "Physics"; |
50 | talkarray = readexcuses(); | 51 | talkarray = readexcuses(); |
51 | } | 52 | } |
@@ -77,6 +78,14 @@ namespace pCampBot | |||
77 | Bot.Client.Self.Chat(randomf, 0, ChatType.Normal); | 78 | Bot.Client.Self.Chat(randomf, 0, ChatType.Normal); |
78 | } | 79 | } |
79 | 80 | ||
81 | public override void Close() | ||
82 | { | ||
83 | if (Bot.ConnectionState == ConnectionState.Connected) | ||
84 | Bot.Client.Self.Jump(false); | ||
85 | |||
86 | base.Close(); | ||
87 | } | ||
88 | |||
80 | private string[] readexcuses() | 89 | private string[] readexcuses() |
81 | { | 90 | { |
82 | string allexcuses = ""; | 91 | string allexcuses = ""; |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs new file mode 100644 index 0000000..1ec2046 --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Linq; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net; | ||
35 | using pCampBot.Interfaces; | ||
36 | |||
37 | namespace pCampBot | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// This behavior is for the systematic study of some performance improvements made | ||
41 | /// for OSCC'13. | ||
42 | /// Walk around, sending AgentUpdate packets all the time. | ||
43 | /// </summary> | ||
44 | public class PhysicsBehaviour2 : AbstractBehaviour | ||
45 | { | ||
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | public PhysicsBehaviour2() | ||
49 | { | ||
50 | AbbreviatedName = "ph2"; | ||
51 | Name = "Physics2"; | ||
52 | } | ||
53 | |||
54 | private const int TIME_WALKING = 5 * 10; // 5 seconds | ||
55 | private int counter = 0; | ||
56 | |||
57 | public override void Action() | ||
58 | { | ||
59 | |||
60 | if (counter >= TIME_WALKING) | ||
61 | { | ||
62 | counter = 0; | ||
63 | |||
64 | Vector3 target = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Client.Self.SimPosition.Z); | ||
65 | MyTurnToward(target); | ||
66 | |||
67 | Bot.Client.Self.Movement.AtPos = true; | ||
68 | |||
69 | } | ||
70 | else | ||
71 | counter++; | ||
72 | // In any case, send an update | ||
73 | Bot.Client.Self.Movement.SendUpdate(); | ||
74 | } | ||
75 | |||
76 | private void MyTurnToward(Vector3 target) | ||
77 | { | ||
78 | Quaternion between = Vector3.RotationBetween(Vector3.UnitX, Vector3.Normalize(target - Bot.Client.Self.SimPosition)); | ||
79 | Quaternion rot = between ; | ||
80 | |||
81 | Bot.Client.Self.Movement.BodyRotation = rot; | ||
82 | Bot.Client.Self.Movement.HeadRotation = rot; | ||
83 | Bot.Client.Self.Movement.Camera.LookAt(Bot.Client.Self.SimPosition, target); | ||
84 | } | ||
85 | } | ||
86 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs index fbb4e96..81f250d 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | 30 | using System.Linq; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using pCampBot.Interfaces; | 35 | using pCampBot.Interfaces; |
@@ -42,7 +43,11 @@ namespace pCampBot | |||
42 | { | 43 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 45 | ||
45 | public TeleportBehaviour() { Name = "Teleport"; } | 46 | public TeleportBehaviour() |
47 | { | ||
48 | AbbreviatedName = "t"; | ||
49 | Name = "Teleport"; | ||
50 | } | ||
46 | 51 | ||
47 | public override void Action() | 52 | public override void Action() |
48 | { | 53 | { |
@@ -70,6 +75,8 @@ namespace pCampBot | |||
70 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); | 75 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); |
71 | 76 | ||
72 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); | 77 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); |
78 | |||
79 | Thread.Sleep(Bot.Random.Next(3000, 10000)); | ||
73 | } | 80 | } |
74 | } | 81 | } |
75 | } \ No newline at end of file | 82 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs new file mode 100644 index 0000000..7b4639d --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Linq; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using pCampBot.Interfaces; | ||
35 | |||
36 | namespace pCampBot | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// This behavior is for the systematic study of some performance improvements made | ||
40 | /// for OSCC'13. | ||
41 | /// Do nothing, but send AgentUpdate packets all the time that have only slightly | ||
42 | /// different state. The delta of difference will be filtered by OpenSim early on | ||
43 | /// in the packet processing pipeline. These filters did not exist before OSCC'13. | ||
44 | /// </summary> | ||
45 | public class TwitchyBehaviour : AbstractBehaviour | ||
46 | { | ||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | public TwitchyBehaviour() | ||
50 | { | ||
51 | AbbreviatedName = "tw"; | ||
52 | Name = "Twitchy"; | ||
53 | } | ||
54 | |||
55 | private const float TWITCH = 0.0001f; | ||
56 | private int direction = 1; | ||
57 | |||
58 | public override void Action() | ||
59 | { | ||
60 | Bot.Client.Self.Movement.BodyRotation = new Quaternion(Bot.Client.Self.Movement.BodyRotation.X + direction * TWITCH, | ||
61 | Bot.Client.Self.Movement.BodyRotation.Y, | ||
62 | Bot.Client.Self.Movement.BodyRotation.Z, | ||
63 | Bot.Client.Self.Movement.BodyRotation.W); | ||
64 | |||
65 | //m_log.DebugFormat("[TWITCH]: BodyRot {0}", Bot.Client.Self.Movement.BodyRotation); | ||
66 | direction = -direction; | ||
67 | |||
68 | Bot.Client.Self.Movement.SendUpdate(); | ||
69 | |||
70 | } | ||
71 | |||
72 | } | ||
73 | } \ No newline at end of file | ||