From 7310b7625e96f2d96c93c40eab1367ed745d9b0d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 2 Jun 2017 12:58:04 +0100 Subject: [PATCH 1/4] move a execution overlap guard to end of job --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 439f79dfe2..826cda103d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2120,7 +2120,6 @@ namespace OpenSim.Region.Framework.Scenes lock (m_returns) { EventManager.TriggerOnBackup(SimulationDataService, forced); - m_backingup = false; foreach (KeyValuePair ret in m_returns) { @@ -2151,6 +2150,7 @@ namespace OpenSim.Region.Framework.Scenes tr.SendInstantMessage(msg, delegate(bool success) { }); } m_returns.Clear(); + m_backingup = false; } } From 12a6625dc76c41f8fb37d379e21ea3a7515463af Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Jun 2017 03:48:49 +0100 Subject: [PATCH 2/4] fix MouseDown in case it gets any use --- .../Region/Framework/Scenes/ScenePresence.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f1e27a5ecb..7a14f2ac60 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5751,29 +5751,21 @@ namespace OpenSim.Region.Framework.Scenes if (scriptedcontrols.Count <= 0) return; - ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; - - if (MouseDown) + ScriptControlled allflags; + // convert mouse from edge to level + if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || + (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) { - allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); - if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) - { - allflags = ScriptControlled.CONTROL_ZERO; - MouseDown = true; - } + allflags = ScriptControlled.CONTROL_ZERO; } + else // recover last state of mouse + allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) - { allflags |= ScriptControlled.CONTROL_ML_LBUTTON; - MouseDown = true; - } if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) - { allflags |= ScriptControlled.CONTROL_LBUTTON; - MouseDown = true; - } // find all activated controls, whether the scripts are interested in them or not if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) @@ -5837,6 +5829,7 @@ namespace OpenSim.Region.Framework.Scenes } LastCommands = allflags; + MouseDown = (allflags & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON)) != 0; } } From 67e540e05c34667b771fb5d95e4d7bdc0dfce24d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Jun 2017 04:28:43 +0100 Subject: [PATCH 3/4] cross mouse buttons state --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 +++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index d6d8dde6fe..ee5007abf8 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -375,6 +375,7 @@ namespace OpenSim.Framework public string ActiveGroupTitle = null; public UUID agentCOF; public byte CrossingFlags; + public byte CrossExtraFlags; public Dictionary ChildrenCapSeeds = null; public Animation[] Anims; @@ -454,6 +455,8 @@ namespace OpenSim.Framework args["agent_cof"] = OSD.FromUUID(agentCOF); args["crossingflags"] = OSD.FromInteger(CrossingFlags); + if(CrossingFlags != 0) + args["crossExtraFlags"] = OSD.FromInteger(CrossExtraFlags); args["active_group_id"] = OSD.FromUUID(ActiveGroupID); args["active_group_name"] = OSD.FromString(ActiveGroupName); @@ -646,6 +649,12 @@ namespace OpenSim.Framework if (args.ContainsKey("crossingflags") && args["crossingflags"] != null) CrossingFlags = (byte)args["crossingflags"].AsInteger(); + if(CrossingFlags != 0) + { + if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null) + CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger(); + } + if (args.ContainsKey("active_group_id") && args["active_group_id"] != null) ActiveGroupID = args["active_group_id"].AsUUID(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7a14f2ac60..cec21d8337 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4668,6 +4668,11 @@ namespace OpenSim.Region.Framework.Scenes { cAgent.CrossingFlags = crossingFlags; cAgent.CrossingFlags |= 1; + cAgent.CrossExtraFlags = 0; + if((LastCommands & ScriptControlled.CONTROL_LBUTTON) != 0) + cAgent.CrossExtraFlags |= 1; + if((LastCommands & ScriptControlled.CONTROL_ML_LBUTTON) != 0) + cAgent.CrossExtraFlags |= 2; } else cAgent.CrossingFlags = 0; @@ -4782,6 +4787,15 @@ namespace OpenSim.Region.Framework.Scenes crossingFlags = cAgent.CrossingFlags; gotCrossUpdate = (crossingFlags != 0); + if(gotCrossUpdate) + { + LastCommands &= ~(ScriptControlled.CONTROL_LBUTTON | ScriptControlled.CONTROL_ML_LBUTTON); + if((cAgent.CrossExtraFlags & 1) != 0) + LastCommands |= ScriptControlled.CONTROL_LBUTTON; + if((cAgent.CrossExtraFlags & 2) != 0) + LastCommands |= ScriptControlled.CONTROL_ML_LBUTTON; + MouseDown = (cAgent.CrossExtraFlags & 3) != 0; + } haveGroupInformation = false; // using this as protocol detection don't want to mess with the numbers for now From f26ad07ce122c43465b9503e36ce3191316a3777 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Jun 2017 07:01:07 +0100 Subject: [PATCH 4/4] add a delayed stop so fast tap on move keys does not stop the avatar in some cases --- .../Region/Framework/Scenes/ScenePresence.cs | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cec21d8337..ed9cf53535 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -364,6 +364,7 @@ namespace OpenSim.Region.Framework.Scenes //PauPaw:Proper PID Controler for autopilot************ public bool MovingToTarget { get; private set; } public Vector3 MoveToPositionTarget { get; private set; } + private double m_delayedStop = -1.0; /// /// Controls whether an avatar automatically moving to a target will land when it gets there (if flying). @@ -2732,7 +2733,6 @@ namespace OpenSim.Region.Framework.Scenes agent_control_v3.Z = 0; // else if(AgentControlStopActive %% Velocity.Z <0.01f) - // m_log.DebugFormat("[SCENE PRESENCE]: MovementFlag {0} for {1}", MovementFlag, Name); // If the agent update does move the avatar, then calculate the force ready for the velocity update, @@ -2741,6 +2741,7 @@ namespace OpenSim.Region.Framework.Scenes // held down AGENT_CONTROL_STOP whilst normal walking/running). However, we do not want to update // if the user rotated whilst holding down AGENT_CONTROL_STOP when already still (which locks the // avatar location in place). + if (update_movementflag || (update_rotation && DCFlagKeyPressed && (!AgentControlStopActive || MovementFlag != 0))) { @@ -2757,12 +2758,22 @@ namespace OpenSim.Region.Framework.Scenes } else { - AddNewMovement(agent_control_v3); + if(MovingToTarget || + (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying && + Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface) + ) + AddNewMovement(agent_control_v3); + else + { + if (MovementFlag != 0) + AddNewMovement(agent_control_v3); + else + m_delayedStop = Util.GetTimeStampMS() + 200.0; + } } - } - if (update_movementflag && ParentID == 0) + if (update_movementflag && ParentID == 0 && m_delayedStop < 0) { // m_log.DebugFormat("[SCENE PRESENCE]: Updating movement animations for {0}", Name); Animator.UpdateMovementAnimations(); @@ -3016,6 +3027,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) { + m_delayedStop = -1; + if (SitGround) StandUp(); @@ -3671,7 +3684,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", // vec, Rotation, thisAddSpeedModifier, Name); - + m_delayedStop = -1; // rotate from avatar coord space to world Quaternion rot = Rotation; if (!Flying && PresenceType != PresenceType.Npc) @@ -3689,7 +3702,7 @@ namespace OpenSim.Region.Framework.Scenes direc.Z = 0f; // Prevent camera WASD up. // odd rescalings - direc *= 0.03f * 128f * SpeedModifier * thisAddSpeedModifier; + direc *= 0.032f * 128f * SpeedModifier * thisAddSpeedModifier; // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); @@ -3754,10 +3767,19 @@ namespace OpenSim.Region.Framework.Scenes if(MovingToTarget) { + m_delayedStop = -1; Vector3 control = Vector3.Zero; if(HandleMoveToTargetUpdate(1f, ref control)) AddNewMovement(control); } + else if(m_delayedStop > 0) + { + if(IsSatOnObject) + m_delayedStop = -1; + else + if(Util.GetTimeStampMS() > m_delayedStop) + AddNewMovement(Vector3.Zero); + } if (Appearance.AvatarSize != m_lastSize) SendAvatarDataToAllAgents();