diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 1502 |
1 files changed, 754 insertions, 748 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 4cdf7f1..74e9cdc 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -40,111 +40,117 @@ using OpenSim.Region.Physics.Manager; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
42 | { | 42 | { |
43 | [Serializable] | 43 | [Serializable] |
44 | public class ScenePresence : EntityBase, ISerializable | 44 | public class ScenePresence : EntityBase, ISerializable |
45 | { | 45 | { |
46 | // ~ScenePresence() | 46 | // ~ScenePresence() |
47 | // { | 47 | // { |
48 | // System.Console.WriteLine("[ScenePresence] Destructor called"); | 48 | // System.Console.WriteLine("[ScenePresence] Destructor called"); |
49 | // } | 49 | // } |
50 | 50 | ||
51 | #region Delegates | ||
52 | |||
53 | public delegate void SignificantClientMovement(IClientAPI remote_client); | ||
54 | |||
55 | #endregion | ||
56 | |||
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 52 | ||
59 | public static AvatarAnimations Animations = new AvatarAnimations(); | 53 | public static AvatarAnimations Animations = new AvatarAnimations(); |
60 | public static byte[] DefaultTexture; | 54 | public static byte[] DefaultTexture; |
61 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | ||
62 | private readonly uint m_AgentControlFlags = 0; | ||
63 | 55 | ||
64 | private readonly List<LLUUID> m_animations = new List<LLUUID>(); | ||
65 | private readonly List<int> m_animationSeqs = new List<int>(); | ||
66 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); | ||
67 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); | ||
68 | private readonly List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); | ||
69 | private readonly UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | ||
70 | private readonly byte m_state = 0; | ||
71 | private readonly Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); | ||
72 | protected ulong crossingFromRegion; | ||
73 | public LLUUID currentParcelUUID = LLUUID.Zero; | 56 | public LLUUID currentParcelUUID = LLUUID.Zero; |
74 | private SignificantClientMovement handlerSignificantClientMovement; //OnSignificantClientMovement; | 57 | private List<LLUUID> m_animations = new List<LLUUID>(); |
58 | private List<int> m_animationSeqs = new List<int>(); | ||
59 | public Vector3 lastKnownAllowedPosition = new Vector3(); | ||
60 | public bool sentMessageAboutRestrictedParcelFlyingDown = false; | ||
75 | 61 | ||
76 | public bool IsRestrictedToRegion; | 62 | private bool m_updateflag = false; |
63 | private byte m_movementflag = 0; | ||
64 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); | ||
65 | private short m_updateCount = 0; | ||
66 | private uint m_requestedSitTargetID = 0; | ||
67 | private LLVector3 m_requestedSitOffset = new LLVector3(); | ||
68 | private float m_sitAvatarHeight = 2.0f; | ||
69 | private float m_godlevel = 0; | ||
70 | private LLVector3 m_LastChildAgentUpdatePosition = new LLVector3(); | ||
71 | |||
72 | private int m_perfMonMS = 0; | ||
73 | |||
74 | private bool m_setAlwaysRun = false; | ||
75 | |||
76 | private Quaternion m_bodyRot; | ||
77 | |||
78 | public bool IsRestrictedToRegion = false; | ||
77 | 79 | ||
78 | public string JID = string.Empty; | 80 | public string JID = string.Empty; |
79 | public Vector3 lastKnownAllowedPosition; | ||
80 | 81 | ||
81 | // Agent moves with a PID controller causing a force to be exerted. | 82 | // Agent moves with a PID controller causing a force to be exerted. |
82 | private LLVector3 lastPhysPos; | 83 | private bool m_newForce = false; |
83 | protected AvatarAppearance m_appearance; | 84 | private bool m_newCoarseLocations = true; |
85 | private bool m_gotAllObjectsInScene = false; | ||
84 | 86 | ||
85 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 87 | private LLVector3 m_lastVelocity = LLVector3.Zero; |
88 | |||
89 | // Default AV Height | ||
86 | private float m_avHeight = 127.0f; | 90 | private float m_avHeight = 127.0f; |
87 | private Quaternion m_bodyRot; | 91 | |
92 | protected RegionInfo m_regionInfo; | ||
93 | protected ulong crossingFromRegion = 0; | ||
94 | |||
95 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | ||
96 | private LLVector3 lastPhysPos = new LLVector3(); | ||
88 | 97 | ||
89 | // Position of agent's camera in world (region cordinates) | 98 | // Position of agent's camera in world (region cordinates) |
99 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | ||
90 | 100 | ||
91 | // Use these three vectors to figure out what the agent is looking at | 101 | // Use these three vectors to figure out what the agent is looking at |
92 | // Convert it to a Matrix and/or Quaternion | 102 | // Convert it to a Matrix and/or Quaternion |
93 | protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); | 103 | protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); |
94 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | ||
95 | protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); | 104 | protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); |
96 | protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); | 105 | protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); |
97 | protected float m_DrawDistance; | 106 | private uint m_AgentControlFlags = (uint) 0; |
98 | private float m_godlevel; | 107 | private LLQuaternion m_headrotation = new LLQuaternion(); |
99 | private bool m_gotAllObjectsInScene; | 108 | private byte m_state = (byte) 0; |
100 | private LLQuaternion m_headrotation; | ||
101 | private LLVector3 m_LastChildAgentUpdatePosition; | ||
102 | private LLVector3 m_lastVelocity = LLVector3.Zero; | ||
103 | private byte m_movementflag; | ||
104 | private bool m_newCoarseLocations = true; | ||
105 | private bool m_newForce; | ||
106 | private int m_perfMonMS; | ||
107 | protected RegionInfo m_regionInfo; | ||
108 | private LLVector3 m_requestedSitOffset; | ||
109 | private uint m_requestedSitTargetID; | ||
110 | private bool m_setAlwaysRun; | ||
111 | private float m_sitAvatarHeight = 2.0f; | ||
112 | private short m_updateCount; | ||
113 | private bool m_updateflag; | ||
114 | 109 | ||
115 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method | 110 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method |
116 | private LLVector3 movementvector; | 111 | private LLVector3 movementvector = new LLVector3(); |
117 | 112 | ||
118 | /// <summary> | 113 | private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); |
119 | /// Position at which a significant movement was made | ||
120 | /// </summary> | ||
121 | private LLVector3 posLastSignificantMove; | ||
122 | 114 | ||
123 | public bool sentMessageAboutRestrictedParcelFlyingDown; | 115 | // Agent's Draw distance. |
116 | protected float m_DrawDistance = 0f; | ||
124 | 117 | ||
125 | #region Properties | 118 | protected AvatarAppearance m_appearance; |
126 | 119 | ||
127 | private readonly string m_firstname; | 120 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
128 | private readonly string m_lastname; | 121 | |
129 | private readonly ulong m_regionHandle; | 122 | //neighbouring regions we have enabled a child agent in |
130 | protected bool m_allowMovement = true; | 123 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); |
124 | |||
125 | private SignificantClientMovement handlerSignificantClientMovement = null; //OnSignificantClientMovement; | ||
131 | 126 | ||
132 | /// <summary> | 127 | /// <summary> |
133 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager | 128 | /// Implemented Control Flags |
134 | /// </summary> | 129 | /// </summary> |
135 | private IClientAPI m_controllingClient; | 130 | private enum Dir_ControlFlags |
131 | { | ||
132 | DIR_CONTROL_FLAG_FORWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS, | ||
133 | DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, | ||
134 | DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS, | ||
135 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | ||
136 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | ||
137 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | ||
138 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | ||
139 | } | ||
136 | 140 | ||
137 | /// <summary> | 141 | /// <summary> |
138 | /// If this is true, agent doesn't have a representation in this scene. | 142 | /// Position at which a significant movement was made |
139 | /// this is an agent 'looking into' this scene from a nearby scene(region) | ||
140 | /// | ||
141 | /// if False, this agent has a representation in this scene | ||
142 | /// </summary> | 143 | /// </summary> |
143 | private bool m_isChildAgent = true; | 144 | private LLVector3 posLastSignificantMove = new LLVector3(); |
144 | 145 | ||
145 | private uint m_parentID; | 146 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
146 | protected LLVector3 m_parentPosition; | 147 | |
147 | protected PhysicsActor m_physicsActor; | 148 | public event SignificantClientMovement OnSignificantClientMovement; |
149 | |||
150 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | ||
151 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); | ||
152 | |||
153 | #region Properties | ||
148 | 154 | ||
149 | /// <summary> | 155 | /// <summary> |
150 | /// Physical scene representation of this Avatar. | 156 | /// Physical scene representation of this Avatar. |
@@ -161,6 +167,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
161 | get { return m_movementflag; } | 167 | get { return m_movementflag; } |
162 | } | 168 | } |
163 | 169 | ||
170 | public bool KnownPrim(LLUUID primID) | ||
171 | { | ||
172 | if (m_knownPrimUUID.Contains(primID)) | ||
173 | { | ||
174 | return true; | ||
175 | } | ||
176 | m_knownPrimUUID.Add(primID); | ||
177 | return false; | ||
178 | } | ||
179 | |||
164 | 180 | ||
165 | public bool Updated | 181 | public bool Updated |
166 | { | 182 | { |
@@ -168,6 +184,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
168 | get { return m_updateflag; } | 184 | get { return m_updateflag; } |
169 | } | 185 | } |
170 | 186 | ||
187 | private readonly ulong m_regionHandle; | ||
188 | |||
171 | public ulong RegionHandle | 189 | public ulong RegionHandle |
172 | { | 190 | { |
173 | get { return m_regionHandle; } | 191 | get { return m_regionHandle; } |
@@ -178,11 +196,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
178 | get { return m_CameraCenter; } | 196 | get { return m_CameraCenter; } |
179 | } | 197 | } |
180 | 198 | ||
199 | private readonly string m_firstname; | ||
200 | |||
181 | public string Firstname | 201 | public string Firstname |
182 | { | 202 | { |
183 | get { return m_firstname; } | 203 | get { return m_firstname; } |
184 | } | 204 | } |
185 | 205 | ||
206 | private readonly string m_lastname; | ||
207 | |||
186 | public string Lastname | 208 | public string Lastname |
187 | { | 209 | { |
188 | get { return m_lastname; } | 210 | get { return m_lastname; } |
@@ -193,18 +215,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
193 | get { return m_DrawDistance; } | 215 | get { return m_DrawDistance; } |
194 | } | 216 | } |
195 | 217 | ||
218 | protected bool m_allowMovement = true; | ||
219 | |||
196 | public bool AllowMovement | 220 | public bool AllowMovement |
197 | { | 221 | { |
198 | get { return m_allowMovement; } | 222 | get { return m_allowMovement; } |
199 | set { m_allowMovement = value; } | 223 | set { m_allowMovement = value; } |
200 | } | 224 | } |
201 | 225 | ||
226 | /// <summary> | ||
227 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager | ||
228 | /// </summary> | ||
229 | private IClientAPI m_controllingClient; | ||
230 | |||
231 | protected PhysicsActor m_physicsActor; | ||
232 | |||
202 | public IClientAPI ControllingClient | 233 | public IClientAPI ControllingClient |
203 | { | 234 | { |
204 | get { return m_controllingClient; } | 235 | get { return m_controllingClient; } |
205 | set { m_controllingClient = value; } | 236 | set { m_controllingClient = value; } |
206 | } | 237 | } |
207 | 238 | ||
239 | protected LLVector3 m_parentPosition = new LLVector3(); | ||
240 | |||
208 | /// <summary> | 241 | /// <summary> |
209 | /// Absolute position of this avatar in 'region cordinates' | 242 | /// Absolute position of this avatar in 'region cordinates' |
210 | /// </summary> | 243 | /// </summary> |
@@ -239,7 +272,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
239 | } | 272 | } |
240 | 273 | ||
241 | m_pos = value; | 274 | m_pos = value; |
242 | m_parentPosition = new LLVector3(0, 0, 0); | 275 | m_parentPosition=new LLVector3(0, 0, 0); |
243 | } | 276 | } |
244 | } | 277 | } |
245 | 278 | ||
@@ -280,12 +313,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
280 | } | 313 | } |
281 | } | 314 | } |
282 | 315 | ||
316 | /// <summary> | ||
317 | /// If this is true, agent doesn't have a representation in this scene. | ||
318 | /// this is an agent 'looking into' this scene from a nearby scene(region) | ||
319 | /// | ||
320 | /// if False, this agent has a representation in this scene | ||
321 | /// </summary> | ||
322 | private bool m_isChildAgent = true; | ||
323 | |||
283 | public bool IsChildAgent | 324 | public bool IsChildAgent |
284 | { | 325 | { |
285 | get { return m_isChildAgent; } | 326 | get { return m_isChildAgent; } |
286 | set { m_isChildAgent = value; } | 327 | set { m_isChildAgent = value; } |
287 | } | 328 | } |
288 | 329 | ||
330 | private uint m_parentID = 0; | ||
331 | |||
289 | public uint ParentID | 332 | public uint ParentID |
290 | { | 333 | { |
291 | get { return m_parentID; } | 334 | get { return m_parentID; } |
@@ -300,16 +343,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
300 | get { return m_knownChildRegions; } | 343 | get { return m_knownChildRegions; } |
301 | } | 344 | } |
302 | 345 | ||
303 | public bool KnownPrim(LLUUID primID) | ||
304 | { | ||
305 | if (m_knownPrimUUID.Contains(primID)) | ||
306 | { | ||
307 | return true; | ||
308 | } | ||
309 | m_knownPrimUUID.Add(primID); | ||
310 | return false; | ||
311 | } | ||
312 | |||
313 | #endregion | 346 | #endregion |
314 | 347 | ||
315 | #region Constructor(s) | 348 | #region Constructor(s) |
@@ -387,360 +420,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
387 | 420 | ||
388 | #endregion | 421 | #endregion |
389 | 422 | ||
390 | static ScenePresence() | ||
391 | { | ||
392 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
393 | DefaultTexture = textu.ToBytes(); | ||
394 | } | ||
395 | |||
396 | public ScenePresence() | ||
397 | { | ||
398 | /* JB | ||
399 | if (Animations == null) | ||
400 | { | ||
401 | Animations = new AvatarAnimations(); | ||
402 | Animations.LoadAnims(); | ||
403 | } | ||
404 | */ | ||
405 | if (DefaultTexture == null) | ||
406 | { | ||
407 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
408 | DefaultTexture = textu.ToBytes(); | ||
409 | } | ||
410 | } | ||
411 | |||
412 | protected ScenePresence(SerializationInfo info, StreamingContext context) | ||
413 | : base(info, context) | ||
414 | { | ||
415 | //System.Console.WriteLine("ScenePresence Deserialize BGN"); | ||
416 | |||
417 | if (info == null) | ||
418 | { | ||
419 | throw new ArgumentNullException("info"); | ||
420 | } | ||
421 | /* JB | ||
422 | if (Animations == null) | ||
423 | { | ||
424 | Animations = new AvatarAnimations(); | ||
425 | Animations.LoadAnims(); | ||
426 | } | ||
427 | */ | ||
428 | if (DefaultTexture == null) | ||
429 | { | ||
430 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
431 | DefaultTexture = textu.ToBytes(); | ||
432 | } | ||
433 | |||
434 | List<Guid> animations_work = (List<Guid>) info.GetValue("m_animations", typeof (List<Guid>)); | ||
435 | |||
436 | foreach (Guid guid in animations_work) | ||
437 | { | ||
438 | m_animations.Add(new LLUUID(guid)); | ||
439 | } | ||
440 | |||
441 | m_animationSeqs = (List<int>) info.GetValue("m_animationSeqs", typeof (List<int>)); | ||
442 | m_updateflag = (bool) info.GetValue("m_updateflag", typeof (bool)); | ||
443 | m_movementflag = (byte) info.GetValue("m_movementflag", typeof (byte)); | ||
444 | m_forcesList = (List<NewForce>) info.GetValue("m_forcesList", typeof (List<NewForce>)); | ||
445 | m_updateCount = (short) info.GetValue("m_updateCount", typeof (short)); | ||
446 | m_requestedSitTargetID = (uint) info.GetValue("m_requestedSitTargetID", typeof (uint)); | ||
447 | |||
448 | m_requestedSitOffset | ||
449 | = new LLVector3( | ||
450 | (float) info.GetValue("m_requestedSitOffset.X", typeof (float)), | ||
451 | (float) info.GetValue("m_requestedSitOffset.Y", typeof (float)), | ||
452 | (float) info.GetValue("m_requestedSitOffset.Z", typeof (float))); | ||
453 | |||
454 | m_sitAvatarHeight = (float) info.GetValue("m_sitAvatarHeight", typeof (float)); | ||
455 | m_godlevel = (float) info.GetValue("m_godlevel", typeof (float)); | ||
456 | m_setAlwaysRun = (bool) info.GetValue("m_setAlwaysRun", typeof (bool)); | ||
457 | |||
458 | m_bodyRot | ||
459 | = new Quaternion( | ||
460 | (float) info.GetValue("m_bodyRot.w", typeof (float)), | ||
461 | (float) info.GetValue("m_bodyRot.x", typeof (float)), | ||
462 | (float) info.GetValue("m_bodyRot.y", typeof (float)), | ||
463 | (float) info.GetValue("m_bodyRot.z", typeof (float))); | ||
464 | |||
465 | IsRestrictedToRegion = (bool) info.GetValue("IsRestrictedToRegion", typeof (bool)); | ||
466 | m_newForce = (bool) info.GetValue("m_newForce", typeof (bool)); | ||
467 | //m_newAvatar = (bool)info.GetValue("m_newAvatar", typeof(bool)); | ||
468 | m_newCoarseLocations = (bool) info.GetValue("m_newCoarseLocations", typeof (bool)); | ||
469 | m_gotAllObjectsInScene = (bool) info.GetValue("m_gotAllObjectsInScene", typeof (bool)); | ||
470 | m_avHeight = (float) info.GetValue("m_avHeight", typeof (float)); | ||
471 | crossingFromRegion = (ulong) info.GetValue("crossingFromRegion", typeof (ulong)); | ||
472 | |||
473 | List<float[]> Dir_Vectors_work = (List<float[]>) info.GetValue("Dir_Vectors", typeof (List<float[]>)); | ||
474 | List<Vector3> Dir_Vectors_work2 = new List<Vector3>(); | ||
475 | |||
476 | foreach (float[] f3 in Dir_Vectors_work) | ||
477 | { | ||
478 | Dir_Vectors_work2.Add(new Vector3(f3[0], f3[1], f3[2])); | ||
479 | } | ||
480 | |||
481 | Dir_Vectors = Dir_Vectors_work2.ToArray(); | ||
482 | |||
483 | lastPhysPos | ||
484 | = new LLVector3( | ||
485 | (float) info.GetValue("lastPhysPos.X", typeof (float)), | ||
486 | (float) info.GetValue("lastPhysPos.Y", typeof (float)), | ||
487 | (float) info.GetValue("lastPhysPos.Z", typeof (float))); | ||
488 | |||
489 | m_CameraCenter | ||
490 | = new Vector3( | ||
491 | (float) info.GetValue("m_CameraCenter.X", typeof (float)), | ||
492 | (float) info.GetValue("m_CameraCenter.Y", typeof (float)), | ||
493 | (float) info.GetValue("m_CameraCenter.Z", typeof (float))); | ||
494 | |||
495 | m_CameraAtAxis | ||
496 | = new Vector3( | ||
497 | (float) info.GetValue("m_CameraAtAxis.X", typeof (float)), | ||
498 | (float) info.GetValue("m_CameraAtAxis.Y", typeof (float)), | ||
499 | (float) info.GetValue("m_CameraAtAxis.Z", typeof (float))); | ||
500 | |||
501 | m_CameraLeftAxis | ||
502 | = new Vector3( | ||
503 | (float) info.GetValue("m_CameraLeftAxis.X", typeof (float)), | ||
504 | (float) info.GetValue("m_CameraLeftAxis.Y", typeof (float)), | ||
505 | (float) info.GetValue("m_CameraLeftAxis.Z", typeof (float))); | ||
506 | |||
507 | m_CameraUpAxis | ||
508 | = new Vector3( | ||
509 | (float) info.GetValue("m_CameraUpAxis.X", typeof (float)), | ||
510 | (float) info.GetValue("m_CameraUpAxis.Y", typeof (float)), | ||
511 | (float) info.GetValue("m_CameraUpAxis.Z", typeof (float))); | ||
512 | |||
513 | m_DrawDistance = (float) info.GetValue("m_DrawDistance", typeof (float)); | ||
514 | m_appearance = (AvatarAppearance) info.GetValue("m_appearance", typeof (AvatarAppearance)); | ||
515 | m_knownChildRegions = (List<ulong>) info.GetValue("m_knownChildRegions", typeof (List<ulong>)); | ||
516 | |||
517 | posLastSignificantMove | ||
518 | = new LLVector3( | ||
519 | (float) info.GetValue("posLastSignificantMove.X", typeof (float)), | ||
520 | (float) info.GetValue("posLastSignificantMove.Y", typeof (float)), | ||
521 | (float) info.GetValue("posLastSignificantMove.Z", typeof (float))); | ||
522 | |||
523 | // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue)); | ||
524 | |||
525 | /* | ||
526 | Dictionary<Guid, ScenePartUpdate> updateTimes_work | ||
527 | = (Dictionary<Guid, ScenePartUpdate>)info.GetValue("m_updateTimes", typeof(Dictionary<Guid, ScenePartUpdate>)); | ||
528 | |||
529 | foreach (Guid id in updateTimes_work.Keys) | ||
530 | { | ||
531 | m_updateTimes.Add(new LLUUID(id), updateTimes_work[id]); | ||
532 | } | ||
533 | */ | ||
534 | m_regionHandle = (ulong) info.GetValue("m_regionHandle", typeof (ulong)); | ||
535 | m_firstname = (string) info.GetValue("m_firstname", typeof (string)); | ||
536 | m_lastname = (string) info.GetValue("m_lastname", typeof (string)); | ||
537 | m_allowMovement = (bool) info.GetValue("m_allowMovement", typeof (bool)); | ||
538 | m_parentPosition = new LLVector3((float) info.GetValue("m_parentPosition.X", typeof (float)), | ||
539 | (float) info.GetValue("m_parentPosition.Y", typeof (float)), | ||
540 | (float) info.GetValue("m_parentPosition.Z", typeof (float))); | ||
541 | |||
542 | m_isChildAgent = (bool) info.GetValue("m_isChildAgent", typeof (bool)); | ||
543 | m_parentID = (uint) info.GetValue("m_parentID", typeof (uint)); | ||
544 | |||
545 | // for OpenSim_v0.5 | ||
546 | currentParcelUUID = new LLUUID((Guid) info.GetValue("currentParcelUUID", typeof (Guid))); | ||
547 | |||
548 | lastKnownAllowedPosition | ||
549 | = new Vector3( | ||
550 | (float) info.GetValue("lastKnownAllowedPosition.X", typeof (float)), | ||
551 | (float) info.GetValue("lastKnownAllowedPosition.Y", typeof (float)), | ||
552 | (float) info.GetValue("lastKnownAllowedPosition.Z", typeof (float))); | ||
553 | |||
554 | sentMessageAboutRestrictedParcelFlyingDown = (bool) info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof (bool)); | ||
555 | |||
556 | m_LastChildAgentUpdatePosition | ||
557 | = new LLVector3( | ||
558 | (float) info.GetValue("m_LastChildAgentUpdatePosition.X", typeof (float)), | ||
559 | (float) info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof (float)), | ||
560 | (float) info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof (float))); | ||
561 | |||
562 | m_perfMonMS = (int) info.GetValue("m_perfMonMS", typeof (int)); | ||
563 | m_AgentControlFlags = (uint) info.GetValue("m_AgentControlFlags", typeof (uint)); | ||
564 | |||
565 | m_headrotation | ||
566 | = new LLQuaternion( | ||
567 | (float) info.GetValue("m_headrotation.W", typeof (float)), | ||
568 | (float) info.GetValue("m_headrotation.X", typeof (float)), | ||
569 | (float) info.GetValue("m_headrotation.Y", typeof (float)), | ||
570 | (float) info.GetValue("m_headrotation.Z", typeof (float))); | ||
571 | |||
572 | m_state = (byte) info.GetValue("m_state", typeof (byte)); | ||
573 | |||
574 | List<Guid> knownPrimUUID_work = (List<Guid>) info.GetValue("m_knownPrimUUID", typeof (List<Guid>)); | ||
575 | |||
576 | foreach (Guid id in knownPrimUUID_work) | ||
577 | { | ||
578 | m_knownPrimUUID.Add(new LLUUID(id)); | ||
579 | } | ||
580 | |||
581 | //System.Console.WriteLine("ScenePresence Deserialize END"); | ||
582 | } | ||
583 | |||
584 | #region ISerializable Members | ||
585 | |||
586 | [SecurityPermission(SecurityAction.LinkDemand, | ||
587 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
588 | public override void GetObjectData( | ||
589 | SerializationInfo info, StreamingContext context) | ||
590 | { | ||
591 | if (info == null) | ||
592 | { | ||
593 | throw new ArgumentNullException("info"); | ||
594 | } | ||
595 | |||
596 | base.GetObjectData(info, context); | ||
597 | |||
598 | List<Guid> animations_work = new List<Guid>(); | ||
599 | |||
600 | foreach (LLUUID uuid in m_animations) | ||
601 | { | ||
602 | animations_work.Add(uuid.UUID); | ||
603 | } | ||
604 | |||
605 | info.AddValue("m_animations", animations_work); | ||
606 | |||
607 | info.AddValue("m_animationSeqs", m_animationSeqs); | ||
608 | info.AddValue("m_updateflag", m_updateflag); | ||
609 | info.AddValue("m_movementflag", m_movementflag); | ||
610 | info.AddValue("m_forcesList", m_forcesList); | ||
611 | info.AddValue("m_updateCount", m_updateCount); | ||
612 | info.AddValue("m_requestedSitTargetID", m_requestedSitTargetID); | ||
613 | |||
614 | // LLVector3 | ||
615 | info.AddValue("m_requestedSitOffset.X", m_requestedSitOffset.X); | ||
616 | info.AddValue("m_requestedSitOffset.Y", m_requestedSitOffset.Y); | ||
617 | info.AddValue("m_requestedSitOffset.Z", m_requestedSitOffset.Z); | ||
618 | |||
619 | info.AddValue("m_sitAvatarHeight", m_sitAvatarHeight); | ||
620 | info.AddValue("m_godlevel", m_godlevel); | ||
621 | info.AddValue("m_setAlwaysRun", m_setAlwaysRun); | ||
622 | |||
623 | // Quaternion | ||
624 | info.AddValue("m_bodyRot.w", m_bodyRot.w); | ||
625 | info.AddValue("m_bodyRot.x", m_bodyRot.x); | ||
626 | info.AddValue("m_bodyRot.y", m_bodyRot.y); | ||
627 | info.AddValue("m_bodyRot.z", m_bodyRot.z); | ||
628 | |||
629 | info.AddValue("IsRestrictedToRegion", IsRestrictedToRegion); | ||
630 | info.AddValue("m_newForce", m_newForce); | ||
631 | //info.AddValue("m_newAvatar", m_newAvatar); | ||
632 | info.AddValue("m_newCoarseLocations", m_newCoarseLocations); | ||
633 | info.AddValue("m_gotAllObjectsInScene", m_gotAllObjectsInScene); | ||
634 | info.AddValue("m_avHeight", m_avHeight); | ||
635 | |||
636 | // info.AddValue("m_regionInfo", m_regionInfo); | ||
637 | |||
638 | info.AddValue("crossingFromRegion", crossingFromRegion); | ||
639 | |||
640 | List<float[]> Dir_Vectors_work = new List<float[]>(); | ||
641 | |||
642 | foreach (Vector3 v3 in Dir_Vectors) | ||
643 | { | ||
644 | Dir_Vectors_work.Add(new[] {v3.x, v3.y, v3.z}); | ||
645 | } | ||
646 | |||
647 | info.AddValue("Dir_Vectors", Dir_Vectors_work); | ||
648 | |||
649 | // LLVector3 | ||
650 | info.AddValue("lastPhysPos.X", lastPhysPos.X); | ||
651 | info.AddValue("lastPhysPos.Y", lastPhysPos.Y); | ||
652 | info.AddValue("lastPhysPos.Z", lastPhysPos.Z); | ||
653 | |||
654 | // Vector3 | ||
655 | info.AddValue("m_CameraCenter.X", m_CameraCenter.x); | ||
656 | info.AddValue("m_CameraCenter.Y", m_CameraCenter.y); | ||
657 | info.AddValue("m_CameraCenter.Z", m_CameraCenter.z); | ||
658 | |||
659 | // Vector3 | ||
660 | info.AddValue("m_CameraAtAxis.X", m_CameraAtAxis.x); | ||
661 | info.AddValue("m_CameraAtAxis.Y", m_CameraAtAxis.y); | ||
662 | info.AddValue("m_CameraAtAxis.Z", m_CameraAtAxis.z); | ||
663 | |||
664 | // Vector3 | ||
665 | info.AddValue("m_CameraLeftAxis.X", m_CameraLeftAxis.x); | ||
666 | info.AddValue("m_CameraLeftAxis.Y", m_CameraLeftAxis.y); | ||
667 | info.AddValue("m_CameraLeftAxis.Z", m_CameraLeftAxis.z); | ||
668 | |||
669 | // Vector3 | ||
670 | info.AddValue("m_CameraUpAxis.X", m_CameraUpAxis.x); | ||
671 | info.AddValue("m_CameraUpAxis.Y", m_CameraUpAxis.y); | ||
672 | info.AddValue("m_CameraUpAxis.Z", m_CameraUpAxis.z); | ||
673 | |||
674 | info.AddValue("m_DrawDistance", m_DrawDistance); | ||
675 | info.AddValue("m_appearance", m_appearance); | ||
676 | info.AddValue("m_knownChildRegions", m_knownChildRegions); | ||
677 | |||
678 | // LLVector3 | ||
679 | info.AddValue("posLastSignificantMove.X", posLastSignificantMove.X); | ||
680 | info.AddValue("posLastSignificantMove.Y", posLastSignificantMove.Y); | ||
681 | info.AddValue("posLastSignificantMove.Z", posLastSignificantMove.Z); | ||
682 | |||
683 | //info.AddValue("m_partsUpdateQueue", m_partsUpdateQueue); | ||
684 | |||
685 | /* | ||
686 | Dictionary<Guid, ScenePartUpdate> updateTimes_work = new Dictionary<Guid, ScenePartUpdate>(); | ||
687 | |||
688 | foreach ( LLUUID id in m_updateTimes.Keys) | ||
689 | { | ||
690 | updateTimes_work.Add(id.UUID, m_updateTimes[id]); | ||
691 | } | ||
692 | |||
693 | info.AddValue("m_updateTimes", updateTimes_work); | ||
694 | */ | ||
695 | |||
696 | info.AddValue("m_regionHandle", m_regionHandle); | ||
697 | info.AddValue("m_firstname", m_firstname); | ||
698 | info.AddValue("m_lastname", m_lastname); | ||
699 | info.AddValue("m_allowMovement", m_allowMovement); | ||
700 | //info.AddValue("m_physicsActor", m_physicsActor); | ||
701 | info.AddValue("m_parentPosition.X", m_parentPosition.X); | ||
702 | info.AddValue("m_parentPosition.Y", m_parentPosition.Y); | ||
703 | info.AddValue("m_parentPosition.Z", m_parentPosition.Z); | ||
704 | info.AddValue("m_isChildAgent", m_isChildAgent); | ||
705 | info.AddValue("m_parentID", m_parentID); | ||
706 | |||
707 | // for OpenSim_v0.5 | ||
708 | info.AddValue("currentParcelUUID", currentParcelUUID.UUID); | ||
709 | |||
710 | info.AddValue("lastKnownAllowedPosition.X", lastKnownAllowedPosition.x); | ||
711 | info.AddValue("lastKnownAllowedPosition.Y", lastKnownAllowedPosition.y); | ||
712 | info.AddValue("lastKnownAllowedPosition.Z", lastKnownAllowedPosition.z); | ||
713 | |||
714 | info.AddValue("sentMessageAboutRestrictedParcelFlyingDown", sentMessageAboutRestrictedParcelFlyingDown); | ||
715 | |||
716 | info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X); | ||
717 | info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y); | ||
718 | info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z); | ||
719 | |||
720 | info.AddValue("m_perfMonMS", m_perfMonMS); | ||
721 | info.AddValue("m_AgentControlFlags", m_AgentControlFlags); | ||
722 | |||
723 | info.AddValue("m_headrotation.W", m_headrotation.W); | ||
724 | info.AddValue("m_headrotation.X", m_headrotation.X); | ||
725 | info.AddValue("m_headrotation.Y", m_headrotation.Y); | ||
726 | info.AddValue("m_headrotation.Z", m_headrotation.Z); | ||
727 | |||
728 | info.AddValue("m_state", m_state); | ||
729 | |||
730 | List<Guid> knownPrimUUID_work = new List<Guid>(); | ||
731 | |||
732 | foreach (LLUUID id in m_knownPrimUUID) | ||
733 | { | ||
734 | knownPrimUUID_work.Add(id.UUID); | ||
735 | } | ||
736 | |||
737 | info.AddValue("m_knownPrimUUID", knownPrimUUID_work); | ||
738 | } | ||
739 | |||
740 | #endregion | ||
741 | |||
742 | public event SignificantClientMovement OnSignificantClientMovement; | ||
743 | |||
744 | /// <summary> | 423 | /// <summary> |
745 | /// Add the part to the queue of parts for which we need to send an update to the client | 424 | /// Add the part to the queue of parts for which we need to send an update to the client |
746 | /// </summary> | 425 | /// </summary> |
@@ -778,12 +457,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
778 | if (!m_gotAllObjectsInScene) | 457 | if (!m_gotAllObjectsInScene) |
779 | { | 458 | { |
780 | if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor) | 459 | if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor) |
781 | { | 460 | { |
782 | m_scene.SendAllSceneObjectsToClient(this); | 461 | m_scene.SendAllSceneObjectsToClient(this); |
783 | m_gotAllObjectsInScene = true; | 462 | m_gotAllObjectsInScene = true; |
784 | } | 463 | } |
785 | } | 464 | } |
786 | 465 | ||
787 | if (m_partsUpdateQueue.Count > 0) | 466 | if (m_partsUpdateQueue.Count > 0) |
788 | { | 467 | { |
789 | bool runUpdate = true; | 468 | bool runUpdate = true; |
@@ -802,7 +481,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
802 | // m_log.DebugFormat( | 481 | // m_log.DebugFormat( |
803 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", | 482 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", |
804 | // part.Name, part.UUID, part.TimeStampFull); | 483 | // part.Name, part.UUID, part.TimeStampFull); |
805 | 484 | ||
806 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); | 485 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); |
807 | 486 | ||
808 | // We'll update to the part's timestamp rather than the current time to | 487 | // We'll update to the part's timestamp rather than the current time to |
@@ -818,7 +497,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
818 | // m_log.DebugFormat( | 497 | // m_log.DebugFormat( |
819 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", | 498 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", |
820 | // part.Name, part.UUID, part.TimeStampTerse); | 499 | // part.Name, part.UUID, part.TimeStampTerse); |
821 | 500 | ||
822 | part.SendTerseUpdate(ControllingClient); | 501 | part.SendTerseUpdate(ControllingClient); |
823 | 502 | ||
824 | update.LastTerseUpdateTime = part.TimeStampTerse; | 503 | update.LastTerseUpdateTime = part.TimeStampTerse; |
@@ -851,235 +530,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
851 | AddNewMovement(position, rotation); | 530 | AddNewMovement(position, rotation); |
852 | } | 531 | } |
853 | 532 | ||
854 | /// <summary> | ||
855 | /// This allows the Sim owner the abiility to kick users from their sim currently. | ||
856 | /// It tells the client that the agent has permission to do so. | ||
857 | /// </summary> | ||
858 | public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, bool godStatus) | ||
859 | { | ||
860 | GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); | ||
861 | GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); | ||
862 | GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); | ||
863 | |||
864 | adb.AgentID = agentID; | ||
865 | adb.SessionID = sessionID; // More security | ||
866 | |||
867 | if (godStatus) | ||
868 | { | ||
869 | gdb.GodLevel = 250; | ||
870 | m_godlevel = 250; | ||
871 | } | ||
872 | else | ||
873 | { | ||
874 | gdb.GodLevel = 0; | ||
875 | m_godlevel = 0; | ||
876 | } | ||
877 | |||
878 | gdb.Token = token; | ||
879 | //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; | ||
880 | respondPacket.GrantData = gdb; | ||
881 | respondPacket.AgentData = adb; | ||
882 | ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); | ||
883 | } | ||
884 | |||
885 | /// <summary> | ||
886 | /// This updates important decision making data about a child agent | ||
887 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | ||
888 | /// </summary> | ||
889 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) | ||
890 | { | ||
891 | // | ||
892 | int shiftx = ((int) rRegionX - (int) tRegionX) * (int) Constants.RegionSize; | ||
893 | int shifty = ((int) rRegionY - (int) tRegionY) * (int) Constants.RegionSize; | ||
894 | |||
895 | m_DrawDistance = cAgentData.drawdistance; | ||
896 | m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); | ||
897 | |||
898 | // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region | ||
899 | m_CameraCenter = | ||
900 | new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); | ||
901 | |||
902 | |||
903 | m_godlevel = cAgentData.godlevel; | ||
904 | SetHeight(cAgentData.AVHeight); | ||
905 | |||
906 | ControllingClient.SetChildAgentThrottle(cAgentData.throttles); | ||
907 | |||
908 | |||
909 | // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. | ||
910 | if (m_scene.m_seeIntoRegionFromNeighbor) | ||
911 | m_scene.SendAllSceneObjectsToClient(this); | ||
912 | //cAgentData.AVHeight; | ||
913 | //cAgentData.regionHandle; | ||
914 | //m_velocity = cAgentData.Velocity; | ||
915 | } | ||
916 | |||
917 | /// <summary> | ||
918 | /// Handles part of the PID controller function for moving an avatar. | ||
919 | /// </summary> | ||
920 | public override void UpdateMovement() | ||
921 | { | ||
922 | m_newForce = false; | ||
923 | lock (m_forcesList) | ||
924 | { | ||
925 | if (m_forcesList.Count > 0) | ||
926 | { | ||
927 | for (int i = 0; i < m_forcesList.Count; i++) | ||
928 | { | ||
929 | NewForce force = m_forcesList[i]; | ||
930 | |||
931 | m_updateflag = true; | ||
932 | try | ||
933 | { | ||
934 | movementvector.X = force.X; | ||
935 | movementvector.Y = force.Y; | ||
936 | movementvector.Z = force.Z; | ||
937 | Velocity = movementvector; | ||
938 | } | ||
939 | catch (NullReferenceException) | ||
940 | { | ||
941 | // Under extreme load, this returns a NullReference Exception that we can ignore. | ||
942 | // Ignoring this causes no movement to be sent to the physics engine... | ||
943 | // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! | ||
944 | } | ||
945 | m_newForce = true; | ||
946 | } | ||
947 | for (int i = 0; i < m_forcesList.Count; i++) | ||
948 | { | ||
949 | m_forcesList.RemoveAt(0); | ||
950 | } | ||
951 | } | ||
952 | } | ||
953 | } | ||
954 | |||
955 | public override void SetText(string text, Vector3 color, double alpha) | ||
956 | { | ||
957 | throw new Exception("Can't set Text on avatar."); | ||
958 | } | ||
959 | |||
960 | /// <summary> | ||
961 | /// Adds a physical representation of the avatar to the Physics plugin | ||
962 | /// </summary> | ||
963 | public void AddToPhysicalScene() | ||
964 | { | ||
965 | PhysicsScene scene = m_scene.PhysicsScene; | ||
966 | |||
967 | PhysicsVector pVec = | ||
968 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | ||
969 | AbsolutePosition.Z); | ||
970 | if (m_avHeight == 127.0f) | ||
971 | { | ||
972 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f)); | ||
973 | } | ||
974 | else | ||
975 | { | ||
976 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight)); | ||
977 | } | ||
978 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | ||
979 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | ||
980 | m_physicsActor.LocalID = LocalId; | ||
981 | } | ||
982 | |||
983 | // Event called by the physics plugin to tell the avatar about a collision. | ||
984 | private void PhysicsCollisionUpdate(EventArgs e) | ||
985 | { | ||
986 | bool isUserMoving = Velocity.X > 0 || Velocity.Y > 0; | ||
987 | UpdateMovementAnimations(isUserMoving); | ||
988 | } | ||
989 | |||
990 | internal void Close() | ||
991 | { | ||
992 | lock (m_attachments) | ||
993 | { | ||
994 | foreach (SceneObjectGroup grp in m_attachments) | ||
995 | { | ||
996 | // ControllingClient may be null at this point! | ||
997 | m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient); | ||
998 | } | ||
999 | m_attachments.Clear(); | ||
1000 | } | ||
1001 | lock (m_knownPrimUUID) | ||
1002 | { | ||
1003 | m_knownPrimUUID.Clear(); | ||
1004 | } | ||
1005 | lock (m_knownChildRegions) | ||
1006 | { | ||
1007 | m_knownChildRegions.Clear(); | ||
1008 | } | ||
1009 | lock (m_updateTimes) | ||
1010 | { | ||
1011 | m_updateTimes.Clear(); | ||
1012 | } | ||
1013 | lock (m_partsUpdateQueue) | ||
1014 | { | ||
1015 | m_partsUpdateQueue.Clear(); | ||
1016 | } | ||
1017 | |||
1018 | RemoveFromPhysicalScene(); | ||
1019 | GC.Collect(); | ||
1020 | } | ||
1021 | |||
1022 | public void AddAttachment(SceneObjectGroup gobj) | ||
1023 | { | ||
1024 | lock (m_attachments) | ||
1025 | { | ||
1026 | m_attachments.Add(gobj); | ||
1027 | } | ||
1028 | } | ||
1029 | |||
1030 | public void RemoveAttachment(SceneObjectGroup gobj) | ||
1031 | { | ||
1032 | lock (m_attachments) | ||
1033 | { | ||
1034 | if (m_attachments.Contains(gobj)) | ||
1035 | { | ||
1036 | m_attachments.Remove(gobj); | ||
1037 | } | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | ||
1042 | { | ||
1043 | lock (m_attachments) | ||
1044 | { | ||
1045 | foreach (SceneObjectGroup gobj in m_attachments) | ||
1046 | { | ||
1047 | // If the prim group is null then something must have happened to it! | ||
1048 | if (gobj != null) | ||
1049 | { | ||
1050 | // Set the parent localID to 0 so it transfers over properly. | ||
1051 | gobj.RootPart.SetParentLocalId(0); | ||
1052 | gobj.RootPart.m_IsAttachment = false; | ||
1053 | gobj.AbsolutePosition = gobj.RootPart.m_attachedPos; | ||
1054 | gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
1055 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); | ||
1056 | } | ||
1057 | } | ||
1058 | m_attachments.Clear(); | ||
1059 | } | ||
1060 | } | ||
1061 | |||
1062 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | ||
1063 | { | ||
1064 | m_controllingClient = client; | ||
1065 | m_regionInfo = region; | ||
1066 | m_scene = scene; | ||
1067 | RegisterToEvents(); | ||
1068 | |||
1069 | /* | ||
1070 | AbsolutePosition = client.StartPos; | ||
1071 | |||
1072 | Animations = new AvatarAnimations(); | ||
1073 | Animations.LoadAnims(); | ||
1074 | |||
1075 | m_animations = new List<LLUUID>(); | ||
1076 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | ||
1077 | m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber); | ||
1078 | |||
1079 | SetDirectionVectors(); | ||
1080 | */ | ||
1081 | } | ||
1082 | |||
1083 | #region Status Methods | 533 | #region Status Methods |
1084 | 534 | ||
1085 | /// <summary> | 535 | /// <summary> |
@@ -1092,7 +542,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1092 | // m_log.DebugFormat( | 542 | // m_log.DebugFormat( |
1093 | // "[SCENEPRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2}", | 543 | // "[SCENEPRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2}", |
1094 | // Name, UUID, m_scene.RegionInfo.RegionName); | 544 | // Name, UUID, m_scene.RegionInfo.RegionName); |
1095 | 545 | ||
1096 | m_isChildAgent = false; | 546 | m_isChildAgent = false; |
1097 | 547 | ||
1098 | AbsolutePosition = pos; | 548 | AbsolutePosition = pos; |
@@ -1108,7 +558,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1108 | //{ | 558 | //{ |
1109 | m_scene.SendAllSceneObjectsToClient(this); | 559 | m_scene.SendAllSceneObjectsToClient(this); |
1110 | m_scene.LandChannel.sendLandUpdate(this, true); | 560 | m_scene.LandChannel.sendLandUpdate(this, true); |
1111 | 561 | ||
1112 | //m_gotAllObjectsInScene = true; | 562 | //m_gotAllObjectsInScene = true; |
1113 | //} | 563 | //} |
1114 | } | 564 | } |
@@ -1122,9 +572,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1122 | /// </summary> | 572 | /// </summary> |
1123 | public void MakeChildAgent() | 573 | public void MakeChildAgent() |
1124 | { | 574 | { |
1125 | if (m_animations.Count > 0) | 575 | if(m_animations.Count > 0) |
1126 | { | 576 | { |
1127 | LLUUID movement = m_animations[0]; | 577 | LLUUID movement=m_animations[0]; |
1128 | 578 | ||
1129 | m_animations.Clear(); | 579 | m_animations.Clear(); |
1130 | m_animationSeqs.Clear(); | 580 | m_animationSeqs.Clear(); |
@@ -1134,7 +584,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1134 | // m_log.DebugFormat( | 584 | // m_log.DebugFormat( |
1135 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", | 585 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", |
1136 | // Name, UUID, m_scene.RegionInfo.RegionName); | 586 | // Name, UUID, m_scene.RegionInfo.RegionName); |
1137 | 587 | ||
1138 | Velocity = new LLVector3(0, 0, 0); | 588 | Velocity = new LLVector3(0, 0, 0); |
1139 | m_isChildAgent = true; | 589 | m_isChildAgent = true; |
1140 | m_scene.SwapRootAgentCount(true); | 590 | m_scene.SwapRootAgentCount(true); |
@@ -1391,8 +841,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1391 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 841 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1392 | 842 | ||
1393 | // Are the collision requirements fulfilled? | 843 | // Are the collision requirements fulfilled? |
1394 | bool colliding = m_physicsActor.IsColliding; | 844 | bool colliding = (m_physicsActor.IsColliding == true); |
1395 | 845 | ||
846 | |||
1396 | 847 | ||
1397 | if (m_physicsActor.Flying && colliding && controlland) | 848 | if (m_physicsActor.Flying && colliding && controlland) |
1398 | { | 849 | { |
@@ -1406,9 +857,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1406 | UpdateMovementAnimations(update_movementflag); | 857 | UpdateMovementAnimations(update_movementflag); |
1407 | } | 858 | } |
1408 | } | 859 | } |
1409 | 860 | ||
1410 | m_scene.EventManager.TriggerOnClientMovement(this); | 861 | m_scene.EventManager.TriggerOnClientMovement(this); |
1411 | 862 | ||
1412 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 863 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
1413 | } | 864 | } |
1414 | 865 | ||
@@ -1435,9 +886,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1435 | AddToPhysicalScene(); | 886 | AddToPhysicalScene(); |
1436 | } | 887 | } |
1437 | 888 | ||
1438 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | 889 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
1439 | m_parentPosition = new LLVector3(); | 890 | m_parentPosition = new LLVector3(); |
1440 | 891 | ||
1441 | m_parentID = 0; | 892 | m_parentID = 0; |
1442 | SendFullUpdateToAllClients(); | 893 | SendFullUpdateToAllClients(); |
1443 | 894 | ||
@@ -1540,7 +991,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1540 | } | 991 | } |
1541 | else | 992 | else |
1542 | { | 993 | { |
1543 | m_log.Warn("Sit requested on unknown object: " + targetID); | 994 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); |
1544 | } | 995 | } |
1545 | SendSitResponse(remoteClient, targetID, offset); | 996 | SendSitResponse(remoteClient, targetID, offset); |
1546 | } | 997 | } |
@@ -1602,11 +1053,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1602 | 1053 | ||
1603 | public void AddAnimation(LLUUID animID) | 1054 | public void AddAnimation(LLUUID animID) |
1604 | { | 1055 | { |
1605 | if (m_isChildAgent) | 1056 | if(m_isChildAgent) |
1606 | return; | 1057 | return; |
1607 | 1058 | ||
1608 | // Don't let this animation become the movement animation | 1059 | // Don't let this animation become the movement animation |
1609 | if (m_animations.Count < 1) | 1060 | if(m_animations.Count < 1) |
1610 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | 1061 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); |
1611 | 1062 | ||
1612 | if (!m_animations.Contains(animID)) | 1063 | if (!m_animations.Contains(animID)) |
@@ -1619,7 +1070,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1619 | 1070 | ||
1620 | public void RemoveAnimation(LLUUID animID) | 1071 | public void RemoveAnimation(LLUUID animID) |
1621 | { | 1072 | { |
1622 | if (m_isChildAgent) | 1073 | if(m_isChildAgent) |
1623 | return; | 1074 | return; |
1624 | 1075 | ||
1625 | if (m_animations.Contains(animID)) | 1076 | if (m_animations.Contains(animID)) |
@@ -1633,11 +1084,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1633 | // What a HACK!! Anim list really needs to be an object! | 1084 | // What a HACK!! Anim list really needs to be an object! |
1634 | int idx; | 1085 | int idx; |
1635 | 1086 | ||
1636 | for (idx = 0; idx < m_animations.Count; idx++) | 1087 | for(idx=0;idx < m_animations.Count;idx++) |
1637 | { | 1088 | { |
1638 | if (m_animations[idx] == animID) | 1089 | if(m_animations[idx] == animID) |
1639 | { | 1090 | { |
1640 | int seq = m_animationSeqs[idx]; | 1091 | int seq=m_animationSeqs[idx]; |
1641 | 1092 | ||
1642 | m_animations.Remove(animID); | 1093 | m_animations.Remove(animID); |
1643 | m_animationSeqs.Remove(seq); | 1094 | m_animationSeqs.Remove(seq); |
@@ -1666,7 +1117,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1666 | /// </summary> | 1117 | /// </summary> |
1667 | protected void SetMovementAnimation(LLUUID anim) | 1118 | protected void SetMovementAnimation(LLUUID anim) |
1668 | { | 1119 | { |
1669 | if (m_animations.Count < 1) | 1120 | if(m_animations.Count < 1) |
1670 | { | 1121 | { |
1671 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | 1122 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); |
1672 | m_animationSeqs.Add(1); | 1123 | m_animationSeqs.Add(1); |
@@ -1699,6 +1150,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1699 | /// </summary> | 1150 | /// </summary> |
1700 | protected void UpdateMovementAnimations(bool update_movementflag) | 1151 | protected void UpdateMovementAnimations(bool update_movementflag) |
1701 | { | 1152 | { |
1153 | |||
1154 | |||
1702 | if (update_movementflag) | 1155 | if (update_movementflag) |
1703 | { | 1156 | { |
1704 | // Are we moving? | 1157 | // Are we moving? |
@@ -1731,8 +1184,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1731 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); | 1184 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); |
1732 | } | 1185 | } |
1733 | catch (KeyNotFoundException) | 1186 | catch (KeyNotFoundException) |
1734 | { | 1187 | { } |
1735 | } | ||
1736 | } | 1188 | } |
1737 | else if (m_setAlwaysRun) | 1189 | else if (m_setAlwaysRun) |
1738 | { | 1190 | { |
@@ -1742,8 +1194,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1742 | SetMovementAnimation(Animations.AnimsLLUUID["RUN"]); | 1194 | SetMovementAnimation(Animations.AnimsLLUUID["RUN"]); |
1743 | } | 1195 | } |
1744 | catch (KeyNotFoundException) | 1196 | catch (KeyNotFoundException) |
1745 | { | 1197 | { } |
1746 | } | ||
1747 | } | 1198 | } |
1748 | else | 1199 | else |
1749 | { | 1200 | { |
@@ -1753,8 +1204,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1753 | SetMovementAnimation(Animations.AnimsLLUUID["WALK"]); | 1204 | SetMovementAnimation(Animations.AnimsLLUUID["WALK"]); |
1754 | } | 1205 | } |
1755 | catch (KeyNotFoundException) | 1206 | catch (KeyNotFoundException) |
1756 | { | 1207 | { } |
1757 | } | 1208 | |
1758 | } | 1209 | } |
1759 | } | 1210 | } |
1760 | else | 1211 | else |
@@ -1788,14 +1239,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1788 | // We're not moving.. and we're not doing anything.. so play the stand animation | 1239 | // We're not moving.. and we're not doing anything.. so play the stand animation |
1789 | try | 1240 | try |
1790 | { | 1241 | { |
1242 | |||
1791 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | 1243 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); |
1792 | } | 1244 | } |
1793 | catch (KeyNotFoundException) | 1245 | catch (KeyNotFoundException) |
1794 | { | 1246 | { } |
1795 | } | ||
1796 | } | 1247 | } |
1797 | } | 1248 | } |
1798 | } | 1249 | } |
1250 | |||
1799 | } | 1251 | } |
1800 | 1252 | ||
1801 | /// <summary> | 1253 | /// <summary> |
@@ -1810,13 +1262,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1810 | } | 1262 | } |
1811 | 1263 | ||
1812 | m_perfMonMS = System.Environment.TickCount; | 1264 | m_perfMonMS = System.Environment.TickCount; |
1813 | 1265 | ||
1814 | m_rotation = rotation; | 1266 | m_rotation = rotation; |
1815 | NewForce newVelocity = new NewForce(); | 1267 | NewForce newVelocity = new NewForce(); |
1816 | Vector3 direc = rotation * vec; | 1268 | Vector3 direc = rotation*vec; |
1817 | direc.Normalize(); | 1269 | direc.Normalize(); |
1818 | 1270 | ||
1819 | direc *= 0.03f * 128f; | 1271 | direc *= 0.03f*128f; |
1820 | if (m_physicsActor.Flying) | 1272 | if (m_physicsActor.Flying) |
1821 | { | 1273 | { |
1822 | direc *= 4; | 1274 | direc *= 4; |
@@ -1848,8 +1300,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1848 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); | 1300 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); |
1849 | } | 1301 | } |
1850 | catch (KeyNotFoundException) | 1302 | catch (KeyNotFoundException) |
1851 | { | 1303 | { } |
1852 | } | ||
1853 | } | 1304 | } |
1854 | } | 1305 | } |
1855 | } | 1306 | } |
@@ -1895,18 +1346,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
1895 | m_updateCount = 0; | 1346 | m_updateCount = 0; |
1896 | } | 1347 | } |
1897 | } | 1348 | } |
1898 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) | 1349 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement |
1899 | // physics-related movement | ||
1900 | { | 1350 | { |
1351 | |||
1352 | |||
1901 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity | 1353 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity |
1902 | // doing the above assures us that we know what we sent the clients last | 1354 | // doing the above assures us that we know what we sent the clients last |
1903 | SendTerseUpdateToAllClients(); | 1355 | SendTerseUpdateToAllClients(); |
1904 | m_updateCount = 0; | 1356 | m_updateCount = 0; |
1357 | |||
1358 | |||
1359 | |||
1905 | } | 1360 | } |
1906 | 1361 | ||
1907 | // followed suggestion from mic bowman. reversed the two lines below. | 1362 | // followed suggestion from mic bowman. reversed the two lines below. |
1908 | CheckForBorderCrossing(); | 1363 | CheckForBorderCrossing(); |
1909 | CheckForSignificantMovement(); // sends update to the modules. | 1364 | CheckForSignificantMovement(); // sends update to the modules. |
1365 | |||
1910 | } | 1366 | } |
1911 | } | 1367 | } |
1912 | 1368 | ||
@@ -1925,7 +1381,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1925 | LLVector3 pos = m_pos; | 1381 | LLVector3 pos = m_pos; |
1926 | LLVector3 vel = Velocity; | 1382 | LLVector3 vel = Velocity; |
1927 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); | 1383 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); |
1928 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort) (m_scene.TimeDilation * ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), | 1384 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), |
1929 | new LLVector3(vel.X, vel.Y, vel.Z), rot); | 1385 | new LLVector3(vel.X, vel.Y, vel.Z), rot); |
1930 | 1386 | ||
1931 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1387 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
@@ -1945,6 +1401,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1945 | lastPhysPos = AbsolutePosition; | 1401 | lastPhysPos = AbsolutePosition; |
1946 | 1402 | ||
1947 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1403 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
1404 | |||
1948 | } | 1405 | } |
1949 | 1406 | ||
1950 | public void SendCoarseLocations() | 1407 | public void SendCoarseLocations() |
@@ -2040,15 +1497,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2040 | /// </summary> | 1497 | /// </summary> |
2041 | public void SendAppearanceToAllOtherAgents() | 1498 | public void SendAppearanceToAllOtherAgents() |
2042 | { | 1499 | { |
2043 | m_perfMonMS = System.Environment.TickCount; | 1500 | m_perfMonMS=System.Environment.TickCount; |
2044 | 1501 | ||
2045 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 1502 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
1503 | { | ||
1504 | if (scenePresence.UUID != UUID) | ||
2046 | { | 1505 | { |
2047 | if (scenePresence.UUID != UUID) | 1506 | m_appearance.SendAppearanceToOtherAgent(scenePresence); |
2048 | { | 1507 | } |
2049 | m_appearance.SendAppearanceToOtherAgent(scenePresence); | 1508 | }); |
2050 | } | ||
2051 | }); | ||
2052 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1509 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
2053 | } | 1510 | } |
2054 | 1511 | ||
@@ -2077,7 +1534,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2077 | /// <param name="seqs"></param> | 1534 | /// <param name="seqs"></param> |
2078 | public void SendAnimPack(LLUUID[] animations, int[] seqs) | 1535 | public void SendAnimPack(LLUUID[] animations, int[] seqs) |
2079 | { | 1536 | { |
2080 | if (m_isChildAgent) | 1537 | if(m_isChildAgent) |
2081 | return; | 1538 | return; |
2082 | 1539 | ||
2083 | m_scene.Broadcast( | 1540 | m_scene.Broadcast( |
@@ -2113,10 +1570,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2113 | } | 1570 | } |
2114 | 1571 | ||
2115 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | 1572 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m |
2116 | if (Util.GetDistanceTo(AbsolutePosition, m_LastChildAgentUpdatePosition) > 32) | 1573 | if (Util.GetDistanceTo(AbsolutePosition,m_LastChildAgentUpdatePosition) > 32) |
2117 | { | 1574 | { |
2118 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 1575 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
2119 | cadu.ActiveGroupID = LLUUID.Zero.UUID; | 1576 | cadu.ActiveGroupID=LLUUID.Zero.UUID; |
2120 | cadu.AgentID = UUID.UUID; | 1577 | cadu.AgentID = UUID.UUID; |
2121 | cadu.alwaysrun = m_setAlwaysRun; | 1578 | cadu.alwaysrun = m_setAlwaysRun; |
2122 | cadu.AVHeight = m_avHeight; | 1579 | cadu.AVHeight = m_avHeight; |
@@ -2128,8 +1585,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2128 | cadu.Position = new sLLVector3(AbsolutePosition); | 1585 | cadu.Position = new sLLVector3(AbsolutePosition); |
2129 | cadu.regionHandle = m_scene.RegionInfo.RegionHandle; | 1586 | cadu.regionHandle = m_scene.RegionInfo.RegionHandle; |
2130 | cadu.throttles = ControllingClient.GetThrottlesPacked(1f); | 1587 | cadu.throttles = ControllingClient.GetThrottlesPacked(1f); |
2131 | cadu.Velocity = new sLLVector3(Velocity); | 1588 | cadu.Velocity = new sLLVector3(Velocity); |
2132 | m_scene.SendOutChildAgentUpdates(cadu, this); | 1589 | m_scene.SendOutChildAgentUpdates(cadu,this); |
2133 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; | 1590 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; |
2134 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; | 1591 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; |
2135 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; | 1592 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; |
@@ -2149,9 +1606,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2149 | LLVector3 vel = Velocity; | 1606 | LLVector3 vel = Velocity; |
2150 | 1607 | ||
2151 | float timeStep = 0.1f; | 1608 | float timeStep = 0.1f; |
2152 | pos2.X = pos2.X + (vel.X * timeStep); | 1609 | pos2.X = pos2.X + (vel.X*timeStep); |
2153 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 1610 | pos2.Y = pos2.Y + (vel.Y*timeStep); |
2154 | pos2.Z = pos2.Z + (vel.Z * timeStep); | 1611 | pos2.Z = pos2.Z + (vel.Z*timeStep); |
2155 | 1612 | ||
2156 | if ((pos2.X < 0) || (pos2.X > Constants.RegionSize)) | 1613 | if ((pos2.X < 0) || (pos2.X > Constants.RegionSize)) |
2157 | { | 1614 | { |
@@ -2206,10 +1663,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2206 | } | 1663 | } |
2207 | 1664 | ||
2208 | LLVector3 vel = m_velocity; | 1665 | LLVector3 vel = m_velocity; |
2209 | ulong neighbourHandle = Helpers.UIntsToLong((neighbourx * Constants.RegionSize), (neighboury * Constants.RegionSize)); | 1666 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
2210 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 1667 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
2211 | if (neighbourRegion != null) | 1668 | if (neighbourRegion != null) |
2212 | { | 1669 | { |
2213 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 1670 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
2214 | // This means we need to remove the current caps handler here and possibly compensate later, | 1671 | // This means we need to remove the current caps handler here and possibly compensate later, |
2215 | // in case both scenes are being hosted on the same region server. Messy | 1672 | // in case both scenes are being hosted on the same region server. Messy |
@@ -2219,17 +1676,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
2219 | m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, | 1676 | m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, |
2220 | m_physicsActor.Flying); | 1677 | m_physicsActor.Flying); |
2221 | if (res) | 1678 | if (res) |
2222 | { | 1679 | { |
2223 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 1680 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
2224 | 1681 | ||
2225 | // TODO Should construct this behind a method | 1682 | // TODO Should construct this behind a method |
2226 | string capsPath = | 1683 | string capsPath = |
2227 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort | 1684 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort |
2228 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; | 1685 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; |
2229 | 1686 | ||
2230 | m_log.DebugFormat( | 1687 | m_log.DebugFormat( |
2231 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); | 1688 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); |
2232 | 1689 | ||
2233 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, | 1690 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, |
2234 | capsPath); | 1691 | capsPath); |
2235 | MakeChildAgent(); | 1692 | MakeChildAgent(); |
@@ -2246,40 +1703,128 @@ namespace OpenSim.Region.Environment.Scenes | |||
2246 | 1703 | ||
2247 | #endregion | 1704 | #endregion |
2248 | 1705 | ||
2249 | #region Nested type: Dir_ControlFlags | 1706 | /// <summary> |
1707 | /// This allows the Sim owner the abiility to kick users from their sim currently. | ||
1708 | /// It tells the client that the agent has permission to do so. | ||
1709 | /// </summary> | ||
1710 | public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, bool godStatus) | ||
1711 | { | ||
1712 | GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); | ||
1713 | GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); | ||
1714 | GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); | ||
1715 | |||
1716 | adb.AgentID = agentID; | ||
1717 | adb.SessionID = sessionID; // More security | ||
1718 | |||
1719 | if (godStatus) | ||
1720 | { | ||
1721 | gdb.GodLevel = (byte)250; | ||
1722 | m_godlevel = 250; | ||
1723 | } | ||
1724 | else | ||
1725 | { | ||
1726 | gdb.GodLevel = (byte)0; | ||
1727 | m_godlevel = 0; | ||
1728 | } | ||
1729 | |||
1730 | gdb.Token = token; | ||
1731 | //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; | ||
1732 | respondPacket.GrantData = gdb; | ||
1733 | respondPacket.AgentData = adb; | ||
1734 | ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); | ||
1735 | } | ||
2250 | 1736 | ||
2251 | /// <summary> | 1737 | /// <summary> |
2252 | /// Implemented Control Flags | 1738 | /// This updates important decision making data about a child agent |
1739 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | ||
2253 | /// </summary> | 1740 | /// </summary> |
2254 | private enum Dir_ControlFlags | 1741 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) |
2255 | { | 1742 | { |
2256 | DIR_CONTROL_FLAG_FORWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS, | 1743 | // |
2257 | DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, | 1744 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; |
2258 | DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS, | 1745 | int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; |
2259 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 1746 | |
2260 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | 1747 | m_DrawDistance = cAgentData.drawdistance; |
2261 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 1748 | m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); |
2262 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | 1749 | |
1750 | // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region | ||
1751 | m_CameraCenter = | ||
1752 | new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); | ||
1753 | |||
1754 | |||
1755 | m_godlevel = cAgentData.godlevel; | ||
1756 | SetHeight(cAgentData.AVHeight); | ||
1757 | |||
1758 | ControllingClient.SetChildAgentThrottle(cAgentData.throttles); | ||
1759 | |||
1760 | |||
1761 | |||
1762 | // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. | ||
1763 | if (m_scene.m_seeIntoRegionFromNeighbor) | ||
1764 | m_scene.SendAllSceneObjectsToClient(this); | ||
1765 | //cAgentData.AVHeight; | ||
1766 | //cAgentData.regionHandle; | ||
1767 | //m_velocity = cAgentData.Velocity; | ||
2263 | } | 1768 | } |
2264 | 1769 | ||
2265 | #endregion | 1770 | /// <summary> |
1771 | /// Handles part of the PID controller function for moving an avatar. | ||
1772 | /// </summary> | ||
1773 | public override void UpdateMovement() | ||
1774 | { | ||
1775 | m_newForce = false; | ||
1776 | lock (m_forcesList) | ||
1777 | { | ||
1778 | if (m_forcesList.Count > 0) | ||
1779 | { | ||
1780 | for (int i = 0; i < m_forcesList.Count; i++) | ||
1781 | { | ||
1782 | NewForce force = m_forcesList[i]; | ||
1783 | |||
1784 | m_updateflag = true; | ||
1785 | try | ||
1786 | { | ||
1787 | movementvector.X = force.X; | ||
1788 | movementvector.Y = force.Y; | ||
1789 | movementvector.Z = force.Z; | ||
1790 | Velocity = movementvector; | ||
1791 | } | ||
1792 | catch (NullReferenceException) | ||
1793 | { | ||
1794 | // Under extreme load, this returns a NullReference Exception that we can ignore. | ||
1795 | // Ignoring this causes no movement to be sent to the physics engine... | ||
1796 | // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! | ||
1797 | } | ||
1798 | m_newForce = true; | ||
1799 | } | ||
1800 | for (int i = 0; i < m_forcesList.Count; i++) | ||
1801 | { | ||
1802 | m_forcesList.RemoveAt(0); | ||
1803 | } | ||
1804 | } | ||
1805 | } | ||
1806 | } | ||
2266 | 1807 | ||
2267 | #region Nested type: NewForce | 1808 | static ScenePresence() |
1809 | { | ||
1810 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1811 | DefaultTexture = textu.ToBytes(); | ||
1812 | } | ||
2268 | 1813 | ||
2269 | [Serializable] | 1814 | [Serializable] |
2270 | public class NewForce | 1815 | public class NewForce |
2271 | { | 1816 | { |
2272 | public float X; | 1817 | public float X; |
2273 | public float Y; | 1818 | public float Y; |
2274 | public float Z; | 1819 | public float Z; |
2275 | } | ||
2276 | 1820 | ||
2277 | #endregion | 1821 | public NewForce() |
2278 | 1822 | { | |
2279 | #region Nested type: ScenePartUpdate | 1823 | } |
1824 | } | ||
2280 | 1825 | ||
2281 | [Serializable] | 1826 | [Serializable] |
2282 | public class ScenePartUpdate : ISerializable | 1827 | public class ScenePartUpdate : ISerializable |
2283 | { | 1828 | { |
2284 | public LLUUID FullID; | 1829 | public LLUUID FullID; |
2285 | public uint LastFullUpdateTime; | 1830 | public uint LastFullUpdateTime; |
@@ -2301,17 +1846,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2301 | throw new ArgumentNullException("info"); | 1846 | throw new ArgumentNullException("info"); |
2302 | } | 1847 | } |
2303 | 1848 | ||
2304 | FullID = new LLUUID((Guid) info.GetValue("FullID", typeof (Guid))); | 1849 | FullID = new LLUUID((Guid)info.GetValue("FullID", typeof(Guid))); |
2305 | LastFullUpdateTime = (uint) info.GetValue("LastFullUpdateTime", typeof (uint)); | 1850 | LastFullUpdateTime = (uint)info.GetValue("LastFullUpdateTime", typeof(uint)); |
2306 | LastTerseUpdateTime = (uint) info.GetValue("LastTerseUpdateTime", typeof (uint)); | 1851 | LastTerseUpdateTime = (uint)info.GetValue("LastTerseUpdateTime", typeof(uint)); |
2307 | 1852 | ||
2308 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); | 1853 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); |
2309 | } | 1854 | } |
2310 | 1855 | ||
2311 | #region ISerializable Members | ||
2312 | |||
2313 | [SecurityPermission(SecurityAction.LinkDemand, | 1856 | [SecurityPermission(SecurityAction.LinkDemand, |
2314 | Flags = SecurityPermissionFlag.SerializationFormatter)] | 1857 | Flags = SecurityPermissionFlag.SerializationFormatter)] |
2315 | public virtual void GetObjectData( | 1858 | public virtual void GetObjectData( |
2316 | SerializationInfo info, StreamingContext context) | 1859 | SerializationInfo info, StreamingContext context) |
2317 | { | 1860 | { |
@@ -2324,10 +1867,473 @@ namespace OpenSim.Region.Environment.Scenes | |||
2324 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); | 1867 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); |
2325 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); | 1868 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); |
2326 | } | 1869 | } |
1870 | } | ||
2327 | 1871 | ||
2328 | #endregion | 1872 | public override void SetText(string text, Vector3 color, double alpha) |
1873 | { | ||
1874 | throw new Exception("Can't set Text on avatar."); | ||
2329 | } | 1875 | } |
2330 | 1876 | ||
2331 | #endregion | 1877 | /// <summary> |
1878 | /// Adds a physical representation of the avatar to the Physics plugin | ||
1879 | /// </summary> | ||
1880 | public void AddToPhysicalScene() | ||
1881 | { | ||
1882 | PhysicsScene scene = m_scene.PhysicsScene; | ||
1883 | |||
1884 | PhysicsVector pVec = | ||
1885 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | ||
1886 | AbsolutePosition.Z); | ||
1887 | if (m_avHeight == 127.0f) | ||
1888 | { | ||
1889 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f)); | ||
1890 | } | ||
1891 | else | ||
1892 | { | ||
1893 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight)); | ||
1894 | } | ||
1895 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | ||
1896 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | ||
1897 | m_physicsActor.LocalID = LocalId; | ||
1898 | } | ||
1899 | |||
1900 | // Event called by the physics plugin to tell the avatar about a collision. | ||
1901 | private void PhysicsCollisionUpdate(EventArgs e) | ||
1902 | { | ||
1903 | bool isUserMoving = Velocity.X > 0 || Velocity.Y > 0; | ||
1904 | UpdateMovementAnimations(isUserMoving); | ||
1905 | } | ||
1906 | |||
1907 | internal void Close() | ||
1908 | { | ||
1909 | lock (m_attachments) | ||
1910 | { | ||
1911 | foreach (SceneObjectGroup grp in m_attachments) | ||
1912 | { | ||
1913 | // ControllingClient may be null at this point! | ||
1914 | m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient); | ||
1915 | } | ||
1916 | m_attachments.Clear(); | ||
1917 | } | ||
1918 | lock (m_knownPrimUUID) | ||
1919 | { | ||
1920 | m_knownPrimUUID.Clear(); | ||
1921 | } | ||
1922 | lock (m_knownChildRegions) | ||
1923 | { | ||
1924 | m_knownChildRegions.Clear(); | ||
1925 | } | ||
1926 | lock (m_updateTimes) | ||
1927 | { | ||
1928 | m_updateTimes.Clear(); | ||
1929 | } | ||
1930 | lock (m_partsUpdateQueue) | ||
1931 | { | ||
1932 | m_partsUpdateQueue.Clear(); | ||
1933 | } | ||
1934 | |||
1935 | RemoveFromPhysicalScene(); | ||
1936 | GC.Collect(); | ||
1937 | } | ||
1938 | |||
1939 | public ScenePresence() | ||
1940 | { | ||
1941 | /* JB | ||
1942 | if (Animations == null) | ||
1943 | { | ||
1944 | Animations = new AvatarAnimations(); | ||
1945 | Animations.LoadAnims(); | ||
1946 | } | ||
1947 | */ | ||
1948 | if (DefaultTexture == null) | ||
1949 | { | ||
1950 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1951 | DefaultTexture = textu.ToBytes(); | ||
1952 | } | ||
1953 | } | ||
1954 | public void AddAttachment(SceneObjectGroup gobj) | ||
1955 | { | ||
1956 | lock (m_attachments) | ||
1957 | { | ||
1958 | m_attachments.Add(gobj); | ||
1959 | } | ||
1960 | } | ||
1961 | public void RemoveAttachment(SceneObjectGroup gobj) | ||
1962 | { | ||
1963 | lock (m_attachments) | ||
1964 | { | ||
1965 | if (m_attachments.Contains(gobj)) | ||
1966 | { | ||
1967 | m_attachments.Remove(gobj); | ||
1968 | } | ||
1969 | } | ||
1970 | } | ||
1971 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | ||
1972 | { | ||
1973 | lock (m_attachments) | ||
1974 | { | ||
1975 | foreach (SceneObjectGroup gobj in m_attachments) | ||
1976 | { | ||
1977 | // If the prim group is null then something must have happened to it! | ||
1978 | if (gobj != null) | ||
1979 | { | ||
1980 | // Set the parent localID to 0 so it transfers over properly. | ||
1981 | gobj.RootPart.SetParentLocalId(0); | ||
1982 | gobj.RootPart.m_IsAttachment = false; | ||
1983 | gobj.AbsolutePosition = gobj.RootPart.m_attachedPos; | ||
1984 | gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
1985 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); | ||
1986 | } | ||
1987 | } | ||
1988 | m_attachments.Clear(); | ||
1989 | } | ||
1990 | |||
1991 | } | ||
1992 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | ||
1993 | { | ||
1994 | m_controllingClient = client; | ||
1995 | m_regionInfo = region; | ||
1996 | m_scene = scene; | ||
1997 | RegisterToEvents(); | ||
1998 | |||
1999 | /* | ||
2000 | AbsolutePosition = client.StartPos; | ||
2001 | |||
2002 | Animations = new AvatarAnimations(); | ||
2003 | Animations.LoadAnims(); | ||
2004 | |||
2005 | m_animations = new List<LLUUID>(); | ||
2006 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | ||
2007 | m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber); | ||
2008 | |||
2009 | SetDirectionVectors(); | ||
2010 | */ | ||
2011 | } | ||
2012 | |||
2013 | protected ScenePresence(SerializationInfo info, StreamingContext context) | ||
2014 | : base (info, context) | ||
2015 | { | ||
2016 | //System.Console.WriteLine("ScenePresence Deserialize BGN"); | ||
2017 | |||
2018 | if (info == null) | ||
2019 | { | ||
2020 | throw new ArgumentNullException("info"); | ||
2021 | } | ||
2022 | /* JB | ||
2023 | if (Animations == null) | ||
2024 | { | ||
2025 | Animations = new AvatarAnimations(); | ||
2026 | Animations.LoadAnims(); | ||
2027 | } | ||
2028 | */ | ||
2029 | if (DefaultTexture == null) | ||
2030 | { | ||
2031 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
2032 | DefaultTexture = textu.ToBytes(); | ||
2033 | } | ||
2034 | |||
2035 | List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>)); | ||
2036 | |||
2037 | foreach (Guid guid in animations_work) | ||
2038 | { | ||
2039 | m_animations.Add(new LLUUID(guid)); | ||
2040 | } | ||
2041 | |||
2042 | m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>)); | ||
2043 | m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool)); | ||
2044 | m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte)); | ||
2045 | m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>)); | ||
2046 | m_updateCount = (short)info.GetValue("m_updateCount", typeof(short)); | ||
2047 | m_requestedSitTargetID = (uint)info.GetValue("m_requestedSitTargetID", typeof(uint)); | ||
2048 | |||
2049 | m_requestedSitOffset | ||
2050 | = new LLVector3( | ||
2051 | (float)info.GetValue("m_requestedSitOffset.X", typeof(float)), | ||
2052 | (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)), | ||
2053 | (float)info.GetValue("m_requestedSitOffset.Z", typeof(float))); | ||
2054 | |||
2055 | m_sitAvatarHeight = (float)info.GetValue("m_sitAvatarHeight", typeof(float)); | ||
2056 | m_godlevel = (float)info.GetValue("m_godlevel", typeof(float)); | ||
2057 | m_setAlwaysRun = (bool)info.GetValue("m_setAlwaysRun", typeof(bool)); | ||
2058 | |||
2059 | m_bodyRot | ||
2060 | = new Quaternion( | ||
2061 | (float)info.GetValue("m_bodyRot.w", typeof(float)), | ||
2062 | (float)info.GetValue("m_bodyRot.x", typeof(float)), | ||
2063 | (float)info.GetValue("m_bodyRot.y", typeof(float)), | ||
2064 | (float)info.GetValue("m_bodyRot.z", typeof(float))); | ||
2065 | |||
2066 | IsRestrictedToRegion = (bool)info.GetValue("IsRestrictedToRegion", typeof(bool)); | ||
2067 | m_newForce = (bool)info.GetValue("m_newForce", typeof(bool)); | ||
2068 | //m_newAvatar = (bool)info.GetValue("m_newAvatar", typeof(bool)); | ||
2069 | m_newCoarseLocations = (bool)info.GetValue("m_newCoarseLocations", typeof(bool)); | ||
2070 | m_gotAllObjectsInScene = (bool)info.GetValue("m_gotAllObjectsInScene", typeof(bool)); | ||
2071 | m_avHeight = (float)info.GetValue("m_avHeight", typeof(float)); | ||
2072 | crossingFromRegion = (ulong)info.GetValue("crossingFromRegion", typeof(ulong)); | ||
2073 | |||
2074 | List<float[]> Dir_Vectors_work = (List<float[]>)info.GetValue("Dir_Vectors", typeof(List<float[]>)); | ||
2075 | List<Vector3> Dir_Vectors_work2 = new List<Vector3>(); | ||
2076 | |||
2077 | foreach (float[] f3 in Dir_Vectors_work) | ||
2078 | { | ||
2079 | Dir_Vectors_work2.Add(new Vector3(f3[0], f3[1], f3[2])); | ||
2080 | } | ||
2081 | |||
2082 | Dir_Vectors = Dir_Vectors_work2.ToArray(); | ||
2083 | |||
2084 | lastPhysPos | ||
2085 | = new LLVector3( | ||
2086 | (float)info.GetValue("lastPhysPos.X", typeof(float)), | ||
2087 | (float)info.GetValue("lastPhysPos.Y", typeof(float)), | ||
2088 | (float)info.GetValue("lastPhysPos.Z", typeof(float))); | ||
2089 | |||
2090 | m_CameraCenter | ||
2091 | = new Vector3( | ||
2092 | (float)info.GetValue("m_CameraCenter.X", typeof(float)), | ||
2093 | (float)info.GetValue("m_CameraCenter.Y", typeof(float)), | ||
2094 | (float)info.GetValue("m_CameraCenter.Z", typeof(float))); | ||
2095 | |||
2096 | m_CameraAtAxis | ||
2097 | = new Vector3( | ||
2098 | (float)info.GetValue("m_CameraAtAxis.X", typeof(float)), | ||
2099 | (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)), | ||
2100 | (float)info.GetValue("m_CameraAtAxis.Z", typeof(float))); | ||
2101 | |||
2102 | m_CameraLeftAxis | ||
2103 | = new Vector3( | ||
2104 | (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)), | ||
2105 | (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)), | ||
2106 | (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float))); | ||
2107 | |||
2108 | m_CameraUpAxis | ||
2109 | = new Vector3( | ||
2110 | (float)info.GetValue("m_CameraUpAxis.X", typeof(float)), | ||
2111 | (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)), | ||
2112 | (float)info.GetValue("m_CameraUpAxis.Z", typeof(float))); | ||
2113 | |||
2114 | m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); | ||
2115 | m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); | ||
2116 | m_knownChildRegions = (List<ulong>)info.GetValue("m_knownChildRegions", typeof(List<ulong>)); | ||
2117 | |||
2118 | posLastSignificantMove | ||
2119 | = new LLVector3( | ||
2120 | (float)info.GetValue("posLastSignificantMove.X", typeof(float)), | ||
2121 | (float)info.GetValue("posLastSignificantMove.Y", typeof(float)), | ||
2122 | (float)info.GetValue("posLastSignificantMove.Z", typeof(float))); | ||
2123 | |||
2124 | // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue)); | ||
2125 | |||
2126 | /* | ||
2127 | Dictionary<Guid, ScenePartUpdate> updateTimes_work | ||
2128 | = (Dictionary<Guid, ScenePartUpdate>)info.GetValue("m_updateTimes", typeof(Dictionary<Guid, ScenePartUpdate>)); | ||
2129 | |||
2130 | foreach (Guid id in updateTimes_work.Keys) | ||
2131 | { | ||
2132 | m_updateTimes.Add(new LLUUID(id), updateTimes_work[id]); | ||
2133 | } | ||
2134 | */ | ||
2135 | m_regionHandle = (ulong)info.GetValue("m_regionHandle", typeof(ulong)); | ||
2136 | m_firstname = (string)info.GetValue("m_firstname", typeof(string)); | ||
2137 | m_lastname = (string)info.GetValue("m_lastname", typeof(string)); | ||
2138 | m_allowMovement = (bool)info.GetValue("m_allowMovement", typeof(bool)); | ||
2139 | m_parentPosition = new LLVector3((float)info.GetValue("m_parentPosition.X", typeof(float)), | ||
2140 | (float)info.GetValue("m_parentPosition.Y", typeof(float)), | ||
2141 | (float)info.GetValue("m_parentPosition.Z", typeof(float))); | ||
2142 | |||
2143 | m_isChildAgent = (bool)info.GetValue("m_isChildAgent", typeof(bool)); | ||
2144 | m_parentID = (uint)info.GetValue("m_parentID", typeof(uint)); | ||
2145 | |||
2146 | // for OpenSim_v0.5 | ||
2147 | currentParcelUUID = new LLUUID((Guid)info.GetValue("currentParcelUUID", typeof(Guid))); | ||
2148 | |||
2149 | lastKnownAllowedPosition | ||
2150 | = new Vector3( | ||
2151 | (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)), | ||
2152 | (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)), | ||
2153 | (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float))); | ||
2154 | |||
2155 | sentMessageAboutRestrictedParcelFlyingDown = (bool)info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof(bool)); | ||
2156 | |||
2157 | m_LastChildAgentUpdatePosition | ||
2158 | = new LLVector3( | ||
2159 | (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)), | ||
2160 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)), | ||
2161 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float))); | ||
2162 | |||
2163 | m_perfMonMS = (int)info.GetValue("m_perfMonMS", typeof(int)); | ||
2164 | m_AgentControlFlags = (uint)info.GetValue("m_AgentControlFlags", typeof(uint)); | ||
2165 | |||
2166 | m_headrotation | ||
2167 | = new LLQuaternion( | ||
2168 | (float)info.GetValue("m_headrotation.W", typeof(float)), | ||
2169 | (float)info.GetValue("m_headrotation.X", typeof(float)), | ||
2170 | (float)info.GetValue("m_headrotation.Y", typeof(float)), | ||
2171 | (float)info.GetValue("m_headrotation.Z", typeof(float))); | ||
2172 | |||
2173 | m_state = (byte)info.GetValue("m_state", typeof(byte)); | ||
2174 | |||
2175 | List<Guid> knownPrimUUID_work = (List<Guid>)info.GetValue("m_knownPrimUUID", typeof(List<Guid>)); | ||
2176 | |||
2177 | foreach (Guid id in knownPrimUUID_work) | ||
2178 | { | ||
2179 | m_knownPrimUUID.Add(new LLUUID(id)); | ||
2180 | } | ||
2181 | |||
2182 | //System.Console.WriteLine("ScenePresence Deserialize END"); | ||
2183 | } | ||
2184 | |||
2185 | [SecurityPermission(SecurityAction.LinkDemand, | ||
2186 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
2187 | public override void GetObjectData( | ||
2188 | SerializationInfo info, StreamingContext context) | ||
2189 | { | ||
2190 | if (info == null) | ||
2191 | { | ||
2192 | throw new ArgumentNullException("info"); | ||
2193 | } | ||
2194 | |||
2195 | base.GetObjectData(info, context); | ||
2196 | |||
2197 | List<Guid> animations_work = new List<Guid>(); | ||
2198 | |||
2199 | foreach (LLUUID uuid in m_animations) | ||
2200 | { | ||
2201 | animations_work.Add(uuid.UUID); | ||
2202 | } | ||
2203 | |||
2204 | info.AddValue("m_animations", animations_work); | ||
2205 | |||
2206 | info.AddValue("m_animationSeqs", m_animationSeqs); | ||
2207 | info.AddValue("m_updateflag", m_updateflag); | ||
2208 | info.AddValue("m_movementflag", m_movementflag); | ||
2209 | info.AddValue("m_forcesList", m_forcesList); | ||
2210 | info.AddValue("m_updateCount", m_updateCount); | ||
2211 | info.AddValue("m_requestedSitTargetID", m_requestedSitTargetID); | ||
2212 | |||
2213 | // LLVector3 | ||
2214 | info.AddValue("m_requestedSitOffset.X", m_requestedSitOffset.X); | ||
2215 | info.AddValue("m_requestedSitOffset.Y", m_requestedSitOffset.Y); | ||
2216 | info.AddValue("m_requestedSitOffset.Z", m_requestedSitOffset.Z); | ||
2217 | |||
2218 | info.AddValue("m_sitAvatarHeight", m_sitAvatarHeight); | ||
2219 | info.AddValue("m_godlevel", m_godlevel); | ||
2220 | info.AddValue("m_setAlwaysRun", m_setAlwaysRun); | ||
2221 | |||
2222 | // Quaternion | ||
2223 | info.AddValue("m_bodyRot.w", m_bodyRot.w); | ||
2224 | info.AddValue("m_bodyRot.x", m_bodyRot.x); | ||
2225 | info.AddValue("m_bodyRot.y", m_bodyRot.y); | ||
2226 | info.AddValue("m_bodyRot.z", m_bodyRot.z); | ||
2227 | |||
2228 | info.AddValue("IsRestrictedToRegion", IsRestrictedToRegion); | ||
2229 | info.AddValue("m_newForce", m_newForce); | ||
2230 | //info.AddValue("m_newAvatar", m_newAvatar); | ||
2231 | info.AddValue("m_newCoarseLocations", m_newCoarseLocations); | ||
2232 | info.AddValue("m_gotAllObjectsInScene", m_gotAllObjectsInScene); | ||
2233 | info.AddValue("m_avHeight", m_avHeight); | ||
2234 | |||
2235 | // info.AddValue("m_regionInfo", m_regionInfo); | ||
2236 | |||
2237 | info.AddValue("crossingFromRegion", crossingFromRegion); | ||
2238 | |||
2239 | List<float[]> Dir_Vectors_work = new List<float[]>(); | ||
2240 | |||
2241 | foreach (Vector3 v3 in Dir_Vectors) | ||
2242 | { | ||
2243 | Dir_Vectors_work.Add(new float[] { v3.x, v3.y, v3.z }); | ||
2244 | } | ||
2245 | |||
2246 | info.AddValue("Dir_Vectors", Dir_Vectors_work); | ||
2247 | |||
2248 | // LLVector3 | ||
2249 | info.AddValue("lastPhysPos.X", lastPhysPos.X); | ||
2250 | info.AddValue("lastPhysPos.Y", lastPhysPos.Y); | ||
2251 | info.AddValue("lastPhysPos.Z", lastPhysPos.Z); | ||
2252 | |||
2253 | // Vector3 | ||
2254 | info.AddValue("m_CameraCenter.X", m_CameraCenter.x); | ||
2255 | info.AddValue("m_CameraCenter.Y", m_CameraCenter.y); | ||
2256 | info.AddValue("m_CameraCenter.Z", m_CameraCenter.z); | ||
2257 | |||
2258 | // Vector3 | ||
2259 | info.AddValue("m_CameraAtAxis.X", m_CameraAtAxis.x); | ||
2260 | info.AddValue("m_CameraAtAxis.Y", m_CameraAtAxis.y); | ||
2261 | info.AddValue("m_CameraAtAxis.Z", m_CameraAtAxis.z); | ||
2262 | |||
2263 | // Vector3 | ||
2264 | info.AddValue("m_CameraLeftAxis.X", m_CameraLeftAxis.x); | ||
2265 | info.AddValue("m_CameraLeftAxis.Y", m_CameraLeftAxis.y); | ||
2266 | info.AddValue("m_CameraLeftAxis.Z", m_CameraLeftAxis.z); | ||
2267 | |||
2268 | // Vector3 | ||
2269 | info.AddValue("m_CameraUpAxis.X", m_CameraUpAxis.x); | ||
2270 | info.AddValue("m_CameraUpAxis.Y", m_CameraUpAxis.y); | ||
2271 | info.AddValue("m_CameraUpAxis.Z", m_CameraUpAxis.z); | ||
2272 | |||
2273 | info.AddValue("m_DrawDistance", m_DrawDistance); | ||
2274 | info.AddValue("m_appearance", m_appearance); | ||
2275 | info.AddValue("m_knownChildRegions", m_knownChildRegions); | ||
2276 | |||
2277 | // LLVector3 | ||
2278 | info.AddValue("posLastSignificantMove.X", posLastSignificantMove.X); | ||
2279 | info.AddValue("posLastSignificantMove.Y", posLastSignificantMove.Y); | ||
2280 | info.AddValue("posLastSignificantMove.Z", posLastSignificantMove.Z); | ||
2281 | |||
2282 | //info.AddValue("m_partsUpdateQueue", m_partsUpdateQueue); | ||
2283 | |||
2284 | /* | ||
2285 | Dictionary<Guid, ScenePartUpdate> updateTimes_work = new Dictionary<Guid, ScenePartUpdate>(); | ||
2286 | |||
2287 | foreach ( LLUUID id in m_updateTimes.Keys) | ||
2288 | { | ||
2289 | updateTimes_work.Add(id.UUID, m_updateTimes[id]); | ||
2290 | } | ||
2291 | |||
2292 | info.AddValue("m_updateTimes", updateTimes_work); | ||
2293 | */ | ||
2294 | |||
2295 | info.AddValue("m_regionHandle", m_regionHandle); | ||
2296 | info.AddValue("m_firstname", m_firstname); | ||
2297 | info.AddValue("m_lastname", m_lastname); | ||
2298 | info.AddValue("m_allowMovement", m_allowMovement); | ||
2299 | //info.AddValue("m_physicsActor", m_physicsActor); | ||
2300 | info.AddValue("m_parentPosition.X", m_parentPosition.X); | ||
2301 | info.AddValue("m_parentPosition.Y", m_parentPosition.Y); | ||
2302 | info.AddValue("m_parentPosition.Z", m_parentPosition.Z); | ||
2303 | info.AddValue("m_isChildAgent", m_isChildAgent); | ||
2304 | info.AddValue("m_parentID", m_parentID); | ||
2305 | |||
2306 | // for OpenSim_v0.5 | ||
2307 | info.AddValue("currentParcelUUID", currentParcelUUID.UUID); | ||
2308 | |||
2309 | info.AddValue("lastKnownAllowedPosition.X", lastKnownAllowedPosition.x); | ||
2310 | info.AddValue("lastKnownAllowedPosition.Y", lastKnownAllowedPosition.y); | ||
2311 | info.AddValue("lastKnownAllowedPosition.Z", lastKnownAllowedPosition.z); | ||
2312 | |||
2313 | info.AddValue("sentMessageAboutRestrictedParcelFlyingDown", sentMessageAboutRestrictedParcelFlyingDown); | ||
2314 | |||
2315 | info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X); | ||
2316 | info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y); | ||
2317 | info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z); | ||
2318 | |||
2319 | info.AddValue("m_perfMonMS", m_perfMonMS); | ||
2320 | info.AddValue("m_AgentControlFlags", m_AgentControlFlags); | ||
2321 | |||
2322 | info.AddValue("m_headrotation.W", m_headrotation.W); | ||
2323 | info.AddValue("m_headrotation.X", m_headrotation.X); | ||
2324 | info.AddValue("m_headrotation.Y", m_headrotation.Y); | ||
2325 | info.AddValue("m_headrotation.Z", m_headrotation.Z); | ||
2326 | |||
2327 | info.AddValue("m_state", m_state); | ||
2328 | |||
2329 | List<Guid> knownPrimUUID_work = new List<Guid>(); | ||
2330 | |||
2331 | foreach (LLUUID id in m_knownPrimUUID) | ||
2332 | { | ||
2333 | knownPrimUUID_work.Add(id.UUID); | ||
2334 | } | ||
2335 | |||
2336 | info.AddValue("m_knownPrimUUID", knownPrimUUID_work); | ||
2337 | } | ||
2332 | } | 2338 | } |
2333 | } \ No newline at end of file | 2339 | } |