aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorlbsa712007-09-21 03:13:49 +0000
committerlbsa712007-09-21 03:13:49 +0000
commit409bcd999d19c52133f7099963febdf96d865467 (patch)
treea4853c05b6af3b17a2ee1392aca9e08ed38ac427 /OpenSim/Region/Environment
parentphysics-related fixes; should stabilize border crossings (diff)
downloadopensim-SC-409bcd999d19c52133f7099963febdf96d865467.zip
opensim-SC-409bcd999d19c52133f7099963febdf96d865467.tar.gz
opensim-SC-409bcd999d19c52133f7099963febdf96d865467.tar.bz2
opensim-SC-409bcd999d19c52133f7099963febdf96d865467.tar.xz
* Continuing refactoring of presence
* Deleted stub ScenePresence.Body.cs * Added stub Region classes The idea is to, at first, have every ScenePresence have one RegionPresence, moving code over to it until we can detach the two classes and not have a ScenePresence for every RegionPresence.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs4
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs12
-rw-r--r--OpenSim/Region/Environment/Regions/Region.cs15
-rw-r--r--OpenSim/Region/Environment/Regions/RegionManager.cs16
-rw-r--r--OpenSim/Region/Environment/Regions/RegionPresence.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs39
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs82
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs116
15 files changed, 145 insertions, 179 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 8aaeace..ac710ad 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -335,7 +335,7 @@ namespace OpenSim.Region.Environment
335 335
336 for (int i = 0; i < avatars.Count; i++) 336 for (int i = 0; i < avatars.Count; i++)
337 { 337 {
338 sendRegionInfoPacket(avatars[i]._ControllingClient); 338 sendRegionInfoPacket(avatars[i].ControllingClient);
339 } 339 }
340 } 340 }
341 341
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Environment
343 { 343 {
344 m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence ) 344 m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence )
345 { 345 {
346 sendRegionHandshake(scenePresence._ControllingClient); 346 sendRegionHandshake(scenePresence.ControllingClient);
347 }); 347 });
348 } 348 }
349 349
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 0ec77c5..6c177cd 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Environment.LandManagement
203 (int) Math.Round(avatars[i].AbsolutePosition.Y)); 203 (int) Math.Round(avatars[i].AbsolutePosition.Y));
204 if (over.landData.localID == landData.localID) 204 if (over.landData.localID == landData.localID)
205 { 205 {
206 sendLandProperties(0, false, 0, avatars[i]._ControllingClient); 206 sendLandProperties(0, false, 0, avatars[i].ControllingClient);
207 } 207 }
208 } 208 }
209 } 209 }
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index d19bae5..dfbb2bb 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Modules
124 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 124 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
125 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 125 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
126 { 126 {
127 presence._ControllingClient.SendChatMessage( 127 presence.ControllingClient.SendChatMessage(
128 Helpers.StringToField(mess), 255, pos, "IRC:", 128 Helpers.StringToField(mess), 255, pos, "IRC:",
129 LLUUID.Zero); 129 LLUUID.Zero);
130 }); 130 });
@@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Modules
159 int dis = -1000; 159 int dis = -1000;
160 160
161 //err ??? the following code seems to be request a scenePresence when it already has a ref to it 161 //err ??? the following code seems to be request a scenePresence when it already has a ref to it
162 avatar = m_scene.GetScenePresence(presence._ControllingClient.AgentId); 162 avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
163 if (avatar != null) 163 if (avatar != null)
164 { 164 {
165 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); 165 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Environment.Modules
171 if ((dis < 10) && (dis > -10)) 171 if ((dis < 10) && (dis > -10))
172 { 172 {
173 //should change so the message is sent through the avatar rather than direct to the ClientView 173 //should change so the message is sent through the avatar rather than direct to the ClientView
174 presence._ControllingClient.SendChatMessage(message, 174 presence.ControllingClient.SendChatMessage(message,
175 type, 175 type,
176 fromPos, 176 fromPos,
177 fromName, 177 fromName,
@@ -182,7 +182,7 @@ namespace OpenSim.Region.Environment.Modules
182 if ((dis < 30) && (dis > -30)) 182 if ((dis < 30) && (dis > -30))
183 { 183 {
184 //Console.WriteLine("sending chat"); 184 //Console.WriteLine("sending chat");
185 presence._ControllingClient.SendChatMessage(message, 185 presence.ControllingClient.SendChatMessage(message,
186 type, 186 type,
187 fromPos, 187 fromPos,
188 fromName, 188 fromName,
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules
192 case 2: // Shout 192 case 2: // Shout
193 if ((dis < 100) && (dis > -100)) 193 if ((dis < 100) && (dis > -100))
194 { 194 {
195 presence._ControllingClient.SendChatMessage(message, 195 presence.ControllingClient.SendChatMessage(message,
196 type, 196 type,
197 fromPos, 197 fromPos,
198 fromName, 198 fromName,
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Environment.Modules
201 break; 201 break;
202 202
203 case 0xff: // Broadcast 203 case 0xff: // Broadcast
204 presence._ControllingClient.SendChatMessage(message, type, 204 presence.ControllingClient.SendChatMessage(message, type,
205 fromPos, 205 fromPos,
206 fromName, 206 fromName,
207 fromAgentID); 207 fromAgentID);
diff --git a/OpenSim/Region/Environment/Regions/Region.cs b/OpenSim/Region/Environment/Regions/Region.cs
new file mode 100644
index 0000000..f7669a9
--- /dev/null
+++ b/OpenSim/Region/Environment/Regions/Region.cs
@@ -0,0 +1,15 @@
1using System.Collections.Generic;
2using libsecondlife;
3
4namespace OpenSim.Region.Environment.Regions
5{
6 public class Region
7 {
8 private Dictionary<LLUUID, RegionPresence> m_regionPresences;
9
10 public Region()
11 {
12 m_regionPresences = new Dictionary<LLUUID, RegionPresence>( );
13 }
14 }
15}
diff --git a/OpenSim/Region/Environment/Regions/RegionManager.cs b/OpenSim/Region/Environment/Regions/RegionManager.cs
new file mode 100644
index 0000000..ab5b97c
--- /dev/null
+++ b/OpenSim/Region/Environment/Regions/RegionManager.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Regions
6{
7 public class RegionManager
8 {
9 private Dictionary<uint, Region> m_regions;
10
11 public RegionManager( )
12 {
13 m_regions = new Dictionary<uint, Region>( );
14 }
15 }
16}
diff --git a/OpenSim/Region/Environment/Regions/RegionPresence.cs b/OpenSim/Region/Environment/Regions/RegionPresence.cs
new file mode 100644
index 0000000..9720bb3
--- /dev/null
+++ b/OpenSim/Region/Environment/Regions/RegionPresence.cs
@@ -0,0 +1,14 @@
1using OpenSim.Framework.Interfaces;
2
3namespace OpenSim.Region.Environment.Regions
4{
5 public class RegionPresence
6 {
7 private IClientAPI m_client;
8
9 public RegionPresence(IClientAPI client )
10 {
11 m_client = client;
12 }
13 }
14}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index bc27ec8..4832956 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -125,4 +125,4 @@ namespace OpenSim.Region.Environment.Scenes
125 125
126 public abstract void SetText(string text, Vector3 color, double alpha); 126 public abstract void SetText(string text, Vector3 color, double alpha);
127 } 127 }
128} \ No newline at end of file 128}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index b0e2b80..a6e47f3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -21,7 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
21 21
22 if ( TryGetAvatar( avatarId, out avatar )) 22 if ( TryGetAvatar( avatarId, out avatar ))
23 { 23 {
24 AddInventoryItem(avatar._ControllingClient, item); 24 AddInventoryItem(avatar.ControllingClient, item);
25 } 25 }
26 } 26 }
27 27
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
41 41
42 if (TryGetAvatar(avatarId, out avatar)) 42 if (TryGetAvatar(avatarId, out avatar))
43 { 43 {
44 return CapsUpdateInventoryItemAsset(avatar._ControllingClient, itemID, data); 44 return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
45 } 45 }
46 46
47 return LLUUID.Zero; 47 return LLUUID.Zero;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 53da016..91b9634 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -77,7 +77,7 @@ namespace OpenSim.Region.Environment.Scenes
77 ScenePresence fromAvatar = m_scenePresences[fromAgentID]; 77 ScenePresence fromAvatar = m_scenePresences[fromAgentID];
78 ScenePresence toAvatar = m_scenePresences[toAgentID]; 78 ScenePresence toAvatar = m_scenePresences[toAgentID];
79 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; 79 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
80 toAvatar._ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, 80 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID,
81 imSessionID, fromName, dialog, timestamp); 81 imSessionID, fromName, dialog, timestamp);
82 } 82 }
83 else 83 else
@@ -508,7 +508,7 @@ namespace OpenSim.Region.Environment.Scenes
508 { 508 {
509 ForEachScenePresence(delegate(ScenePresence presence) 509 ForEachScenePresence(delegate(ScenePresence presence)
510 { 510 {
511 presence._ControllingClient.SendAnimation(animID, seq, client.AgentId); 511 presence.ControllingClient.SendAnimation(animID, seq, client.AgentId);
512 }); 512 });
513 } 513 }
514 514
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d89ca28..55d760e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -310,7 +310,7 @@ namespace OpenSim.Region.Environment.Scenes
310 { 310 {
311 if (Terrain.Tainted(x * 16, y * 16)) 311 if (Terrain.Tainted(x * 16, y * 16))
312 { 312 {
313 SendLayerData(x, y, presence._ControllingClient, 313 SendLayerData(x, y, presence.ControllingClient,
314 terData); 314 terData);
315 } 315 }
316 } 316 }
@@ -344,7 +344,7 @@ namespace OpenSim.Region.Environment.Scenes
344 List<ScenePresence> avatars = GetAvatars(); 344 List<ScenePresence> avatars = GetAvatars();
345 foreach (ScenePresence avatar in avatars) 345 foreach (ScenePresence avatar in avatars)
346 { 346 {
347 avatar._ControllingClient.SendViewerTime(m_timePhase); 347 avatar.ControllingClient.SendViewerTime(m_timePhase);
348 } 348 }
349 349
350 m_timeUpdateCount = 0; 350 m_timeUpdateCount = 0;
@@ -396,7 +396,7 @@ namespace OpenSim.Region.Environment.Scenes
396 396
397 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 397 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
398 398
399 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence._ControllingClient); }); 399 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
400 400
401 foreach (LLUUID UUID in Entities.Keys) 401 foreach (LLUUID UUID in Entities.Keys)
402 { 402 {
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Environment.Scenes
424 } 424 }
425 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 425 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
426 426
427 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence._ControllingClient); }); 427 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
428 428
429 foreach (LLUUID UUID in Entities.Keys) 429 foreach (LLUUID UUID in Entities.Keys)
430 { 430 {
@@ -772,7 +772,7 @@ namespace OpenSim.Region.Environment.Scenes
772 ScenePresence newAvatar = null; 772 ScenePresence newAvatar = null;
773 773
774 newAvatar = new ScenePresence(client, this, m_regInfo); 774 newAvatar = new ScenePresence(client, this, m_regInfo);
775 newAvatar.childAgent = child; 775 newAvatar.IsChildAgent = child;
776 776
777 if (child) 777 if (child)
778 { 778 {
@@ -829,7 +829,7 @@ namespace OpenSim.Region.Environment.Scenes
829 delegate(ScenePresence presence) 829 delegate(ScenePresence presence)
830 { 830 {
831 presence.CoarseLocationChange(avatar); 831 presence.CoarseLocationChange(avatar);
832 presence._ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 832 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
833 if (presence.PhysicsActor != null) 833 if (presence.PhysicsActor != null)
834 { 834 {
835 phyScene.RemoveAvatar(presence.PhysicsActor); 835 phyScene.RemoveAvatar(presence.PhysicsActor);
@@ -881,7 +881,7 @@ namespace OpenSim.Region.Environment.Scenes
881 { 881 {
882 List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence) 882 List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence)
883 { 883 {
884 return !scenePresence.childAgent; 884 return !scenePresence.IsChildAgent;
885 }); 885 });
886 886
887 return result; 887 return result;
@@ -954,7 +954,7 @@ namespace OpenSim.Region.Environment.Scenes
954 { 954 {
955 ForEachScenePresence(delegate(ScenePresence presence) 955 ForEachScenePresence(delegate(ScenePresence presence)
956 { 956 {
957 presence._ControllingClient.SendKillObject(m_regionHandle, localID); 957 presence.ControllingClient.SendKillObject(m_regionHandle, localID);
958 }); 958 });
959 } 959 }
960 960
@@ -1182,7 +1182,7 @@ namespace OpenSim.Region.Environment.Scenes
1182 { 1182 {
1183 if (m_scenePresences.ContainsKey(avatarID)) 1183 if (m_scenePresences.ContainsKey(avatarID))
1184 { 1184 {
1185 m_scenePresences[avatarID]._ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url); 1185 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url);
1186 } 1186 }
1187 } 1187 }
1188 1188
@@ -1198,7 +1198,7 @@ namespace OpenSim.Region.Environment.Scenes
1198 { 1198 {
1199 foreach (ScenePresence presence in m_scenePresences.Values) 1199 foreach (ScenePresence presence in m_scenePresences.Values)
1200 { 1200 {
1201 presence._ControllingClient.SendAlertMessage(message); 1201 presence.ControllingClient.SendAlertMessage(message);
1202 } 1202 }
1203 } 1203 }
1204 1204
@@ -1206,7 +1206,7 @@ namespace OpenSim.Region.Environment.Scenes
1206 { 1206 {
1207 if (m_scenePresences.ContainsKey(agentID)) 1207 if (m_scenePresences.ContainsKey(agentID))
1208 { 1208 {
1209 m_scenePresences[agentID]._ControllingClient.SendAgentAlertMessage(message, modal); 1209 m_scenePresences[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
1210 } 1210 }
1211 } 1211 }
1212 1212
@@ -1216,7 +1216,7 @@ namespace OpenSim.Region.Environment.Scenes
1216 { 1216 {
1217 if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) 1217 if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
1218 { 1218 {
1219 presence._ControllingClient.SendAgentAlertMessage(message, modal); 1219 presence.ControllingClient.SendAgentAlertMessage(message, modal);
1220 break; 1220 break;
1221 } 1221 }
1222 } 1222 }
@@ -1292,24 +1292,17 @@ namespace OpenSim.Region.Environment.Scenes
1292 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", 1292 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
1293 "Agent ID", "Session ID", "Circuit", "IP", "World")); 1293 "Agent ID", "Session ID", "Circuit", "IP", "World"));
1294 1294
1295 foreach (EntityBase entity in Entities.Values) 1295 foreach (ScenePresence scenePrescence in GetAvatars())
1296 { 1296 {
1297 if (entity is ScenePresence) 1297 MainLog.Instance.Error(
1298 {
1299 ScenePresence scenePrescence = entity as ScenePresence;
1300 if (!scenePrescence.childAgent)
1301 {
1302 MainLog.Instance.Error(
1303 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", 1298 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
1304 scenePrescence.Firstname, 1299 scenePrescence.Firstname,
1305 scenePrescence.Lastname, 1300 scenePrescence.Lastname,
1306 scenePrescence.UUID, 1301 scenePrescence.UUID,
1307 scenePrescence._ControllingClient.AgentId, 1302 scenePrescence.ControllingClient.AgentId,
1308 "Unknown", 1303 "Unknown",
1309 "Unknown", 1304 "Unknown",
1310 RegionInfo.RegionName)); 1305 RegionInfo.RegionName));
1311 }
1312 }
1313 } 1306 }
1314 break; 1307 break;
1315 case "modules": 1308 case "modules":
@@ -1403,7 +1396,7 @@ namespace OpenSim.Region.Environment.Scenes
1403 ScenePresence presence; 1396 ScenePresence presence;
1404 if (m_scenePresences.TryGetValue(avatarId, out presence)) 1397 if (m_scenePresences.TryGetValue(avatarId, out presence))
1405 { 1398 {
1406 if (!presence.childAgent) 1399 if (!presence.IsChildAgent)
1407 { 1400 {
1408 avatar = presence; 1401 avatar = presence;
1409 return true; 1402 return true;
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 27331ee..79fdff7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -145,13 +145,13 @@ namespace OpenSim.Region.Environment.Scenes
145 if (entity is ScenePresence) 145 if (entity is ScenePresence)
146 { 146 {
147 ScenePresence scenePrescence = entity as ScenePresence; 147 ScenePresence scenePrescence = entity as ScenePresence;
148 if (!scenePrescence.childAgent) 148 if (!scenePrescence.IsChildAgent)
149 { 149 {
150 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 150 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
151 scenePrescence.Firstname, scenePrescence.Lastname, 151 scenePrescence.Firstname, scenePrescence.Lastname,
152 newDebug)); 152 newDebug));
153 153
154 scenePrescence._ControllingClient.SetDebug(newDebug); 154 scenePrescence.ControllingClient.SetDebug(newDebug);
155 } 155 }
156 } 156 }
157 } 157 }
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Environment.Scenes
169 if (entity is ScenePresence) 169 if (entity is ScenePresence)
170 { 170 {
171 ScenePresence scenePrescence = entity as ScenePresence; 171 ScenePresence scenePrescence = entity as ScenePresence;
172 if (!scenePrescence.childAgent) 172 if (!scenePrescence.IsChildAgent)
173 { 173 {
174 avatars.Add(scenePrescence); 174 avatars.Add(scenePrescence);
175 } 175 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index d1c4ae8..c1c678f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Environment.Scenes
80 } 80 }
81 } 81 }
82 82
83 public override LLVector3 AbsolutePosition 83 public LLVector3 AbsolutePosition
84 { 84 {
85 get { return m_rootPart.GroupPosition; } 85 get { return m_rootPart.GroupPosition; }
86 set 86 set
@@ -1236,7 +1236,7 @@ namespace OpenSim.Region.Environment.Scenes
1236 List<ScenePresence> avatars = GetScenePresences(); 1236 List<ScenePresence> avatars = GetScenePresences();
1237 for (int i = 0; i < avatars.Count; i++) 1237 for (int i = 0; i < avatars.Count; i++)
1238 { 1238 {
1239 avatars[i]._ControllingClient.SendKillObject(m_regionHandle, part.LocalID); 1239 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID);
1240 } 1240 }
1241 } 1241 }
1242 } 1242 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 1b667b8..468def0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -700,7 +700,7 @@ namespace OpenSim.Region.Environment.Scenes
700 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 700 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
701 for (int i = 0; i < avatars.Count; i++) 701 for (int i = 0; i < avatars.Count; i++)
702 { 702 {
703 m_parentGroup.SendPartFullUpdate(avatars[i]._ControllingClient, this); 703 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
704 } 704 }
705 } 705 }
706 706
@@ -764,7 +764,7 @@ namespace OpenSim.Region.Environment.Scenes
764 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 764 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
765 for (int i = 0; i < avatars.Count; i++) 765 for (int i = 0; i < avatars.Count; i++)
766 { 766 {
767 m_parentGroup.SendPartTerseUpdate(avatars[i]._ControllingClient, this); 767 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
768 } 768 }
769 } 769 }
770 770
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
deleted file mode 100644
index 605e8a1..0000000
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
+++ /dev/null
@@ -1,82 +0,0 @@
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 OpenSim 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*/
28using libsecondlife;
29using libsecondlife.Packets;
30using OpenSim.Framework.Interfaces;
31
32namespace OpenSim.Region.Environment.Scenes
33{
34 partial class ScenePresence
35 {
36 public class Avatar : IScenePresenceBody
37 {
38 public Avatar()
39 {
40 }
41
42 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
43 {
44 }
45
46 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
47 {
48 }
49
50 public void SendOurAppearance(IClientAPI OurClient)
51 {
52 }
53
54 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
55 {
56 }
57 }
58
59 public class ChildAgent : IScenePresenceBody //is a ghost
60 {
61 public ChildAgent()
62 {
63 }
64
65 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
66 {
67 }
68
69 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
70 {
71 }
72
73 public void SendOurAppearance(IClientAPI OurClient)
74 {
75 }
76
77 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
78 {
79 }
80 }
81 }
82} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 1a38244..23e1035 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.Physics.Manager;
38using OpenSim.Region.Environment.Regions;
38 39
39namespace OpenSim.Region.Environment.Scenes 40namespace OpenSim.Region.Environment.Scenes
40{ 41{
@@ -42,33 +43,34 @@ namespace OpenSim.Region.Environment.Scenes
42 { 43 {
43 public static AvatarAnimations Animations; 44 public static AvatarAnimations Animations;
44 public static byte[] DefaultTexture; 45 public static byte[] DefaultTexture;
45 public LLUUID current_anim; 46
46 public int anim_seq; 47 public LLUUID CurrentAnimation;
47 private bool updateflag = false; 48 public int AnimationSeq;
48 private byte movementflag = 0; 49
49 private List<NewForce> forcesList = new List<NewForce>(); 50 private bool m_updateflag = false;
50 private short _updateCount = 0; 51 private byte m_movementflag = 0;
52 private readonly List<NewForce> m_forcesList = new List<NewForce>();
53 private short m_updateCount = 0;
51 54
52 private Quaternion bodyRot; 55 private Quaternion bodyRot;
53 private byte[] visualParams; 56 private byte[] visualParams;
54 private AvatarWearable[] Wearables; 57 private AvatarWearable[] Wearables;
55 private LLObject.TextureEntry m_textureEntry; 58 private LLObject.TextureEntry m_textureEntry;
56 59
57 public bool childAgent = true;
58 public bool IsRestrictedToRegion = false; 60 public bool IsRestrictedToRegion = false;
59 61
60 private bool newForce = false; 62 private bool m_newForce = false;
61 private bool newAvatar = false; 63 private bool newAvatar = false;
62 private bool newCoarseLocations = true; 64 private bool newCoarseLocations = true;
63 65
64 protected RegionInfo m_regionInfo; 66 protected RegionInfo m_regionInfo;
65 protected ulong crossingFromRegion = 0; 67 protected ulong crossingFromRegion = 0;
66 68
67 private IScenePresenceBody m_body; 69 private readonly Vector3[] Dir_Vectors = new Vector3[6];
68
69 private Vector3[] Dir_Vectors = new Vector3[6];
70 private LLVector3 lastPhysPos = new LLVector3(); 70 private LLVector3 lastPhysPos = new LLVector3();
71 71
72 private RegionPresence m_regionPresence;
73
72 private enum Dir_ControlFlags 74 private enum Dir_ControlFlags
73 { 75 {
74 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, 76 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
@@ -93,8 +95,8 @@ namespace OpenSim.Region.Environment.Scenes
93 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); 95 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>();
94 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); 96 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>();
95 97
96 private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); 98 private readonly Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
97 private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); 99 private readonly Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
98 100
99 #region Properties 101 #region Properties
100 102
@@ -109,8 +111,8 @@ namespace OpenSim.Region.Environment.Scenes
109 111
110 public bool Updated 112 public bool Updated
111 { 113 {
112 set { updateflag = value; } 114 set { m_updateflag = value; }
113 get { return updateflag; } 115 get { return m_updateflag; }
114 } 116 }
115 117
116 private readonly ulong m_regionHandle; 118 private readonly ulong m_regionHandle;
@@ -134,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes
134 private readonly IClientAPI m_controllingClient; 136 private readonly IClientAPI m_controllingClient;
135 protected PhysicsActor m_physicsActor; 137 protected PhysicsActor m_physicsActor;
136 138
137 public IClientAPI _ControllingClient 139 public IClientAPI ControllingClient
138 { 140 {
139 get { return m_controllingClient; } 141 get { return m_controllingClient; }
140 } 142 }
@@ -207,6 +209,13 @@ namespace OpenSim.Region.Environment.Scenes
207 } 209 }
208 } 210 }
209 211
212 private bool m_isChildAgent = true;
213 public bool IsChildAgent
214 {
215 get { return m_isChildAgent; }
216 set { m_isChildAgent = value; }
217 }
218
210 #endregion 219 #endregion
211 220
212 #region Constructor(s) 221 #region Constructor(s)
@@ -220,6 +229,8 @@ namespace OpenSim.Region.Environment.Scenes
220 /// <param name="regionDat"></param> 229 /// <param name="regionDat"></param>
221 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) 230 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo)
222 { 231 {
232 m_regionPresence = new RegionPresence( client );
233
223 m_scene = world; 234 m_scene = world;
224 m_uuid = client.AgentId; 235 m_uuid = client.AgentId;
225 236
@@ -262,7 +273,6 @@ namespace OpenSim.Region.Environment.Scenes
262 m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); 273 m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length);
263 274
264 //temporary until we move some code into the body classes 275 //temporary until we move some code into the body classes
265 m_body = new ChildAgent();
266 276
267 if (newAvatar) 277 if (newAvatar)
268 { 278 {
@@ -327,9 +337,9 @@ namespace OpenSim.Region.Environment.Scenes
327 /// <param name="status"></param> 337 /// <param name="status"></param>
328 public void ChildStatusChange(bool status) 338 public void ChildStatusChange(bool status)
329 { 339 {
330 childAgent = status; 340 m_isChildAgent = status;
331 341
332 if (childAgent == true) 342 if (m_isChildAgent == true)
333 { 343 {
334 Velocity = new LLVector3(0, 0, 0); 344 Velocity = new LLVector3(0, 0, 0);
335 AbsolutePosition = new LLVector3(128, 128, 70); 345 AbsolutePosition = new LLVector3(128, 128, 70);
@@ -339,7 +349,7 @@ namespace OpenSim.Region.Environment.Scenes
339 public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) 349 public void MakeAvatarPhysical(LLVector3 pos, bool isFlying)
340 { 350 {
341 newAvatar = true; 351 newAvatar = true;
342 childAgent = false; 352 m_isChildAgent = false;
343 353
344 AbsolutePosition = pos; 354 AbsolutePosition = pos;
345 355
@@ -353,7 +363,7 @@ namespace OpenSim.Region.Environment.Scenes
353 protected void MakeChildAgent() 363 protected void MakeChildAgent()
354 { 364 {
355 Velocity = new LLVector3(0, 0, 0); 365 Velocity = new LLVector3(0, 0, 0);
356 childAgent = true; 366 m_isChildAgent = true;
357 367
358 RemoveFromPhysicalScene(); 368 RemoveFromPhysicalScene();
359 369
@@ -416,9 +426,9 @@ namespace OpenSim.Region.Environment.Scenes
416 look = new LLVector3(0.99f, 0.042f, 0); 426 look = new LLVector3(0.99f, 0.042f, 0);
417 } 427 }
418 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 428 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
419 if (childAgent) 429 if (m_isChildAgent)
420 { 430 {
421 childAgent = false; 431 m_isChildAgent = false;
422 432
423 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 433 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
424 } 434 }
@@ -430,7 +440,7 @@ namespace OpenSim.Region.Environment.Scenes
430 /// <param name="pack"></param> 440 /// <param name="pack"></param>
431 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 441 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
432 { 442 {
433 if (childAgent) 443 if (m_isChildAgent)
434 { 444 {
435 Console.WriteLine("DEBUG: HandleAgentUpdate: child agent"); 445 Console.WriteLine("DEBUG: HandleAgentUpdate: child agent");
436 return; 446 return;
@@ -463,17 +473,17 @@ namespace OpenSim.Region.Environment.Scenes
463 { 473 {
464 DCFlagKeyPressed = true; 474 DCFlagKeyPressed = true;
465 agent_control_v3 += Dir_Vectors[i]; 475 agent_control_v3 += Dir_Vectors[i];
466 if ((movementflag & (uint) DCF) == 0) 476 if ((m_movementflag & (uint) DCF) == 0)
467 { 477 {
468 movementflag += (byte) (uint) DCF; 478 m_movementflag += (byte) (uint) DCF;
469 update_movementflag = true; 479 update_movementflag = true;
470 } 480 }
471 } 481 }
472 else 482 else
473 { 483 {
474 if ((movementflag & (uint) DCF) != 0) 484 if ((m_movementflag & (uint) DCF) != 0)
475 { 485 {
476 movementflag -= (byte) (uint) DCF; 486 m_movementflag -= (byte) (uint) DCF;
477 update_movementflag = true; 487 update_movementflag = true;
478 } 488 }
479 } 489 }
@@ -490,7 +500,7 @@ namespace OpenSim.Region.Environment.Scenes
490 { 500 {
491 if (update_movementflag) 501 if (update_movementflag)
492 { 502 {
493 if (movementflag != 0) 503 if (m_movementflag != 0)
494 { 504 {
495 if (m_physicsActor.Flying) 505 if (m_physicsActor.Flying)
496 { 506 {
@@ -511,7 +521,7 @@ namespace OpenSim.Region.Environment.Scenes
511 521
512 protected void AddNewMovement(Vector3 vec, Quaternion rotation) 522 protected void AddNewMovement(Vector3 vec, Quaternion rotation)
513 { 523 {
514 if (childAgent) 524 if (m_isChildAgent)
515 { 525 {
516 Console.WriteLine("DEBUG: AddNewMovement: child agent"); 526 Console.WriteLine("DEBUG: AddNewMovement: child agent");
517 return; 527 return;
@@ -527,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes
527 newVelocity.X = direc.x; 537 newVelocity.X = direc.x;
528 newVelocity.Y = direc.y; 538 newVelocity.Y = direc.y;
529 newVelocity.Z = direc.z; 539 newVelocity.Z = direc.z;
530 forcesList.Add(newVelocity); 540 m_forcesList.Add(newVelocity);
531 } 541 }
532 542
533 #endregion 543 #endregion
@@ -554,23 +564,23 @@ namespace OpenSim.Region.Environment.Scenes
554 newCoarseLocations = false; 564 newCoarseLocations = false;
555 } 565 }
556 566
557 if (childAgent == false) 567 if (m_isChildAgent == false)
558 { 568 {
559 /// check for user movement 'forces' (ie commands to move) 569 /// check for user movement 'forces' (ie commands to move)
560 if (newForce) 570 if (m_newForce)
561 { 571 {
562 SendTerseUpdateToAllClients(); 572 SendTerseUpdateToAllClients();
563 _updateCount = 0; 573 m_updateCount = 0;
564 } 574 }
565 575
566 /// check for scripted movement (?) 576 /// check for scripted movement (?)
567 else if (movementflag != 0) 577 else if (m_movementflag != 0)
568 { 578 {
569 _updateCount++; 579 m_updateCount++;
570 if (_updateCount > 3) 580 if (m_updateCount > 3)
571 { 581 {
572 SendTerseUpdateToAllClients(); 582 SendTerseUpdateToAllClients();
573 _updateCount = 0; 583 m_updateCount = 0;
574 } 584 }
575 } 585 }
576 586
@@ -578,7 +588,7 @@ namespace OpenSim.Region.Environment.Scenes
578 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) 588 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
579 { 589 {
580 SendTerseUpdateToAllClients(); 590 SendTerseUpdateToAllClients();
581 _updateCount = 0; 591 m_updateCount = 0;
582 lastPhysPos = AbsolutePosition; 592 lastPhysPos = AbsolutePosition;
583 } 593 }
584 CheckForSignificantMovement(); 594 CheckForSignificantMovement();
@@ -669,7 +679,7 @@ namespace OpenSim.Region.Environment.Scenes
669 SendFullUpdateToOtherClient(avatar); 679 SendFullUpdateToOtherClient(avatar);
670 if (avatar.LocalId != LocalId) 680 if (avatar.LocalId != LocalId)
671 { 681 {
672 if (!avatar.childAgent) 682 if (!avatar.m_isChildAgent)
673 { 683 {
674 avatar.SendFullUpdateToOtherClient(this); 684 avatar.SendFullUpdateToOtherClient(this);
675 avatar.SendAppearanceToOtherAgent(this); 685 avatar.SendAppearanceToOtherAgent(this);
@@ -685,7 +695,7 @@ namespace OpenSim.Region.Environment.Scenes
685 { 695 {
686 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, 696 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
687 AbsolutePosition, m_textureEntry.ToBytes()); 697 AbsolutePosition, m_textureEntry.ToBytes());
688 if (!childAgent) 698 if (!m_isChildAgent)
689 { 699 {
690 m_scene.InformClientOfNeighbours(m_controllingClient); 700 m_scene.InformClientOfNeighbours(m_controllingClient);
691 newAvatar = false; 701 newAvatar = false;
@@ -748,8 +758,8 @@ namespace OpenSim.Region.Environment.Scenes
748 /// <param name="seq"></param> 758 /// <param name="seq"></param>
749 public void SendAnimPack(LLUUID animID, int seq) 759 public void SendAnimPack(LLUUID animID, int seq)
750 { 760 {
751 current_anim = animID; 761 CurrentAnimation = animID;
752 anim_seq = seq; 762 AnimationSeq = seq;
753 763
754 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 764 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
755 { 765 {
@@ -763,7 +773,7 @@ namespace OpenSim.Region.Environment.Scenes
763 /// </summary> 773 /// </summary>
764 public void SendAnimPack() 774 public void SendAnimPack()
765 { 775 {
766 SendAnimPack(current_anim, anim_seq); 776 SendAnimPack(CurrentAnimation, AnimationSeq);
767 } 777 }
768 778
769 #endregion 779 #endregion
@@ -878,22 +888,22 @@ namespace OpenSim.Region.Environment.Scenes
878 /// </summary> 888 /// </summary>
879 public override void UpdateMovement() 889 public override void UpdateMovement()
880 { 890 {
881 newForce = false; 891 m_newForce = false;
882 lock (forcesList) 892 lock (m_forcesList)
883 { 893 {
884 if (forcesList.Count > 0) 894 if (m_forcesList.Count > 0)
885 { 895 {
886 for (int i = 0; i < forcesList.Count; i++) 896 for (int i = 0; i < m_forcesList.Count; i++)
887 { 897 {
888 NewForce force = forcesList[i]; 898 NewForce force = m_forcesList[i];
889 899
890 updateflag = true; 900 m_updateflag = true;
891 Velocity = new LLVector3(force.X, force.Y, force.Z); 901 Velocity = new LLVector3(force.X, force.Y, force.Z);
892 newForce = true; 902 m_newForce = true;
893 } 903 }
894 for (int i = 0; i < forcesList.Count; i++) 904 for (int i = 0; i < m_forcesList.Count; i++)
895 { 905 {
896 forcesList.RemoveAt(0); 906 m_forcesList.RemoveAt(0);
897 } 907 }
898 } 908 }
899 } 909 }