diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 1502 |
1 files changed, 748 insertions, 754 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 74e9cdc..4cdf7f1 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -40,117 +40,111 @@ 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 | |||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | 50 | ||
53 | public static AvatarAnimations Animations = new AvatarAnimations(); | 51 | #region Delegates |
54 | public static byte[] DefaultTexture; | ||
55 | 52 | ||
56 | public LLUUID currentParcelUUID = LLUUID.Zero; | 53 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
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; | ||
61 | 54 | ||
62 | private bool m_updateflag = false; | 55 | #endregion |
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 | 56 | ||
72 | private int m_perfMonMS = 0; | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
73 | 58 | ||
74 | private bool m_setAlwaysRun = false; | 59 | public static AvatarAnimations Animations = new AvatarAnimations(); |
60 | public static byte[] DefaultTexture; | ||
61 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | ||
62 | private readonly uint m_AgentControlFlags = 0; | ||
75 | 63 | ||
76 | private Quaternion m_bodyRot; | 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; | ||
74 | private SignificantClientMovement handlerSignificantClientMovement; //OnSignificantClientMovement; | ||
77 | 75 | ||
78 | public bool IsRestrictedToRegion = false; | 76 | public bool IsRestrictedToRegion; |
79 | 77 | ||
80 | public string JID = string.Empty; | 78 | public string JID = string.Empty; |
79 | public Vector3 lastKnownAllowedPosition; | ||
81 | 80 | ||
82 | // Agent moves with a PID controller causing a force to be exerted. | 81 | // Agent moves with a PID controller causing a force to be exerted. |
83 | private bool m_newForce = false; | 82 | private LLVector3 lastPhysPos; |
84 | private bool m_newCoarseLocations = true; | 83 | protected AvatarAppearance m_appearance; |
85 | private bool m_gotAllObjectsInScene = false; | ||
86 | 84 | ||
87 | private LLVector3 m_lastVelocity = LLVector3.Zero; | 85 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
88 | |||
89 | // Default AV Height | ||
90 | private float m_avHeight = 127.0f; | 86 | private float m_avHeight = 127.0f; |
91 | 87 | private Quaternion m_bodyRot; | |
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(); | ||
97 | 88 | ||
98 | // Position of agent's camera in world (region cordinates) | 89 | // Position of agent's camera in world (region cordinates) |
99 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | ||
100 | 90 | ||
101 | // Use these three vectors to figure out what the agent is looking at | 91 | // Use these three vectors to figure out what the agent is looking at |
102 | // Convert it to a Matrix and/or Quaternion | 92 | // Convert it to a Matrix and/or Quaternion |
103 | protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); | 93 | protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); |
94 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | ||
104 | protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); | 95 | protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); |
105 | protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); | 96 | protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); |
106 | private uint m_AgentControlFlags = (uint) 0; | 97 | protected float m_DrawDistance; |
107 | private LLQuaternion m_headrotation = new LLQuaternion(); | 98 | private float m_godlevel; |
108 | private byte m_state = (byte) 0; | 99 | private bool m_gotAllObjectsInScene; |
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; | ||
109 | 114 | ||
110 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method | 115 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method |
111 | private LLVector3 movementvector = new LLVector3(); | 116 | private LLVector3 movementvector; |
112 | |||
113 | private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); | ||
114 | 117 | ||
115 | // Agent's Draw distance. | 118 | /// <summary> |
116 | protected float m_DrawDistance = 0f; | 119 | /// Position at which a significant movement was made |
117 | 120 | /// </summary> | |
118 | protected AvatarAppearance m_appearance; | 121 | private LLVector3 posLastSignificantMove; |
119 | 122 | ||
120 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 123 | public bool sentMessageAboutRestrictedParcelFlyingDown; |
121 | 124 | ||
122 | //neighbouring regions we have enabled a child agent in | 125 | #region Properties |
123 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); | ||
124 | 126 | ||
125 | private SignificantClientMovement handlerSignificantClientMovement = null; //OnSignificantClientMovement; | 127 | private readonly string m_firstname; |
128 | private readonly string m_lastname; | ||
129 | private readonly ulong m_regionHandle; | ||
130 | protected bool m_allowMovement = true; | ||
126 | 131 | ||
127 | /// <summary> | 132 | /// <summary> |
128 | /// Implemented Control Flags | 133 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager |
129 | /// </summary> | 134 | /// </summary> |
130 | private enum Dir_ControlFlags | 135 | private IClientAPI m_controllingClient; |
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 | } | ||
140 | 136 | ||
141 | /// <summary> | 137 | /// <summary> |
142 | /// Position at which a significant movement was made | 138 | /// If this is true, agent doesn't have a representation in this scene. |
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 | ||
143 | /// </summary> | 142 | /// </summary> |
144 | private LLVector3 posLastSignificantMove = new LLVector3(); | 143 | private bool m_isChildAgent = true; |
145 | |||
146 | public delegate void SignificantClientMovement(IClientAPI remote_client); | ||
147 | |||
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 | 144 | ||
153 | #region Properties | 145 | private uint m_parentID; |
146 | protected LLVector3 m_parentPosition; | ||
147 | protected PhysicsActor m_physicsActor; | ||
154 | 148 | ||
155 | /// <summary> | 149 | /// <summary> |
156 | /// Physical scene representation of this Avatar. | 150 | /// Physical scene representation of this Avatar. |
@@ -167,16 +161,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
167 | get { return m_movementflag; } | 161 | get { return m_movementflag; } |
168 | } | 162 | } |
169 | 163 | ||
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 | |||
180 | 164 | ||
181 | public bool Updated | 165 | public bool Updated |
182 | { | 166 | { |
@@ -184,8 +168,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
184 | get { return m_updateflag; } | 168 | get { return m_updateflag; } |
185 | } | 169 | } |
186 | 170 | ||
187 | private readonly ulong m_regionHandle; | ||
188 | |||
189 | public ulong RegionHandle | 171 | public ulong RegionHandle |
190 | { | 172 | { |
191 | get { return m_regionHandle; } | 173 | get { return m_regionHandle; } |
@@ -196,15 +178,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
196 | get { return m_CameraCenter; } | 178 | get { return m_CameraCenter; } |
197 | } | 179 | } |
198 | 180 | ||
199 | private readonly string m_firstname; | ||
200 | |||
201 | public string Firstname | 181 | public string Firstname |
202 | { | 182 | { |
203 | get { return m_firstname; } | 183 | get { return m_firstname; } |
204 | } | 184 | } |
205 | 185 | ||
206 | private readonly string m_lastname; | ||
207 | |||
208 | public string Lastname | 186 | public string Lastname |
209 | { | 187 | { |
210 | get { return m_lastname; } | 188 | get { return m_lastname; } |
@@ -215,29 +193,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | get { return m_DrawDistance; } | 193 | get { return m_DrawDistance; } |
216 | } | 194 | } |
217 | 195 | ||
218 | protected bool m_allowMovement = true; | ||
219 | |||
220 | public bool AllowMovement | 196 | public bool AllowMovement |
221 | { | 197 | { |
222 | get { return m_allowMovement; } | 198 | get { return m_allowMovement; } |
223 | set { m_allowMovement = value; } | 199 | set { m_allowMovement = value; } |
224 | } | 200 | } |
225 | 201 | ||
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 | |||
233 | public IClientAPI ControllingClient | 202 | public IClientAPI ControllingClient |
234 | { | 203 | { |
235 | get { return m_controllingClient; } | 204 | get { return m_controllingClient; } |
236 | set { m_controllingClient = value; } | 205 | set { m_controllingClient = value; } |
237 | } | 206 | } |
238 | 207 | ||
239 | protected LLVector3 m_parentPosition = new LLVector3(); | ||
240 | |||
241 | /// <summary> | 208 | /// <summary> |
242 | /// Absolute position of this avatar in 'region cordinates' | 209 | /// Absolute position of this avatar in 'region cordinates' |
243 | /// </summary> | 210 | /// </summary> |
@@ -272,7 +239,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
272 | } | 239 | } |
273 | 240 | ||
274 | m_pos = value; | 241 | m_pos = value; |
275 | m_parentPosition=new LLVector3(0, 0, 0); | 242 | m_parentPosition = new LLVector3(0, 0, 0); |
276 | } | 243 | } |
277 | } | 244 | } |
278 | 245 | ||
@@ -313,22 +280,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
313 | } | 280 | } |
314 | } | 281 | } |
315 | 282 | ||
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 | |||
324 | public bool IsChildAgent | 283 | public bool IsChildAgent |
325 | { | 284 | { |
326 | get { return m_isChildAgent; } | 285 | get { return m_isChildAgent; } |
327 | set { m_isChildAgent = value; } | 286 | set { m_isChildAgent = value; } |
328 | } | 287 | } |
329 | 288 | ||
330 | private uint m_parentID = 0; | ||
331 | |||
332 | public uint ParentID | 289 | public uint ParentID |
333 | { | 290 | { |
334 | get { return m_parentID; } | 291 | get { return m_parentID; } |
@@ -343,6 +300,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
343 | get { return m_knownChildRegions; } | 300 | get { return m_knownChildRegions; } |
344 | } | 301 | } |
345 | 302 | ||
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 | |||
346 | #endregion | 313 | #endregion |
347 | 314 | ||
348 | #region Constructor(s) | 315 | #region Constructor(s) |
@@ -420,6 +387,360 @@ namespace OpenSim.Region.Environment.Scenes | |||
420 | 387 | ||
421 | #endregion | 388 | #endregion |
422 | 389 | ||
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 | |||
423 | /// <summary> | 744 | /// <summary> |
424 | /// Add the part to the queue of parts for which we need to send an update to the client | 745 | /// Add the part to the queue of parts for which we need to send an update to the client |
425 | /// </summary> | 746 | /// </summary> |
@@ -457,12 +778,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
457 | if (!m_gotAllObjectsInScene) | 778 | if (!m_gotAllObjectsInScene) |
458 | { | 779 | { |
459 | if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor) | 780 | if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor) |
460 | { | 781 | { |
461 | m_scene.SendAllSceneObjectsToClient(this); | 782 | m_scene.SendAllSceneObjectsToClient(this); |
462 | m_gotAllObjectsInScene = true; | 783 | m_gotAllObjectsInScene = true; |
463 | } | 784 | } |
464 | } | 785 | } |
465 | 786 | ||
466 | if (m_partsUpdateQueue.Count > 0) | 787 | if (m_partsUpdateQueue.Count > 0) |
467 | { | 788 | { |
468 | bool runUpdate = true; | 789 | bool runUpdate = true; |
@@ -481,7 +802,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
481 | // m_log.DebugFormat( | 802 | // m_log.DebugFormat( |
482 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", | 803 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", |
483 | // part.Name, part.UUID, part.TimeStampFull); | 804 | // part.Name, part.UUID, part.TimeStampFull); |
484 | 805 | ||
485 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); | 806 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); |
486 | 807 | ||
487 | // We'll update to the part's timestamp rather than the current time to | 808 | // We'll update to the part's timestamp rather than the current time to |
@@ -497,7 +818,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
497 | // m_log.DebugFormat( | 818 | // m_log.DebugFormat( |
498 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", | 819 | // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", |
499 | // part.Name, part.UUID, part.TimeStampTerse); | 820 | // part.Name, part.UUID, part.TimeStampTerse); |
500 | 821 | ||
501 | part.SendTerseUpdate(ControllingClient); | 822 | part.SendTerseUpdate(ControllingClient); |
502 | 823 | ||
503 | update.LastTerseUpdateTime = part.TimeStampTerse; | 824 | update.LastTerseUpdateTime = part.TimeStampTerse; |
@@ -530,6 +851,235 @@ namespace OpenSim.Region.Environment.Scenes | |||
530 | AddNewMovement(position, rotation); | 851 | AddNewMovement(position, rotation); |
531 | } | 852 | } |
532 | 853 | ||
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 | |||
533 | #region Status Methods | 1083 | #region Status Methods |
534 | 1084 | ||
535 | /// <summary> | 1085 | /// <summary> |
@@ -542,7 +1092,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
542 | // m_log.DebugFormat( | 1092 | // m_log.DebugFormat( |
543 | // "[SCENEPRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2}", | 1093 | // "[SCENEPRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2}", |
544 | // Name, UUID, m_scene.RegionInfo.RegionName); | 1094 | // Name, UUID, m_scene.RegionInfo.RegionName); |
545 | 1095 | ||
546 | m_isChildAgent = false; | 1096 | m_isChildAgent = false; |
547 | 1097 | ||
548 | AbsolutePosition = pos; | 1098 | AbsolutePosition = pos; |
@@ -558,7 +1108,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
558 | //{ | 1108 | //{ |
559 | m_scene.SendAllSceneObjectsToClient(this); | 1109 | m_scene.SendAllSceneObjectsToClient(this); |
560 | m_scene.LandChannel.sendLandUpdate(this, true); | 1110 | m_scene.LandChannel.sendLandUpdate(this, true); |
561 | 1111 | ||
562 | //m_gotAllObjectsInScene = true; | 1112 | //m_gotAllObjectsInScene = true; |
563 | //} | 1113 | //} |
564 | } | 1114 | } |
@@ -572,9 +1122,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
572 | /// </summary> | 1122 | /// </summary> |
573 | public void MakeChildAgent() | 1123 | public void MakeChildAgent() |
574 | { | 1124 | { |
575 | if(m_animations.Count > 0) | 1125 | if (m_animations.Count > 0) |
576 | { | 1126 | { |
577 | LLUUID movement=m_animations[0]; | 1127 | LLUUID movement = m_animations[0]; |
578 | 1128 | ||
579 | m_animations.Clear(); | 1129 | m_animations.Clear(); |
580 | m_animationSeqs.Clear(); | 1130 | m_animationSeqs.Clear(); |
@@ -584,7 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
584 | // m_log.DebugFormat( | 1134 | // m_log.DebugFormat( |
585 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", | 1135 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", |
586 | // Name, UUID, m_scene.RegionInfo.RegionName); | 1136 | // Name, UUID, m_scene.RegionInfo.RegionName); |
587 | 1137 | ||
588 | Velocity = new LLVector3(0, 0, 0); | 1138 | Velocity = new LLVector3(0, 0, 0); |
589 | m_isChildAgent = true; | 1139 | m_isChildAgent = true; |
590 | m_scene.SwapRootAgentCount(true); | 1140 | m_scene.SwapRootAgentCount(true); |
@@ -841,9 +1391,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
841 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1391 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
842 | 1392 | ||
843 | // Are the collision requirements fulfilled? | 1393 | // Are the collision requirements fulfilled? |
844 | bool colliding = (m_physicsActor.IsColliding == true); | 1394 | bool colliding = m_physicsActor.IsColliding; |
845 | 1395 | ||
846 | |||
847 | 1396 | ||
848 | if (m_physicsActor.Flying && colliding && controlland) | 1397 | if (m_physicsActor.Flying && colliding && controlland) |
849 | { | 1398 | { |
@@ -857,9 +1406,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
857 | UpdateMovementAnimations(update_movementflag); | 1406 | UpdateMovementAnimations(update_movementflag); |
858 | } | 1407 | } |
859 | } | 1408 | } |
860 | 1409 | ||
861 | m_scene.EventManager.TriggerOnClientMovement(this); | 1410 | m_scene.EventManager.TriggerOnClientMovement(this); |
862 | 1411 | ||
863 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1412 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
864 | } | 1413 | } |
865 | 1414 | ||
@@ -886,9 +1435,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
886 | AddToPhysicalScene(); | 1435 | AddToPhysicalScene(); |
887 | } | 1436 | } |
888 | 1437 | ||
889 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 1438 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); |
890 | m_parentPosition = new LLVector3(); | 1439 | m_parentPosition = new LLVector3(); |
891 | 1440 | ||
892 | m_parentID = 0; | 1441 | m_parentID = 0; |
893 | SendFullUpdateToAllClients(); | 1442 | SendFullUpdateToAllClients(); |
894 | 1443 | ||
@@ -991,7 +1540,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
991 | } | 1540 | } |
992 | else | 1541 | else |
993 | { | 1542 | { |
994 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); | 1543 | m_log.Warn("Sit requested on unknown object: " + targetID); |
995 | } | 1544 | } |
996 | SendSitResponse(remoteClient, targetID, offset); | 1545 | SendSitResponse(remoteClient, targetID, offset); |
997 | } | 1546 | } |
@@ -1053,11 +1602,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1053 | 1602 | ||
1054 | public void AddAnimation(LLUUID animID) | 1603 | public void AddAnimation(LLUUID animID) |
1055 | { | 1604 | { |
1056 | if(m_isChildAgent) | 1605 | if (m_isChildAgent) |
1057 | return; | 1606 | return; |
1058 | 1607 | ||
1059 | // Don't let this animation become the movement animation | 1608 | // Don't let this animation become the movement animation |
1060 | if(m_animations.Count < 1) | 1609 | if (m_animations.Count < 1) |
1061 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | 1610 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); |
1062 | 1611 | ||
1063 | if (!m_animations.Contains(animID)) | 1612 | if (!m_animations.Contains(animID)) |
@@ -1070,7 +1619,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1070 | 1619 | ||
1071 | public void RemoveAnimation(LLUUID animID) | 1620 | public void RemoveAnimation(LLUUID animID) |
1072 | { | 1621 | { |
1073 | if(m_isChildAgent) | 1622 | if (m_isChildAgent) |
1074 | return; | 1623 | return; |
1075 | 1624 | ||
1076 | if (m_animations.Contains(animID)) | 1625 | if (m_animations.Contains(animID)) |
@@ -1084,11 +1633,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1084 | // What a HACK!! Anim list really needs to be an object! | 1633 | // What a HACK!! Anim list really needs to be an object! |
1085 | int idx; | 1634 | int idx; |
1086 | 1635 | ||
1087 | for(idx=0;idx < m_animations.Count;idx++) | 1636 | for (idx = 0; idx < m_animations.Count; idx++) |
1088 | { | 1637 | { |
1089 | if(m_animations[idx] == animID) | 1638 | if (m_animations[idx] == animID) |
1090 | { | 1639 | { |
1091 | int seq=m_animationSeqs[idx]; | 1640 | int seq = m_animationSeqs[idx]; |
1092 | 1641 | ||
1093 | m_animations.Remove(animID); | 1642 | m_animations.Remove(animID); |
1094 | m_animationSeqs.Remove(seq); | 1643 | m_animationSeqs.Remove(seq); |
@@ -1117,7 +1666,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1117 | /// </summary> | 1666 | /// </summary> |
1118 | protected void SetMovementAnimation(LLUUID anim) | 1667 | protected void SetMovementAnimation(LLUUID anim) |
1119 | { | 1668 | { |
1120 | if(m_animations.Count < 1) | 1669 | if (m_animations.Count < 1) |
1121 | { | 1670 | { |
1122 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | 1671 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); |
1123 | m_animationSeqs.Add(1); | 1672 | m_animationSeqs.Add(1); |
@@ -1150,8 +1699,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1150 | /// </summary> | 1699 | /// </summary> |
1151 | protected void UpdateMovementAnimations(bool update_movementflag) | 1700 | protected void UpdateMovementAnimations(bool update_movementflag) |
1152 | { | 1701 | { |
1153 | |||
1154 | |||
1155 | if (update_movementflag) | 1702 | if (update_movementflag) |
1156 | { | 1703 | { |
1157 | // Are we moving? | 1704 | // Are we moving? |
@@ -1184,7 +1731,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1184 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); | 1731 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); |
1185 | } | 1732 | } |
1186 | catch (KeyNotFoundException) | 1733 | catch (KeyNotFoundException) |
1187 | { } | 1734 | { |
1735 | } | ||
1188 | } | 1736 | } |
1189 | else if (m_setAlwaysRun) | 1737 | else if (m_setAlwaysRun) |
1190 | { | 1738 | { |
@@ -1194,7 +1742,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1194 | SetMovementAnimation(Animations.AnimsLLUUID["RUN"]); | 1742 | SetMovementAnimation(Animations.AnimsLLUUID["RUN"]); |
1195 | } | 1743 | } |
1196 | catch (KeyNotFoundException) | 1744 | catch (KeyNotFoundException) |
1197 | { } | 1745 | { |
1746 | } | ||
1198 | } | 1747 | } |
1199 | else | 1748 | else |
1200 | { | 1749 | { |
@@ -1204,8 +1753,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1204 | SetMovementAnimation(Animations.AnimsLLUUID["WALK"]); | 1753 | SetMovementAnimation(Animations.AnimsLLUUID["WALK"]); |
1205 | } | 1754 | } |
1206 | catch (KeyNotFoundException) | 1755 | catch (KeyNotFoundException) |
1207 | { } | 1756 | { |
1208 | 1757 | } | |
1209 | } | 1758 | } |
1210 | } | 1759 | } |
1211 | else | 1760 | else |
@@ -1239,15 +1788,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1239 | // We're not moving.. and we're not doing anything.. so play the stand animation | 1788 | // We're not moving.. and we're not doing anything.. so play the stand animation |
1240 | try | 1789 | try |
1241 | { | 1790 | { |
1242 | |||
1243 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | 1791 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); |
1244 | } | 1792 | } |
1245 | catch (KeyNotFoundException) | 1793 | catch (KeyNotFoundException) |
1246 | { } | 1794 | { |
1795 | } | ||
1247 | } | 1796 | } |
1248 | } | 1797 | } |
1249 | } | 1798 | } |
1250 | |||
1251 | } | 1799 | } |
1252 | 1800 | ||
1253 | /// <summary> | 1801 | /// <summary> |
@@ -1262,13 +1810,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1262 | } | 1810 | } |
1263 | 1811 | ||
1264 | m_perfMonMS = System.Environment.TickCount; | 1812 | m_perfMonMS = System.Environment.TickCount; |
1265 | 1813 | ||
1266 | m_rotation = rotation; | 1814 | m_rotation = rotation; |
1267 | NewForce newVelocity = new NewForce(); | 1815 | NewForce newVelocity = new NewForce(); |
1268 | Vector3 direc = rotation*vec; | 1816 | Vector3 direc = rotation * vec; |
1269 | direc.Normalize(); | 1817 | direc.Normalize(); |
1270 | 1818 | ||
1271 | direc *= 0.03f*128f; | 1819 | direc *= 0.03f * 128f; |
1272 | if (m_physicsActor.Flying) | 1820 | if (m_physicsActor.Flying) |
1273 | { | 1821 | { |
1274 | direc *= 4; | 1822 | direc *= 4; |
@@ -1300,7 +1848,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1300 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); | 1848 | SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]); |
1301 | } | 1849 | } |
1302 | catch (KeyNotFoundException) | 1850 | catch (KeyNotFoundException) |
1303 | { } | 1851 | { |
1852 | } | ||
1304 | } | 1853 | } |
1305 | } | 1854 | } |
1306 | } | 1855 | } |
@@ -1346,23 +1895,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1346 | m_updateCount = 0; | 1895 | m_updateCount = 0; |
1347 | } | 1896 | } |
1348 | } | 1897 | } |
1349 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement | 1898 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) |
1899 | // physics-related movement | ||
1350 | { | 1900 | { |
1351 | |||
1352 | |||
1353 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity | 1901 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity |
1354 | // doing the above assures us that we know what we sent the clients last | 1902 | // doing the above assures us that we know what we sent the clients last |
1355 | SendTerseUpdateToAllClients(); | 1903 | SendTerseUpdateToAllClients(); |
1356 | m_updateCount = 0; | 1904 | m_updateCount = 0; |
1357 | |||
1358 | |||
1359 | |||
1360 | } | 1905 | } |
1361 | 1906 | ||
1362 | // followed suggestion from mic bowman. reversed the two lines below. | 1907 | // followed suggestion from mic bowman. reversed the two lines below. |
1363 | CheckForBorderCrossing(); | 1908 | CheckForBorderCrossing(); |
1364 | CheckForSignificantMovement(); // sends update to the modules. | 1909 | CheckForSignificantMovement(); // sends update to the modules. |
1365 | |||
1366 | } | 1910 | } |
1367 | } | 1911 | } |
1368 | 1912 | ||
@@ -1381,7 +1925,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1381 | LLVector3 pos = m_pos; | 1925 | LLVector3 pos = m_pos; |
1382 | LLVector3 vel = Velocity; | 1926 | LLVector3 vel = Velocity; |
1383 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); | 1927 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); |
1384 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), | 1928 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort) (m_scene.TimeDilation * ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), |
1385 | new LLVector3(vel.X, vel.Y, vel.Z), rot); | 1929 | new LLVector3(vel.X, vel.Y, vel.Z), rot); |
1386 | 1930 | ||
1387 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1931 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
@@ -1401,7 +1945,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1401 | lastPhysPos = AbsolutePosition; | 1945 | lastPhysPos = AbsolutePosition; |
1402 | 1946 | ||
1403 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1947 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
1404 | |||
1405 | } | 1948 | } |
1406 | 1949 | ||
1407 | public void SendCoarseLocations() | 1950 | public void SendCoarseLocations() |
@@ -1497,15 +2040,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1497 | /// </summary> | 2040 | /// </summary> |
1498 | public void SendAppearanceToAllOtherAgents() | 2041 | public void SendAppearanceToAllOtherAgents() |
1499 | { | 2042 | { |
1500 | m_perfMonMS=System.Environment.TickCount; | 2043 | m_perfMonMS = System.Environment.TickCount; |
1501 | 2044 | ||
1502 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2045 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
1503 | { | ||
1504 | if (scenePresence.UUID != UUID) | ||
1505 | { | 2046 | { |
1506 | m_appearance.SendAppearanceToOtherAgent(scenePresence); | 2047 | if (scenePresence.UUID != UUID) |
1507 | } | 2048 | { |
1508 | }); | 2049 | m_appearance.SendAppearanceToOtherAgent(scenePresence); |
2050 | } | ||
2051 | }); | ||
1509 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 2052 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
1510 | } | 2053 | } |
1511 | 2054 | ||
@@ -1534,7 +2077,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1534 | /// <param name="seqs"></param> | 2077 | /// <param name="seqs"></param> |
1535 | public void SendAnimPack(LLUUID[] animations, int[] seqs) | 2078 | public void SendAnimPack(LLUUID[] animations, int[] seqs) |
1536 | { | 2079 | { |
1537 | if(m_isChildAgent) | 2080 | if (m_isChildAgent) |
1538 | return; | 2081 | return; |
1539 | 2082 | ||
1540 | m_scene.Broadcast( | 2083 | m_scene.Broadcast( |
@@ -1570,10 +2113,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1570 | } | 2113 | } |
1571 | 2114 | ||
1572 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | 2115 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m |
1573 | if (Util.GetDistanceTo(AbsolutePosition,m_LastChildAgentUpdatePosition) > 32) | 2116 | if (Util.GetDistanceTo(AbsolutePosition, m_LastChildAgentUpdatePosition) > 32) |
1574 | { | 2117 | { |
1575 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 2118 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
1576 | cadu.ActiveGroupID=LLUUID.Zero.UUID; | 2119 | cadu.ActiveGroupID = LLUUID.Zero.UUID; |
1577 | cadu.AgentID = UUID.UUID; | 2120 | cadu.AgentID = UUID.UUID; |
1578 | cadu.alwaysrun = m_setAlwaysRun; | 2121 | cadu.alwaysrun = m_setAlwaysRun; |
1579 | cadu.AVHeight = m_avHeight; | 2122 | cadu.AVHeight = m_avHeight; |
@@ -1585,8 +2128,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1585 | cadu.Position = new sLLVector3(AbsolutePosition); | 2128 | cadu.Position = new sLLVector3(AbsolutePosition); |
1586 | cadu.regionHandle = m_scene.RegionInfo.RegionHandle; | 2129 | cadu.regionHandle = m_scene.RegionInfo.RegionHandle; |
1587 | cadu.throttles = ControllingClient.GetThrottlesPacked(1f); | 2130 | cadu.throttles = ControllingClient.GetThrottlesPacked(1f); |
1588 | cadu.Velocity = new sLLVector3(Velocity); | 2131 | cadu.Velocity = new sLLVector3(Velocity); |
1589 | m_scene.SendOutChildAgentUpdates(cadu,this); | 2132 | m_scene.SendOutChildAgentUpdates(cadu, this); |
1590 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; | 2133 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; |
1591 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; | 2134 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; |
1592 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; | 2135 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; |
@@ -1606,9 +2149,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1606 | LLVector3 vel = Velocity; | 2149 | LLVector3 vel = Velocity; |
1607 | 2150 | ||
1608 | float timeStep = 0.1f; | 2151 | float timeStep = 0.1f; |
1609 | pos2.X = pos2.X + (vel.X*timeStep); | 2152 | pos2.X = pos2.X + (vel.X * timeStep); |
1610 | pos2.Y = pos2.Y + (vel.Y*timeStep); | 2153 | pos2.Y = pos2.Y + (vel.Y * timeStep); |
1611 | pos2.Z = pos2.Z + (vel.Z*timeStep); | 2154 | pos2.Z = pos2.Z + (vel.Z * timeStep); |
1612 | 2155 | ||
1613 | if ((pos2.X < 0) || (pos2.X > Constants.RegionSize)) | 2156 | if ((pos2.X < 0) || (pos2.X > Constants.RegionSize)) |
1614 | { | 2157 | { |
@@ -1663,10 +2206,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1663 | } | 2206 | } |
1664 | 2207 | ||
1665 | LLVector3 vel = m_velocity; | 2208 | LLVector3 vel = m_velocity; |
1666 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 2209 | ulong neighbourHandle = Helpers.UIntsToLong((neighbourx * Constants.RegionSize), (neighboury * Constants.RegionSize)); |
1667 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 2210 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
1668 | if (neighbourRegion != null) | 2211 | if (neighbourRegion != null) |
1669 | { | 2212 | { |
1670 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 2213 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
1671 | // This means we need to remove the current caps handler here and possibly compensate later, | 2214 | // This means we need to remove the current caps handler here and possibly compensate later, |
1672 | // in case both scenes are being hosted on the same region server. Messy | 2215 | // in case both scenes are being hosted on the same region server. Messy |
@@ -1676,17 +2219,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1676 | m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, | 2219 | m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, |
1677 | m_physicsActor.Flying); | 2220 | m_physicsActor.Flying); |
1678 | if (res) | 2221 | if (res) |
1679 | { | 2222 | { |
1680 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 2223 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
1681 | 2224 | ||
1682 | // TODO Should construct this behind a method | 2225 | // TODO Should construct this behind a method |
1683 | string capsPath = | 2226 | string capsPath = |
1684 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort | 2227 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort |
1685 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; | 2228 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; |
1686 | 2229 | ||
1687 | m_log.DebugFormat( | 2230 | m_log.DebugFormat( |
1688 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); | 2231 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid); |
1689 | 2232 | ||
1690 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, | 2233 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, |
1691 | capsPath); | 2234 | capsPath); |
1692 | MakeChildAgent(); | 2235 | MakeChildAgent(); |
@@ -1703,128 +2246,40 @@ namespace OpenSim.Region.Environment.Scenes | |||
1703 | 2246 | ||
1704 | #endregion | 2247 | #endregion |
1705 | 2248 | ||
1706 | /// <summary> | 2249 | #region Nested type: Dir_ControlFlags |
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 | } | ||
1736 | 2250 | ||
1737 | /// <summary> | 2251 | /// <summary> |
1738 | /// This updates important decision making data about a child agent | 2252 | /// Implemented Control Flags |
1739 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | ||
1740 | /// </summary> | 2253 | /// </summary> |
1741 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) | 2254 | private enum Dir_ControlFlags |
1742 | { | 2255 | { |
1743 | // | 2256 | DIR_CONTROL_FLAG_FORWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS, |
1744 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; | 2257 | DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, |
1745 | int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; | 2258 | DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS, |
1746 | 2259 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | |
1747 | m_DrawDistance = cAgentData.drawdistance; | 2260 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, |
1748 | m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); | 2261 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
1749 | 2262 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | |
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; | ||
1768 | } | 2263 | } |
1769 | 2264 | ||
1770 | /// <summary> | 2265 | #endregion |
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 | } | ||
1807 | 2266 | ||
1808 | static ScenePresence() | 2267 | #region Nested type: NewForce |
1809 | { | ||
1810 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1811 | DefaultTexture = textu.ToBytes(); | ||
1812 | } | ||
1813 | 2268 | ||
1814 | [Serializable] | 2269 | [Serializable] |
1815 | public class NewForce | 2270 | public class NewForce |
1816 | { | 2271 | { |
1817 | public float X; | 2272 | public float X; |
1818 | public float Y; | 2273 | public float Y; |
1819 | public float Z; | 2274 | public float Z; |
1820 | |||
1821 | public NewForce() | ||
1822 | { | ||
1823 | } | ||
1824 | } | 2275 | } |
1825 | 2276 | ||
1826 | [Serializable] | 2277 | #endregion |
1827 | public class ScenePartUpdate : ISerializable | 2278 | |
2279 | #region Nested type: ScenePartUpdate | ||
2280 | |||
2281 | [Serializable] | ||
2282 | public class ScenePartUpdate : ISerializable | ||
1828 | { | 2283 | { |
1829 | public LLUUID FullID; | 2284 | public LLUUID FullID; |
1830 | public uint LastFullUpdateTime; | 2285 | public uint LastFullUpdateTime; |
@@ -1846,15 +2301,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1846 | throw new ArgumentNullException("info"); | 2301 | throw new ArgumentNullException("info"); |
1847 | } | 2302 | } |
1848 | 2303 | ||
1849 | FullID = new LLUUID((Guid)info.GetValue("FullID", typeof(Guid))); | 2304 | FullID = new LLUUID((Guid) info.GetValue("FullID", typeof (Guid))); |
1850 | LastFullUpdateTime = (uint)info.GetValue("LastFullUpdateTime", typeof(uint)); | 2305 | LastFullUpdateTime = (uint) info.GetValue("LastFullUpdateTime", typeof (uint)); |
1851 | LastTerseUpdateTime = (uint)info.GetValue("LastTerseUpdateTime", typeof(uint)); | 2306 | LastTerseUpdateTime = (uint) info.GetValue("LastTerseUpdateTime", typeof (uint)); |
1852 | 2307 | ||
1853 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); | 2308 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); |
1854 | } | 2309 | } |
1855 | 2310 | ||
2311 | #region ISerializable Members | ||
2312 | |||
1856 | [SecurityPermission(SecurityAction.LinkDemand, | 2313 | [SecurityPermission(SecurityAction.LinkDemand, |
1857 | Flags = SecurityPermissionFlag.SerializationFormatter)] | 2314 | Flags = SecurityPermissionFlag.SerializationFormatter)] |
1858 | public virtual void GetObjectData( | 2315 | public virtual void GetObjectData( |
1859 | SerializationInfo info, StreamingContext context) | 2316 | SerializationInfo info, StreamingContext context) |
1860 | { | 2317 | { |
@@ -1867,473 +2324,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1867 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); | 2324 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); |
1868 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); | 2325 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); |
1869 | } | 2326 | } |
1870 | } | ||
1871 | |||
1872 | public override void SetText(string text, Vector3 color, double alpha) | ||
1873 | { | ||
1874 | throw new Exception("Can't set Text on avatar."); | ||
1875 | } | ||
1876 | |||
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 | 2327 | ||
1935 | RemoveFromPhysicalScene(); | 2328 | #endregion |
1936 | GC.Collect(); | ||
1937 | } | 2329 | } |
1938 | 2330 | ||
1939 | public ScenePresence() | 2331 | #endregion |
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 | } | ||
2338 | } | 2332 | } |
2339 | } | 2333 | } \ No newline at end of file |