diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 91f9c0b..f2aa0c5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -221,8 +221,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
221 | 221 | ||
222 | private Quaternion m_headrotation = Quaternion.Identity; | 222 | private Quaternion m_headrotation = Quaternion.Identity; |
223 | 223 | ||
224 | private string m_nextSitAnimation = String.Empty; | ||
225 | |||
226 | //PauPaw:Proper PID Controler for autopilot************ | 224 | //PauPaw:Proper PID Controler for autopilot************ |
227 | public bool MovingToTarget { get; private set; } | 225 | public bool MovingToTarget { get; private set; } |
228 | public Vector3 MoveToPositionTarget { get; private set; } | 226 | public Vector3 MoveToPositionTarget { get; private set; } |
@@ -598,18 +596,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
598 | set | 596 | set |
599 | { | 597 | { |
600 | m_bodyRot = value; | 598 | m_bodyRot = value; |
601 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); | ||
602 | if (PhysicsActor != null) | 599 | if (PhysicsActor != null) |
603 | { | 600 | { |
604 | try | 601 | try |
605 | { | 602 | { |
606 | PhysicsActor.Orientation = value; | 603 | PhysicsActor.Orientation = m_bodyRot; |
607 | } | 604 | } |
608 | catch (Exception e) | 605 | catch (Exception e) |
609 | { | 606 | { |
610 | m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); | 607 | m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); |
611 | } | 608 | } |
612 | } | 609 | } |
610 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); | ||
613 | } | 611 | } |
614 | } | 612 | } |
615 | 613 | ||
@@ -705,6 +703,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | 703 | ||
706 | private bool m_inTransit; | 704 | private bool m_inTransit; |
707 | 705 | ||
706 | /// <summary> | ||
707 | /// This signals whether the presence is in transit between neighbouring regions. | ||
708 | /// </summary> | ||
709 | /// <remarks> | ||
710 | /// It is not set when the presence is teleporting or logging in/out directly to a region. | ||
711 | /// </remarks> | ||
708 | public bool IsInTransit | 712 | public bool IsInTransit |
709 | { | 713 | { |
710 | get { return m_inTransit; } | 714 | get { return m_inTransit; } |
@@ -2077,7 +2081,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2077 | // Get terrain height for sub-region in a megaregion if necessary | 2081 | // Get terrain height for sub-region in a megaregion if necessary |
2078 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | 2082 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); |
2079 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | 2083 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); |
2080 | UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; | 2084 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); |
2085 | // If X and Y is NaN, target_region will be null | ||
2086 | if (target_region == null) | ||
2087 | return; | ||
2088 | UUID target_regionID = target_region.RegionID; | ||
2081 | Scene targetScene = m_scene; | 2089 | Scene targetScene = m_scene; |
2082 | 2090 | ||
2083 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 2091 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
@@ -2322,28 +2330,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2322 | 2330 | ||
2323 | if (ParentID != 0) | 2331 | if (ParentID != 0) |
2324 | { | 2332 | { |
2333 | if (ParentPart.UUID == targetID) | ||
2334 | return; // already sitting here, ignore | ||
2335 | |||
2325 | StandUp(); | 2336 | StandUp(); |
2326 | } | 2337 | } |
2327 | 2338 | ||
2328 | // if (!String.IsNullOrEmpty(sitAnimation)) | ||
2329 | // { | ||
2330 | // m_nextSitAnimation = sitAnimation; | ||
2331 | // } | ||
2332 | // else | ||
2333 | // { | ||
2334 | m_nextSitAnimation = "SIT"; | ||
2335 | // } | ||
2336 | |||
2337 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | ||
2338 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | 2339 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
2339 | 2340 | ||
2340 | if (part != null) | 2341 | if (part != null) |
2341 | { | 2342 | { |
2342 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2343 | { | ||
2344 | m_nextSitAnimation = part.SitAnimation; | ||
2345 | } | ||
2346 | |||
2347 | m_requestedSitTargetID = part.LocalId; | 2343 | m_requestedSitTargetID = part.LocalId; |
2348 | m_requestedSitTargetUUID = targetID; | 2344 | m_requestedSitTargetUUID = targetID; |
2349 | 2345 | ||
@@ -2464,18 +2460,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2464 | 2460 | ||
2465 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2461 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2466 | { | 2462 | { |
2467 | if (!String.IsNullOrEmpty(m_nextSitAnimation)) | ||
2468 | { | ||
2469 | HandleAgentSit(remoteClient, agentID, m_nextSitAnimation); | ||
2470 | } | ||
2471 | else | ||
2472 | { | ||
2473 | HandleAgentSit(remoteClient, agentID, "SIT"); | ||
2474 | } | ||
2475 | } | ||
2476 | |||
2477 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation) | ||
2478 | { | ||
2479 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2463 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2480 | 2464 | ||
2481 | if (part != null) | 2465 | if (part != null) |
@@ -2545,10 +2529,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2545 | 2529 | ||
2546 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2530 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2547 | ParentID = m_requestedSitTargetID; | 2531 | ParentID = m_requestedSitTargetID; |
2548 | 2532 | m_AngularVelocity = Vector3.Zero; | |
2549 | Velocity = Vector3.Zero; | 2533 | Velocity = Vector3.Zero; |
2550 | RemoveFromPhysicalScene(); | 2534 | RemoveFromPhysicalScene(); |
2551 | 2535 | ||
2536 | String sitAnimation = "SIT"; | ||
2537 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2538 | { | ||
2539 | sitAnimation = part.SitAnimation; | ||
2540 | } | ||
2552 | Animator.TrySetMovementAnimation(sitAnimation); | 2541 | Animator.TrySetMovementAnimation(sitAnimation); |
2553 | SendAvatarDataToAllAgents(); | 2542 | SendAvatarDataToAllAgents(); |
2554 | } | 2543 | } |
@@ -2556,7 +2545,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2556 | 2545 | ||
2557 | public void HandleAgentSitOnGround() | 2546 | public void HandleAgentSitOnGround() |
2558 | { | 2547 | { |
2559 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | 2548 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. |
2549 | m_AngularVelocity = Vector3.Zero; | ||
2560 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2550 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2561 | SitGround = true; | 2551 | SitGround = true; |
2562 | RemoveFromPhysicalScene(); | 2552 | RemoveFromPhysicalScene(); |
@@ -2578,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2578 | 2568 | ||
2579 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) | 2569 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) |
2580 | { | 2570 | { |
2581 | Animator.RemoveAnimation(animID); | 2571 | Animator.RemoveAnimation(animID, false); |
2582 | } | 2572 | } |
2583 | 2573 | ||
2584 | public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) | 2574 | public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) |
@@ -4289,6 +4279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4289 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4279 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4290 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | 4280 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) |
4291 | { | 4281 | { |
4282 | |||
4292 | if (GodLevel < 200 && | 4283 | if (GodLevel < 200 && |
4293 | ((!m_scene.Permissions.IsGod(m_uuid) && | 4284 | ((!m_scene.Permissions.IsGod(m_uuid) && |
4294 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || | 4285 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
@@ -4297,7 +4288,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4297 | { | 4288 | { |
4298 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | 4289 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); |
4299 | if (spawnPoints.Length == 0) | 4290 | if (spawnPoints.Length == 0) |
4291 | { | ||
4292 | if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) | ||
4293 | { | ||
4294 | pos.X = 128.0f; | ||
4295 | pos.Y = 128.0f; | ||
4296 | } | ||
4300 | return; | 4297 | return; |
4298 | } | ||
4301 | 4299 | ||
4302 | int index; | 4300 | int index; |
4303 | bool selected = false; | 4301 | bool selected = false; |
@@ -4306,6 +4304,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4306 | { | 4304 | { |
4307 | case "random": | 4305 | case "random": |
4308 | 4306 | ||
4307 | if (spawnPoints.Length == 0) | ||
4308 | return; | ||
4309 | do | 4309 | do |
4310 | { | 4310 | { |
4311 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | 4311 | index = Util.RandomClass.Next(spawnPoints.Length - 1); |
@@ -4317,6 +4317,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4317 | // SpawnPoint sp = spawnPoints[index]; | 4317 | // SpawnPoint sp = spawnPoints[index]; |
4318 | 4318 | ||
4319 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | 4319 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); |
4320 | |||
4320 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | 4321 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) |
4321 | selected = false; | 4322 | selected = false; |
4322 | else | 4323 | else |