From fffac7d5315074c15ddea1906143d97b55e5ffff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 May 2020 00:35:51 +0100 Subject: [PATCH] mantis 8704: fix issues on YEngine --- .../Region/ScriptEngine/YEngine/XMRInstBackend.cs | 14 ++++++++++++++ .../Region/ScriptEngine/YEngine/XMRInstCapture.cs | 9 +++++++++ OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs | 11 ++++++++++- OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs | 3 +++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs index 025fb94a46..8c033c58f7 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs @@ -78,6 +78,16 @@ namespace OpenSim.Region.ScriptEngine.Yengine inst.Die(); } + public void SetLSLTimer(double time) + { + m_timer = time; + } + + public double getLSLTimer() + { + return(m_timer); + } + /** * @brief Seat avatar on prim. * @param owner = true: owner of prim script is running in @@ -218,6 +228,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine // do not do llResetScript on entry if(eventCode == ScriptEventCode.state_entry && stateCode == 0) return; + + if (m_XMRLSLApi != null) + m_XMRLSLApi.llResetTime(); + // do clear the events queue on reset ClearQueue(); //ClearQueueExceptLinkMessages(); diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs index 5798638623..f8680027d7 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs @@ -28,6 +28,7 @@ using System; using System.IO; using System.Xml; +using OpenSim.Framework; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api; using log4net; @@ -115,6 +116,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine m_RunOnePhase = "GetExecutionState D"; CheckRunLockInvariants(true); + if(m_XMRLSLApi != null) + { + double scriptTime = Util.GetTimeStampMS() - m_XMRLSLApi.getLSLTimer(); + XmlElement scriptTimeN = doc.CreateElement("", "scrpTime", ""); + scriptTimeN.AppendChild(doc.CreateTextNode(scriptTime.ToString())); + scriptStateN.AppendChild(scriptTimeN); + } + if (m_minEventDelay != 0.0) { XmlElement minEventDelayN = doc.CreateElement("", "mEvtDly", ""); diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs index 6fdb0da8f1..91a39cbf70 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs @@ -529,9 +529,18 @@ namespace OpenSim.Region.ScriptEngine.Yengine XmlElement doGblInitN = (XmlElement)scriptStateN.SelectSingleNode("DoGblInit"); doGblInit = bool.Parse(doGblInitN.InnerText); + if (m_XMRLSLApi != null) + { + XmlElement scpttimeN = (XmlElement)scriptStateN.SelectSingleNode("scrpTime"); + if (scpttimeN != null && Double.TryParse(scpttimeN.InnerText, out double t)) + { + m_XMRLSLApi.SetLSLTimer(Util.GetTimeStampMS() - t); + } + } + double minEventDelay = 0.0; XmlElement minEventDelayN = (XmlElement)scriptStateN.SelectSingleNode("mEvtDly"); - if(minEventDelayN != null) + if (minEventDelayN != null) minEventDelay = Double.Parse(minEventDelayN.InnerText); // get values used by stuff like llDetectedGrab, etc. diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index b7c6605833..ac61e08648 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -874,6 +874,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine ReleaseControlsOrPermissions(true); m_Part.CollisionSound = UUID.Zero; + if (m_XMRLSLApi != null) + m_XMRLSLApi.llResetTime(); + m_RunOnePhase = "ResetLocked: removing script"; IUrlModule urlModule = m_Engine.World.RequestModuleInterface(); if(urlModule != null)