diff options
author | Melanie Thielker | 2008-08-25 17:50:44 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-25 17:50:44 +0000 |
commit | 64e4c34c1a111a39b9ab883cb41340dac08be52a (patch) | |
tree | 704d097be5c98c92a1ca15d304878d8c933792b8 /OpenSim/Region/ScriptEngine | |
parent | Update svn properties. (diff) | |
download | opensim-SC-64e4c34c1a111a39b9ab883cb41340dac08be52a.zip opensim-SC-64e4c34c1a111a39b9ab883cb41340dac08be52a.tar.gz opensim-SC-64e4c34c1a111a39b9ab883cb41340dac08be52a.tar.bz2 opensim-SC-64e4c34c1a111a39b9ab883cb41340dac08be52a.tar.xz |
Add ScriptDelayFactor under LL-Functions in OpenSim.ini. Defaulted
at 1.0, it allows delays to function as coded. Smaller values will
reduce, larger values will increase the delays. A value of 0 is
permitted and results in on delay being applied.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 786288b..602a3c8 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -71,12 +71,28 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
71 | m_itemID = itemID; | 71 | m_itemID = itemID; |
72 | 72 | ||
73 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | 73 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); |
74 | |||
75 | IConfigSource config = new IniConfigSource(Application.iniFilePath); | ||
76 | if (config.Configs["LL-Functions"] == null) | ||
77 | config.AddConfig("LL-Functions"); | ||
78 | |||
79 | m_delayFactor = config.Configs["LL-Functions"].GetFloat("ScriptDelayFactor", 1.0f); | ||
80 | |||
74 | } | 81 | } |
75 | 82 | ||
76 | private DateTime m_timer = DateTime.Now; | 83 | private DateTime m_timer = DateTime.Now; |
77 | private string m_state = "default"; | 84 | private string m_state = "default"; |
78 | private bool m_waitingForScriptAnswer=false; | 85 | private bool m_waitingForScriptAnswer=false; |
86 | private float m_delayFactor = 1.0f; | ||
87 | |||
79 | 88 | ||
89 | private void ScriptSleep(int delay) | ||
90 | { | ||
91 | delay = (int)((float)delay * m_delayFactor); | ||
92 | if(delay == 0) | ||
93 | return; | ||
94 | System.Threading.Thread.Sleep(delay); | ||
95 | } | ||
80 | 96 | ||
81 | public string State | 97 | public string State |
82 | { | 98 | { |
@@ -1613,7 +1629,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1613 | SetPos(m_host, pos); | 1629 | SetPos(m_host, pos); |
1614 | 1630 | ||
1615 | // sleep for 0.2 seconds | 1631 | // sleep for 0.2 seconds |
1616 | System.Threading.Thread.Sleep(200); | 1632 | ScriptSleep(200); |
1617 | } | 1633 | } |
1618 | 1634 | ||
1619 | private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) | 1635 | private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) |
@@ -1660,7 +1676,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1660 | SetRot(m_host, rot); | 1676 | SetRot(m_host, rot); |
1661 | 1677 | ||
1662 | // sleep for 0.2 seconds | 1678 | // sleep for 0.2 seconds |
1663 | System.Threading.Thread.Sleep(200); | 1679 | ScriptSleep(200); |
1664 | } | 1680 | } |
1665 | 1681 | ||
1666 | private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot) | 1682 | private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot) |
@@ -2290,7 +2306,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2290 | llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); | 2306 | llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); |
2291 | found = true; | 2307 | found = true; |
2292 | //script delay | 2308 | //script delay |
2293 | System.Threading.Thread.Sleep((int)((groupmass * velmag) / 10)); | 2309 | ScriptSleep((int)((groupmass * velmag) / 10)); |
2294 | break; | 2310 | break; |
2295 | } | 2311 | } |
2296 | } | 2312 | } |
@@ -2325,7 +2341,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2325 | public void llSleep(double sec) | 2341 | public void llSleep(double sec) |
2326 | { | 2342 | { |
2327 | m_host.AddScriptLPS((int)(sec * 100)); | 2343 | m_host.AddScriptLPS((int)(sec * 100)); |
2328 | Thread.Sleep((int)(sec * 1000)); | 2344 | System.Threading.Thread.Sleep((int)(sec * 1000)); |
2329 | } | 2345 | } |
2330 | 2346 | ||
2331 | public double llGetMass() | 2347 | public double llGetMass() |
@@ -2917,7 +2933,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2917 | parentPrim.GetProperties(client); | 2933 | parentPrim.GetProperties(client); |
2918 | 2934 | ||
2919 | // sleep for 1 second | 2935 | // sleep for 1 second |
2920 | System.Threading.Thread.Sleep(1000); | 2936 | ScriptSleep(1000); |
2921 | 2937 | ||
2922 | } | 2938 | } |
2923 | 2939 | ||
@@ -5268,7 +5284,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5268 | // the rest of the permission checks are done in RezScript, so check the pin there as well | 5284 | // the rest of the permission checks are done in RezScript, so check the pin there as well |
5269 | World.RezScript(srcId, m_host, destId, pin, running, start_param); | 5285 | World.RezScript(srcId, m_host, destId, pin, running, start_param); |
5270 | // this will cause the delay even if the script pin or permissions were wrong - seems ok | 5286 | // this will cause the delay even if the script pin or permissions were wrong - seems ok |
5271 | System.Threading.Thread.Sleep(3000); | 5287 | ScriptSleep(3000); |
5272 | } | 5288 | } |
5273 | 5289 | ||
5274 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) | 5290 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) |