diff options
author | lbsa71 | 2007-09-20 23:47:32 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-20 23:47:32 +0000 |
commit | ca611c6668c5a063ce92feb72ce14866fc3322a3 (patch) | |
tree | 15f856675fc2d12d73c96cd7f65ab83ea1681b15 /OpenSim/Region/Environment/Scenes/ScenePresence.cs | |
parent | * Some more presence refactoring (diff) | |
download | opensim-SC-ca611c6668c5a063ce92feb72ce14866fc3322a3.zip opensim-SC-ca611c6668c5a063ce92feb72ce14866fc3322a3.tar.gz opensim-SC-ca611c6668c5a063ce92feb72ce14866fc3322a3.tar.bz2 opensim-SC-ca611c6668c5a063ce92feb72ce14866fc3322a3.tar.xz |
* even more renaming and refactoring; the cleaning woman is on call.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 101 |
1 files changed, 51 insertions, 50 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index bcffe39..c75136f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -40,10 +40,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | { | 40 | { |
41 | public partial class ScenePresence : Entity | 41 | public partial class ScenePresence : Entity |
42 | { | 42 | { |
43 | public static bool PhysicsEngineFlying = false; | ||
44 | public static AvatarAnimations Animations; | 43 | public static AvatarAnimations Animations; |
45 | public static byte[] DefaultTexture; | 44 | public static byte[] DefaultTexture; |
46 | public IClientAPI ControllingClient; | ||
47 | public LLUUID current_anim; | 45 | public LLUUID current_anim; |
48 | public int anim_seq; | 46 | public int anim_seq; |
49 | private bool updateflag = false; | 47 | private bool updateflag = false; |
@@ -56,8 +54,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
56 | private AvatarWearable[] Wearables; | 54 | private AvatarWearable[] Wearables; |
57 | private LLObject.TextureEntry m_textureEntry; | 55 | private LLObject.TextureEntry m_textureEntry; |
58 | 56 | ||
59 | private ulong m_regionHandle; | ||
60 | |||
61 | public bool childAgent = true; | 57 | public bool childAgent = true; |
62 | public bool IsRestrictedToRegion = false; | 58 | public bool IsRestrictedToRegion = false; |
63 | 59 | ||
@@ -105,10 +101,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
105 | /// <summary> | 101 | /// <summary> |
106 | /// | 102 | /// |
107 | /// </summary> | 103 | /// </summary> |
108 | public PhysicsActor PhysActor | 104 | public PhysicsActor PhysicsActor |
109 | { | 105 | { |
110 | set { _physActor = value; } | 106 | set { m_physicsActor = value; } |
111 | get { return _physActor; } | 107 | get { return m_physicsActor; } |
112 | } | 108 | } |
113 | 109 | ||
114 | public bool Updated | 110 | public bool Updated |
@@ -117,25 +113,30 @@ namespace OpenSim.Region.Environment.Scenes | |||
117 | get { return updateflag; } | 113 | get { return updateflag; } |
118 | } | 114 | } |
119 | 115 | ||
116 | private readonly ulong m_regionHandle; | ||
120 | public ulong RegionHandle | 117 | public ulong RegionHandle |
121 | { | 118 | { |
122 | get { return m_regionHandle; } | 119 | get { return m_regionHandle; } |
123 | } | 120 | } |
124 | 121 | ||
125 | private string m_firstname; | 122 | private readonly string m_firstname; |
126 | |||
127 | public string Firstname | 123 | public string Firstname |
128 | { | 124 | { |
129 | get { return m_firstname; } | 125 | get { return m_firstname; } |
130 | } | 126 | } |
131 | 127 | ||
132 | private string m_lastname; | 128 | private readonly string m_lastname; |
133 | |||
134 | public string Lastname | 129 | public string Lastname |
135 | { | 130 | { |
136 | get { return m_lastname; } | 131 | get { return m_lastname; } |
137 | } | 132 | } |
138 | 133 | ||
134 | private readonly IClientAPI m_controllingClient; | ||
135 | public IClientAPI _ControllingClient | ||
136 | { | ||
137 | get { return m_controllingClient; } | ||
138 | } | ||
139 | |||
139 | #endregion | 140 | #endregion |
140 | 141 | ||
141 | #region Constructor(s) | 142 | #region Constructor(s) |
@@ -143,23 +144,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
143 | /// <summary> | 144 | /// <summary> |
144 | /// | 145 | /// |
145 | /// </summary> | 146 | /// </summary> |
146 | /// <param name="theClient"></param> | 147 | /// <param name="client"></param> |
147 | /// <param name="world"></param> | 148 | /// <param name="world"></param> |
148 | /// <param name="clientThreads"></param> | 149 | /// <param name="clientThreads"></param> |
149 | /// <param name="regionDat"></param> | 150 | /// <param name="regionDat"></param> |
150 | public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) | 151 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) |
151 | { | 152 | { |
152 | m_scene = world; | 153 | m_scene = world; |
153 | m_uuid = theClient.AgentId; | 154 | m_uuid = client.AgentId; |
154 | 155 | ||
155 | m_regionInfo = reginfo; | 156 | m_regionInfo = reginfo; |
156 | m_regionHandle = reginfo.RegionHandle; | 157 | m_regionHandle = reginfo.RegionHandle; |
157 | MainLog.Instance.Verbose("Avatar.cs "); | 158 | MainLog.Instance.Verbose("Avatar.cs "); |
158 | ControllingClient = theClient; | 159 | m_controllingClient = client; |
159 | m_firstname = ControllingClient.FirstName; | 160 | m_firstname = m_controllingClient.FirstName; |
160 | m_lastname = ControllingClient.LastName; | 161 | m_lastname = m_controllingClient.LastName; |
161 | m_localId = m_scene.NextLocalId; | 162 | m_localId = m_scene.NextLocalId; |
162 | AbsolutePosition = ControllingClient.StartPos; | 163 | AbsolutePosition = m_controllingClient.StartPos; |
163 | 164 | ||
164 | visualParams = new byte[218]; | 165 | visualParams = new byte[218]; |
165 | for (int i = 0; i < 218; i++) | 166 | for (int i = 0; i < 218; i++) |
@@ -172,11 +173,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
172 | Animations.LoadAnims(); | 173 | Animations.LoadAnims(); |
173 | 174 | ||
174 | //register for events | 175 | //register for events |
175 | ControllingClient.OnRequestWearables += SendOurAppearance; | 176 | m_controllingClient.OnRequestWearables += SendOurAppearance; |
176 | ControllingClient.OnSetAppearance += new SetAppearance(SetAppearance); | 177 | m_controllingClient.OnSetAppearance += new SetAppearance(SetAppearance); |
177 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 178 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; |
178 | ControllingClient.OnCompleteMovementToRegion += SendInitialData; | 179 | m_controllingClient.OnCompleteMovementToRegion += SendInitialData; |
179 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; | 180 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; |
180 | // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | 181 | // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); |
181 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 182 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
182 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 183 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -221,7 +222,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | while (terse) | 222 | while (terse) |
222 | { | 223 | { |
223 | SceneObjectPart part = m_tersePartUpdates.Dequeue(); | 224 | SceneObjectPart part = m_tersePartUpdates.Dequeue(); |
224 | part.SendTerseUpdate(ControllingClient); | 225 | part.SendTerseUpdate(m_controllingClient); |
225 | terseCount++; | 226 | terseCount++; |
226 | 227 | ||
227 | if ((m_tersePartUpdates.Count < 1) | (terseCount > 30)) | 228 | if ((m_tersePartUpdates.Count < 1) | (terseCount > 30)) |
@@ -238,7 +239,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
238 | while (full) | 239 | while (full) |
239 | { | 240 | { |
240 | SceneObjectPart part = m_fullPartUpdates.Dequeue(); | 241 | SceneObjectPart part = m_fullPartUpdates.Dequeue(); |
241 | part.SendFullUpdate(ControllingClient); | 242 | part.SendFullUpdate(m_controllingClient); |
242 | fullCount++; | 243 | fullCount++; |
243 | if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) | 244 | if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) |
244 | { | 245 | { |
@@ -273,7 +274,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
273 | AbsolutePosition = pos; | 274 | AbsolutePosition = pos; |
274 | 275 | ||
275 | AddToPhysicalScene( ); | 276 | AddToPhysicalScene( ); |
276 | _physActor.Flying = isFlying; | 277 | m_physicsActor.Flying = isFlying; |
277 | 278 | ||
278 | 279 | ||
279 | m_scene.SendAllSceneObjectsToClient(this); | 280 | m_scene.SendAllSceneObjectsToClient(this); |
@@ -291,7 +292,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
291 | 292 | ||
292 | private void RemoveFromPhysicalScene() | 293 | private void RemoveFromPhysicalScene() |
293 | { | 294 | { |
294 | m_scene.PhysScene.RemoveAvatar( this.PhysActor ); | 295 | m_scene.PhysScene.RemoveAvatar( this.PhysicsActor ); |
295 | } | 296 | } |
296 | 297 | ||
297 | /// <summary> | 298 | /// <summary> |
@@ -343,7 +344,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
343 | { | 344 | { |
344 | look = new LLVector3(0.99f, 0.042f, 0); | 345 | look = new LLVector3(0.99f, 0.042f, 0); |
345 | } | 346 | } |
346 | ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 347 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
347 | if (childAgent) | 348 | if (childAgent) |
348 | { | 349 | { |
349 | childAgent = false; | 350 | childAgent = false; |
@@ -364,9 +365,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
364 | bool DCFlagKeyPressed = false; | 365 | bool DCFlagKeyPressed = false; |
365 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | 366 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); |
366 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 367 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); |
367 | bool oldflying = PhysActor.Flying; | 368 | bool oldflying = PhysicsActor.Flying; |
368 | PhysActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); | 369 | PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); |
369 | if (PhysActor.Flying != oldflying) | 370 | if (PhysicsActor.Flying != oldflying) |
370 | { | 371 | { |
371 | update_movementflag = true; | 372 | update_movementflag = true; |
372 | } | 373 | } |
@@ -411,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
411 | { | 412 | { |
412 | if (movementflag != 0) | 413 | if (movementflag != 0) |
413 | { | 414 | { |
414 | if (_physActor.Flying) | 415 | if (m_physicsActor.Flying) |
415 | { | 416 | { |
416 | SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); | 417 | SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); |
417 | } | 418 | } |
@@ -435,7 +436,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
435 | direc.Normalize(); | 436 | direc.Normalize(); |
436 | 437 | ||
437 | direc = direc*((0.03f)*128f); | 438 | direc = direc*((0.03f)*128f); |
438 | if (_physActor.Flying) | 439 | if (m_physicsActor.Flying) |
439 | direc *= 4; | 440 | direc *= 4; |
440 | 441 | ||
441 | newVelocity.X = direc.x; | 442 | newVelocity.X = direc.x; |
@@ -528,7 +529,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
528 | { | 529 | { |
529 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 530 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
530 | { | 531 | { |
531 | SendTerseUpdateToClient(presence.ControllingClient); | 532 | SendTerseUpdateToClient(presence.m_controllingClient); |
532 | }); | 533 | }); |
533 | } | 534 | } |
534 | 535 | ||
@@ -545,7 +546,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
545 | } | 546 | } |
546 | } | 547 | } |
547 | 548 | ||
548 | ControllingClient.SendCoarseLocationUpdate(CoarseLocations); | 549 | m_controllingClient.SendCoarseLocationUpdate(CoarseLocations); |
549 | } | 550 | } |
550 | 551 | ||
551 | public void CoarseLocationChange(ScenePresence avatar) | 552 | public void CoarseLocationChange(ScenePresence avatar) |
@@ -571,7 +572,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
571 | /// <param name="remoteAvatar"></param> | 572 | /// <param name="remoteAvatar"></param> |
572 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 573 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
573 | { | 574 | { |
574 | remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 575 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
575 | LocalId, AbsolutePosition, m_textureEntry.ToBytes()); | 576 | LocalId, AbsolutePosition, m_textureEntry.ToBytes()); |
576 | } | 577 | } |
577 | 578 | ||
@@ -597,11 +598,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
597 | /// </summary> | 598 | /// </summary> |
598 | public void SendInitialData() | 599 | public void SendInitialData() |
599 | { | 600 | { |
600 | ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, | 601 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, |
601 | AbsolutePosition, m_textureEntry.ToBytes()); | 602 | AbsolutePosition, m_textureEntry.ToBytes()); |
602 | if (!childAgent) | 603 | if (!childAgent) |
603 | { | 604 | { |
604 | m_scene.InformClientOfNeighbours(ControllingClient); | 605 | m_scene.InformClientOfNeighbours(m_controllingClient); |
605 | newAvatar = false; | 606 | newAvatar = false; |
606 | } | 607 | } |
607 | 608 | ||
@@ -615,13 +616,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | /// <param name="OurClient"></param> | 616 | /// <param name="OurClient"></param> |
616 | public void SendOurAppearance(IClientAPI OurClient) | 617 | public void SendOurAppearance(IClientAPI OurClient) |
617 | { | 618 | { |
618 | ControllingClient.SendWearables(Wearables); | 619 | m_controllingClient.SendWearables(Wearables); |
619 | 620 | ||
620 | //this.SendFullUpdateToAllClients(); | 621 | //this.SendFullUpdateToAllClients(); |
621 | //this.SendArrearanceToAllOtherAgents(); | 622 | //this.SendArrearanceToAllOtherAgents(); |
622 | 623 | ||
623 | m_scene.SendAllSceneObjectsToClient(this); | 624 | m_scene.SendAllSceneObjectsToClient(this); |
624 | ControllingClient.SendViewerTime(m_scene.TimePhase); | 625 | m_controllingClient.SendViewerTime(m_scene.TimePhase); |
625 | 626 | ||
626 | //Please don't remove the following code (at least not yet), just leave it commented out | 627 | //Please don't remove the following code (at least not yet), just leave it commented out |
627 | //gives the user god powers, should help with debuging things in the future | 628 | //gives the user god powers, should help with debuging things in the future |
@@ -651,7 +652,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
651 | /// <param name="avatarInfo"></param> | 652 | /// <param name="avatarInfo"></param> |
652 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | 653 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) |
653 | { | 654 | { |
654 | avatarInfo.ControllingClient.SendAppearance(ControllingClient.AgentId, visualParams, | 655 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, visualParams, |
655 | m_textureEntry.ToBytes()); | 656 | m_textureEntry.ToBytes()); |
656 | } | 657 | } |
657 | 658 | ||
@@ -667,8 +668,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
667 | 668 | ||
668 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 669 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
669 | { | 670 | { |
670 | scenePresence.ControllingClient.SendAnimation(animID, seq, | 671 | scenePresence.m_controllingClient.SendAnimation(animID, seq, |
671 | ControllingClient.AgentId); | 672 | m_controllingClient.AgentId); |
672 | }); | 673 | }); |
673 | } | 674 | } |
674 | 675 | ||
@@ -691,7 +692,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
691 | posLastSignificantMove = AbsolutePosition; | 692 | posLastSignificantMove = AbsolutePosition; |
692 | if (OnSignificantClientMovement != null) | 693 | if (OnSignificantClientMovement != null) |
693 | { | 694 | { |
694 | OnSignificantClientMovement(ControllingClient); | 695 | OnSignificantClientMovement(m_controllingClient); |
695 | NotifyMyCoarseLocationChange(); | 696 | NotifyMyCoarseLocationChange(); |
696 | } | 697 | } |
697 | } | 698 | } |
@@ -762,14 +763,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
762 | if (neighbourRegion != null) | 763 | if (neighbourRegion != null) |
763 | { | 764 | { |
764 | bool res = | 765 | bool res = |
765 | m_scene.InformNeighbourOfCrossing(neighbourHandle, ControllingClient.AgentId, newpos, | 766 | m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, |
766 | _physActor.Flying); | 767 | m_physicsActor.Flying); |
767 | if (res) | 768 | if (res) |
768 | { | 769 | { |
769 | //TODO: following line is hard coded to port 9000, really need to change this as soon as possible | 770 | //TODO: following line is hard coded to port 9000, really need to change this as soon as possible |
770 | AgentCircuitData circuitdata = ControllingClient.RequestClientInfo(); | 771 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
771 | string capsPath = Util.GetCapsURL(ControllingClient.AgentId); | 772 | string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); |
772 | ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, | 773 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, |
773 | capsPath); | 774 | capsPath); |
774 | MakeChildAgent(); | 775 | MakeChildAgent(); |
775 | m_scene.SendKillObject(m_localId); | 776 | m_scene.SendKillObject(m_localId); |
@@ -850,7 +851,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
850 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 851 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
851 | AbsolutePosition.Z); | 852 | AbsolutePosition.Z); |
852 | 853 | ||
853 | _physActor = scene.AddAvatar(pVec); | 854 | m_physicsActor = scene.AddAvatar(pVec); |
854 | } | 855 | } |
855 | } | 856 | } |
856 | } \ No newline at end of file | 857 | } \ No newline at end of file |