aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs312
1 files changed, 208 insertions, 104 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 212720e..5a6fb6c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
45 45
46namespace OpenSim.Region.Framework.Scenes 46namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 [Flags]
48 enum ScriptControlled : uint 49 enum ScriptControlled : uint
49 { 50 {
50 CONTROL_ZERO = 0, 51 CONTROL_ZERO = 0,
@@ -1084,19 +1085,7 @@ namespace OpenSim.Region.Framework.Scenes
1084 /// <param name="pos"></param> 1085 /// <param name="pos"></param>
1085 public void Teleport(Vector3 pos) 1086 public void Teleport(Vector3 pos)
1086 { 1087 {
1087 bool isFlying = Flying; 1088 TeleportWithMomentum(pos, Vector3.Zero);
1088 RemoveFromPhysicalScene();
1089 Velocity = Vector3.Zero;
1090 CheckLandingPoint(ref pos);
1091 AbsolutePosition = pos;
1092 AddToPhysicalScene(isFlying);
1093
1094 SendTerseUpdateToAllClients();
1095 }
1096
1097 public void TeleportWithMomentum(Vector3 pos)
1098 {
1099 TeleportWithMomentum(pos, null);
1100 } 1089 }
1101 1090
1102 public void TeleportWithMomentum(Vector3 pos, Vector3? v) 1091 public void TeleportWithMomentum(Vector3 pos, Vector3? v)
@@ -1280,17 +1269,27 @@ namespace OpenSim.Region.Framework.Scenes
1280 1269
1281 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1270 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1282 MakeRootAgent(AbsolutePosition, flying); 1271 MakeRootAgent(AbsolutePosition, flying);
1272 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1273
1274// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1283 1275
1284 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1276 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1285 { 1277 {
1286 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); 1278 // We cannot sleep here since this would hold up the inbound packet processing thread, as
1279 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
1280 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
1281 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
1282 // region as the current region, meaning that a close sent before then will fail the teleport.
1283// System.Threading.Thread.Sleep(2000);
1284
1285 m_log.DebugFormat(
1286 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
1287 client.Name, client.AgentId, m_callbackURI);
1288
1287 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); 1289 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1288 m_callbackURI = null; 1290 m_callbackURI = null;
1289 } 1291 }
1290 1292
1291// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1292
1293 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1294 ValidateAndSendAppearanceAndAgentData(); 1293 ValidateAndSendAppearanceAndAgentData();
1295 1294
1296 // Create child agents in neighbouring regions 1295 // Create child agents in neighbouring regions
@@ -1305,7 +1304,6 @@ namespace OpenSim.Region.Framework.Scenes
1305 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1304 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1306 } 1305 }
1307 1306
1308
1309// m_log.DebugFormat( 1307// m_log.DebugFormat(
1310// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1308// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1311// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1309// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
@@ -1358,7 +1356,7 @@ namespace OpenSim.Region.Framework.Scenes
1358 { 1356 {
1359// m_log.DebugFormat( 1357// m_log.DebugFormat(
1360// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", 1358// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
1361// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); 1359// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
1362 1360
1363 if (IsChildAgent) 1361 if (IsChildAgent)
1364 { 1362 {
@@ -1468,14 +1466,8 @@ namespace OpenSim.Region.Framework.Scenes
1468 } 1466 }
1469 } 1467 }
1470 1468
1471 lock (scriptedcontrols) 1469 uint flagsForScripts = (uint)flags;
1472 { 1470 flags = RemoveIgnoredControls(flags, IgnoredControls);
1473 if (scriptedcontrols.Count > 0)
1474 {
1475 SendControlToScripts((uint)flags);
1476 flags = RemoveIgnoredControls(flags, IgnoredControls);
1477 }
1478 }
1479 1471
1480 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) 1472 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
1481 HandleAgentSitOnGround(); 1473 HandleAgentSitOnGround();
@@ -1489,6 +1481,7 @@ namespace OpenSim.Region.Framework.Scenes
1489 PhysicsActor actor = PhysicsActor; 1481 PhysicsActor actor = PhysicsActor;
1490 if (actor == null) 1482 if (actor == null)
1491 { 1483 {
1484 SendControlsToScripts(flagsForScripts);
1492 return; 1485 return;
1493 } 1486 }
1494 1487
@@ -1568,7 +1561,7 @@ namespace OpenSim.Region.Framework.Scenes
1568 MovementFlag |= (byte)nudgehack; 1561 MovementFlag |= (byte)nudgehack;
1569 } 1562 }
1570 1563
1571// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); 1564 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF);
1572 MovementFlag += (byte)(uint)DCF; 1565 MovementFlag += (byte)(uint)DCF;
1573 update_movementflag = true; 1566 update_movementflag = true;
1574 } 1567 }
@@ -1581,7 +1574,7 @@ namespace OpenSim.Region.Framework.Scenes
1581 && ((MovementFlag & (byte)nudgehack) == nudgehack)) 1574 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1582 ) // This or is for Nudge forward 1575 ) // This or is for Nudge forward
1583 { 1576 {
1584// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); 1577 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
1585 MovementFlag -= ((byte)(uint)DCF); 1578 MovementFlag -= ((byte)(uint)DCF);
1586 update_movementflag = true; 1579 update_movementflag = true;
1587 1580
@@ -1662,8 +1655,10 @@ namespace OpenSim.Region.Framework.Scenes
1662// } 1655// }
1663// } 1656// }
1664 1657
1665// if (update_movementflag && ParentID == 0) 1658 if (update_movementflag && ParentID == 0)
1666// Animator.UpdateMovementAnimations(); 1659 Animator.UpdateMovementAnimations();
1660
1661 SendControlsToScripts(flagsForScripts);
1667 } 1662 }
1668 1663
1669 m_scene.EventManager.TriggerOnClientMovement(this); 1664 m_scene.EventManager.TriggerOnClientMovement(this);
@@ -3081,8 +3076,8 @@ namespace OpenSim.Region.Framework.Scenes
3081 x = x / Constants.RegionSize; 3076 x = x / Constants.RegionSize;
3082 y = y / Constants.RegionSize; 3077 y = y / Constants.RegionSize;
3083 3078
3084 //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); 3079// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
3085 //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); 3080// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
3086 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) 3081 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
3087 { 3082 {
3088 byebyeRegions.Add(handle); 3083 byebyeRegions.Add(handle);
@@ -3489,25 +3484,53 @@ namespace OpenSim.Region.Framework.Scenes
3489 } 3484 }
3490 } 3485 }
3491 3486
3492 RaiseCollisionScriptEvents(coldata); 3487 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
3493 3488 if (Invulnerable || GodLevel > 0)
3494 if (Invulnerable)
3495 return; 3489 return;
3496 3490
3491 // The following may be better in the ICombatModule
3492 // probably tweaking of the values for ground and normal prim collisions will be needed
3497 float starthealth = Health; 3493 float starthealth = Health;
3498 uint killerObj = 0; 3494 uint killerObj = 0;
3495 SceneObjectPart part = null;
3499 foreach (uint localid in coldata.Keys) 3496 foreach (uint localid in coldata.Keys)
3500 { 3497 {
3501 SceneObjectPart part = Scene.GetSceneObjectPart(localid); 3498 if (localid == 0)
3502 3499 {
3503 if (part != null && part.ParentGroup.Damage != -1.0f) 3500 part = null;
3504 Health -= part.ParentGroup.Damage; 3501 }
3502 else
3503 {
3504 part = Scene.GetSceneObjectPart(localid);
3505 }
3506 if (part != null)
3507 {
3508 // Ignore if it has been deleted or volume detect
3509 if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect)
3510 {
3511 if (part.ParentGroup.Damage > 0.0f)
3512 {
3513 // Something with damage...
3514 Health -= part.ParentGroup.Damage;
3515 part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false);
3516 }
3517 else
3518 {
3519 // An ordinary prim
3520 if (coldata[localid].PenetrationDepth >= 0.10f)
3521 Health -= coldata[localid].PenetrationDepth * 5.0f;
3522 }
3523 }
3524 }
3505 else 3525 else
3506 { 3526 {
3507 if (coldata[localid].PenetrationDepth >= 0.10f) 3527 // 0 is the ground
3528 // what about collisions with other avatars?
3529 if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f)
3508 Health -= coldata[localid].PenetrationDepth * 5.0f; 3530 Health -= coldata[localid].PenetrationDepth * 5.0f;
3509 } 3531 }
3510 3532
3533
3511 if (Health <= 0.0f) 3534 if (Health <= 0.0f)
3512 { 3535 {
3513 if (localid != 0) 3536 if (localid != 0)
@@ -3523,7 +3546,16 @@ namespace OpenSim.Region.Framework.Scenes
3523 ControllingClient.SendHealth(Health); 3546 ControllingClient.SendHealth(Health);
3524 } 3547 }
3525 if (Health <= 0) 3548 if (Health <= 0)
3549 {
3526 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3550 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3551 }
3552 if (starthealth == Health && Health < 100.0f)
3553 {
3554 Health += 0.03f;
3555 if (Health > 100.0f)
3556 Health = 100.0f;
3557 ControllingClient.SendHealth(Health);
3558 }
3527 } 3559 }
3528 } 3560 }
3529 3561
@@ -3605,6 +3637,63 @@ namespace OpenSim.Region.Framework.Scenes
3605 return m_attachments.Count > 0; 3637 return m_attachments.Count > 0;
3606 } 3638 }
3607 3639
3640 /// <summary>
3641 /// Returns the total count of scripts in all parts inventories.
3642 /// </summary>
3643 public int ScriptCount()
3644 {
3645 int count = 0;
3646 lock (m_attachments)
3647 {
3648 foreach (SceneObjectGroup gobj in m_attachments)
3649 {
3650 if (gobj != null)
3651 {
3652 count += gobj.ScriptCount();
3653 }
3654 }
3655 }
3656 return count;
3657 }
3658
3659 /// <summary>
3660 /// A float the value is a representative execution time in milliseconds of all scripts in all attachments.
3661 /// </summary>
3662 public float ScriptExecutionTime()
3663 {
3664 float time = 0.0f;
3665 lock (m_attachments)
3666 {
3667 foreach (SceneObjectGroup gobj in m_attachments)
3668 {
3669 if (gobj != null)
3670 {
3671 time += gobj.ScriptExecutionTime();
3672 }
3673 }
3674 }
3675 return time;
3676 }
3677
3678 /// <summary>
3679 /// Returns the total count of running scripts in all parts.
3680 /// </summary>
3681 public int RunningScriptCount()
3682 {
3683 int count = 0;
3684 lock (m_attachments)
3685 {
3686 foreach (SceneObjectGroup gobj in m_attachments)
3687 {
3688 if (gobj != null)
3689 {
3690 count += gobj.RunningScriptCount();
3691 }
3692 }
3693 }
3694 return count;
3695 }
3696
3608 public bool HasScriptedAttachments() 3697 public bool HasScriptedAttachments()
3609 { 3698 {
3610 lock (m_attachments) 3699 lock (m_attachments)
@@ -3822,77 +3911,92 @@ namespace OpenSim.Region.Framework.Scenes
3822 } 3911 }
3823 } 3912 }
3824 3913
3825 internal void SendControlToScripts(uint flags) 3914 private void SendControlsToScripts(uint flags)
3826 { 3915 {
3827 ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; 3916 // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
3828 3917 // (e.g., a walking script) checks which animation is active it will be the correct animation.
3829 if (MouseDown) 3918 lock (scriptedcontrols)
3830 { 3919 {
3831 allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); 3920 if (scriptedcontrols.Count <= 0)
3832 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) 3921 return;
3922
3923 ScriptControlled allflags = ScriptControlled.CONTROL_ZERO;
3924
3925 if (MouseDown)
3926 {
3927 allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON);
3928 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0)
3929 {
3930 allflags = ScriptControlled.CONTROL_ZERO;
3931 MouseDown = true;
3932 }
3933 }
3934
3935 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0)
3833 { 3936 {
3834 allflags = ScriptControlled.CONTROL_ZERO; 3937 allflags |= ScriptControlled.CONTROL_ML_LBUTTON;
3835 MouseDown = true; 3938 MouseDown = true;
3836 } 3939 }
3837 } 3940
3941 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0)
3942 {
3943 allflags |= ScriptControlled.CONTROL_LBUTTON;
3944 MouseDown = true;
3945 }
3946
3947 // find all activated controls, whether the scripts are interested in them or not
3948 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0)
3949 {
3950 allflags |= ScriptControlled.CONTROL_FWD;
3951 }
3952
3953 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
3954 {
3955 allflags |= ScriptControlled.CONTROL_BACK;
3956 }
3957
3958 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
3959 {
3960 allflags |= ScriptControlled.CONTROL_UP;
3961 }
3962
3963 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
3964 {
3965 allflags |= ScriptControlled.CONTROL_DOWN;
3966 }
3838 3967
3839 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) 3968 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
3840 { 3969 {
3841 allflags |= ScriptControlled.CONTROL_ML_LBUTTON; 3970 allflags |= ScriptControlled.CONTROL_LEFT;
3842 MouseDown = true; 3971 }
3843 } 3972
3844 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) 3973 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
3845 { 3974 {
3846 allflags |= ScriptControlled.CONTROL_LBUTTON; 3975 allflags |= ScriptControlled.CONTROL_RIGHT;
3847 MouseDown = true; 3976 }
3848 } 3977
3978 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
3979 {
3980 allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
3981 }
3982
3983 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
3984 {
3985 allflags |= ScriptControlled.CONTROL_ROT_LEFT;
3986 }
3849 3987
3850 // find all activated controls, whether the scripts are interested in them or not 3988 // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
3851 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) 3989 if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
3852 {
3853 allflags |= ScriptControlled.CONTROL_FWD;
3854 }
3855 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
3856 {
3857 allflags |= ScriptControlled.CONTROL_BACK;
3858 }
3859 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
3860 {
3861 allflags |= ScriptControlled.CONTROL_UP;
3862 }
3863 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
3864 {
3865 allflags |= ScriptControlled.CONTROL_DOWN;
3866 }
3867 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
3868 {
3869 allflags |= ScriptControlled.CONTROL_LEFT;
3870 }
3871 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
3872 {
3873 allflags |= ScriptControlled.CONTROL_RIGHT;
3874 }
3875 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
3876 {
3877 allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
3878 }
3879 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
3880 {
3881 allflags |= ScriptControlled.CONTROL_ROT_LEFT;
3882 }
3883 // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
3884 if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
3885 {
3886 lock (scriptedcontrols)
3887 { 3990 {
3888 foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) 3991 foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols)
3889 { 3992 {
3890 UUID scriptUUID = kvp.Key; 3993 UUID scriptUUID = kvp.Key;
3891 ScriptControllers scriptControlData = kvp.Value; 3994 ScriptControllers scriptControlData = kvp.Value;
3892 3995
3893 ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us 3996 ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us
3894 ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle 3997 ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle
3895 ScriptControlled localChange = localHeld ^ localLast; // the changed bits 3998 ScriptControlled localChange = localHeld ^ localLast; // the changed bits
3999
3896 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) 4000 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
3897 { 4001 {
3898 // only send if still pressed or just changed 4002 // only send if still pressed or just changed
@@ -3900,9 +4004,9 @@ namespace OpenSim.Region.Framework.Scenes
3900 } 4004 }
3901 } 4005 }
3902 } 4006 }
4007
4008 LastCommands = allflags;
3903 } 4009 }
3904
3905 LastCommands = allflags;
3906 } 4010 }
3907 4011
3908 internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) 4012 internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored)
@@ -3982,7 +4086,7 @@ namespace OpenSim.Region.Framework.Scenes
3982 land.LandData.UserLocation != Vector3.Zero && 4086 land.LandData.UserLocation != Vector3.Zero &&
3983 land.LandData.OwnerID != m_uuid && 4087 land.LandData.OwnerID != m_uuid &&
3984 (!m_scene.Permissions.IsGod(m_uuid)) && 4088 (!m_scene.Permissions.IsGod(m_uuid)) &&
3985 (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) 4089 (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)))
3986 { 4090 {
3987 float curr = Vector3.Distance(AbsolutePosition, pos); 4091 float curr = Vector3.Distance(AbsolutePosition, pos);
3988 if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) 4092 if (Vector3.Distance(land.LandData.UserLocation, pos) < curr)
@@ -4002,7 +4106,7 @@ namespace OpenSim.Region.Framework.Scenes
4002 { 4106 {
4003 if (GodLevel < 200 && 4107 if (GodLevel < 200 &&
4004 ((!m_scene.Permissions.IsGod(m_uuid) && 4108 ((!m_scene.Permissions.IsGod(m_uuid) &&
4005 !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || 4109 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
4006 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || 4110 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
4007 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) 4111 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
4008 { 4112 {
@@ -4076,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
4076 GodLevel < 200 && 4180 GodLevel < 200 &&
4077 ((land.LandData.OwnerID != m_uuid && 4181 ((land.LandData.OwnerID != m_uuid &&
4078 !m_scene.Permissions.IsGod(m_uuid) && 4182 !m_scene.Permissions.IsGod(m_uuid) &&
4079 !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || 4183 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
4080 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || 4184 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
4081 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) 4185 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
4082 { 4186 {