diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Environment/Scenes/ScenePresence.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6ed50b7..527eb22 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -30,11 +30,10 @@ using System.Collections.Generic; | |||
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
36 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Framework.Console; |
37 | using OpenSim.Region.Environment.Types; | 35 | using OpenSim.Region.Environment.Types; |
36 | using OpenSim.Region.Physics.Manager; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 38 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 39 | { |
@@ -116,18 +115,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
116 | } | 115 | } |
117 | 116 | ||
118 | private readonly ulong m_regionHandle; | 117 | private readonly ulong m_regionHandle; |
118 | |||
119 | public ulong RegionHandle | 119 | public ulong RegionHandle |
120 | { | 120 | { |
121 | get { return m_regionHandle; } | 121 | get { return m_regionHandle; } |
122 | } | 122 | } |
123 | 123 | ||
124 | private readonly string m_firstname; | 124 | private readonly string m_firstname; |
125 | |||
125 | public string Firstname | 126 | public string Firstname |
126 | { | 127 | { |
127 | get { return m_firstname; } | 128 | get { return m_firstname; } |
128 | } | 129 | } |
129 | 130 | ||
130 | private readonly string m_lastname; | 131 | private readonly string m_lastname; |
132 | |||
131 | public string Lastname | 133 | public string Lastname |
132 | { | 134 | { |
133 | get { return m_lastname; } | 135 | get { return m_lastname; } |
@@ -210,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
210 | } | 212 | } |
211 | 213 | ||
212 | private bool m_isChildAgent = true; | 214 | private bool m_isChildAgent = true; |
215 | |||
213 | public bool IsChildAgent | 216 | public bool IsChildAgent |
214 | { | 217 | { |
215 | get { return m_isChildAgent; } | 218 | get { return m_isChildAgent; } |
@@ -217,6 +220,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
217 | } | 220 | } |
218 | 221 | ||
219 | private uint m_parentID = 0; | 222 | private uint m_parentID = 0; |
223 | |||
220 | public uint ParentID | 224 | public uint ParentID |
221 | { | 225 | { |
222 | get { return m_parentID; } | 226 | get { return m_parentID; } |
@@ -227,7 +231,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
227 | 231 | ||
228 | #region Constructor(s) | 232 | #region Constructor(s) |
229 | 233 | ||
230 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables) | 234 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
235 | AvatarWearable[] wearables) | ||
231 | { | 236 | { |
232 | m_scene = world; | 237 | m_scene = world; |
233 | m_uuid = client.AgentId; | 238 | m_uuid = client.AgentId; |
@@ -309,24 +314,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
309 | if (update.LastFullUpdateTime < part.TimeStampFull) | 314 | if (update.LastFullUpdateTime < part.TimeStampFull) |
310 | { | 315 | { |
311 | //need to do a full update | 316 | //need to do a full update |
312 | part.SendFullUpdate(this.ControllingClient); | 317 | part.SendFullUpdate(ControllingClient); |
313 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 318 | update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
314 | updateCount++; | 319 | updateCount++; |
315 | } | 320 | } |
316 | else if (update.LastTerseUpdateTime < part.TimeStampTerse) | 321 | else if (update.LastTerseUpdateTime < part.TimeStampTerse) |
317 | { | 322 | { |
318 | part.SendTerseUpdate(this.ControllingClient); | 323 | part.SendTerseUpdate(ControllingClient); |
319 | update.LastTerseUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 324 | update.LastTerseUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
320 | updateCount++; | 325 | updateCount++; |
321 | } | 326 | } |
322 | } | 327 | } |
323 | else | 328 | else |
324 | { | 329 | { |
325 | //never been sent to client before so do full update | 330 | //never been sent to client before so do full update |
326 | part.SendFullUpdate(this.ControllingClient); | 331 | part.SendFullUpdate(ControllingClient); |
327 | ScenePartUpdate update = new ScenePartUpdate(); | 332 | ScenePartUpdate update = new ScenePartUpdate(); |
328 | update.FullID = part.UUID; | 333 | update.FullID = part.UUID; |
329 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 334 | update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
330 | m_updateTimes.Add(part.UUID, update); | 335 | m_updateTimes.Add(part.UUID, update); |
331 | updateCount++; | 336 | updateCount++; |
332 | } | 337 | } |
@@ -339,7 +344,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
339 | } | 344 | } |
340 | } | 345 | } |
341 | 346 | ||
342 | |||
343 | #region Status Methods | 347 | #region Status Methods |
344 | 348 | ||
345 | public void MakeRootAgent(LLVector3 pos, bool isFlying) | 349 | public void MakeRootAgent(LLVector3 pos, bool isFlying) |
@@ -368,10 +372,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
368 | 372 | ||
369 | private void RemoveFromPhysicalScene() | 373 | private void RemoveFromPhysicalScene() |
370 | { | 374 | { |
371 | if (this.PhysicsActor != null) | 375 | if (PhysicsActor != null) |
372 | { | 376 | { |
373 | m_scene.PhysScene.RemoveAvatar(this.PhysicsActor); | 377 | m_scene.PhysScene.RemoveAvatar(PhysicsActor); |
374 | this.PhysicsActor = null; | 378 | PhysicsActor = null; |
375 | } | 379 | } |
376 | } | 380 | } |
377 | 381 | ||
@@ -432,7 +436,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
432 | m_isChildAgent = false; | 436 | m_isChildAgent = false; |
433 | 437 | ||
434 | //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 438 | //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); |
435 | this.MakeRootAgent(this.AbsolutePosition, false); | 439 | MakeRootAgent(AbsolutePosition, false); |
436 | } | 440 | } |
437 | } | 441 | } |
438 | 442 | ||
@@ -457,13 +461,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
457 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | 461 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); |
458 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 462 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); |
459 | bool oldflying = PhysicsActor.Flying; | 463 | bool oldflying = PhysicsActor.Flying; |
460 | PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); | 464 | PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); |
461 | if (PhysicsActor.Flying != oldflying) | 465 | if (PhysicsActor.Flying != oldflying) |
462 | { | 466 | { |
463 | update_movementflag = true; | 467 | update_movementflag = true; |
464 | } | 468 | } |
465 | 469 | ||
466 | if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 470 | if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
467 | { | 471 | { |
468 | StandUp(); | 472 | StandUp(); |
469 | update_movementflag = true; | 473 | update_movementflag = true; |
@@ -477,23 +481,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
477 | 481 | ||
478 | if (m_parentID == 0) | 482 | if (m_parentID == 0) |
479 | { | 483 | { |
480 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) | 484 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) |
481 | { | 485 | { |
482 | if ((flags & (uint)DCF) != 0) | 486 | if ((flags & (uint) DCF) != 0) |
483 | { | 487 | { |
484 | DCFlagKeyPressed = true; | 488 | DCFlagKeyPressed = true; |
485 | agent_control_v3 += Dir_Vectors[i]; | 489 | agent_control_v3 += Dir_Vectors[i]; |
486 | if ((m_movementflag & (uint)DCF) == 0) | 490 | if ((m_movementflag & (uint) DCF) == 0) |
487 | { | 491 | { |
488 | m_movementflag += (byte)(uint)DCF; | 492 | m_movementflag += (byte) (uint) DCF; |
489 | update_movementflag = true; | 493 | update_movementflag = true; |
490 | } | 494 | } |
491 | } | 495 | } |
492 | else | 496 | else |
493 | { | 497 | { |
494 | if ((m_movementflag & (uint)DCF) != 0) | 498 | if ((m_movementflag & (uint) DCF) != 0) |
495 | { | 499 | { |
496 | m_movementflag -= (byte)(uint)DCF; | 500 | m_movementflag -= (byte) (uint) DCF; |
497 | update_movementflag = true; | 501 | update_movementflag = true; |
498 | } | 502 | } |
499 | } | 503 | } |
@@ -580,10 +584,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
580 | } | 584 | } |
581 | 585 | ||
582 | NewForce newVelocity = new NewForce(); | 586 | NewForce newVelocity = new NewForce(); |
583 | Vector3 direc = rotation * vec; | 587 | Vector3 direc = rotation*vec; |
584 | direc.Normalize(); | 588 | direc.Normalize(); |
585 | 589 | ||
586 | direc = direc * ((0.03f) * 128f); | 590 | direc = direc*((0.03f)*128f); |
587 | if (m_physicsActor.Flying) | 591 | if (m_physicsActor.Flying) |
588 | direc *= 4; | 592 | direc *= 4; |
589 | 593 | ||
@@ -692,8 +696,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
692 | } | 696 | } |
693 | 697 | ||
694 | 698 | ||
695 | |||
696 | |||
697 | /// <summary> | 699 | /// <summary> |
698 | /// | 700 | /// |
699 | /// </summary> | 701 | /// </summary> |
@@ -701,7 +703,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 703 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
702 | { | 704 | { |
703 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 705 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
704 | LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); | 706 | LocalId, AbsolutePosition, m_textureEntry.ToBytes(), |
707 | m_parentID); | ||
705 | } | 708 | } |
706 | 709 | ||
707 | public void SendFullUpdateToAllClients() | 710 | public void SendFullUpdateToAllClients() |
@@ -784,7 +787,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
784 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | 787 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) |
785 | { | 788 | { |
786 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, | 789 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, |
787 | m_textureEntry.ToBytes()); | 790 | m_textureEntry.ToBytes()); |
788 | } | 791 | } |
789 | 792 | ||
790 | /// <summary> | 793 | /// <summary> |
@@ -798,10 +801,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
798 | AnimationSeq = seq; | 801 | AnimationSeq = seq; |
799 | LLUUID sourceAgentId = m_controllingClient.AgentId; | 802 | LLUUID sourceAgentId = m_controllingClient.AgentId; |
800 | 803 | ||
801 | m_scene.Broadcast(delegate(IClientAPI client) | 804 | m_scene.Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, sourceAgentId); }); |
802 | { | ||
803 | client.SendAnimation(animID, seq, sourceAgentId); | ||
804 | }); | ||
805 | } | 805 | } |
806 | 806 | ||
807 | /// <summary> | 807 | /// <summary> |
@@ -842,9 +842,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
842 | LLVector3 vel = Velocity; | 842 | LLVector3 vel = Velocity; |
843 | 843 | ||
844 | float timeStep = 0.1f; | 844 | float timeStep = 0.1f; |
845 | pos2.X = pos2.X + (vel.X * timeStep); | 845 | pos2.X = pos2.X + (vel.X*timeStep); |
846 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 846 | pos2.Y = pos2.Y + (vel.Y*timeStep); |
847 | pos2.Z = pos2.Z + (vel.Z * timeStep); | 847 | pos2.Z = pos2.Z + (vel.Z*timeStep); |
848 | 848 | ||
849 | if ((pos2.X < 0) || (pos2.X > 256)) | 849 | if ((pos2.X < 0) || (pos2.X > 256)) |
850 | { | 850 | { |
@@ -889,7 +889,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
889 | } | 889 | } |
890 | 890 | ||
891 | LLVector3 vel = m_velocity; | 891 | LLVector3 vel = m_velocity; |
892 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); | 892 | ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); |
893 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 893 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
894 | if (neighbourRegion != null) | 894 | if (neighbourRegion != null) |
895 | { | 895 | { |
@@ -901,7 +901,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
901 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 901 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
902 | string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); | 902 | string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); |
903 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, | 903 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, |
904 | capsPath); | 904 | capsPath); |
905 | MakeChildAgent(); | 905 | MakeChildAgent(); |
906 | m_scene.SendKillObject(m_localId); | 906 | m_scene.SendKillObject(m_localId); |
907 | m_scene.NotifyMyCoarseLocationChange(); | 907 | m_scene.NotifyMyCoarseLocationChange(); |
@@ -980,7 +980,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
980 | LastFullUpdateTime = 0; | 980 | LastFullUpdateTime = 0; |
981 | LastTerseUpdateTime = 0; | 981 | LastTerseUpdateTime = 0; |
982 | } | 982 | } |
983 | |||
984 | } | 983 | } |
985 | 984 | ||
986 | 985 | ||
@@ -997,7 +996,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
997 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 996 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
998 | AbsolutePosition.Z); | 997 | AbsolutePosition.Z); |
999 | 998 | ||
1000 | m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec); | 999 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec); |
1001 | } | 1000 | } |
1002 | 1001 | ||
1003 | internal void Close() | 1002 | internal void Close() |
@@ -1008,7 +1007,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1008 | public void SetWearable(int wearableId, AvatarWearable wearable) | 1007 | public void SetWearable(int wearableId, AvatarWearable wearable) |
1009 | { | 1008 | { |
1010 | m_wearables[wearableId] = wearable; | 1009 | m_wearables[wearableId] = wearable; |
1011 | SendOurAppearance( m_controllingClient ); | 1010 | SendOurAppearance(m_controllingClient); |
1012 | } | 1011 | } |
1013 | } | 1012 | } |
1014 | } | 1013 | } \ No newline at end of file |