diff options
author | Dan Lake | 2011-10-06 12:19:31 -0700 |
---|---|---|
committer | Dan Lake | 2011-10-06 12:19:31 -0700 |
commit | bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15 (patch) | |
tree | 3c844104ae8b8e61684cae11e4675bf5b43c4a8a /OpenSim/Region | |
parent | Removed redundant scene presence lookups in HGMessageTransferModule (diff) | |
download | opensim-SC_OLD-bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15.zip opensim-SC_OLD-bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15.tar.gz opensim-SC_OLD-bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15.tar.bz2 opensim-SC_OLD-bd9ba904c3e4d9c2c626a7749f19f124b4ddcf15.tar.xz |
Refactor ScenePresence so gets and sets are through properties. Added private sets when needed. Removed redundant code when methods replicated what the set already does
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 575 |
1 files changed, 288 insertions, 287 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b3e04be..0290576 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -100,16 +100,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
100 | 100 | ||
101 | public UUID currentParcelUUID = UUID.Zero; | 101 | public UUID currentParcelUUID = UUID.Zero; |
102 | 102 | ||
103 | private ISceneViewer m_sceneViewer; | 103 | protected ScenePresenceAnimator m_animator; |
104 | |||
105 | /// <value> | 104 | /// <value> |
106 | /// The animator for this avatar | 105 | /// The animator for this avatar |
107 | /// </value> | 106 | /// </value> |
108 | public ScenePresenceAnimator Animator | 107 | public ScenePresenceAnimator Animator |
109 | { | 108 | { |
110 | get { return m_animator; } | 109 | get { return m_animator; } |
110 | private set { m_animator = value; } | ||
111 | } | 111 | } |
112 | protected ScenePresenceAnimator m_animator; | ||
113 | 112 | ||
114 | /// <summary> | 113 | /// <summary> |
115 | /// Attachments recorded on this avatar. | 114 | /// Attachments recorded on this avatar. |
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | private Vector3 m_lastVelocity; | 136 | private Vector3 m_lastVelocity; |
138 | //private int m_lastTerseSent; | 137 | //private int m_lastTerseSent; |
139 | 138 | ||
140 | private bool m_updateflag; | ||
141 | private byte m_movementflag; | ||
142 | private Vector3? m_forceToApply; | 139 | private Vector3? m_forceToApply; |
143 | private TeleportFlags m_teleportFlags; | 140 | private TeleportFlags m_teleportFlags; |
144 | public TeleportFlags TeleportFlags | 141 | public TeleportFlags TeleportFlags |
@@ -159,25 +156,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
159 | 156 | ||
160 | private float m_sitAvatarHeight = 2.0f; | 157 | private float m_sitAvatarHeight = 2.0f; |
161 | 158 | ||
162 | private int m_godLevel; | ||
163 | private int m_userLevel; | ||
164 | |||
165 | private bool m_invulnerable = true; | ||
166 | |||
167 | private Vector3 m_lastChildAgentUpdatePosition; | 159 | private Vector3 m_lastChildAgentUpdatePosition; |
168 | private Vector3 m_lastChildAgentUpdateCamPosition; | 160 | private Vector3 m_lastChildAgentUpdateCamPosition; |
169 | 161 | ||
170 | private int m_perfMonMS; | 162 | private int m_perfMonMS; |
171 | 163 | ||
172 | private bool m_setAlwaysRun; | ||
173 | |||
174 | private bool m_forceFly; | ||
175 | private bool m_flyDisabled; | ||
176 | |||
177 | private float m_speedModifier = 1.0f; | ||
178 | |||
179 | private Quaternion m_bodyRot = Quaternion.Identity; | ||
180 | |||
181 | private const int LAND_VELOCITYMAG_MAX = 12; | 164 | private const int LAND_VELOCITYMAG_MAX = 12; |
182 | 165 | ||
183 | public bool IsRestrictedToRegion; | 166 | public bool IsRestrictedToRegion; |
@@ -190,22 +173,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
190 | 173 | ||
191 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; | 174 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; |
192 | 175 | ||
193 | // Position of agent's camera in world (region cordinates) | ||
194 | protected Vector3 m_CameraCenter; | ||
195 | protected Vector3 m_lastCameraCenter; | ||
196 | 176 | ||
197 | protected Timer m_reprioritization_timer; | 177 | protected Timer m_reprioritization_timer; |
198 | protected bool m_reprioritizing; | 178 | protected bool m_reprioritizing; |
199 | protected bool m_reprioritization_called; | 179 | protected bool m_reprioritization_called; |
200 | 180 | ||
201 | // Use these three vectors to figure out what the agent is looking at | ||
202 | // Convert it to a Matrix and/or Quaternion | ||
203 | protected Vector3 m_CameraAtAxis; | ||
204 | protected Vector3 m_CameraLeftAxis; | ||
205 | protected Vector3 m_CameraUpAxis; | ||
206 | private AgentManager.ControlFlags m_AgentControlFlags; | ||
207 | private Quaternion m_headrotation = Quaternion.Identity; | 181 | private Quaternion m_headrotation = Quaternion.Identity; |
208 | private byte m_state; | ||
209 | 182 | ||
210 | //Reuse the Vector3 instead of creating a new one on the UpdateMovement method | 183 | //Reuse the Vector3 instead of creating a new one on the UpdateMovement method |
211 | // private Vector3 movementvector; | 184 | // private Vector3 movementvector; |
@@ -234,11 +207,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
234 | //private int m_moveToPositionStateStatus; | 207 | //private int m_moveToPositionStateStatus; |
235 | //***************************************************** | 208 | //***************************************************** |
236 | 209 | ||
237 | // Agent's Draw distance. | ||
238 | protected float m_DrawDistance; | ||
239 | |||
240 | protected AvatarAppearance m_appearance; | 210 | protected AvatarAppearance m_appearance; |
241 | 211 | ||
212 | public AvatarAppearance Appearance | ||
213 | { | ||
214 | get { return m_appearance; } | ||
215 | set | ||
216 | { | ||
217 | m_appearance = value; | ||
218 | // m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | |||
242 | // neighbouring regions we have enabled a child agent in | 223 | // neighbouring regions we have enabled a child agent in |
243 | // holds the seed cap for the child agent in that region | 224 | // holds the seed cap for the child agent in that region |
244 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | 225 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); |
@@ -250,6 +231,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
250 | public List<string> InTransitScriptStates | 231 | public List<string> InTransitScriptStates |
251 | { | 232 | { |
252 | get { return m_InTransitScriptStates; } | 233 | get { return m_InTransitScriptStates; } |
234 | private set { m_InTransitScriptStates = value; } | ||
253 | } | 235 | } |
254 | private List<string> m_InTransitScriptStates = new List<string>(); | 236 | private List<string> m_InTransitScriptStates = new List<string>(); |
255 | 237 | ||
@@ -278,8 +260,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | string m_callbackURI; | 260 | string m_callbackURI; |
279 | UUID m_originRegionID; | 261 | UUID m_originRegionID; |
280 | 262 | ||
281 | ulong m_rootRegionHandle; | ||
282 | |||
283 | /// <value> | 263 | /// <value> |
284 | /// Script engines present in the scene | 264 | /// Script engines present in the scene |
285 | /// </value> | 265 | /// </value> |
@@ -287,6 +267,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
287 | 267 | ||
288 | #region Properties | 268 | #region Properties |
289 | 269 | ||
270 | protected PhysicsActor m_physicsActor; | ||
271 | |||
290 | /// <summary> | 272 | /// <summary> |
291 | /// Physical scene representation of this Avatar. | 273 | /// Physical scene representation of this Avatar. |
292 | /// </summary> | 274 | /// </summary> |
@@ -296,69 +278,102 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | get { return m_physicsActor; } | 278 | get { return m_physicsActor; } |
297 | } | 279 | } |
298 | 280 | ||
281 | private byte m_movementflag; | ||
282 | |||
299 | public byte MovementFlag | 283 | public byte MovementFlag |
300 | { | 284 | { |
301 | set { m_movementflag = value; } | 285 | set { m_movementflag = value; } |
302 | get { return m_movementflag; } | 286 | get { return m_movementflag; } |
303 | } | 287 | } |
304 | 288 | ||
289 | private bool m_updateflag; | ||
290 | |||
305 | public bool Updated | 291 | public bool Updated |
306 | { | 292 | { |
307 | set { m_updateflag = value; } | 293 | set { m_updateflag = value; } |
308 | get { return m_updateflag; } | 294 | get { return m_updateflag; } |
309 | } | 295 | } |
310 | 296 | ||
297 | private bool m_invulnerable = true; | ||
298 | |||
311 | public bool Invulnerable | 299 | public bool Invulnerable |
312 | { | 300 | { |
313 | set { m_invulnerable = value; } | 301 | set { m_invulnerable = value; } |
314 | get { return m_invulnerable; } | 302 | get { return m_invulnerable; } |
315 | } | 303 | } |
316 | 304 | ||
305 | private int m_userLevel; | ||
306 | |||
317 | public int UserLevel | 307 | public int UserLevel |
318 | { | 308 | { |
319 | get { return m_userLevel; } | 309 | get { return m_userLevel; } |
310 | private set { m_userLevel = value; } | ||
320 | } | 311 | } |
321 | 312 | ||
313 | private int m_godLevel; | ||
314 | |||
322 | public int GodLevel | 315 | public int GodLevel |
323 | { | 316 | { |
324 | get { return m_godLevel; } | 317 | get { return m_godLevel; } |
318 | private set { m_godLevel = value; } | ||
325 | } | 319 | } |
326 | 320 | ||
321 | private ulong m_rootRegionHandle; | ||
322 | |||
327 | public ulong RegionHandle | 323 | public ulong RegionHandle |
328 | { | 324 | { |
329 | get { return m_rootRegionHandle; } | 325 | get { return m_rootRegionHandle; } |
326 | private set { m_rootRegionHandle = value; } | ||
330 | } | 327 | } |
331 | 328 | ||
329 | #region Client Camera | ||
330 | // Position of agent's camera in world (region cordinates) | ||
331 | protected Vector3 m_lastCameraPosition; | ||
332 | |||
333 | protected Vector3 m_CameraPosition; | ||
334 | |||
332 | public Vector3 CameraPosition | 335 | public Vector3 CameraPosition |
333 | { | 336 | { |
334 | get { return m_CameraCenter; } | 337 | get { return m_CameraPosition; } |
338 | private set { m_CameraPosition = value; } | ||
335 | } | 339 | } |
336 | 340 | ||
337 | public Quaternion CameraRotation | 341 | public Quaternion CameraRotation |
338 | { | 342 | { |
339 | get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); } | 343 | get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); } |
340 | } | 344 | } |
341 | 345 | ||
346 | // Use these three vectors to figure out what the agent is looking at | ||
347 | // Convert it to a Matrix and/or Quaternion | ||
348 | // | ||
349 | protected Vector3 m_CameraAtAxis; | ||
350 | protected Vector3 m_CameraLeftAxis; | ||
351 | protected Vector3 m_CameraUpAxis; | ||
352 | |||
342 | public Vector3 CameraAtAxis | 353 | public Vector3 CameraAtAxis |
343 | { | 354 | { |
344 | get { return m_CameraAtAxis; } | 355 | get { return m_CameraAtAxis; } |
356 | private set { m_CameraAtAxis = value; } | ||
345 | } | 357 | } |
346 | 358 | ||
359 | |||
347 | public Vector3 CameraLeftAxis | 360 | public Vector3 CameraLeftAxis |
348 | { | 361 | { |
349 | get { return m_CameraLeftAxis; } | 362 | get { return m_CameraLeftAxis; } |
363 | private set { m_CameraLeftAxis = value; } | ||
350 | } | 364 | } |
351 | 365 | ||
352 | public Vector3 CameraUpAxis | 366 | public Vector3 CameraUpAxis |
353 | { | 367 | { |
354 | get { return m_CameraUpAxis; } | 368 | get { return m_CameraUpAxis; } |
369 | private set { m_CameraUpAxis = value; } | ||
355 | } | 370 | } |
356 | 371 | ||
357 | public Vector3 Lookat | 372 | public Vector3 Lookat |
358 | { | 373 | { |
359 | get | 374 | get |
360 | { | 375 | { |
361 | Vector3 a = new Vector3(m_CameraAtAxis.X, m_CameraAtAxis.Y, 0); | 376 | Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0); |
362 | 377 | ||
363 | if (a == Vector3.Zero) | 378 | if (a == Vector3.Zero) |
364 | return a; | 379 | return a; |
@@ -366,20 +381,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
366 | return Util.GetNormalizedVector(a); | 381 | return Util.GetNormalizedVector(a); |
367 | } | 382 | } |
368 | } | 383 | } |
384 | #endregion | ||
369 | 385 | ||
370 | private readonly string m_firstname; | 386 | public readonly string Firstname; |
371 | 387 | public readonly string Lastname; | |
372 | public string Firstname | ||
373 | { | ||
374 | get { return m_firstname; } | ||
375 | } | ||
376 | |||
377 | private readonly string m_lastname; | ||
378 | |||
379 | public string Lastname | ||
380 | { | ||
381 | get { return m_lastname; } | ||
382 | } | ||
383 | 388 | ||
384 | private string m_grouptitle; | 389 | private string m_grouptitle; |
385 | 390 | ||
@@ -389,9 +394,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
389 | set { m_grouptitle = value; } | 394 | set { m_grouptitle = value; } |
390 | } | 395 | } |
391 | 396 | ||
397 | // Agent's Draw distance. | ||
398 | protected float m_DrawDistance; | ||
399 | |||
392 | public float DrawDistance | 400 | public float DrawDistance |
393 | { | 401 | { |
394 | get { return m_DrawDistance; } | 402 | get { return m_DrawDistance; } |
403 | private set { m_DrawDistance = value; } | ||
395 | } | 404 | } |
396 | 405 | ||
397 | protected bool m_allowMovement = true; | 406 | protected bool m_allowMovement = true; |
@@ -402,6 +411,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
402 | set { m_allowMovement = value; } | 411 | set { m_allowMovement = value; } |
403 | } | 412 | } |
404 | 413 | ||
414 | private bool m_setAlwaysRun; | ||
415 | |||
405 | public bool SetAlwaysRun | 416 | public bool SetAlwaysRun |
406 | { | 417 | { |
407 | get | 418 | get |
@@ -425,12 +436,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
425 | } | 436 | } |
426 | } | 437 | } |
427 | 438 | ||
439 | private byte m_state; | ||
440 | |||
428 | public byte State | 441 | public byte State |
429 | { | 442 | { |
430 | get { return m_state; } | 443 | get { return m_state; } |
431 | set { m_state = value; } | 444 | set { m_state = value; } |
432 | } | 445 | } |
433 | 446 | ||
447 | private AgentManager.ControlFlags m_AgentControlFlags; | ||
448 | |||
434 | public uint AgentControlFlags | 449 | public uint AgentControlFlags |
435 | { | 450 | { |
436 | get { return (uint)m_AgentControlFlags; } | 451 | get { return (uint)m_AgentControlFlags; } |
@@ -442,11 +457,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
442 | /// </summary> | 457 | /// </summary> |
443 | private IClientAPI m_controllingClient; | 458 | private IClientAPI m_controllingClient; |
444 | 459 | ||
445 | protected PhysicsActor m_physicsActor; | ||
446 | |||
447 | public IClientAPI ControllingClient | 460 | public IClientAPI ControllingClient |
448 | { | 461 | { |
449 | get { return m_controllingClient; } | 462 | get { return m_controllingClient; } |
463 | private set { m_controllingClient = value; } | ||
450 | } | 464 | } |
451 | 465 | ||
452 | public IClientCore ClientView | 466 | public IClientCore ClientView |
@@ -455,6 +469,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | } | 469 | } |
456 | 470 | ||
457 | protected Vector3 m_parentPosition; | 471 | protected Vector3 m_parentPosition; |
472 | |||
458 | public Vector3 ParentPosition | 473 | public Vector3 ParentPosition |
459 | { | 474 | { |
460 | get { return m_parentPosition; } | 475 | get { return m_parentPosition; } |
@@ -468,10 +483,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
468 | { | 483 | { |
469 | get | 484 | get |
470 | { | 485 | { |
471 | PhysicsActor actor = m_physicsActor; | 486 | if (PhysicsActor != null) |
472 | if (actor != null) | ||
473 | { | 487 | { |
474 | m_pos = actor.Position; | 488 | m_pos = PhysicsActor.Position; |
475 | 489 | ||
476 | // m_log.DebugFormat( | 490 | // m_log.DebugFormat( |
477 | // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", | 491 | // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", |
@@ -484,7 +498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | // the avatar is seated, this value will also | 498 | // the avatar is seated, this value will also |
485 | // be used as the location to unsit to. | 499 | // be used as the location to unsit to. |
486 | // | 500 | // |
487 | // If m_parentID is not 0, assume we are a seated avatar | 501 | // If ParentID is not 0, assume we are a seated avatar |
488 | // and we should return the position based on the sittarget | 502 | // and we should return the position based on the sittarget |
489 | // offset and rotation of the prim we are seated on. | 503 | // offset and rotation of the prim we are seated on. |
490 | // | 504 | // |
@@ -492,16 +506,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
492 | // in the sim unless the avatar is on a sit target. While | 506 | // in the sim unless the avatar is on a sit target. While |
493 | // on a sit target, m_pos will contain the desired offset | 507 | // on a sit target, m_pos will contain the desired offset |
494 | // without the parent rotation applied. | 508 | // without the parent rotation applied. |
495 | if (m_parentID != 0) | 509 | if (ParentID != 0) |
496 | { | 510 | { |
497 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 511 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); |
498 | if (part != null) | 512 | if (part != null) |
499 | { | 513 | { |
500 | return m_parentPosition + (m_pos * part.GetWorldRotation()); | 514 | return ParentPosition + (m_pos * part.GetWorldRotation()); |
501 | } | 515 | } |
502 | else | 516 | else |
503 | { | 517 | { |
504 | return m_parentPosition + m_pos; | 518 | return ParentPosition + m_pos; |
505 | } | 519 | } |
506 | } | 520 | } |
507 | } | 521 | } |
@@ -510,13 +524,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
510 | } | 524 | } |
511 | set | 525 | set |
512 | { | 526 | { |
513 | PhysicsActor actor = m_physicsActor; | 527 | if (PhysicsActor != null) |
514 | if (actor != null) | ||
515 | { | 528 | { |
516 | try | 529 | try |
517 | { | 530 | { |
518 | lock (m_scene.SyncRoot) | 531 | lock (m_scene.SyncRoot) |
519 | m_physicsActor.Position = value; | 532 | PhysicsActor.Position = value; |
520 | } | 533 | } |
521 | catch (Exception e) | 534 | catch (Exception e) |
522 | { | 535 | { |
@@ -525,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
525 | } | 538 | } |
526 | 539 | ||
527 | m_pos = value; | 540 | m_pos = value; |
528 | m_parentPosition = Vector3.Zero; | 541 | ParentPosition = Vector3.Zero; |
529 | 542 | ||
530 | // m_log.DebugFormat( | 543 | // m_log.DebugFormat( |
531 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", | 544 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", |
@@ -549,10 +562,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
549 | { | 562 | { |
550 | get | 563 | get |
551 | { | 564 | { |
552 | PhysicsActor actor = m_physicsActor; | 565 | if (PhysicsActor != null) |
553 | if (actor != null) | ||
554 | { | 566 | { |
555 | m_velocity = actor.Velocity; | 567 | m_velocity = PhysicsActor.Velocity; |
556 | 568 | ||
557 | // m_log.DebugFormat( | 569 | // m_log.DebugFormat( |
558 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", | 570 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", |
@@ -563,13 +575,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | } | 575 | } |
564 | set | 576 | set |
565 | { | 577 | { |
566 | PhysicsActor actor = m_physicsActor; | 578 | if (PhysicsActor != null) |
567 | if (actor != null) | ||
568 | { | 579 | { |
569 | try | 580 | try |
570 | { | 581 | { |
571 | lock (m_scene.SyncRoot) | 582 | lock (m_scene.SyncRoot) |
572 | actor.Velocity = value; | 583 | PhysicsActor.Velocity = value; |
573 | } | 584 | } |
574 | catch (Exception e) | 585 | catch (Exception e) |
575 | { | 586 | { |
@@ -585,6 +596,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
585 | } | 596 | } |
586 | } | 597 | } |
587 | 598 | ||
599 | private Quaternion m_bodyRot = Quaternion.Identity; | ||
600 | |||
588 | public Quaternion Rotation | 601 | public Quaternion Rotation |
589 | { | 602 | { |
590 | get { return m_bodyRot; } | 603 | get { return m_bodyRot; } |
@@ -645,9 +658,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
645 | } | 658 | } |
646 | } | 659 | } |
647 | 660 | ||
661 | private ISceneViewer m_sceneViewer; | ||
662 | |||
648 | public ISceneViewer SceneViewer | 663 | public ISceneViewer SceneViewer |
649 | { | 664 | { |
650 | get { return m_sceneViewer; } | 665 | get { return m_sceneViewer; } |
666 | private set { m_sceneViewer = value; } | ||
651 | } | 667 | } |
652 | 668 | ||
653 | public void AdjustKnownSeeds() | 669 | public void AdjustKnownSeeds() |
@@ -694,28 +710,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
694 | } | 710 | } |
695 | } | 711 | } |
696 | 712 | ||
697 | private bool m_inTransit; | ||
698 | private bool m_mouseLook; | 713 | private bool m_mouseLook; |
699 | private bool m_leftButtonDown; | 714 | private bool m_leftButtonDown; |
700 | 715 | ||
716 | private bool m_inTransit; | ||
717 | |||
701 | public bool IsInTransit | 718 | public bool IsInTransit |
702 | { | 719 | { |
703 | get { return m_inTransit; } | 720 | get { return m_inTransit; } |
704 | set { m_inTransit = value; } | 721 | private set { m_inTransit = value; } |
705 | } | 722 | } |
706 | 723 | ||
724 | private float m_speedModifier = 1.0f; | ||
725 | |||
707 | public float SpeedModifier | 726 | public float SpeedModifier |
708 | { | 727 | { |
709 | get { return m_speedModifier; } | 728 | get { return m_speedModifier; } |
710 | set { m_speedModifier = value; } | 729 | set { m_speedModifier = value; } |
711 | } | 730 | } |
712 | 731 | ||
732 | private bool m_forceFly; | ||
733 | |||
713 | public bool ForceFly | 734 | public bool ForceFly |
714 | { | 735 | { |
715 | get { return m_forceFly; } | 736 | get { return m_forceFly; } |
716 | set { m_forceFly = value; } | 737 | set { m_forceFly = value; } |
717 | } | 738 | } |
718 | 739 | ||
740 | private bool m_flyDisabled; | ||
741 | |||
719 | public bool FlyDisabled | 742 | public bool FlyDisabled |
720 | { | 743 | { |
721 | get { return m_flyDisabled; } | 744 | get { return m_flyDisabled; } |
@@ -737,15 +760,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | AttachmentsSyncLock = new Object(); | 760 | AttachmentsSyncLock = new Object(); |
738 | 761 | ||
739 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 762 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
740 | m_sceneViewer = new SceneViewer(this); | 763 | SceneViewer = new SceneViewer(this); |
741 | m_animator = new ScenePresenceAnimator(this); | 764 | Animator = new ScenePresenceAnimator(this); |
742 | PresenceType = type; | 765 | PresenceType = type; |
743 | m_DrawDistance = world.DefaultDrawDistance; | 766 | DrawDistance = world.DefaultDrawDistance; |
744 | m_rootRegionHandle = world.RegionInfo.RegionHandle; | 767 | RegionHandle = world.RegionInfo.RegionHandle; |
745 | m_controllingClient = client; | 768 | ControllingClient = client; |
746 | m_firstname = m_controllingClient.FirstName; | 769 | Firstname = ControllingClient.FirstName; |
747 | m_lastname = m_controllingClient.LastName; | 770 | Lastname = ControllingClient.LastName; |
748 | m_name = String.Format("{0} {1}", m_firstname, m_lastname); | 771 | m_name = String.Format("{0} {1}", Firstname, Lastname); |
749 | m_scene = world; | 772 | m_scene = world; |
750 | m_uuid = client.AgentId; | 773 | m_uuid = client.AgentId; |
751 | m_localId = m_scene.AllocateLocalId(); | 774 | m_localId = m_scene.AllocateLocalId(); |
@@ -753,16 +776,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
753 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | 776 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); |
754 | 777 | ||
755 | if (account != null) | 778 | if (account != null) |
756 | m_userLevel = account.UserLevel; | 779 | UserLevel = account.UserLevel; |
757 | 780 | ||
758 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 781 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
759 | if (gm != null) | 782 | if (gm != null) |
760 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 783 | Grouptitle = gm.GetGroupTitle(m_uuid); |
761 | 784 | ||
762 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); | 785 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); |
763 | 786 | ||
764 | AbsolutePosition = posLastSignificantMove = m_CameraCenter = | 787 | AbsolutePosition = posLastSignificantMove = CameraPosition = |
765 | m_lastCameraCenter = m_controllingClient.StartPos; | 788 | m_lastCameraPosition = ControllingClient.StartPos; |
766 | 789 | ||
767 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); | 790 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); |
768 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 791 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
@@ -785,21 +808,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
785 | RegisterToEvents(); | 808 | RegisterToEvents(); |
786 | SetDirectionVectors(); | 809 | SetDirectionVectors(); |
787 | 810 | ||
788 | m_appearance = appearance; | 811 | Appearance = appearance; |
789 | } | 812 | } |
790 | 813 | ||
791 | public void RegisterToEvents() | 814 | public void RegisterToEvents() |
792 | { | 815 | { |
793 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 816 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
794 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | 817 | //ControllingClient.OnCompleteMovementToRegion += SendInitialData; |
795 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | 818 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
796 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 819 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
797 | m_controllingClient.OnAgentSit += HandleAgentSit; | 820 | ControllingClient.OnAgentSit += HandleAgentSit; |
798 | m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; | 821 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; |
799 | m_controllingClient.OnStartAnim += HandleStartAnim; | 822 | ControllingClient.OnStartAnim += HandleStartAnim; |
800 | m_controllingClient.OnStopAnim += HandleStopAnim; | 823 | ControllingClient.OnStopAnim += HandleStopAnim; |
801 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 824 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
802 | m_controllingClient.OnAutoPilotGo += MoveToTarget; | 825 | ControllingClient.OnAutoPilotGo += MoveToTarget; |
803 | 826 | ||
804 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 827 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
805 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 828 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -821,15 +844,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
821 | private Vector3[] GetWalkDirectionVectors() | 844 | private Vector3[] GetWalkDirectionVectors() |
822 | { | 845 | { |
823 | Vector3[] vector = new Vector3[9]; | 846 | Vector3[] vector = new Vector3[9]; |
824 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 847 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD |
825 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK | 848 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK |
826 | vector[2] = Vector3.UnitY; //LEFT | 849 | vector[2] = Vector3.UnitY; //LEFT |
827 | vector[3] = -Vector3.UnitY; //RIGHT | 850 | vector[3] = -Vector3.UnitY; //RIGHT |
828 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 851 | vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP |
829 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN | 852 | vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN |
830 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | 853 | vector[8] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge |
831 | vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z) * 2); //FORWARD Nudge | 854 | vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z) * 2); //FORWARD Nudge |
832 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK Nudge | 855 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK Nudge |
833 | return vector; | 856 | return vector; |
834 | } | 857 | } |
835 | 858 | ||
@@ -849,7 +872,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
849 | { | 872 | { |
850 | m_perfMonMS = Util.EnvironmentTickCount(); | 873 | m_perfMonMS = Util.EnvironmentTickCount(); |
851 | 874 | ||
852 | m_sceneViewer.SendPrimUpdates(); | 875 | SceneViewer.SendPrimUpdates(); |
853 | 876 | ||
854 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 877 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
855 | } | 878 | } |
@@ -869,21 +892,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
869 | 892 | ||
870 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); | 893 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); |
871 | 894 | ||
872 | bool wasChild = m_isChildAgent; | 895 | bool wasChild = IsChildAgent; |
873 | m_isChildAgent = false; | 896 | IsChildAgent = false; |
874 | 897 | ||
875 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 898 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
876 | if (gm != null) | 899 | if (gm != null) |
877 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 900 | Grouptitle = gm.GetGroupTitle(m_uuid); |
878 | 901 | ||
879 | m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; | 902 | RegionHandle = m_scene.RegionInfo.RegionHandle; |
880 | 903 | ||
881 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 904 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
882 | 905 | ||
883 | // Moved this from SendInitialData to ensure that m_appearance is initialized | 906 | // Moved this from SendInitialData to ensure that Appearance is initialized |
884 | // before the inventory is processed in MakeRootAgent. This fixes a race condition | 907 | // before the inventory is processed in MakeRootAgent. This fixes a race condition |
885 | // related to the handling of attachments | 908 | // related to the handling of attachments |
886 | //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 909 | //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); |
887 | if (m_scene.TestBorderCross(pos, Cardinals.E)) | 910 | if (m_scene.TestBorderCross(pos, Cardinals.E)) |
888 | { | 911 | { |
889 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); | 912 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); |
@@ -908,8 +931,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
908 | } | 931 | } |
909 | 932 | ||
910 | float localAVHeight = 1.56f; | 933 | float localAVHeight = 1.56f; |
911 | if (m_appearance.AvatarHeight > 0) | 934 | if (Appearance.AvatarHeight > 0) |
912 | localAVHeight = m_appearance.AvatarHeight; | 935 | localAVHeight = Appearance.AvatarHeight; |
913 | 936 | ||
914 | float posZLimit = 0; | 937 | float posZLimit = 0; |
915 | 938 | ||
@@ -925,13 +948,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
925 | 948 | ||
926 | AddToPhysicalScene(isFlying); | 949 | AddToPhysicalScene(isFlying); |
927 | 950 | ||
928 | if (m_forceFly) | 951 | if (ForceFly) |
929 | { | 952 | { |
930 | m_physicsActor.Flying = true; | 953 | PhysicsActor.Flying = true; |
931 | } | 954 | } |
932 | else if (m_flyDisabled) | 955 | else if (FlyDisabled) |
933 | { | 956 | { |
934 | m_physicsActor.Flying = false; | 957 | PhysicsActor.Flying = false; |
935 | } | 958 | } |
936 | 959 | ||
937 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 960 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
@@ -969,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
969 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | 992 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will |
970 | // stall on the border crossing since the existing child agent will still have the last movement | 993 | // stall on the border crossing since the existing child agent will still have the last movement |
971 | // recorded, which stops the input from being processed. | 994 | // recorded, which stops the input from being processed. |
972 | m_movementflag = 0; | 995 | MovementFlag = 0; |
973 | 996 | ||
974 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 997 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
975 | } | 998 | } |
@@ -999,12 +1022,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
999 | { | 1022 | { |
1000 | // Reset these so that teleporting in and walking out isn't seen | 1023 | // Reset these so that teleporting in and walking out isn't seen |
1001 | // as teleporting back | 1024 | // as teleporting back |
1002 | m_teleportFlags = TeleportFlags.Default; | 1025 | TeleportFlags = TeleportFlags.Default; |
1003 | 1026 | ||
1004 | // It looks like m_animator is set to null somewhere, and MakeChild | 1027 | // It looks like Animator is set to null somewhere, and MakeChild |
1005 | // is called after that. Probably in aborted teleports. | 1028 | // is called after that. Probably in aborted teleports. |
1006 | if (m_animator == null) | 1029 | if (Animator == null) |
1007 | m_animator = new ScenePresenceAnimator(this); | 1030 | Animator = new ScenePresenceAnimator(this); |
1008 | else | 1031 | else |
1009 | Animator.ResetAnimations(); | 1032 | Animator.ResetAnimations(); |
1010 | 1033 | ||
@@ -1016,11 +1039,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1016 | // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. | 1039 | // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. |
1017 | //Velocity = new Vector3(0, 0, 0); | 1040 | //Velocity = new Vector3(0, 0, 0); |
1018 | 1041 | ||
1019 | m_isChildAgent = true; | 1042 | IsChildAgent = true; |
1020 | m_scene.SwapRootAgentCount(true); | 1043 | m_scene.SwapRootAgentCount(true); |
1021 | RemoveFromPhysicalScene(); | 1044 | RemoveFromPhysicalScene(); |
1022 | 1045 | ||
1023 | // FIXME: Set m_rootRegionHandle to the region handle of the scene this agent is moving into | 1046 | // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into |
1024 | 1047 | ||
1025 | m_scene.EventManager.TriggerOnMakeChildAgent(this); | 1048 | m_scene.EventManager.TriggerOnMakeChildAgent(this); |
1026 | } | 1049 | } |
@@ -1032,11 +1055,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1032 | { | 1055 | { |
1033 | if (PhysicsActor != null) | 1056 | if (PhysicsActor != null) |
1034 | { | 1057 | { |
1035 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 1058 | PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
1036 | m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; | 1059 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; |
1037 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 1060 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
1038 | m_physicsActor.UnSubscribeEvents(); | 1061 | PhysicsActor.UnSubscribeEvents(); |
1039 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | 1062 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
1040 | PhysicsActor = null; | 1063 | PhysicsActor = null; |
1041 | } | 1064 | } |
1042 | } | 1065 | } |
@@ -1048,8 +1071,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1048 | public void Teleport(Vector3 pos) | 1071 | public void Teleport(Vector3 pos) |
1049 | { | 1072 | { |
1050 | bool isFlying = false; | 1073 | bool isFlying = false; |
1051 | if (m_physicsActor != null) | 1074 | if (PhysicsActor != null) |
1052 | isFlying = m_physicsActor.Flying; | 1075 | isFlying = PhysicsActor.Flying; |
1053 | 1076 | ||
1054 | RemoveFromPhysicalScene(); | 1077 | RemoveFromPhysicalScene(); |
1055 | Velocity = Vector3.Zero; | 1078 | Velocity = Vector3.Zero; |
@@ -1062,8 +1085,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1062 | public void TeleportWithMomentum(Vector3 pos) | 1085 | public void TeleportWithMomentum(Vector3 pos) |
1063 | { | 1086 | { |
1064 | bool isFlying = false; | 1087 | bool isFlying = false; |
1065 | if (m_physicsActor != null) | 1088 | if (PhysicsActor != null) |
1066 | isFlying = m_physicsActor.Flying; | 1089 | isFlying = PhysicsActor.Flying; |
1067 | 1090 | ||
1068 | RemoveFromPhysicalScene(); | 1091 | RemoveFromPhysicalScene(); |
1069 | AbsolutePosition = pos; | 1092 | AbsolutePosition = pos; |
@@ -1178,11 +1201,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1178 | 1201 | ||
1179 | //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | 1202 | //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); |
1180 | 1203 | ||
1181 | m_controllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1204 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1182 | SendInitialData(); | 1205 | SendInitialData(); |
1183 | 1206 | ||
1184 | // Create child agents in neighbouring regions | 1207 | // Create child agents in neighbouring regions |
1185 | if (openChildAgents && !m_isChildAgent) | 1208 | if (openChildAgents && !IsChildAgent) |
1186 | { | 1209 | { |
1187 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 1210 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
1188 | if (m_agentTransfer != null) | 1211 | if (m_agentTransfer != null) |
@@ -1226,7 +1249,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1226 | { | 1249 | { |
1227 | if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 1250 | if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
1228 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 1251 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
1229 | !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) | 1252 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) |
1230 | { | 1253 | { |
1231 | if (CameraConstraintActive) | 1254 | if (CameraConstraintActive) |
1232 | { | 1255 | { |
@@ -1247,7 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1247 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", | 1270 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", |
1248 | // Scene.RegionInfo.RegionName, remoteClient.Name); | 1271 | // Scene.RegionInfo.RegionName, remoteClient.Name); |
1249 | 1272 | ||
1250 | //if (m_isChildAgent) | 1273 | //if (IsChildAgent) |
1251 | //{ | 1274 | //{ |
1252 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1275 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1253 | // return; | 1276 | // return; |
@@ -1291,28 +1314,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1291 | 1314 | ||
1292 | // Camera location in world. We'll need to raytrace | 1315 | // Camera location in world. We'll need to raytrace |
1293 | // from this location from time to time. | 1316 | // from this location from time to time. |
1294 | m_CameraCenter = agentData.CameraCenter; | 1317 | CameraPosition = agentData.CameraCenter; |
1295 | if (Vector3.Distance(m_lastCameraCenter, m_CameraCenter) >= Scene.RootReprioritizationDistance) | 1318 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) |
1296 | { | 1319 | { |
1297 | ReprioritizeUpdates(); | 1320 | ReprioritizeUpdates(); |
1298 | m_lastCameraCenter = m_CameraCenter; | 1321 | m_lastCameraPosition = CameraPosition; |
1299 | } | 1322 | } |
1300 | 1323 | ||
1301 | // Use these three vectors to figure out what the agent is looking at | 1324 | // Use these three vectors to figure out what the agent is looking at |
1302 | // Convert it to a Matrix and/or Quaternion | 1325 | // Convert it to a Matrix and/or Quaternion |
1303 | m_CameraAtAxis = agentData.CameraAtAxis; | 1326 | CameraAtAxis = agentData.CameraAtAxis; |
1304 | m_CameraLeftAxis = agentData.CameraLeftAxis; | 1327 | CameraLeftAxis = agentData.CameraLeftAxis; |
1305 | m_CameraUpAxis = agentData.CameraUpAxis; | 1328 | m_CameraUpAxis = agentData.CameraUpAxis; |
1306 | 1329 | ||
1307 | // The Agent's Draw distance setting | 1330 | // The Agent's Draw distance setting |
1308 | // When we get to the point of re-computing neighbors everytime this | 1331 | // When we get to the point of re-computing neighbors everytime this |
1309 | // changes, then start using the agent's drawdistance rather than the | 1332 | // changes, then start using the agent's drawdistance rather than the |
1310 | // region's draw distance. | 1333 | // region's draw distance. |
1311 | // m_DrawDistance = agentData.Far; | 1334 | // DrawDistance = agentData.Far; |
1312 | m_DrawDistance = Scene.DefaultDrawDistance; | 1335 | DrawDistance = Scene.DefaultDrawDistance; |
1313 | 1336 | ||
1314 | // Check if Client has camera in 'follow cam' or 'build' mode. | 1337 | // Check if Client has camera in 'follow cam' or 'build' mode. |
1315 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); | 1338 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
1316 | 1339 | ||
1317 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) | 1340 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) |
1318 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | 1341 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; |
@@ -1334,7 +1357,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1334 | if (m_followCamAuto) | 1357 | if (m_followCamAuto) |
1335 | { | 1358 | { |
1336 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; | 1359 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; |
1337 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); | 1360 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); |
1338 | } | 1361 | } |
1339 | } | 1362 | } |
1340 | 1363 | ||
@@ -1363,7 +1386,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1363 | // Here's where you get them. | 1386 | // Here's where you get them. |
1364 | m_AgentControlFlags = flags; | 1387 | m_AgentControlFlags = flags; |
1365 | m_headrotation = agentData.HeadRotation; | 1388 | m_headrotation = agentData.HeadRotation; |
1366 | m_state = agentData.State; | 1389 | State = agentData.State; |
1367 | 1390 | ||
1368 | PhysicsActor actor = PhysicsActor; | 1391 | PhysicsActor actor = PhysicsActor; |
1369 | if (actor == null) | 1392 | if (actor == null) |
@@ -1371,12 +1394,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1371 | return; | 1394 | return; |
1372 | } | 1395 | } |
1373 | 1396 | ||
1374 | if (m_allowMovement && !SitGround) | 1397 | if (AllowMovement && !SitGround) |
1375 | { | 1398 | { |
1376 | Quaternion bodyRotation = agentData.BodyRotation; | 1399 | Quaternion bodyRotation = agentData.BodyRotation; |
1377 | bool update_rotation = false; | 1400 | bool update_rotation = false; |
1378 | 1401 | ||
1379 | if (bodyRotation != m_bodyRot) | 1402 | if (bodyRotation != Rotation) |
1380 | { | 1403 | { |
1381 | Rotation = bodyRotation; | 1404 | Rotation = bodyRotation; |
1382 | update_rotation = true; | 1405 | update_rotation = true; |
@@ -1396,9 +1419,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1396 | 1419 | ||
1397 | bool oldflying = PhysicsActor.Flying; | 1420 | bool oldflying = PhysicsActor.Flying; |
1398 | 1421 | ||
1399 | if (m_forceFly) | 1422 | if (ForceFly) |
1400 | actor.Flying = true; | 1423 | actor.Flying = true; |
1401 | else if (m_flyDisabled) | 1424 | else if (FlyDisabled) |
1402 | actor.Flying = false; | 1425 | actor.Flying = false; |
1403 | else | 1426 | else |
1404 | actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1427 | actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
@@ -1406,7 +1429,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | if (actor.Flying != oldflying) | 1429 | if (actor.Flying != oldflying) |
1407 | update_movementflag = true; | 1430 | update_movementflag = true; |
1408 | 1431 | ||
1409 | if (m_parentID == 0) | 1432 | if (ParentID == 0) |
1410 | { | 1433 | { |
1411 | bool bAllowUpdateMoveToPosition = false; | 1434 | bool bAllowUpdateMoveToPosition = false; |
1412 | 1435 | ||
@@ -1414,12 +1437,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1414 | 1437 | ||
1415 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | 1438 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying |
1416 | // this prevents 'jumping' in inappropriate situations. | 1439 | // this prevents 'jumping' in inappropriate situations. |
1417 | if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) | 1440 | if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying)) |
1418 | dirVectors = GetWalkDirectionVectors(); | 1441 | dirVectors = GetWalkDirectionVectors(); |
1419 | else | 1442 | else |
1420 | dirVectors = Dir_Vectors; | 1443 | dirVectors = Dir_Vectors; |
1421 | 1444 | ||
1422 | // The fact that m_movementflag is a byte needs to be fixed | 1445 | // The fact that MovementFlag is a byte needs to be fixed |
1423 | // it really should be a uint | 1446 | // it really should be a uint |
1424 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. | 1447 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. |
1425 | uint nudgehack = 250; | 1448 | uint nudgehack = 250; |
@@ -1439,32 +1462,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1439 | // Why did I get this? | 1462 | // Why did I get this? |
1440 | } | 1463 | } |
1441 | 1464 | ||
1442 | if ((m_movementflag & (byte)(uint)DCF) == 0) | 1465 | if ((MovementFlag & (byte)(uint)DCF) == 0) |
1443 | { | 1466 | { |
1444 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1467 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1445 | { | 1468 | { |
1446 | m_movementflag |= (byte)nudgehack; | 1469 | MovementFlag |= (byte)nudgehack; |
1447 | } | 1470 | } |
1448 | 1471 | ||
1449 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF); | 1472 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); |
1450 | m_movementflag += (byte)(uint)DCF; | 1473 | MovementFlag += (byte)(uint)DCF; |
1451 | update_movementflag = true; | 1474 | update_movementflag = true; |
1452 | } | 1475 | } |
1453 | } | 1476 | } |
1454 | else | 1477 | else |
1455 | { | 1478 | { |
1456 | if ((m_movementflag & (byte)(uint)DCF) != 0 || | 1479 | if ((MovementFlag & (byte)(uint)DCF) != 0 || |
1457 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1480 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1458 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | 1481 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1459 | ) // This or is for Nudge forward | 1482 | ) // This or is for Nudge forward |
1460 | { | 1483 | { |
1461 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF); | 1484 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); |
1462 | m_movementflag -= ((byte)(uint)DCF); | 1485 | MovementFlag -= ((byte)(uint)DCF); |
1463 | update_movementflag = true; | 1486 | update_movementflag = true; |
1464 | 1487 | ||
1465 | /* | 1488 | /* |
1466 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1489 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1467 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | 1490 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1468 | { | 1491 | { |
1469 | m_log.Debug("Removed Hack flag"); | 1492 | m_log.Debug("Removed Hack flag"); |
1470 | } | 1493 | } |
@@ -1499,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1499 | // with something with the down arrow pressed. | 1522 | // with something with the down arrow pressed. |
1500 | 1523 | ||
1501 | // Only do this if we're flying | 1524 | // Only do this if we're flying |
1502 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) | 1525 | if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly) |
1503 | { | 1526 | { |
1504 | // Landing detection code | 1527 | // Landing detection code |
1505 | 1528 | ||
@@ -1507,10 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1507 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1530 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1508 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1531 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1509 | 1532 | ||
1510 | // Are the collision requirements fulfilled? | 1533 | if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) |
1511 | bool colliding = (m_physicsActor.IsColliding == true); | ||
1512 | |||
1513 | if (m_physicsActor.Flying && colliding && controlland) | ||
1514 | { | 1534 | { |
1515 | // nesting this check because LengthSquared() is expensive and we don't | 1535 | // nesting this check because LengthSquared() is expensive and we don't |
1516 | // want to do it every step when flying. | 1536 | // want to do it every step when flying. |
@@ -1539,7 +1559,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1539 | // } | 1559 | // } |
1540 | // } | 1560 | // } |
1541 | 1561 | ||
1542 | if (update_movementflag && m_parentID == 0) | 1562 | if (update_movementflag && ParentID == 0) |
1543 | Animator.UpdateMovementAnimations(); | 1563 | Animator.UpdateMovementAnimations(); |
1544 | } | 1564 | } |
1545 | 1565 | ||
@@ -1620,26 +1640,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1620 | // one of left/right/back/forward. | 1640 | // one of left/right/back/forward. |
1621 | if (LocalVectorToTarget3D.X < 0) //MoveBack | 1641 | if (LocalVectorToTarget3D.X < 0) //MoveBack |
1622 | { | 1642 | { |
1623 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | 1643 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; |
1624 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | 1644 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; |
1625 | updated = true; | 1645 | updated = true; |
1626 | } | 1646 | } |
1627 | else if (LocalVectorToTarget3D.X > 0) //Move Forward | 1647 | else if (LocalVectorToTarget3D.X > 0) //Move Forward |
1628 | { | 1648 | { |
1629 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | 1649 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; |
1630 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | 1650 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; |
1631 | updated = true; | 1651 | updated = true; |
1632 | } | 1652 | } |
1633 | 1653 | ||
1634 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft | 1654 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft |
1635 | { | 1655 | { |
1636 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | 1656 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; |
1637 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | 1657 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; |
1638 | updated = true; | 1658 | updated = true; |
1639 | } | 1659 | } |
1640 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight | 1660 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight |
1641 | { | 1661 | { |
1642 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | 1662 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; |
1643 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | 1663 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; |
1644 | updated = true; | 1664 | updated = true; |
1645 | } | 1665 | } |
@@ -1648,14 +1668,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1648 | { | 1668 | { |
1649 | // Don't set these flags for up or down - doing so will make the avatar crouch or | 1669 | // Don't set these flags for up or down - doing so will make the avatar crouch or |
1650 | // keep trying to jump even if walking along level ground | 1670 | // keep trying to jump even if walking along level ground |
1651 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1671 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1652 | //AgentControlFlags | 1672 | //AgentControlFlags |
1653 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1673 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1654 | updated = true; | 1674 | updated = true; |
1655 | } | 1675 | } |
1656 | else if (LocalVectorToTarget3D.Z < 0) //Down | 1676 | else if (LocalVectorToTarget3D.Z < 0) //Down |
1657 | { | 1677 | { |
1658 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1678 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1659 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1679 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1660 | updated = true; | 1680 | updated = true; |
1661 | } | 1681 | } |
@@ -1818,10 +1838,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1818 | { | 1838 | { |
1819 | SitGround = false; | 1839 | SitGround = false; |
1820 | 1840 | ||
1821 | if (m_parentID != 0) | 1841 | if (ParentID != 0) |
1822 | { | 1842 | { |
1823 | m_log.Debug("StandupCode Executed"); | 1843 | m_log.Debug("StandupCode Executed"); |
1824 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 1844 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); |
1825 | if (part != null) | 1845 | if (part != null) |
1826 | { | 1846 | { |
1827 | TaskInventoryDictionary taskIDict = part.TaskInventory; | 1847 | TaskInventoryDictionary taskIDict = part.TaskInventory; |
@@ -1844,19 +1864,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1844 | part.SitTargetAvatar = UUID.Zero; | 1864 | part.SitTargetAvatar = UUID.Zero; |
1845 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 1865 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
1846 | 1866 | ||
1847 | m_parentPosition = part.GetWorldPosition(); | 1867 | ParentPosition = part.GetWorldPosition(); |
1848 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 1868 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
1849 | } | 1869 | } |
1850 | 1870 | ||
1851 | if (m_physicsActor == null) | 1871 | if (PhysicsActor == null) |
1852 | { | 1872 | { |
1853 | AddToPhysicalScene(false); | 1873 | AddToPhysicalScene(false); |
1854 | } | 1874 | } |
1855 | 1875 | ||
1856 | m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 1876 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
1857 | m_parentPosition = Vector3.Zero; | 1877 | ParentPosition = Vector3.Zero; |
1858 | 1878 | ||
1859 | m_parentID = 0; | 1879 | ParentID = 0; |
1860 | SendAvatarDataToAllAgents(); | 1880 | SendAvatarDataToAllAgents(); |
1861 | m_requestedSitTargetID = 0; | 1881 | m_requestedSitTargetID = 0; |
1862 | } | 1882 | } |
@@ -1954,11 +1974,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1954 | // offset = pos; | 1974 | // offset = pos; |
1955 | //autopilot = false; | 1975 | //autopilot = false; |
1956 | //} | 1976 | //} |
1957 | if (m_physicsActor != null) | 1977 | if (PhysicsActor != null) |
1958 | { | 1978 | { |
1959 | // If we're not using the client autopilot, we're immediately warping the avatar to the location | 1979 | // If we're not using the client autopilot, we're immediately warping the avatar to the location |
1960 | // We can remove the physicsActor until they stand up. | 1980 | // We can remove the physicsActor until they stand up. |
1961 | m_sitAvatarHeight = m_physicsActor.Size.Z; | 1981 | m_sitAvatarHeight = PhysicsActor.Size.Z; |
1962 | 1982 | ||
1963 | if (autopilot) | 1983 | if (autopilot) |
1964 | { | 1984 | { |
@@ -1997,7 +2017,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1997 | // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) | 2017 | // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) |
1998 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) | 2018 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) |
1999 | { | 2019 | { |
2000 | if (m_parentID != 0) | 2020 | if (ParentID != 0) |
2001 | { | 2021 | { |
2002 | StandUp(); | 2022 | StandUp(); |
2003 | } | 2023 | } |
@@ -2266,16 +2286,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2266 | 2286 | ||
2267 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); | 2287 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); |
2268 | m_pos += SIT_TARGET_ADJUSTMENT; | 2288 | m_pos += SIT_TARGET_ADJUSTMENT; |
2269 | m_bodyRot = sitTargetOrient; | 2289 | Rotation = sitTargetOrient; |
2270 | //Rotation = sitTargetOrient; | 2290 | //Rotation = sitTargetOrient; |
2271 | m_parentPosition = part.AbsolutePosition; | 2291 | ParentPosition = part.AbsolutePosition; |
2272 | 2292 | ||
2273 | //SendTerseUpdateToAllClients(); | 2293 | //SendTerseUpdateToAllClients(); |
2274 | } | 2294 | } |
2275 | else | 2295 | else |
2276 | { | 2296 | { |
2277 | m_pos -= part.AbsolutePosition; | 2297 | m_pos -= part.AbsolutePosition; |
2278 | m_parentPosition = part.AbsolutePosition; | 2298 | ParentPosition = part.AbsolutePosition; |
2279 | } | 2299 | } |
2280 | } | 2300 | } |
2281 | else | 2301 | else |
@@ -2283,7 +2303,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2283 | return; | 2303 | return; |
2284 | } | 2304 | } |
2285 | } | 2305 | } |
2286 | m_parentID = m_requestedSitTargetID; | 2306 | ParentID = m_requestedSitTargetID; |
2287 | 2307 | ||
2288 | Velocity = Vector3.Zero; | 2308 | Velocity = Vector3.Zero; |
2289 | RemoveFromPhysicalScene(); | 2309 | RemoveFromPhysicalScene(); |
@@ -2302,11 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2302 | /// </summary> | 2322 | /// </summary> |
2303 | public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) | 2323 | public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) |
2304 | { | 2324 | { |
2305 | m_setAlwaysRun = pSetAlwaysRun; | 2325 | SetAlwaysRun = pSetAlwaysRun; |
2306 | if (PhysicsActor != null) | ||
2307 | { | ||
2308 | PhysicsActor.SetAlwaysRun = pSetAlwaysRun; | ||
2309 | } | ||
2310 | } | 2326 | } |
2311 | 2327 | ||
2312 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) | 2328 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) |
@@ -2330,27 +2346,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2330 | Vector3 direc = vec * Rotation; | 2346 | Vector3 direc = vec * Rotation; |
2331 | direc.Normalize(); | 2347 | direc.Normalize(); |
2332 | 2348 | ||
2333 | direc *= 0.03f * 128f * m_speedModifier; | 2349 | direc *= 0.03f * 128f * SpeedModifier; |
2334 | 2350 | ||
2335 | PhysicsActor actor = m_physicsActor; | 2351 | if (PhysicsActor != null) |
2336 | if (actor != null) | ||
2337 | { | 2352 | { |
2338 | if (actor.Flying) | 2353 | if (PhysicsActor.Flying) |
2339 | { | 2354 | { |
2340 | direc *= 4.0f; | 2355 | direc *= 4.0f; |
2341 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 2356 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
2342 | //bool colliding = (m_physicsActor.IsColliding==true); | ||
2343 | //if (controlland) | 2357 | //if (controlland) |
2344 | // m_log.Info("[AGENT]: landCommand"); | 2358 | // m_log.Info("[AGENT]: landCommand"); |
2345 | //if (colliding) | 2359 | //if (PhysicsActor.IsColliding) |
2346 | // m_log.Info("[AGENT]: colliding"); | 2360 | // m_log.Info("[AGENT]: colliding"); |
2347 | //if (m_physicsActor.Flying && colliding && controlland) | 2361 | //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) |
2348 | //{ | 2362 | //{ |
2349 | // StopFlying(); | 2363 | // StopFlying(); |
2350 | // m_log.Info("[AGENT]: Stop FLying"); | 2364 | // m_log.Info("[AGENT]: Stop Flying"); |
2351 | //} | 2365 | //} |
2352 | } | 2366 | } |
2353 | else if (!actor.Flying && actor.IsColliding) | 2367 | else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) |
2354 | { | 2368 | { |
2355 | if (direc.Z > 2.0f) | 2369 | if (direc.Z > 2.0f) |
2356 | { | 2370 | { |
@@ -2385,16 +2399,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2385 | if (!sendingPrims) | 2399 | if (!sendingPrims) |
2386 | Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); | 2400 | Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); |
2387 | 2401 | ||
2388 | if (m_isChildAgent == false) | 2402 | if (IsChildAgent == false) |
2389 | { | 2403 | { |
2390 | // PhysicsActor actor = m_physicsActor; | ||
2391 | |||
2392 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to | 2404 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to |
2393 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 2405 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
2394 | // storing a requested force instead of an actual traveling velocity | 2406 | // storing a requested force instead of an actual traveling velocity |
2395 | 2407 | ||
2396 | // Throw away duplicate or insignificant updates | 2408 | // Throw away duplicate or insignificant updates |
2397 | if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 2409 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || |
2398 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 2410 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
2399 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 2411 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
2400 | //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2412 | //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
@@ -2403,13 +2415,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2403 | 2415 | ||
2404 | // Update the "last" values | 2416 | // Update the "last" values |
2405 | m_lastPosition = m_pos; | 2417 | m_lastPosition = m_pos; |
2406 | m_lastRotation = m_bodyRot; | 2418 | m_lastRotation = Rotation; |
2407 | m_lastVelocity = Velocity; | 2419 | m_lastVelocity = Velocity; |
2408 | //m_lastTerseSent = Environment.TickCount; | 2420 | //m_lastTerseSent = Environment.TickCount; |
2409 | } | 2421 | } |
2410 | 2422 | ||
2411 | // followed suggestion from mic bowman. reversed the two lines below. | 2423 | // followed suggestion from mic bowman. reversed the two lines below. |
2412 | if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something | 2424 | if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something |
2413 | CheckForBorderCrossing(); | 2425 | CheckForBorderCrossing(); |
2414 | 2426 | ||
2415 | CheckForSignificantMovement(); // sends update to the modules. | 2427 | CheckForSignificantMovement(); // sends update to the modules. |
@@ -2434,9 +2446,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2434 | m_perfMonMS = Util.EnvironmentTickCount(); | 2446 | m_perfMonMS = Util.EnvironmentTickCount(); |
2435 | 2447 | ||
2436 | Vector3 pos = m_pos; | 2448 | Vector3 pos = m_pos; |
2437 | pos.Z += m_appearance.HipOffset; | 2449 | pos.Z += Appearance.HipOffset; |
2438 | 2450 | ||
2439 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); | 2451 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); |
2440 | 2452 | ||
2441 | remoteClient.SendPrimUpdate( | 2453 | remoteClient.SendPrimUpdate( |
2442 | this, | 2454 | this, |
@@ -2513,7 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2513 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2525 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2514 | { | 2526 | { |
2515 | m_perfMonMS = Util.EnvironmentTickCount(); | 2527 | m_perfMonMS = Util.EnvironmentTickCount(); |
2516 | m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 2528 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
2517 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2529 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2518 | } | 2530 | } |
2519 | 2531 | ||
@@ -2524,21 +2536,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2524 | private void SendInitialData() | 2536 | private void SendInitialData() |
2525 | { | 2537 | { |
2526 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); | 2538 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); |
2527 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before | 2539 | // Moved this into CompleteMovement to ensure that Appearance is initialized before |
2528 | // the inventory arrives | 2540 | // the inventory arrives |
2529 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 2541 | // m_scene.GetAvatarAppearance(ControllingClient, out Appearance); |
2530 | 2542 | ||
2531 | bool cachedappearance = false; | 2543 | bool cachedappearance = false; |
2532 | 2544 | ||
2533 | // We have an appearance but we may not have the baked textures. Check the asset cache | 2545 | // We have an appearance but we may not have the baked textures. Check the asset cache |
2534 | // to see if all the baked textures are already here. | 2546 | // to see if all the baked textures are already here. |
2535 | if (m_scene.AvatarFactory != null) | 2547 | if (m_scene.AvatarFactory != null) |
2536 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); | 2548 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(ControllingClient); |
2537 | 2549 | ||
2538 | // If we aren't using a cached appearance, then clear out the baked textures | 2550 | // If we aren't using a cached appearance, then clear out the baked textures |
2539 | if (!cachedappearance) | 2551 | if (!cachedappearance) |
2540 | { | 2552 | { |
2541 | m_appearance.ResetAppearance(); | 2553 | Appearance.ResetAppearance(); |
2542 | if (m_scene.AvatarFactory != null) | 2554 | if (m_scene.AvatarFactory != null) |
2543 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 2555 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
2544 | } | 2556 | } |
@@ -2697,17 +2709,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2697 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 2709 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
2698 | 2710 | ||
2699 | avatar.ControllingClient.SendAppearance( | 2711 | avatar.ControllingClient.SendAppearance( |
2700 | UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2712 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
2701 | } | ||
2702 | |||
2703 | public AvatarAppearance Appearance | ||
2704 | { | ||
2705 | get { return m_appearance; } | ||
2706 | set | ||
2707 | { | ||
2708 | m_appearance = value; | ||
2709 | // m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); | ||
2710 | } | ||
2711 | } | 2713 | } |
2712 | 2714 | ||
2713 | #endregion | 2715 | #endregion |
@@ -2735,14 +2737,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2735 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 2737 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
2736 | cadu.ActiveGroupID = UUID.Zero.Guid; | 2738 | cadu.ActiveGroupID = UUID.Zero.Guid; |
2737 | cadu.AgentID = UUID.Guid; | 2739 | cadu.AgentID = UUID.Guid; |
2738 | cadu.alwaysrun = m_setAlwaysRun; | 2740 | cadu.alwaysrun = SetAlwaysRun; |
2739 | cadu.AVHeight = m_appearance.AvatarHeight; | 2741 | cadu.AVHeight = Appearance.AvatarHeight; |
2740 | Vector3 tempCameraCenter = m_CameraCenter; | 2742 | cadu.cameraPosition = CameraPosition; |
2741 | cadu.cameraPosition = tempCameraCenter; | 2743 | cadu.drawdistance = DrawDistance; |
2742 | cadu.drawdistance = m_DrawDistance; | ||
2743 | cadu.GroupAccess = 0; | 2744 | cadu.GroupAccess = 0; |
2744 | cadu.Position = AbsolutePosition; | 2745 | cadu.Position = AbsolutePosition; |
2745 | cadu.regionHandle = m_rootRegionHandle; | 2746 | cadu.regionHandle = RegionHandle; |
2746 | 2747 | ||
2747 | // Throttles | 2748 | // Throttles |
2748 | float multiplier = 1; | 2749 | float multiplier = 1; |
@@ -2848,7 +2849,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2848 | { | 2849 | { |
2849 | if (m_requestedSitTargetUUID == UUID.Zero) | 2850 | if (m_requestedSitTargetUUID == UUID.Zero) |
2850 | { | 2851 | { |
2851 | bool isFlying = m_physicsActor.Flying; | 2852 | bool isFlying = PhysicsActor.Flying; |
2852 | RemoveFromPhysicalScene(); | 2853 | RemoveFromPhysicalScene(); |
2853 | 2854 | ||
2854 | Vector3 pos = AbsolutePosition; | 2855 | Vector3 pos = AbsolutePosition; |
@@ -2873,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2873 | { | 2874 | { |
2874 | if (m_requestedSitTargetUUID == UUID.Zero) | 2875 | if (m_requestedSitTargetUUID == UUID.Zero) |
2875 | { | 2876 | { |
2876 | bool isFlying = m_physicsActor.Flying; | 2877 | bool isFlying = PhysicsActor.Flying; |
2877 | RemoveFromPhysicalScene(); | 2878 | RemoveFromPhysicalScene(); |
2878 | 2879 | ||
2879 | Vector3 pos = AbsolutePosition; | 2880 | Vector3 pos = AbsolutePosition; |
@@ -2963,7 +2964,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2963 | { | 2964 | { |
2964 | try | 2965 | try |
2965 | { | 2966 | { |
2966 | return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2967 | return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); |
2967 | } | 2968 | } |
2968 | catch | 2969 | catch |
2969 | { | 2970 | { |
@@ -2973,9 +2974,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2973 | 2974 | ||
2974 | public void InTransit() | 2975 | public void InTransit() |
2975 | { | 2976 | { |
2976 | m_inTransit = true; | 2977 | IsInTransit = true; |
2977 | 2978 | ||
2978 | if ((m_physicsActor != null) && m_physicsActor.Flying) | 2979 | if ((PhysicsActor != null) && PhysicsActor.Flying) |
2979 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 2980 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
2980 | else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) | 2981 | else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) |
2981 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 2982 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
@@ -2983,7 +2984,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2983 | 2984 | ||
2984 | public void NotInTransit() | 2985 | public void NotInTransit() |
2985 | { | 2986 | { |
2986 | m_inTransit = false; | 2987 | IsInTransit = false; |
2987 | } | 2988 | } |
2988 | 2989 | ||
2989 | public void RestoreInCurrentScene() | 2990 | public void RestoreInCurrentScene() |
@@ -3039,7 +3040,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | if (byebyeRegions.Count > 0) | 3040 | if (byebyeRegions.Count > 0) |
3040 | { | 3041 | { |
3041 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 3042 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
3042 | m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); | 3043 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); |
3043 | } | 3044 | } |
3044 | 3045 | ||
3045 | foreach (ulong handle in byebyeRegions) | 3046 | foreach (ulong handle in byebyeRegions) |
@@ -3065,17 +3066,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3065 | if (account != null) | 3066 | if (account != null) |
3066 | { | 3067 | { |
3067 | if (account.UserLevel > 0) | 3068 | if (account.UserLevel > 0) |
3068 | m_godLevel = account.UserLevel; | 3069 | GodLevel = account.UserLevel; |
3069 | else | 3070 | else |
3070 | m_godLevel = 200; | 3071 | GodLevel = 200; |
3071 | } | 3072 | } |
3072 | } | 3073 | } |
3073 | else | 3074 | else |
3074 | { | 3075 | { |
3075 | m_godLevel = 0; | 3076 | GodLevel = 0; |
3076 | } | 3077 | } |
3077 | 3078 | ||
3078 | ControllingClient.SendAdminResponse(token, (uint)m_godLevel); | 3079 | ControllingClient.SendAdminResponse(token, (uint)GodLevel); |
3079 | } | 3080 | } |
3080 | 3081 | ||
3081 | #region Child Agent Updates | 3082 | #region Child Agent Updates |
@@ -3107,8 +3108,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3107 | // When we get to the point of re-computing neighbors everytime this | 3108 | // When we get to the point of re-computing neighbors everytime this |
3108 | // changes, then start using the agent's drawdistance rather than the | 3109 | // changes, then start using the agent's drawdistance rather than the |
3109 | // region's draw distance. | 3110 | // region's draw distance. |
3110 | // m_DrawDistance = cAgentData.Far; | 3111 | // DrawDistance = cAgentData.Far; |
3111 | m_DrawDistance = Scene.DefaultDrawDistance; | 3112 | DrawDistance = Scene.DefaultDrawDistance; |
3112 | 3113 | ||
3113 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! | 3114 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! |
3114 | m_pos = cAgentData.Position + offset; | 3115 | m_pos = cAgentData.Position + offset; |
@@ -3119,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3119 | ReprioritizeUpdates(); | 3120 | ReprioritizeUpdates(); |
3120 | } | 3121 | } |
3121 | 3122 | ||
3122 | m_CameraCenter = cAgentData.Center + offset; | 3123 | CameraPosition = cAgentData.Center + offset; |
3123 | 3124 | ||
3124 | //SetHeight(cAgentData.AVHeight); | 3125 | //SetHeight(cAgentData.AVHeight); |
3125 | 3126 | ||
@@ -3127,7 +3128,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3127 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); | 3128 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); |
3128 | 3129 | ||
3129 | //cAgentData.AVHeight; | 3130 | //cAgentData.AVHeight; |
3130 | m_rootRegionHandle = cAgentData.RegionHandle; | 3131 | RegionHandle = cAgentData.RegionHandle; |
3131 | //m_velocity = cAgentData.Velocity; | 3132 | //m_velocity = cAgentData.Velocity; |
3132 | } | 3133 | } |
3133 | 3134 | ||
@@ -3140,12 +3141,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3140 | 3141 | ||
3141 | cAgent.Position = AbsolutePosition; | 3142 | cAgent.Position = AbsolutePosition; |
3142 | cAgent.Velocity = m_velocity; | 3143 | cAgent.Velocity = m_velocity; |
3143 | cAgent.Center = m_CameraCenter; | 3144 | cAgent.Center = CameraPosition; |
3144 | cAgent.AtAxis = m_CameraAtAxis; | 3145 | cAgent.AtAxis = CameraAtAxis; |
3145 | cAgent.LeftAxis = m_CameraLeftAxis; | 3146 | cAgent.LeftAxis = CameraLeftAxis; |
3146 | cAgent.UpAxis = m_CameraUpAxis; | 3147 | cAgent.UpAxis = m_CameraUpAxis; |
3147 | 3148 | ||
3148 | cAgent.Far = m_DrawDistance; | 3149 | cAgent.Far = DrawDistance; |
3149 | 3150 | ||
3150 | // Throttles | 3151 | // Throttles |
3151 | float multiplier = 1; | 3152 | float multiplier = 1; |
@@ -3160,17 +3161,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3160 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); | 3161 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); |
3161 | 3162 | ||
3162 | cAgent.HeadRotation = m_headrotation; | 3163 | cAgent.HeadRotation = m_headrotation; |
3163 | cAgent.BodyRotation = m_bodyRot; | 3164 | cAgent.BodyRotation = Rotation; |
3164 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 3165 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
3165 | 3166 | ||
3166 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3167 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3167 | cAgent.GodLevel = (byte)m_godLevel; | 3168 | cAgent.GodLevel = (byte)GodLevel; |
3168 | else | 3169 | else |
3169 | cAgent.GodLevel = (byte) 0; | 3170 | cAgent.GodLevel = (byte) 0; |
3170 | 3171 | ||
3171 | cAgent.AlwaysRun = m_setAlwaysRun; | 3172 | cAgent.AlwaysRun = SetAlwaysRun; |
3172 | 3173 | ||
3173 | cAgent.Appearance = new AvatarAppearance(m_appearance); | 3174 | cAgent.Appearance = new AvatarAppearance(Appearance); |
3174 | 3175 | ||
3175 | lock (scriptedcontrols) | 3176 | lock (scriptedcontrols) |
3176 | { | 3177 | { |
@@ -3199,7 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3199 | cAgent.AttachmentObjects = new List<ISceneObject>(); | 3200 | cAgent.AttachmentObjects = new List<ISceneObject>(); |
3200 | cAgent.AttachmentObjectStates = new List<string>(); | 3201 | cAgent.AttachmentObjectStates = new List<string>(); |
3201 | // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); | 3202 | // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); |
3202 | m_InTransitScriptStates.Clear(); | 3203 | InTransitScriptStates.Clear(); |
3203 | 3204 | ||
3204 | foreach (SceneObjectGroup sog in m_attachments) | 3205 | foreach (SceneObjectGroup sog in m_attachments) |
3205 | { | 3206 | { |
@@ -3212,7 +3213,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3212 | cAgent.AttachmentObjects.Add(clone); | 3213 | cAgent.AttachmentObjects.Add(clone); |
3213 | string state = sog.GetStateSnapshot(); | 3214 | string state = sog.GetStateSnapshot(); |
3214 | cAgent.AttachmentObjectStates.Add(state); | 3215 | cAgent.AttachmentObjectStates.Add(state); |
3215 | m_InTransitScriptStates.Add(state); | 3216 | InTransitScriptStates.Add(state); |
3216 | // Let's remove the scripts of the original object here | 3217 | // Let's remove the scripts of the original object here |
3217 | sog.RemoveScriptInstances(true); | 3218 | sog.RemoveScriptInstances(true); |
3218 | } | 3219 | } |
@@ -3228,32 +3229,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3228 | 3229 | ||
3229 | m_pos = cAgent.Position; | 3230 | m_pos = cAgent.Position; |
3230 | m_velocity = cAgent.Velocity; | 3231 | m_velocity = cAgent.Velocity; |
3231 | m_CameraCenter = cAgent.Center; | 3232 | CameraPosition = cAgent.Center; |
3232 | m_CameraAtAxis = cAgent.AtAxis; | 3233 | CameraAtAxis = cAgent.AtAxis; |
3233 | m_CameraLeftAxis = cAgent.LeftAxis; | 3234 | CameraLeftAxis = cAgent.LeftAxis; |
3234 | m_CameraUpAxis = cAgent.UpAxis; | 3235 | m_CameraUpAxis = cAgent.UpAxis; |
3235 | 3236 | ||
3236 | // When we get to the point of re-computing neighbors everytime this | 3237 | // When we get to the point of re-computing neighbors everytime this |
3237 | // changes, then start using the agent's drawdistance rather than the | 3238 | // changes, then start using the agent's drawdistance rather than the |
3238 | // region's draw distance. | 3239 | // region's draw distance. |
3239 | // m_DrawDistance = cAgent.Far; | 3240 | // DrawDistance = cAgent.Far; |
3240 | m_DrawDistance = Scene.DefaultDrawDistance; | 3241 | DrawDistance = Scene.DefaultDrawDistance; |
3241 | 3242 | ||
3242 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 3243 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
3243 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 3244 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); |
3244 | 3245 | ||
3245 | m_headrotation = cAgent.HeadRotation; | 3246 | m_headrotation = cAgent.HeadRotation; |
3246 | m_bodyRot = cAgent.BodyRotation; | 3247 | Rotation = cAgent.BodyRotation; |
3247 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 3248 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
3248 | 3249 | ||
3249 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3250 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3250 | m_godLevel = cAgent.GodLevel; | 3251 | GodLevel = cAgent.GodLevel; |
3251 | m_setAlwaysRun = cAgent.AlwaysRun; | 3252 | SetAlwaysRun = cAgent.AlwaysRun; |
3252 | 3253 | ||
3253 | m_appearance = new AvatarAppearance(cAgent.Appearance); | 3254 | Appearance = new AvatarAppearance(cAgent.Appearance); |
3254 | if (m_physicsActor != null) | 3255 | if (PhysicsActor != null) |
3255 | { | 3256 | { |
3256 | bool isFlying = m_physicsActor.Flying; | 3257 | bool isFlying = PhysicsActor.Flying; |
3257 | RemoveFromPhysicalScene(); | 3258 | RemoveFromPhysicalScene(); |
3258 | AddToPhysicalScene(isFlying); | 3259 | AddToPhysicalScene(isFlying); |
3259 | } | 3260 | } |
@@ -3319,7 +3320,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3319 | { | 3320 | { |
3320 | Vector3 force = m_forceToApply.Value; | 3321 | Vector3 force = m_forceToApply.Value; |
3321 | 3322 | ||
3322 | m_updateflag = true; | 3323 | Updated = true; |
3323 | 3324 | ||
3324 | Velocity = force; | 3325 | Velocity = force; |
3325 | 3326 | ||
@@ -3336,30 +3337,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3336 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", | 3337 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", |
3337 | // Name, isFlying, Scene.RegionInfo.RegionName); | 3338 | // Name, isFlying, Scene.RegionInfo.RegionName); |
3338 | 3339 | ||
3339 | if (m_appearance.AvatarHeight == 0) | 3340 | if (Appearance.AvatarHeight == 0) |
3340 | m_appearance.SetHeight(); | 3341 | Appearance.SetHeight(); |
3341 | 3342 | ||
3342 | PhysicsScene scene = m_scene.PhysicsScene; | 3343 | PhysicsScene scene = m_scene.PhysicsScene; |
3343 | 3344 | ||
3344 | Vector3 pVec = AbsolutePosition; | 3345 | Vector3 pVec = AbsolutePosition; |
3345 | 3346 | ||
3346 | // Old bug where the height was in centimeters instead of meters | 3347 | // Old bug where the height was in centimeters instead of meters |
3347 | m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, | 3348 | PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, |
3348 | new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); | 3349 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); |
3349 | 3350 | ||
3350 | scene.AddPhysicsActorTaint(m_physicsActor); | 3351 | scene.AddPhysicsActorTaint(PhysicsActor); |
3351 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3352 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3352 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3353 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3353 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3354 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3354 | m_physicsActor.SubscribeEvents(500); | 3355 | PhysicsActor.SubscribeEvents(500); |
3355 | m_physicsActor.LocalID = LocalId; | 3356 | PhysicsActor.LocalID = LocalId; |
3356 | 3357 | ||
3357 | SetHeight(m_appearance.AvatarHeight); | 3358 | SetHeight(Appearance.AvatarHeight); |
3358 | } | 3359 | } |
3359 | 3360 | ||
3360 | private void OutOfBoundsCall(Vector3 pos) | 3361 | private void OutOfBoundsCall(Vector3 pos) |
3361 | { | 3362 | { |
3362 | //bool flying = m_physicsActor.Flying; | 3363 | //bool flying = PhysicsActor.Flying; |
3363 | //RemoveFromPhysicalScene(); | 3364 | //RemoveFromPhysicalScene(); |
3364 | 3365 | ||
3365 | //AddToPhysicalScene(flying); | 3366 | //AddToPhysicalScene(flying); |
@@ -3374,7 +3375,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | return; | 3375 | return; |
3375 | 3376 | ||
3376 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | 3377 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) |
3377 | // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( | 3378 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
3378 | // as of this comment the interval is set in AddToPhysicalScene | 3379 | // as of this comment the interval is set in AddToPhysicalScene |
3379 | if (Animator != null) | 3380 | if (Animator != null) |
3380 | Animator.UpdateMovementAnimations(); | 3381 | Animator.UpdateMovementAnimations(); |
@@ -3413,7 +3414,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3413 | } | 3414 | } |
3414 | } | 3415 | } |
3415 | 3416 | ||
3416 | if (m_invulnerable) | 3417 | if (Invulnerable) |
3417 | return; | 3418 | return; |
3418 | 3419 | ||
3419 | float starthealth = Health; | 3420 | float starthealth = Health; |
@@ -3438,13 +3439,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3438 | //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); | 3439 | //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); |
3439 | } | 3440 | } |
3440 | //Health = 100; | 3441 | //Health = 100; |
3441 | if (!m_invulnerable) | 3442 | if (!Invulnerable) |
3442 | { | 3443 | { |
3443 | if (starthealth != Health) | 3444 | if (starthealth != Health) |
3444 | { | 3445 | { |
3445 | ControllingClient.SendHealth(Health); | 3446 | ControllingClient.SendHealth(Health); |
3446 | } | 3447 | } |
3447 | if (m_health <= 0) | 3448 | if (Health <= 0) |
3448 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3449 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3449 | } | 3450 | } |
3450 | } | 3451 | } |
@@ -3475,11 +3476,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | // unsetting the elapsed callback should be enough to allow for cleanup however. | 3476 | // unsetting the elapsed callback should be enough to allow for cleanup however. |
3476 | // m_reprioritizationTimer.Dispose(); | 3477 | // m_reprioritizationTimer.Dispose(); |
3477 | 3478 | ||
3478 | m_sceneViewer.Close(); | 3479 | SceneViewer.Close(); |
3479 | 3480 | ||
3480 | RemoveFromPhysicalScene(); | 3481 | RemoveFromPhysicalScene(); |
3481 | m_animator.Close(); | 3482 | Animator.Close(); |
3482 | m_animator = null; | 3483 | Animator = null; |
3483 | } | 3484 | } |
3484 | 3485 | ||
3485 | public void AddAttachment(SceneObjectGroup gobj) | 3486 | public void AddAttachment(SceneObjectGroup gobj) |
@@ -3841,7 +3842,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3841 | 3842 | ||
3842 | private void Reprioritize(object sender, ElapsedEventArgs e) | 3843 | private void Reprioritize(object sender, ElapsedEventArgs e) |
3843 | { | 3844 | { |
3844 | m_controllingClient.ReprioritizeUpdates(); | 3845 | ControllingClient.ReprioritizeUpdates(); |
3845 | 3846 | ||
3846 | lock (m_reprioritization_timer) | 3847 | lock (m_reprioritization_timer) |
3847 | { | 3848 | { |