diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 590 |
1 files changed, 295 insertions, 295 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f049b78..e4e5f17 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,44 @@ 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 | set { |
722 | if(value) | ||
723 | { | ||
724 | if ((PhysicsActor != null) && PhysicsActor.Flying) | ||
725 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
726 | else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) | ||
727 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
728 | } | ||
729 | m_inTransit = value; | ||
730 | } | ||
705 | } | 731 | } |
706 | 732 | ||
733 | private float m_speedModifier = 1.0f; | ||
734 | |||
707 | public float SpeedModifier | 735 | public float SpeedModifier |
708 | { | 736 | { |
709 | get { return m_speedModifier; } | 737 | get { return m_speedModifier; } |
710 | set { m_speedModifier = value; } | 738 | set { m_speedModifier = value; } |
711 | } | 739 | } |
712 | 740 | ||
741 | private bool m_forceFly; | ||
742 | |||
713 | public bool ForceFly | 743 | public bool ForceFly |
714 | { | 744 | { |
715 | get { return m_forceFly; } | 745 | get { return m_forceFly; } |
716 | set { m_forceFly = value; } | 746 | set { m_forceFly = value; } |
717 | } | 747 | } |
718 | 748 | ||
749 | private bool m_flyDisabled; | ||
750 | |||
719 | public bool FlyDisabled | 751 | public bool FlyDisabled |
720 | { | 752 | { |
721 | get { return m_flyDisabled; } | 753 | get { return m_flyDisabled; } |
@@ -737,15 +769,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | AttachmentsSyncLock = new Object(); | 769 | AttachmentsSyncLock = new Object(); |
738 | 770 | ||
739 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 771 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
740 | m_sceneViewer = new SceneViewer(this); | 772 | SceneViewer = new SceneViewer(this); |
741 | m_animator = new ScenePresenceAnimator(this); | 773 | Animator = new ScenePresenceAnimator(this); |
742 | PresenceType = type; | 774 | PresenceType = type; |
743 | m_DrawDistance = world.DefaultDrawDistance; | 775 | DrawDistance = world.DefaultDrawDistance; |
744 | m_rootRegionHandle = world.RegionInfo.RegionHandle; | 776 | RegionHandle = world.RegionInfo.RegionHandle; |
745 | m_controllingClient = client; | 777 | ControllingClient = client; |
746 | m_firstname = m_controllingClient.FirstName; | 778 | Firstname = ControllingClient.FirstName; |
747 | m_lastname = m_controllingClient.LastName; | 779 | Lastname = ControllingClient.LastName; |
748 | m_name = String.Format("{0} {1}", m_firstname, m_lastname); | 780 | m_name = String.Format("{0} {1}", Firstname, Lastname); |
749 | m_scene = world; | 781 | m_scene = world; |
750 | m_uuid = client.AgentId; | 782 | m_uuid = client.AgentId; |
751 | m_localId = m_scene.AllocateLocalId(); | 783 | m_localId = m_scene.AllocateLocalId(); |
@@ -753,16 +785,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
753 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | 785 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); |
754 | 786 | ||
755 | if (account != null) | 787 | if (account != null) |
756 | m_userLevel = account.UserLevel; | 788 | UserLevel = account.UserLevel; |
757 | 789 | ||
758 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 790 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
759 | if (gm != null) | 791 | if (gm != null) |
760 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 792 | Grouptitle = gm.GetGroupTitle(m_uuid); |
761 | 793 | ||
762 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); | 794 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); |
763 | 795 | ||
764 | AbsolutePosition = posLastSignificantMove = m_CameraCenter = | 796 | AbsolutePosition = posLastSignificantMove = CameraPosition = |
765 | m_lastCameraCenter = m_controllingClient.StartPos; | 797 | m_lastCameraPosition = ControllingClient.StartPos; |
766 | 798 | ||
767 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); | 799 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); |
768 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 800 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
@@ -785,21 +817,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
785 | RegisterToEvents(); | 817 | RegisterToEvents(); |
786 | SetDirectionVectors(); | 818 | SetDirectionVectors(); |
787 | 819 | ||
788 | m_appearance = appearance; | 820 | Appearance = appearance; |
789 | } | 821 | } |
790 | 822 | ||
791 | public void RegisterToEvents() | 823 | public void RegisterToEvents() |
792 | { | 824 | { |
793 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 825 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
794 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | 826 | //ControllingClient.OnCompleteMovementToRegion += SendInitialData; |
795 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | 827 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
796 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 828 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
797 | m_controllingClient.OnAgentSit += HandleAgentSit; | 829 | ControllingClient.OnAgentSit += HandleAgentSit; |
798 | m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; | 830 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; |
799 | m_controllingClient.OnStartAnim += HandleStartAnim; | 831 | ControllingClient.OnStartAnim += HandleStartAnim; |
800 | m_controllingClient.OnStopAnim += HandleStopAnim; | 832 | ControllingClient.OnStopAnim += HandleStopAnim; |
801 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 833 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
802 | m_controllingClient.OnAutoPilotGo += MoveToTarget; | 834 | ControllingClient.OnAutoPilotGo += MoveToTarget; |
803 | 835 | ||
804 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 836 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
805 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 837 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -821,15 +853,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
821 | private Vector3[] GetWalkDirectionVectors() | 853 | private Vector3[] GetWalkDirectionVectors() |
822 | { | 854 | { |
823 | Vector3[] vector = new Vector3[9]; | 855 | Vector3[] vector = new Vector3[9]; |
824 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 856 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD |
825 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK | 857 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK |
826 | vector[2] = Vector3.UnitY; //LEFT | 858 | vector[2] = Vector3.UnitY; //LEFT |
827 | vector[3] = -Vector3.UnitY; //RIGHT | 859 | vector[3] = -Vector3.UnitY; //RIGHT |
828 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 860 | vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP |
829 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN | 861 | 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 | 862 | 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 | 863 | 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 | 864 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK Nudge |
833 | return vector; | 865 | return vector; |
834 | } | 866 | } |
835 | 867 | ||
@@ -847,7 +879,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
847 | /// </summary> | 879 | /// </summary> |
848 | public void SendPrimUpdates() | 880 | public void SendPrimUpdates() |
849 | { | 881 | { |
850 | m_sceneViewer.SendPrimUpdates(); | 882 | SceneViewer.SendPrimUpdates(); |
851 | } | 883 | } |
852 | 884 | ||
853 | #region Status Methods | 885 | #region Status Methods |
@@ -865,21 +897,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
865 | 897 | ||
866 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); | 898 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); |
867 | 899 | ||
868 | bool wasChild = m_isChildAgent; | 900 | bool wasChild = IsChildAgent; |
869 | m_isChildAgent = false; | 901 | IsChildAgent = false; |
870 | 902 | ||
871 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 903 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
872 | if (gm != null) | 904 | if (gm != null) |
873 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 905 | Grouptitle = gm.GetGroupTitle(m_uuid); |
874 | 906 | ||
875 | m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; | 907 | RegionHandle = m_scene.RegionInfo.RegionHandle; |
876 | 908 | ||
877 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 909 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
878 | 910 | ||
879 | // Moved this from SendInitialData to ensure that m_appearance is initialized | 911 | // Moved this from SendInitialData to ensure that Appearance is initialized |
880 | // before the inventory is processed in MakeRootAgent. This fixes a race condition | 912 | // before the inventory is processed in MakeRootAgent. This fixes a race condition |
881 | // related to the handling of attachments | 913 | // related to the handling of attachments |
882 | //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 914 | //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); |
883 | if (m_scene.TestBorderCross(pos, Cardinals.E)) | 915 | if (m_scene.TestBorderCross(pos, Cardinals.E)) |
884 | { | 916 | { |
885 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); | 917 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); |
@@ -904,8 +936,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
904 | } | 936 | } |
905 | 937 | ||
906 | float localAVHeight = 1.56f; | 938 | float localAVHeight = 1.56f; |
907 | if (m_appearance.AvatarHeight > 0) | 939 | if (Appearance.AvatarHeight > 0) |
908 | localAVHeight = m_appearance.AvatarHeight; | 940 | localAVHeight = Appearance.AvatarHeight; |
909 | 941 | ||
910 | float posZLimit = 0; | 942 | float posZLimit = 0; |
911 | 943 | ||
@@ -921,13 +953,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
921 | 953 | ||
922 | AddToPhysicalScene(isFlying); | 954 | AddToPhysicalScene(isFlying); |
923 | 955 | ||
924 | if (m_forceFly) | 956 | if (ForceFly) |
925 | { | 957 | { |
926 | m_physicsActor.Flying = true; | 958 | PhysicsActor.Flying = true; |
927 | } | 959 | } |
928 | else if (m_flyDisabled) | 960 | else if (FlyDisabled) |
929 | { | 961 | { |
930 | m_physicsActor.Flying = false; | 962 | PhysicsActor.Flying = false; |
931 | } | 963 | } |
932 | 964 | ||
933 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 965 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
@@ -965,7 +997,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | 997 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will |
966 | // stall on the border crossing since the existing child agent will still have the last movement | 998 | // stall on the border crossing since the existing child agent will still have the last movement |
967 | // recorded, which stops the input from being processed. | 999 | // recorded, which stops the input from being processed. |
968 | m_movementflag = 0; | 1000 | MovementFlag = 0; |
969 | 1001 | ||
970 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 1002 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
971 | } | 1003 | } |
@@ -995,12 +1027,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
995 | { | 1027 | { |
996 | // Reset these so that teleporting in and walking out isn't seen | 1028 | // Reset these so that teleporting in and walking out isn't seen |
997 | // as teleporting back | 1029 | // as teleporting back |
998 | m_teleportFlags = TeleportFlags.Default; | 1030 | TeleportFlags = TeleportFlags.Default; |
999 | 1031 | ||
1000 | // It looks like m_animator is set to null somewhere, and MakeChild | 1032 | // It looks like Animator is set to null somewhere, and MakeChild |
1001 | // is called after that. Probably in aborted teleports. | 1033 | // is called after that. Probably in aborted teleports. |
1002 | if (m_animator == null) | 1034 | if (Animator == null) |
1003 | m_animator = new ScenePresenceAnimator(this); | 1035 | Animator = new ScenePresenceAnimator(this); |
1004 | else | 1036 | else |
1005 | Animator.ResetAnimations(); | 1037 | Animator.ResetAnimations(); |
1006 | 1038 | ||
@@ -1012,11 +1044,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. | 1044 | // depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated. |
1013 | //Velocity = new Vector3(0, 0, 0); | 1045 | //Velocity = new Vector3(0, 0, 0); |
1014 | 1046 | ||
1015 | m_isChildAgent = true; | 1047 | IsChildAgent = true; |
1016 | m_scene.SwapRootAgentCount(true); | 1048 | m_scene.SwapRootAgentCount(true); |
1017 | RemoveFromPhysicalScene(); | 1049 | RemoveFromPhysicalScene(); |
1018 | 1050 | ||
1019 | // FIXME: Set m_rootRegionHandle to the region handle of the scene this agent is moving into | 1051 | // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into |
1020 | 1052 | ||
1021 | m_scene.EventManager.TriggerOnMakeChildAgent(this); | 1053 | m_scene.EventManager.TriggerOnMakeChildAgent(this); |
1022 | } | 1054 | } |
@@ -1028,11 +1060,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1028 | { | 1060 | { |
1029 | if (PhysicsActor != null) | 1061 | if (PhysicsActor != null) |
1030 | { | 1062 | { |
1031 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 1063 | PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
1032 | m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; | 1064 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; |
1033 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 1065 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
1034 | m_physicsActor.UnSubscribeEvents(); | 1066 | PhysicsActor.UnSubscribeEvents(); |
1035 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | 1067 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
1036 | PhysicsActor = null; | 1068 | PhysicsActor = null; |
1037 | } | 1069 | } |
1038 | } | 1070 | } |
@@ -1044,8 +1076,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1044 | public void Teleport(Vector3 pos) | 1076 | public void Teleport(Vector3 pos) |
1045 | { | 1077 | { |
1046 | bool isFlying = false; | 1078 | bool isFlying = false; |
1047 | if (m_physicsActor != null) | 1079 | if (PhysicsActor != null) |
1048 | isFlying = m_physicsActor.Flying; | 1080 | isFlying = PhysicsActor.Flying; |
1049 | 1081 | ||
1050 | RemoveFromPhysicalScene(); | 1082 | RemoveFromPhysicalScene(); |
1051 | Velocity = Vector3.Zero; | 1083 | Velocity = Vector3.Zero; |
@@ -1058,8 +1090,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1058 | public void TeleportWithMomentum(Vector3 pos) | 1090 | public void TeleportWithMomentum(Vector3 pos) |
1059 | { | 1091 | { |
1060 | bool isFlying = false; | 1092 | bool isFlying = false; |
1061 | if (m_physicsActor != null) | 1093 | if (PhysicsActor != null) |
1062 | isFlying = m_physicsActor.Flying; | 1094 | isFlying = PhysicsActor.Flying; |
1063 | 1095 | ||
1064 | RemoveFromPhysicalScene(); | 1096 | RemoveFromPhysicalScene(); |
1065 | AbsolutePosition = pos; | 1097 | AbsolutePosition = pos; |
@@ -1174,11 +1206,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1174 | 1206 | ||
1175 | //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | 1207 | //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); |
1176 | 1208 | ||
1177 | m_controllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1209 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1178 | SendInitialData(); | 1210 | SendInitialData(); |
1179 | 1211 | ||
1180 | // Create child agents in neighbouring regions | 1212 | // Create child agents in neighbouring regions |
1181 | if (openChildAgents && !m_isChildAgent) | 1213 | if (openChildAgents && !IsChildAgent) |
1182 | { | 1214 | { |
1183 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 1215 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
1184 | if (m_agentTransfer != null) | 1216 | if (m_agentTransfer != null) |
@@ -1222,7 +1254,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1222 | { | 1254 | { |
1223 | if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 1255 | if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
1224 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 1256 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
1225 | !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) | 1257 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) |
1226 | { | 1258 | { |
1227 | if (CameraConstraintActive) | 1259 | if (CameraConstraintActive) |
1228 | { | 1260 | { |
@@ -1243,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1243 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", | 1275 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", |
1244 | // Scene.RegionInfo.RegionName, remoteClient.Name); | 1276 | // Scene.RegionInfo.RegionName, remoteClient.Name); |
1245 | 1277 | ||
1246 | //if (m_isChildAgent) | 1278 | //if (IsChildAgent) |
1247 | //{ | 1279 | //{ |
1248 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1280 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1249 | // return; | 1281 | // return; |
@@ -1287,28 +1319,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1287 | 1319 | ||
1288 | // Camera location in world. We'll need to raytrace | 1320 | // Camera location in world. We'll need to raytrace |
1289 | // from this location from time to time. | 1321 | // from this location from time to time. |
1290 | m_CameraCenter = agentData.CameraCenter; | 1322 | CameraPosition = agentData.CameraCenter; |
1291 | if (Vector3.Distance(m_lastCameraCenter, m_CameraCenter) >= Scene.RootReprioritizationDistance) | 1323 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) |
1292 | { | 1324 | { |
1293 | ReprioritizeUpdates(); | 1325 | ReprioritizeUpdates(); |
1294 | m_lastCameraCenter = m_CameraCenter; | 1326 | m_lastCameraPosition = CameraPosition; |
1295 | } | 1327 | } |
1296 | 1328 | ||
1297 | // Use these three vectors to figure out what the agent is looking at | 1329 | // Use these three vectors to figure out what the agent is looking at |
1298 | // Convert it to a Matrix and/or Quaternion | 1330 | // Convert it to a Matrix and/or Quaternion |
1299 | m_CameraAtAxis = agentData.CameraAtAxis; | 1331 | CameraAtAxis = agentData.CameraAtAxis; |
1300 | m_CameraLeftAxis = agentData.CameraLeftAxis; | 1332 | CameraLeftAxis = agentData.CameraLeftAxis; |
1301 | m_CameraUpAxis = agentData.CameraUpAxis; | 1333 | m_CameraUpAxis = agentData.CameraUpAxis; |
1302 | 1334 | ||
1303 | // The Agent's Draw distance setting | 1335 | // The Agent's Draw distance setting |
1304 | // When we get to the point of re-computing neighbors everytime this | 1336 | // When we get to the point of re-computing neighbors everytime this |
1305 | // changes, then start using the agent's drawdistance rather than the | 1337 | // changes, then start using the agent's drawdistance rather than the |
1306 | // region's draw distance. | 1338 | // region's draw distance. |
1307 | // m_DrawDistance = agentData.Far; | 1339 | // DrawDistance = agentData.Far; |
1308 | m_DrawDistance = Scene.DefaultDrawDistance; | 1340 | DrawDistance = Scene.DefaultDrawDistance; |
1309 | 1341 | ||
1310 | // Check if Client has camera in 'follow cam' or 'build' mode. | 1342 | // Check if Client has camera in 'follow cam' or 'build' mode. |
1311 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); | 1343 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
1312 | 1344 | ||
1313 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) | 1345 | m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) |
1314 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | 1346 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; |
@@ -1330,7 +1362,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1330 | if (m_followCamAuto) | 1362 | if (m_followCamAuto) |
1331 | { | 1363 | { |
1332 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; | 1364 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; |
1333 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); | 1365 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); |
1334 | } | 1366 | } |
1335 | } | 1367 | } |
1336 | 1368 | ||
@@ -1359,7 +1391,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1359 | // Here's where you get them. | 1391 | // Here's where you get them. |
1360 | m_AgentControlFlags = flags; | 1392 | m_AgentControlFlags = flags; |
1361 | m_headrotation = agentData.HeadRotation; | 1393 | m_headrotation = agentData.HeadRotation; |
1362 | m_state = agentData.State; | 1394 | State = agentData.State; |
1363 | 1395 | ||
1364 | PhysicsActor actor = PhysicsActor; | 1396 | PhysicsActor actor = PhysicsActor; |
1365 | if (actor == null) | 1397 | if (actor == null) |
@@ -1367,12 +1399,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1367 | return; | 1399 | return; |
1368 | } | 1400 | } |
1369 | 1401 | ||
1370 | if (m_allowMovement && !SitGround) | 1402 | if (AllowMovement && !SitGround) |
1371 | { | 1403 | { |
1372 | Quaternion bodyRotation = agentData.BodyRotation; | 1404 | Quaternion bodyRotation = agentData.BodyRotation; |
1373 | bool update_rotation = false; | 1405 | bool update_rotation = false; |
1374 | 1406 | ||
1375 | if (bodyRotation != m_bodyRot) | 1407 | if (bodyRotation != Rotation) |
1376 | { | 1408 | { |
1377 | Rotation = bodyRotation; | 1409 | Rotation = bodyRotation; |
1378 | update_rotation = true; | 1410 | update_rotation = true; |
@@ -1392,9 +1424,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1392 | 1424 | ||
1393 | bool oldflying = PhysicsActor.Flying; | 1425 | bool oldflying = PhysicsActor.Flying; |
1394 | 1426 | ||
1395 | if (m_forceFly) | 1427 | if (ForceFly) |
1396 | actor.Flying = true; | 1428 | actor.Flying = true; |
1397 | else if (m_flyDisabled) | 1429 | else if (FlyDisabled) |
1398 | actor.Flying = false; | 1430 | actor.Flying = false; |
1399 | else | 1431 | else |
1400 | actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1432 | actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
@@ -1402,7 +1434,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1402 | if (actor.Flying != oldflying) | 1434 | if (actor.Flying != oldflying) |
1403 | update_movementflag = true; | 1435 | update_movementflag = true; |
1404 | 1436 | ||
1405 | if (m_parentID == 0) | 1437 | if (ParentID == 0) |
1406 | { | 1438 | { |
1407 | bool bAllowUpdateMoveToPosition = false; | 1439 | bool bAllowUpdateMoveToPosition = false; |
1408 | 1440 | ||
@@ -1410,12 +1442,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1410 | 1442 | ||
1411 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | 1443 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying |
1412 | // this prevents 'jumping' in inappropriate situations. | 1444 | // this prevents 'jumping' in inappropriate situations. |
1413 | if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying)) | 1445 | if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying)) |
1414 | dirVectors = GetWalkDirectionVectors(); | 1446 | dirVectors = GetWalkDirectionVectors(); |
1415 | else | 1447 | else |
1416 | dirVectors = Dir_Vectors; | 1448 | dirVectors = Dir_Vectors; |
1417 | 1449 | ||
1418 | // The fact that m_movementflag is a byte needs to be fixed | 1450 | // The fact that MovementFlag is a byte needs to be fixed |
1419 | // it really should be a uint | 1451 | // it really should be a uint |
1420 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. | 1452 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. |
1421 | uint nudgehack = 250; | 1453 | uint nudgehack = 250; |
@@ -1435,32 +1467,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1435 | // Why did I get this? | 1467 | // Why did I get this? |
1436 | } | 1468 | } |
1437 | 1469 | ||
1438 | if ((m_movementflag & (byte)(uint)DCF) == 0) | 1470 | if ((MovementFlag & (byte)(uint)DCF) == 0) |
1439 | { | 1471 | { |
1440 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1472 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1441 | { | 1473 | { |
1442 | m_movementflag |= (byte)nudgehack; | 1474 | MovementFlag |= (byte)nudgehack; |
1443 | } | 1475 | } |
1444 | 1476 | ||
1445 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF); | 1477 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); |
1446 | m_movementflag += (byte)(uint)DCF; | 1478 | MovementFlag += (byte)(uint)DCF; |
1447 | update_movementflag = true; | 1479 | update_movementflag = true; |
1448 | } | 1480 | } |
1449 | } | 1481 | } |
1450 | else | 1482 | else |
1451 | { | 1483 | { |
1452 | if ((m_movementflag & (byte)(uint)DCF) != 0 || | 1484 | if ((MovementFlag & (byte)(uint)DCF) != 0 || |
1453 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1485 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1454 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | 1486 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1455 | ) // This or is for Nudge forward | 1487 | ) // This or is for Nudge forward |
1456 | { | 1488 | { |
1457 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF); | 1489 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); |
1458 | m_movementflag -= ((byte)(uint)DCF); | 1490 | MovementFlag -= ((byte)(uint)DCF); |
1459 | update_movementflag = true; | 1491 | update_movementflag = true; |
1460 | 1492 | ||
1461 | /* | 1493 | /* |
1462 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | 1494 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) |
1463 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | 1495 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1464 | { | 1496 | { |
1465 | m_log.Debug("Removed Hack flag"); | 1497 | m_log.Debug("Removed Hack flag"); |
1466 | } | 1498 | } |
@@ -1495,7 +1527,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1495 | // with something with the down arrow pressed. | 1527 | // with something with the down arrow pressed. |
1496 | 1528 | ||
1497 | // Only do this if we're flying | 1529 | // Only do this if we're flying |
1498 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) | 1530 | if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly) |
1499 | { | 1531 | { |
1500 | // Landing detection code | 1532 | // Landing detection code |
1501 | 1533 | ||
@@ -1503,10 +1535,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1503 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1535 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1504 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1536 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1505 | 1537 | ||
1506 | // Are the collision requirements fulfilled? | 1538 | if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) |
1507 | bool colliding = (m_physicsActor.IsColliding == true); | ||
1508 | |||
1509 | if (m_physicsActor.Flying && colliding && controlland) | ||
1510 | { | 1539 | { |
1511 | // nesting this check because LengthSquared() is expensive and we don't | 1540 | // nesting this check because LengthSquared() is expensive and we don't |
1512 | // want to do it every step when flying. | 1541 | // want to do it every step when flying. |
@@ -1535,7 +1564,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1535 | // } | 1564 | // } |
1536 | // } | 1565 | // } |
1537 | 1566 | ||
1538 | if (update_movementflag && m_parentID == 0) | 1567 | if (update_movementflag && ParentID == 0) |
1539 | Animator.UpdateMovementAnimations(); | 1568 | Animator.UpdateMovementAnimations(); |
1540 | } | 1569 | } |
1541 | 1570 | ||
@@ -1617,26 +1646,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1617 | // one of left/right/back/forward. | 1646 | // one of left/right/back/forward. |
1618 | if (LocalVectorToTarget3D.X < 0) //MoveBack | 1647 | if (LocalVectorToTarget3D.X < 0) //MoveBack |
1619 | { | 1648 | { |
1620 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | 1649 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; |
1621 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | 1650 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; |
1622 | updated = true; | 1651 | updated = true; |
1623 | } | 1652 | } |
1624 | else if (LocalVectorToTarget3D.X > 0) //Move Forward | 1653 | else if (LocalVectorToTarget3D.X > 0) //Move Forward |
1625 | { | 1654 | { |
1626 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | 1655 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; |
1627 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | 1656 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; |
1628 | updated = true; | 1657 | updated = true; |
1629 | } | 1658 | } |
1630 | 1659 | ||
1631 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft | 1660 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft |
1632 | { | 1661 | { |
1633 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | 1662 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; |
1634 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | 1663 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; |
1635 | updated = true; | 1664 | updated = true; |
1636 | } | 1665 | } |
1637 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight | 1666 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight |
1638 | { | 1667 | { |
1639 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | 1668 | MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; |
1640 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | 1669 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; |
1641 | updated = true; | 1670 | updated = true; |
1642 | } | 1671 | } |
@@ -1645,14 +1674,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1645 | { | 1674 | { |
1646 | // Don't set these flags for up or down - doing so will make the avatar crouch or | 1675 | // Don't set these flags for up or down - doing so will make the avatar crouch or |
1647 | // keep trying to jump even if walking along level ground | 1676 | // keep trying to jump even if walking along level ground |
1648 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1677 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1649 | //AgentControlFlags | 1678 | //AgentControlFlags |
1650 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1679 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1651 | updated = true; | 1680 | updated = true; |
1652 | } | 1681 | } |
1653 | else if (LocalVectorToTarget3D.Z < 0) //Down | 1682 | else if (LocalVectorToTarget3D.Z < 0) //Down |
1654 | { | 1683 | { |
1655 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1684 | //MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1656 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1685 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1657 | updated = true; | 1686 | updated = true; |
1658 | } | 1687 | } |
@@ -1815,10 +1844,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1815 | { | 1844 | { |
1816 | SitGround = false; | 1845 | SitGround = false; |
1817 | 1846 | ||
1818 | if (m_parentID != 0) | 1847 | if (ParentID != 0) |
1819 | { | 1848 | { |
1820 | m_log.Debug("StandupCode Executed"); | 1849 | m_log.Debug("StandupCode Executed"); |
1821 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 1850 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); |
1822 | if (part != null) | 1851 | if (part != null) |
1823 | { | 1852 | { |
1824 | TaskInventoryDictionary taskIDict = part.TaskInventory; | 1853 | TaskInventoryDictionary taskIDict = part.TaskInventory; |
@@ -1841,19 +1870,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1841 | part.SitTargetAvatar = UUID.Zero; | 1870 | part.SitTargetAvatar = UUID.Zero; |
1842 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 1871 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
1843 | 1872 | ||
1844 | m_parentPosition = part.GetWorldPosition(); | 1873 | ParentPosition = part.GetWorldPosition(); |
1845 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 1874 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
1846 | } | 1875 | } |
1847 | 1876 | ||
1848 | if (m_physicsActor == null) | 1877 | if (PhysicsActor == null) |
1849 | { | 1878 | { |
1850 | AddToPhysicalScene(false); | 1879 | AddToPhysicalScene(false); |
1851 | } | 1880 | } |
1852 | 1881 | ||
1853 | m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 1882 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
1854 | m_parentPosition = Vector3.Zero; | 1883 | ParentPosition = Vector3.Zero; |
1855 | 1884 | ||
1856 | m_parentID = 0; | 1885 | ParentID = 0; |
1857 | SendAvatarDataToAllAgents(); | 1886 | SendAvatarDataToAllAgents(); |
1858 | m_requestedSitTargetID = 0; | 1887 | m_requestedSitTargetID = 0; |
1859 | } | 1888 | } |
@@ -1951,11 +1980,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1951 | // offset = pos; | 1980 | // offset = pos; |
1952 | //autopilot = false; | 1981 | //autopilot = false; |
1953 | //} | 1982 | //} |
1954 | if (m_physicsActor != null) | 1983 | if (PhysicsActor != null) |
1955 | { | 1984 | { |
1956 | // If we're not using the client autopilot, we're immediately warping the avatar to the location | 1985 | // If we're not using the client autopilot, we're immediately warping the avatar to the location |
1957 | // We can remove the physicsActor until they stand up. | 1986 | // We can remove the physicsActor until they stand up. |
1958 | m_sitAvatarHeight = m_physicsActor.Size.Z; | 1987 | m_sitAvatarHeight = PhysicsActor.Size.Z; |
1959 | 1988 | ||
1960 | if (autopilot) | 1989 | if (autopilot) |
1961 | { | 1990 | { |
@@ -1994,7 +2023,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1994 | // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) | 2023 | // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) |
1995 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) | 2024 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) |
1996 | { | 2025 | { |
1997 | if (m_parentID != 0) | 2026 | if (ParentID != 0) |
1998 | { | 2027 | { |
1999 | StandUp(); | 2028 | StandUp(); |
2000 | } | 2029 | } |
@@ -2263,16 +2292,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2263 | 2292 | ||
2264 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); | 2293 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); |
2265 | m_pos += SIT_TARGET_ADJUSTMENT; | 2294 | m_pos += SIT_TARGET_ADJUSTMENT; |
2266 | m_bodyRot = sitTargetOrient; | 2295 | Rotation = sitTargetOrient; |
2267 | //Rotation = sitTargetOrient; | 2296 | //Rotation = sitTargetOrient; |
2268 | m_parentPosition = part.AbsolutePosition; | 2297 | ParentPosition = part.AbsolutePosition; |
2269 | 2298 | ||
2270 | //SendTerseUpdateToAllClients(); | 2299 | //SendTerseUpdateToAllClients(); |
2271 | } | 2300 | } |
2272 | else | 2301 | else |
2273 | { | 2302 | { |
2274 | m_pos -= part.AbsolutePosition; | 2303 | m_pos -= part.AbsolutePosition; |
2275 | m_parentPosition = part.AbsolutePosition; | 2304 | ParentPosition = part.AbsolutePosition; |
2276 | } | 2305 | } |
2277 | } | 2306 | } |
2278 | else | 2307 | else |
@@ -2280,7 +2309,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2280 | return; | 2309 | return; |
2281 | } | 2310 | } |
2282 | } | 2311 | } |
2283 | m_parentID = m_requestedSitTargetID; | 2312 | ParentID = m_requestedSitTargetID; |
2284 | 2313 | ||
2285 | Velocity = Vector3.Zero; | 2314 | Velocity = Vector3.Zero; |
2286 | RemoveFromPhysicalScene(); | 2315 | RemoveFromPhysicalScene(); |
@@ -2299,11 +2328,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2299 | /// </summary> | 2328 | /// </summary> |
2300 | public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) | 2329 | public void HandleSetAlwaysRun(IClientAPI remoteClient, bool pSetAlwaysRun) |
2301 | { | 2330 | { |
2302 | m_setAlwaysRun = pSetAlwaysRun; | 2331 | SetAlwaysRun = pSetAlwaysRun; |
2303 | if (PhysicsActor != null) | ||
2304 | { | ||
2305 | PhysicsActor.SetAlwaysRun = pSetAlwaysRun; | ||
2306 | } | ||
2307 | } | 2332 | } |
2308 | 2333 | ||
2309 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) | 2334 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) |
@@ -2325,27 +2350,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2325 | Vector3 direc = vec * Rotation; | 2350 | Vector3 direc = vec * Rotation; |
2326 | direc.Normalize(); | 2351 | direc.Normalize(); |
2327 | 2352 | ||
2328 | direc *= 0.03f * 128f * m_speedModifier; | 2353 | direc *= 0.03f * 128f * SpeedModifier; |
2329 | 2354 | ||
2330 | PhysicsActor actor = m_physicsActor; | 2355 | if (PhysicsActor != null) |
2331 | if (actor != null) | ||
2332 | { | 2356 | { |
2333 | if (actor.Flying) | 2357 | if (PhysicsActor.Flying) |
2334 | { | 2358 | { |
2335 | direc *= 4.0f; | 2359 | direc *= 4.0f; |
2336 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 2360 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
2337 | //bool colliding = (m_physicsActor.IsColliding==true); | ||
2338 | //if (controlland) | 2361 | //if (controlland) |
2339 | // m_log.Info("[AGENT]: landCommand"); | 2362 | // m_log.Info("[AGENT]: landCommand"); |
2340 | //if (colliding) | 2363 | //if (PhysicsActor.IsColliding) |
2341 | // m_log.Info("[AGENT]: colliding"); | 2364 | // m_log.Info("[AGENT]: colliding"); |
2342 | //if (m_physicsActor.Flying && colliding && controlland) | 2365 | //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) |
2343 | //{ | 2366 | //{ |
2344 | // StopFlying(); | 2367 | // StopFlying(); |
2345 | // m_log.Info("[AGENT]: Stop FLying"); | 2368 | // m_log.Info("[AGENT]: Stop Flying"); |
2346 | //} | 2369 | //} |
2347 | } | 2370 | } |
2348 | else if (!actor.Flying && actor.IsColliding) | 2371 | else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) |
2349 | { | 2372 | { |
2350 | if (direc.Z > 2.0f) | 2373 | if (direc.Z > 2.0f) |
2351 | { | 2374 | { |
@@ -2378,16 +2401,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2378 | if (!sendingPrims) | 2401 | if (!sendingPrims) |
2379 | Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); | 2402 | Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); |
2380 | 2403 | ||
2381 | if (m_isChildAgent == false) | 2404 | if (IsChildAgent == false) |
2382 | { | 2405 | { |
2383 | // PhysicsActor actor = m_physicsActor; | ||
2384 | |||
2385 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to | 2406 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to |
2386 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 2407 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
2387 | // storing a requested force instead of an actual traveling velocity | 2408 | // storing a requested force instead of an actual traveling velocity |
2388 | 2409 | ||
2389 | // Throw away duplicate or insignificant updates | 2410 | // Throw away duplicate or insignificant updates |
2390 | if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 2411 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || |
2391 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 2412 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
2392 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 2413 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
2393 | //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2414 | //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
@@ -2396,13 +2417,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2396 | 2417 | ||
2397 | // Update the "last" values | 2418 | // Update the "last" values |
2398 | m_lastPosition = m_pos; | 2419 | m_lastPosition = m_pos; |
2399 | m_lastRotation = m_bodyRot; | 2420 | m_lastRotation = Rotation; |
2400 | m_lastVelocity = Velocity; | 2421 | m_lastVelocity = Velocity; |
2401 | //m_lastTerseSent = Environment.TickCount; | 2422 | //m_lastTerseSent = Environment.TickCount; |
2402 | } | 2423 | } |
2403 | 2424 | ||
2404 | // followed suggestion from mic bowman. reversed the two lines below. | 2425 | // followed suggestion from mic bowman. reversed the two lines below. |
2405 | if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something | 2426 | if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something |
2406 | CheckForBorderCrossing(); | 2427 | CheckForBorderCrossing(); |
2407 | 2428 | ||
2408 | CheckForSignificantMovement(); // sends update to the modules. | 2429 | CheckForSignificantMovement(); // sends update to the modules. |
@@ -2425,9 +2446,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2425 | if (remoteClient.IsActive) | 2446 | if (remoteClient.IsActive) |
2426 | { | 2447 | { |
2427 | Vector3 pos = m_pos; | 2448 | Vector3 pos = m_pos; |
2428 | pos.Z += m_appearance.HipOffset; | 2449 | pos.Z += Appearance.HipOffset; |
2429 | 2450 | ||
2430 | //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); |
2431 | 2452 | ||
2432 | remoteClient.SendPrimUpdate( | 2453 | remoteClient.SendPrimUpdate( |
2433 | this, | 2454 | this, |
@@ -2499,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2499 | 2520 | ||
2500 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2521 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2501 | { | 2522 | { |
2502 | m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 2523 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
2503 | } | 2524 | } |
2504 | 2525 | ||
2505 | /// <summary> | 2526 | /// <summary> |
@@ -2509,21 +2530,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2509 | private void SendInitialData() | 2530 | private void SendInitialData() |
2510 | { | 2531 | { |
2511 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); | 2532 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); |
2512 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before | 2533 | // Moved this into CompleteMovement to ensure that Appearance is initialized before |
2513 | // the inventory arrives | 2534 | // the inventory arrives |
2514 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 2535 | // m_scene.GetAvatarAppearance(ControllingClient, out Appearance); |
2515 | 2536 | ||
2516 | bool cachedappearance = false; | 2537 | bool cachedappearance = false; |
2517 | 2538 | ||
2518 | // We have an appearance but we may not have the baked textures. Check the asset cache | 2539 | // We have an appearance but we may not have the baked textures. Check the asset cache |
2519 | // to see if all the baked textures are already here. | 2540 | // to see if all the baked textures are already here. |
2520 | if (m_scene.AvatarFactory != null) | 2541 | if (m_scene.AvatarFactory != null) |
2521 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); | 2542 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(ControllingClient); |
2522 | 2543 | ||
2523 | // If we aren't using a cached appearance, then clear out the baked textures | 2544 | // If we aren't using a cached appearance, then clear out the baked textures |
2524 | if (!cachedappearance) | 2545 | if (!cachedappearance) |
2525 | { | 2546 | { |
2526 | m_appearance.ResetAppearance(); | 2547 | Appearance.ResetAppearance(); |
2527 | if (m_scene.AvatarFactory != null) | 2548 | if (m_scene.AvatarFactory != null) |
2528 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 2549 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
2529 | } | 2550 | } |
@@ -2671,17 +2692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2671 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 2692 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
2672 | 2693 | ||
2673 | avatar.ControllingClient.SendAppearance( | 2694 | avatar.ControllingClient.SendAppearance( |
2674 | UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2695 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
2675 | } | ||
2676 | |||
2677 | public AvatarAppearance Appearance | ||
2678 | { | ||
2679 | get { return m_appearance; } | ||
2680 | set | ||
2681 | { | ||
2682 | m_appearance = value; | ||
2683 | // m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); | ||
2684 | } | ||
2685 | } | 2696 | } |
2686 | 2697 | ||
2687 | #endregion | 2698 | #endregion |
@@ -2709,14 +2720,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2709 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 2720 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
2710 | cadu.ActiveGroupID = UUID.Zero.Guid; | 2721 | cadu.ActiveGroupID = UUID.Zero.Guid; |
2711 | cadu.AgentID = UUID.Guid; | 2722 | cadu.AgentID = UUID.Guid; |
2712 | cadu.alwaysrun = m_setAlwaysRun; | 2723 | cadu.alwaysrun = SetAlwaysRun; |
2713 | cadu.AVHeight = m_appearance.AvatarHeight; | 2724 | cadu.AVHeight = Appearance.AvatarHeight; |
2714 | Vector3 tempCameraCenter = m_CameraCenter; | 2725 | cadu.cameraPosition = CameraPosition; |
2715 | cadu.cameraPosition = tempCameraCenter; | 2726 | cadu.drawdistance = DrawDistance; |
2716 | cadu.drawdistance = m_DrawDistance; | ||
2717 | cadu.GroupAccess = 0; | 2727 | cadu.GroupAccess = 0; |
2718 | cadu.Position = AbsolutePosition; | 2728 | cadu.Position = AbsolutePosition; |
2719 | cadu.regionHandle = m_rootRegionHandle; | 2729 | cadu.regionHandle = RegionHandle; |
2720 | 2730 | ||
2721 | // Throttles | 2731 | // Throttles |
2722 | float multiplier = 1; | 2732 | float multiplier = 1; |
@@ -2822,7 +2832,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2822 | { | 2832 | { |
2823 | if (m_requestedSitTargetUUID == UUID.Zero) | 2833 | if (m_requestedSitTargetUUID == UUID.Zero) |
2824 | { | 2834 | { |
2825 | bool isFlying = m_physicsActor.Flying; | 2835 | bool isFlying = PhysicsActor.Flying; |
2826 | RemoveFromPhysicalScene(); | 2836 | RemoveFromPhysicalScene(); |
2827 | 2837 | ||
2828 | Vector3 pos = AbsolutePosition; | 2838 | Vector3 pos = AbsolutePosition; |
@@ -2847,7 +2857,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2847 | { | 2857 | { |
2848 | if (m_requestedSitTargetUUID == UUID.Zero) | 2858 | if (m_requestedSitTargetUUID == UUID.Zero) |
2849 | { | 2859 | { |
2850 | bool isFlying = m_physicsActor.Flying; | 2860 | bool isFlying = PhysicsActor.Flying; |
2851 | RemoveFromPhysicalScene(); | 2861 | RemoveFromPhysicalScene(); |
2852 | 2862 | ||
2853 | Vector3 pos = AbsolutePosition; | 2863 | Vector3 pos = AbsolutePosition; |
@@ -2937,7 +2947,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2937 | { | 2947 | { |
2938 | try | 2948 | try |
2939 | { | 2949 | { |
2940 | return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2950 | return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); |
2941 | } | 2951 | } |
2942 | catch | 2952 | catch |
2943 | { | 2953 | { |
@@ -2945,19 +2955,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2945 | } | 2955 | } |
2946 | } | 2956 | } |
2947 | 2957 | ||
2948 | public void InTransit() | ||
2949 | { | ||
2950 | m_inTransit = true; | ||
2951 | |||
2952 | if ((m_physicsActor != null) && m_physicsActor.Flying) | ||
2953 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
2954 | else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) | ||
2955 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
2956 | } | ||
2957 | |||
2958 | public void NotInTransit() | 2958 | public void NotInTransit() |
2959 | { | 2959 | { |
2960 | m_inTransit = false; | 2960 | IsInTransit = false; |
2961 | } | 2961 | } |
2962 | 2962 | ||
2963 | public void RestoreInCurrentScene() | 2963 | public void RestoreInCurrentScene() |
@@ -3013,7 +3013,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3013 | if (byebyeRegions.Count > 0) | 3013 | if (byebyeRegions.Count > 0) |
3014 | { | 3014 | { |
3015 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 3015 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
3016 | m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions); | 3016 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); |
3017 | } | 3017 | } |
3018 | 3018 | ||
3019 | foreach (ulong handle in byebyeRegions) | 3019 | foreach (ulong handle in byebyeRegions) |
@@ -3039,17 +3039,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | if (account != null) | 3039 | if (account != null) |
3040 | { | 3040 | { |
3041 | if (account.UserLevel > 0) | 3041 | if (account.UserLevel > 0) |
3042 | m_godLevel = account.UserLevel; | 3042 | GodLevel = account.UserLevel; |
3043 | else | 3043 | else |
3044 | m_godLevel = 200; | 3044 | GodLevel = 200; |
3045 | } | 3045 | } |
3046 | } | 3046 | } |
3047 | else | 3047 | else |
3048 | { | 3048 | { |
3049 | m_godLevel = 0; | 3049 | GodLevel = 0; |
3050 | } | 3050 | } |
3051 | 3051 | ||
3052 | ControllingClient.SendAdminResponse(token, (uint)m_godLevel); | 3052 | ControllingClient.SendAdminResponse(token, (uint)GodLevel); |
3053 | } | 3053 | } |
3054 | 3054 | ||
3055 | #region Child Agent Updates | 3055 | #region Child Agent Updates |
@@ -3081,8 +3081,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3081 | // When we get to the point of re-computing neighbors everytime this | 3081 | // When we get to the point of re-computing neighbors everytime this |
3082 | // changes, then start using the agent's drawdistance rather than the | 3082 | // changes, then start using the agent's drawdistance rather than the |
3083 | // region's draw distance. | 3083 | // region's draw distance. |
3084 | // m_DrawDistance = cAgentData.Far; | 3084 | // DrawDistance = cAgentData.Far; |
3085 | m_DrawDistance = Scene.DefaultDrawDistance; | 3085 | DrawDistance = Scene.DefaultDrawDistance; |
3086 | 3086 | ||
3087 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! | 3087 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! |
3088 | m_pos = cAgentData.Position + offset; | 3088 | m_pos = cAgentData.Position + offset; |
@@ -3093,7 +3093,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3093 | ReprioritizeUpdates(); | 3093 | ReprioritizeUpdates(); |
3094 | } | 3094 | } |
3095 | 3095 | ||
3096 | m_CameraCenter = cAgentData.Center + offset; | 3096 | CameraPosition = cAgentData.Center + offset; |
3097 | 3097 | ||
3098 | //SetHeight(cAgentData.AVHeight); | 3098 | //SetHeight(cAgentData.AVHeight); |
3099 | 3099 | ||
@@ -3101,7 +3101,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3101 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); | 3101 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); |
3102 | 3102 | ||
3103 | //cAgentData.AVHeight; | 3103 | //cAgentData.AVHeight; |
3104 | m_rootRegionHandle = cAgentData.RegionHandle; | 3104 | RegionHandle = cAgentData.RegionHandle; |
3105 | //m_velocity = cAgentData.Velocity; | 3105 | //m_velocity = cAgentData.Velocity; |
3106 | } | 3106 | } |
3107 | 3107 | ||
@@ -3114,12 +3114,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3114 | 3114 | ||
3115 | cAgent.Position = AbsolutePosition; | 3115 | cAgent.Position = AbsolutePosition; |
3116 | cAgent.Velocity = m_velocity; | 3116 | cAgent.Velocity = m_velocity; |
3117 | cAgent.Center = m_CameraCenter; | 3117 | cAgent.Center = CameraPosition; |
3118 | cAgent.AtAxis = m_CameraAtAxis; | 3118 | cAgent.AtAxis = CameraAtAxis; |
3119 | cAgent.LeftAxis = m_CameraLeftAxis; | 3119 | cAgent.LeftAxis = CameraLeftAxis; |
3120 | cAgent.UpAxis = m_CameraUpAxis; | 3120 | cAgent.UpAxis = m_CameraUpAxis; |
3121 | 3121 | ||
3122 | cAgent.Far = m_DrawDistance; | 3122 | cAgent.Far = DrawDistance; |
3123 | 3123 | ||
3124 | // Throttles | 3124 | // Throttles |
3125 | float multiplier = 1; | 3125 | float multiplier = 1; |
@@ -3134,17 +3134,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3134 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); | 3134 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); |
3135 | 3135 | ||
3136 | cAgent.HeadRotation = m_headrotation; | 3136 | cAgent.HeadRotation = m_headrotation; |
3137 | cAgent.BodyRotation = m_bodyRot; | 3137 | cAgent.BodyRotation = Rotation; |
3138 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 3138 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
3139 | 3139 | ||
3140 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3140 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3141 | cAgent.GodLevel = (byte)m_godLevel; | 3141 | cAgent.GodLevel = (byte)GodLevel; |
3142 | else | 3142 | else |
3143 | cAgent.GodLevel = (byte) 0; | 3143 | cAgent.GodLevel = (byte) 0; |
3144 | 3144 | ||
3145 | cAgent.AlwaysRun = m_setAlwaysRun; | 3145 | cAgent.AlwaysRun = SetAlwaysRun; |
3146 | 3146 | ||
3147 | cAgent.Appearance = new AvatarAppearance(m_appearance); | 3147 | cAgent.Appearance = new AvatarAppearance(Appearance); |
3148 | 3148 | ||
3149 | lock (scriptedcontrols) | 3149 | lock (scriptedcontrols) |
3150 | { | 3150 | { |
@@ -3173,7 +3173,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3173 | cAgent.AttachmentObjects = new List<ISceneObject>(); | 3173 | cAgent.AttachmentObjects = new List<ISceneObject>(); |
3174 | cAgent.AttachmentObjectStates = new List<string>(); | 3174 | cAgent.AttachmentObjectStates = new List<string>(); |
3175 | // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); | 3175 | // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); |
3176 | m_InTransitScriptStates.Clear(); | 3176 | InTransitScriptStates.Clear(); |
3177 | 3177 | ||
3178 | foreach (SceneObjectGroup sog in m_attachments) | 3178 | foreach (SceneObjectGroup sog in m_attachments) |
3179 | { | 3179 | { |
@@ -3186,7 +3186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3186 | cAgent.AttachmentObjects.Add(clone); | 3186 | cAgent.AttachmentObjects.Add(clone); |
3187 | string state = sog.GetStateSnapshot(); | 3187 | string state = sog.GetStateSnapshot(); |
3188 | cAgent.AttachmentObjectStates.Add(state); | 3188 | cAgent.AttachmentObjectStates.Add(state); |
3189 | m_InTransitScriptStates.Add(state); | 3189 | InTransitScriptStates.Add(state); |
3190 | // Let's remove the scripts of the original object here | 3190 | // Let's remove the scripts of the original object here |
3191 | sog.RemoveScriptInstances(true); | 3191 | sog.RemoveScriptInstances(true); |
3192 | } | 3192 | } |
@@ -3202,32 +3202,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3202 | 3202 | ||
3203 | m_pos = cAgent.Position; | 3203 | m_pos = cAgent.Position; |
3204 | m_velocity = cAgent.Velocity; | 3204 | m_velocity = cAgent.Velocity; |
3205 | m_CameraCenter = cAgent.Center; | 3205 | CameraPosition = cAgent.Center; |
3206 | m_CameraAtAxis = cAgent.AtAxis; | 3206 | CameraAtAxis = cAgent.AtAxis; |
3207 | m_CameraLeftAxis = cAgent.LeftAxis; | 3207 | CameraLeftAxis = cAgent.LeftAxis; |
3208 | m_CameraUpAxis = cAgent.UpAxis; | 3208 | m_CameraUpAxis = cAgent.UpAxis; |
3209 | 3209 | ||
3210 | // When we get to the point of re-computing neighbors everytime this | 3210 | // When we get to the point of re-computing neighbors everytime this |
3211 | // changes, then start using the agent's drawdistance rather than the | 3211 | // changes, then start using the agent's drawdistance rather than the |
3212 | // region's draw distance. | 3212 | // region's draw distance. |
3213 | // m_DrawDistance = cAgent.Far; | 3213 | // DrawDistance = cAgent.Far; |
3214 | m_DrawDistance = Scene.DefaultDrawDistance; | 3214 | DrawDistance = Scene.DefaultDrawDistance; |
3215 | 3215 | ||
3216 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 3216 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
3217 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 3217 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); |
3218 | 3218 | ||
3219 | m_headrotation = cAgent.HeadRotation; | 3219 | m_headrotation = cAgent.HeadRotation; |
3220 | m_bodyRot = cAgent.BodyRotation; | 3220 | Rotation = cAgent.BodyRotation; |
3221 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 3221 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
3222 | 3222 | ||
3223 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3223 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3224 | m_godLevel = cAgent.GodLevel; | 3224 | GodLevel = cAgent.GodLevel; |
3225 | m_setAlwaysRun = cAgent.AlwaysRun; | 3225 | SetAlwaysRun = cAgent.AlwaysRun; |
3226 | 3226 | ||
3227 | m_appearance = new AvatarAppearance(cAgent.Appearance); | 3227 | Appearance = new AvatarAppearance(cAgent.Appearance); |
3228 | if (m_physicsActor != null) | 3228 | if (PhysicsActor != null) |
3229 | { | 3229 | { |
3230 | bool isFlying = m_physicsActor.Flying; | 3230 | bool isFlying = PhysicsActor.Flying; |
3231 | RemoveFromPhysicalScene(); | 3231 | RemoveFromPhysicalScene(); |
3232 | AddToPhysicalScene(isFlying); | 3232 | AddToPhysicalScene(isFlying); |
3233 | } | 3233 | } |
@@ -3293,7 +3293,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3293 | { | 3293 | { |
3294 | Vector3 force = m_forceToApply.Value; | 3294 | Vector3 force = m_forceToApply.Value; |
3295 | 3295 | ||
3296 | m_updateflag = true; | 3296 | Updated = true; |
3297 | 3297 | ||
3298 | Velocity = force; | 3298 | Velocity = force; |
3299 | 3299 | ||
@@ -3310,30 +3310,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3310 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", | 3310 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", |
3311 | // Name, isFlying, Scene.RegionInfo.RegionName); | 3311 | // Name, isFlying, Scene.RegionInfo.RegionName); |
3312 | 3312 | ||
3313 | if (m_appearance.AvatarHeight == 0) | 3313 | if (Appearance.AvatarHeight == 0) |
3314 | m_appearance.SetHeight(); | 3314 | Appearance.SetHeight(); |
3315 | 3315 | ||
3316 | PhysicsScene scene = m_scene.PhysicsScene; | 3316 | PhysicsScene scene = m_scene.PhysicsScene; |
3317 | 3317 | ||
3318 | Vector3 pVec = AbsolutePosition; | 3318 | Vector3 pVec = AbsolutePosition; |
3319 | 3319 | ||
3320 | // Old bug where the height was in centimeters instead of meters | 3320 | // Old bug where the height was in centimeters instead of meters |
3321 | m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, | 3321 | PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, |
3322 | new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); | 3322 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); |
3323 | 3323 | ||
3324 | scene.AddPhysicsActorTaint(m_physicsActor); | 3324 | scene.AddPhysicsActorTaint(PhysicsActor); |
3325 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3325 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3326 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3326 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3327 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3327 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3328 | m_physicsActor.SubscribeEvents(500); | 3328 | PhysicsActor.SubscribeEvents(500); |
3329 | m_physicsActor.LocalID = LocalId; | 3329 | PhysicsActor.LocalID = LocalId; |
3330 | 3330 | ||
3331 | SetHeight(m_appearance.AvatarHeight); | 3331 | SetHeight(Appearance.AvatarHeight); |
3332 | } | 3332 | } |
3333 | 3333 | ||
3334 | private void OutOfBoundsCall(Vector3 pos) | 3334 | private void OutOfBoundsCall(Vector3 pos) |
3335 | { | 3335 | { |
3336 | //bool flying = m_physicsActor.Flying; | 3336 | //bool flying = PhysicsActor.Flying; |
3337 | //RemoveFromPhysicalScene(); | 3337 | //RemoveFromPhysicalScene(); |
3338 | 3338 | ||
3339 | //AddToPhysicalScene(flying); | 3339 | //AddToPhysicalScene(flying); |
@@ -3348,7 +3348,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3348 | return; | 3348 | return; |
3349 | 3349 | ||
3350 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | 3350 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) |
3351 | // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( | 3351 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
3352 | // as of this comment the interval is set in AddToPhysicalScene | 3352 | // as of this comment the interval is set in AddToPhysicalScene |
3353 | if (Animator != null) | 3353 | if (Animator != null) |
3354 | Animator.UpdateMovementAnimations(); | 3354 | Animator.UpdateMovementAnimations(); |
@@ -3387,7 +3387,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3387 | } | 3387 | } |
3388 | } | 3388 | } |
3389 | 3389 | ||
3390 | if (m_invulnerable) | 3390 | if (Invulnerable) |
3391 | return; | 3391 | return; |
3392 | 3392 | ||
3393 | float starthealth = Health; | 3393 | float starthealth = Health; |
@@ -3412,13 +3412,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3412 | //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); | 3412 | //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); |
3413 | } | 3413 | } |
3414 | //Health = 100; | 3414 | //Health = 100; |
3415 | if (!m_invulnerable) | 3415 | if (!Invulnerable) |
3416 | { | 3416 | { |
3417 | if (starthealth != Health) | 3417 | if (starthealth != Health) |
3418 | { | 3418 | { |
3419 | ControllingClient.SendHealth(Health); | 3419 | ControllingClient.SendHealth(Health); |
3420 | } | 3420 | } |
3421 | if (m_health <= 0) | 3421 | if (Health <= 0) |
3422 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3422 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3423 | } | 3423 | } |
3424 | } | 3424 | } |
@@ -3449,11 +3449,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3449 | // unsetting the elapsed callback should be enough to allow for cleanup however. | 3449 | // unsetting the elapsed callback should be enough to allow for cleanup however. |
3450 | // m_reprioritizationTimer.Dispose(); | 3450 | // m_reprioritizationTimer.Dispose(); |
3451 | 3451 | ||
3452 | m_sceneViewer.Close(); | 3452 | SceneViewer.Close(); |
3453 | 3453 | ||
3454 | RemoveFromPhysicalScene(); | 3454 | RemoveFromPhysicalScene(); |
3455 | m_animator.Close(); | 3455 | Animator.Close(); |
3456 | m_animator = null; | 3456 | Animator = null; |
3457 | } | 3457 | } |
3458 | 3458 | ||
3459 | public void AddAttachment(SceneObjectGroup gobj) | 3459 | public void AddAttachment(SceneObjectGroup gobj) |
@@ -3815,7 +3815,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3815 | 3815 | ||
3816 | private void Reprioritize(object sender, ElapsedEventArgs e) | 3816 | private void Reprioritize(object sender, ElapsedEventArgs e) |
3817 | { | 3817 | { |
3818 | m_controllingClient.ReprioritizeUpdates(); | 3818 | ControllingClient.ReprioritizeUpdates(); |
3819 | 3819 | ||
3820 | lock (m_reprioritization_timer) | 3820 | lock (m_reprioritization_timer) |
3821 | { | 3821 | { |