diff options
Diffstat (limited to 'OpenSim/Tools/pCampBot/Bot.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 9821180..dac8ccb 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -64,11 +64,6 @@ namespace pCampBot | |||
64 | public BotManager Manager { get; private set; } | 64 | public BotManager Manager { get; private set; } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Bot config, passed from BotManager. | ||
68 | /// </summary> | ||
69 | private IConfig startupConfig; | ||
70 | |||
71 | /// <summary> | ||
72 | /// Behaviours implemented by this bot. | 67 | /// Behaviours implemented by this bot. |
73 | /// </summary> | 68 | /// </summary> |
74 | /// <remarks> | 69 | /// <remarks> |
@@ -102,6 +97,8 @@ namespace pCampBot | |||
102 | public string Name { get; private set; } | 97 | public string Name { get; private set; } |
103 | public string Password { get; private set; } | 98 | public string Password { get; private set; } |
104 | public string LoginUri { get; private set; } | 99 | public string LoginUri { get; private set; } |
100 | public string StartLocation { get; private set; } | ||
101 | |||
105 | public string saveDir; | 102 | public string saveDir; |
106 | public string wear; | 103 | public string wear; |
107 | 104 | ||
@@ -137,7 +134,7 @@ namespace pCampBot | |||
137 | /// <param name="behaviours"></param> | 134 | /// <param name="behaviours"></param> |
138 | public Bot( | 135 | public Bot( |
139 | BotManager bm, List<IBehaviour> behaviours, | 136 | BotManager bm, List<IBehaviour> behaviours, |
140 | string firstName, string lastName, string password, string loginUri) | 137 | string firstName, string lastName, string password, string startLocation, string loginUri) |
141 | { | 138 | { |
142 | ConnectionState = ConnectionState.Disconnected; | 139 | ConnectionState = ConnectionState.Disconnected; |
143 | 140 | ||
@@ -151,11 +148,9 @@ namespace pCampBot | |||
151 | Name = string.Format("{0} {1}", FirstName, LastName); | 148 | Name = string.Format("{0} {1}", FirstName, LastName); |
152 | Password = password; | 149 | Password = password; |
153 | LoginUri = loginUri; | 150 | LoginUri = loginUri; |
151 | StartLocation = startLocation; | ||
154 | 152 | ||
155 | Manager = bm; | 153 | Manager = bm; |
156 | startupConfig = bm.Config; | ||
157 | readconfig(); | ||
158 | |||
159 | Behaviours = behaviours; | 154 | Behaviours = behaviours; |
160 | } | 155 | } |
161 | 156 | ||
@@ -163,7 +158,7 @@ namespace pCampBot | |||
163 | //add additional steps and/or things the bot should do | 158 | //add additional steps and/or things the bot should do |
164 | private void Action() | 159 | private void Action() |
165 | { | 160 | { |
166 | while (true) | 161 | while (ConnectionState != ConnectionState.Disconnecting) |
167 | lock (Behaviours) | 162 | lock (Behaviours) |
168 | Behaviours.ForEach( | 163 | Behaviours.ForEach( |
169 | b => | 164 | b => |
@@ -177,22 +172,14 @@ namespace pCampBot | |||
177 | } | 172 | } |
178 | 173 | ||
179 | /// <summary> | 174 | /// <summary> |
180 | /// Read the Nini config and initialize | ||
181 | /// </summary> | ||
182 | public void readconfig() | ||
183 | { | ||
184 | wear = startupConfig.GetString("wear", "no"); | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. | 175 | /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. |
189 | /// </summary> | 176 | /// </summary> |
190 | public void shutdown() | 177 | public void shutdown() |
191 | { | 178 | { |
192 | ConnectionState = ConnectionState.Disconnecting; | 179 | ConnectionState = ConnectionState.Disconnecting; |
193 | 180 | ||
194 | if (m_actionThread != null) | 181 | // if (m_actionThread != null) |
195 | m_actionThread.Abort(); | 182 | // m_actionThread.Abort(); |
196 | 183 | ||
197 | Client.Network.Logout(); | 184 | Client.Network.Logout(); |
198 | } | 185 | } |
@@ -207,6 +194,7 @@ namespace pCampBot | |||
207 | Client.Settings.AVATAR_TRACKING = false; | 194 | Client.Settings.AVATAR_TRACKING = false; |
208 | Client.Settings.OBJECT_TRACKING = false; | 195 | Client.Settings.OBJECT_TRACKING = false; |
209 | Client.Settings.SEND_AGENT_THROTTLE = true; | 196 | Client.Settings.SEND_AGENT_THROTTLE = true; |
197 | Client.Settings.SEND_AGENT_UPDATES = false; | ||
210 | Client.Settings.SEND_PINGS = true; | 198 | Client.Settings.SEND_PINGS = true; |
211 | Client.Settings.STORE_LAND_PATCHES = false; | 199 | Client.Settings.STORE_LAND_PATCHES = false; |
212 | Client.Settings.USE_ASSET_CACHE = false; | 200 | Client.Settings.USE_ASSET_CACHE = false; |
@@ -224,7 +212,7 @@ namespace pCampBot | |||
224 | 212 | ||
225 | ConnectionState = ConnectionState.Connecting; | 213 | ConnectionState = ConnectionState.Connecting; |
226 | 214 | ||
227 | if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) | 215 | if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "Your name")) |
228 | { | 216 | { |
229 | ConnectionState = ConnectionState.Connected; | 217 | ConnectionState = ConnectionState.Connected; |
230 | 218 | ||
@@ -481,9 +469,6 @@ namespace pCampBot | |||
481 | 469 | ||
482 | public void Objects_NewPrim(object sender, PrimEventArgs args) | 470 | public void Objects_NewPrim(object sender, PrimEventArgs args) |
483 | { | 471 | { |
484 | // if (Name.EndsWith("4")) | ||
485 | // throw new Exception("Aaargh"); | ||
486 | |||
487 | Primitive prim = args.Prim; | 472 | Primitive prim = args.Prim; |
488 | 473 | ||
489 | if (prim != null) | 474 | if (prim != null) |