diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsBot.cs | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs index 500683a..48ce062 100644 --- a/OpenSim/Tools/pCampBot/PhysicsBot.cs +++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs | |||
@@ -36,7 +36,7 @@ using Nini.Config; | |||
36 | using System.Threading; | 36 | using System.Threading; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using Timer=System.Timers.Timer; | 39 | using Timer = System.Timers.Timer; |
40 | 40 | ||
41 | namespace pCampBot | 41 | namespace pCampBot |
42 | { | 42 | { |
@@ -49,10 +49,10 @@ namespace pCampBot | |||
49 | public string lastname; | 49 | public string lastname; |
50 | public string password; | 50 | public string password; |
51 | public string loginURI; | 51 | public string loginURI; |
52 | 52 | ||
53 | public event AnEvent OnConnected; | 53 | public event AnEvent OnConnected; |
54 | public event AnEvent OnDisconnected; | 54 | public event AnEvent OnDisconnected; |
55 | 55 | ||
56 | protected Timer m_action; // Action Timer | 56 | protected Timer m_action; // Action Timer |
57 | 57 | ||
58 | protected Random somthing = new Random(System.Environment.TickCount);// We do stuff randomly here | 58 | protected Random somthing = new Random(System.Environment.TickCount);// We do stuff randomly here |
@@ -79,24 +79,34 @@ namespace pCampBot | |||
79 | { | 79 | { |
80 | //client.Throttle.Task = 500000f; | 80 | //client.Throttle.Task = 500000f; |
81 | //client.Throttle.Set(); | 81 | //client.Throttle.Set(); |
82 | 82 | int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number, | |
83 | client.Self.Movement.AlwaysRun = true; | 83 | // the greater the bot's chances to walk instead of run. |
84 | if (walkorrun == 0) | ||
85 | { | ||
86 | client.Self.Movement.AlwaysRun = true; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | client.Self.Movement.AlwaysRun = false; | ||
91 | } | ||
92 | |||
84 | LLVector3 pos = client.Self.SimPosition; | 93 | LLVector3 pos = client.Self.SimPosition; |
85 | LLVector3 newpos = new LLVector3(somthing.Next(255),somthing.Next(255),somthing.Next(255)); | 94 | LLVector3 newpos = new LLVector3(somthing.Next(255), somthing.Next(255), somthing.Next(255)); |
86 | |||
87 | |||
88 | client.Self.Movement.TurnToward(newpos); | 95 | client.Self.Movement.TurnToward(newpos); |
96 | |||
89 | for (int i = 0; i < 2000; i++) | 97 | for (int i = 0; i < 2000; i++) |
90 | { | 98 | { |
91 | client.Self.Movement.AtPos = true; | 99 | client.Self.Movement.AtPos = true; |
100 | Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time. | ||
92 | } | 101 | } |
93 | client.Self.Jump(); | 102 | client.Self.Jump(); |
103 | |||
94 | string randomf = talkarray[somthing.Next(talkarray.Length)]; | 104 | string randomf = talkarray[somthing.Next(talkarray.Length)]; |
95 | if (talkarray.Length > 1 && randomf.Length > 1) | 105 | if (talkarray.Length > 1 && randomf.Length > 1) |
96 | client.Self.Chat("Can't do it, " + randomf, 0, ChatType.Normal); | 106 | client.Self.Chat(randomf, 0, ChatType.Normal); |
97 | 107 | ||
98 | Thread.Sleep(somthing.Next(1,20)); | 108 | //Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now. |
99 | 109 | ||
100 | } | 110 | } |
101 | 111 | ||
102 | /// <summary> | 112 | /// <summary> |
@@ -132,7 +142,7 @@ namespace pCampBot | |||
132 | client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected); | 142 | client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected); |
133 | if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) | 143 | if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) |
134 | { | 144 | { |
135 | 145 | ||
136 | if (OnConnected != null) | 146 | if (OnConnected != null) |
137 | { | 147 | { |
138 | m_action = new Timer(somthing.Next(1000, 10000)); | 148 | m_action = new Timer(somthing.Next(1000, 10000)); |
@@ -169,15 +179,15 @@ namespace pCampBot | |||
169 | { | 179 | { |
170 | if (OnDisconnected != null) | 180 | if (OnDisconnected != null) |
171 | { | 181 | { |
172 | OnDisconnected(this,EventType.DISCONNECTED); | 182 | OnDisconnected(this, EventType.DISCONNECTED); |
173 | } | 183 | } |
174 | } | 184 | } |
175 | 185 | ||
176 | public string[] readexcuses() | 186 | public string[] readexcuses() |
177 | { | 187 | { |
178 | string allexcuses = ""; | 188 | string allexcuses = ""; |
179 | 189 | ||
180 | string file = Path.Combine(Util.configDir(), "excuses"); | 190 | string file = Path.Combine(Util.configDir(), "pCampBotSentences.txt"); |
181 | if (File.Exists(file)) | 191 | if (File.Exists(file)) |
182 | { | 192 | { |
183 | StreamReader csr = File.OpenText(file); | 193 | StreamReader csr = File.OpenText(file); |
@@ -185,7 +195,7 @@ namespace pCampBot | |||
185 | csr.Close(); | 195 | csr.Close(); |
186 | } | 196 | } |
187 | 197 | ||
188 | return allexcuses.Split(Environment.NewLine.ToCharArray()); | 198 | return allexcuses.Split(Environment.NewLine.ToCharArray()); |
189 | } | 199 | } |
190 | } | 200 | } |
191 | } | 201 | } |