diff options
author | lbsa71 | 2007-09-21 03:13:49 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-21 03:13:49 +0000 |
commit | 409bcd999d19c52133f7099963febdf96d865467 (patch) | |
tree | a4853c05b6af3b17a2ee1392aca9e08ed38ac427 /OpenSim/Region/Environment/Scenes | |
parent | physics-related fixes; should stabilize border crossings (diff) | |
download | opensim-SC_OLD-409bcd999d19c52133f7099963febdf96d865467.zip opensim-SC_OLD-409bcd999d19c52133f7099963febdf96d865467.tar.gz opensim-SC_OLD-409bcd999d19c52133f7099963febdf96d865467.tar.bz2 opensim-SC_OLD-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/Scenes')
9 files changed, 91 insertions, 170 deletions
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 | */ | ||
28 | using libsecondlife; | ||
29 | using libsecondlife.Packets; | ||
30 | using OpenSim.Framework.Interfaces; | ||
31 | |||
32 | namespace 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; | |||
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.Physics.Manager; |
38 | using OpenSim.Region.Environment.Regions; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 40 | namespace 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 | } |