aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie2013-01-16 15:47:55 +0000
committerMelanie2013-01-16 15:47:55 +0000
commit818254916cb562422b3a3301b9f35fafd64ee3fe (patch)
treee8655f6472b305d43a2f23059c375c90e7004a2b /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.zip
opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.gz
opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.bz2
opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.xz
JustinCC's core re-merge
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs45
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs5
5 files changed, 47 insertions, 25 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index b5fa6de..d03955b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using System.Reflection; 30using System.Reflection;
30using System.Collections; 31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
@@ -62,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
62 internal TaskInventoryItem m_item; 63 internal TaskInventoryItem m_item;
63 internal bool m_CMFunctionsEnabled = false; 64 internal bool m_CMFunctionsEnabled = false;
64 65
65 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 66 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
66 { 67 {
67 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = ScriptEngine;
68 m_host = host; 69 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4ce2afd..e83bbbb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -87,10 +87,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
87 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi 87 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
88 { 88 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90
90 protected IScriptEngine m_ScriptEngine; 91 protected IScriptEngine m_ScriptEngine;
91 protected SceneObjectPart m_host; 92 protected SceneObjectPart m_host;
92 93
93 /// <summary> 94 /// <summary>
95 /// Used for script sleeps when we are using co-operative script termination.
96 /// </summary>
97 /// <remarks>null if co-operative script termination is not active</remarks>
98 EventWaitHandle m_coopSleepHandle;
99
100 /// <summary>
94 /// The item that hosts this script 101 /// The item that hosts this script
95 /// </summary> 102 /// </summary>
96 protected TaskInventoryItem m_item; 103 protected TaskInventoryItem m_item;
@@ -142,33 +149,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
142 {"TURNRIGHT", "Turning Right"} 149 {"TURNRIGHT", "Turning Right"}
143 }; 150 };
144 151
145 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 152 public void Initialize(
153 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
146 { 154 {
147/*
148 m_ShoutSayTimer = new Timer(1000);
149 m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed;
150 m_ShoutSayTimer.AutoReset = true;
151 m_ShoutSayTimer.Start();
152*/
153 m_lastSayShoutCheck = DateTime.UtcNow; 155 m_lastSayShoutCheck = DateTime.UtcNow;
154 156
155 m_ScriptEngine = ScriptEngine; 157 m_ScriptEngine = scriptEngine;
156 m_host = host; 158 m_host = host;
157 m_item = item; 159 m_item = item;
158 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 160 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
161 m_coopSleepHandle = coopSleepHandle;
159 162
160 LoadLimits(); // read script limits from config. 163 LoadConfig();
161 164
162 m_TransferModule = 165 m_TransferModule =
163 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 166 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
164 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 167 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
165 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); 168 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
166 169
167 AsyncCommands = new AsyncCommandManager(ScriptEngine); 170 AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
168 } 171 }
169 172
170 /* load configuration items that affect script, object and run-time behavior. */ 173 /// <summary>
171 private void LoadLimits() 174 /// Load configuration items that affect script, object and run-time behavior. */
175 /// </summary>
176 private void LoadConfig()
172 { 177 {
173 m_ScriptDelayFactor = 178 m_ScriptDelayFactor =
174 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 179 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@@ -182,12 +187,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
182 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 187 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
183 if (m_notecardLineReadCharsMax > 65535) 188 if (m_notecardLineReadCharsMax > 65535)
184 m_notecardLineReadCharsMax = 65535; 189 m_notecardLineReadCharsMax = 65535;
190
185 // load limits for particular subsystems. 191 // load limits for particular subsystems.
186 IConfig SMTPConfig; 192 IConfig SMTPConfig;
187 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { 193 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
188 // there's an smtp config, so load in the snooze time. 194 // there's an smtp config, so load in the snooze time.
189 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); 195 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
190 } 196 }
197
191 // Rezzing an object with a velocity can create recoil. This feature seems to have been 198 // Rezzing an object with a velocity can create recoil. This feature seems to have been
192 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales 199 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
193 // it by this factor. May be zero to turn off recoil all together. 200 // it by this factor. May be zero to turn off recoil all together.
@@ -212,7 +219,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
212 delay = (int)((float)delay * m_ScriptDelayFactor); 219 delay = (int)((float)delay * m_ScriptDelayFactor);
213 if (delay == 0) 220 if (delay == 0)
214 return; 221 return;
215 System.Threading.Thread.Sleep(delay); 222
223 Sleep(delay);
224 }
225
226 protected virtual void Sleep(int delay)
227 {
228 if (m_coopSleepHandle == null)
229 System.Threading.Thread.Sleep(delay);
230 else if (m_coopSleepHandle.WaitOne(delay))
231 throw new ScriptCoopStopException();
216 } 232 }
217 233
218 public Scene World 234 public Scene World
@@ -3228,7 +3244,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3228 { 3244 {
3229// m_log.Info("llSleep snoozing " + sec + "s."); 3245// m_log.Info("llSleep snoozing " + sec + "s.");
3230 m_host.AddScriptLPS(1); 3246 m_host.AddScriptLPS(1);
3231 Thread.Sleep((int)(sec * 1000)); 3247
3248 Sleep((int)(sec * 1000));
3232 } 3249 }
3233 3250
3234 public LSL_Float llGetMass() 3251 public LSL_Float llGetMass()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index ceb4660..a08ccc8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
33using OpenMetaverse; 34using OpenMetaverse;
34using Nini.Config; 35using Nini.Config;
35using OpenSim; 36using OpenSim;
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
61 internal bool m_LSFunctionsEnabled = false; 62 internal bool m_LSFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
63 64
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = scriptEngine;
67 m_host = host; 69 m_host = host;
68 70
69 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) 71 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
@@ -92,10 +94,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
92 get { return m_ScriptEngine.World; } 94 get { return m_ScriptEngine.World; }
93 } 95 }
94 96
95 // 97 /// <summary>
96 //Dumps an error message on the debug console. 98 /// Dumps an error message on the debug console.
97 // 99 /// </summary>
98
99 internal void LSShoutError(string message) 100 internal void LSShoutError(string message)
100 { 101 {
101 if (message.Length > 1023) 102 if (message.Length > 1023)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 8f34833..981499e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
33using OpenMetaverse; 34using OpenMetaverse;
34using Nini.Config; 35using Nini.Config;
35using OpenSim; 36using OpenSim;
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
61 internal bool m_MODFunctionsEnabled = false; 62 internal bool m_MODFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
63 64
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = scriptEngine;
67 m_host = host; 69 m_host = host;
68 m_item = item; 70 m_item = item;
69 71
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4a46398..49857cf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -143,9 +143,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
143 143
144 protected IUrlModule m_UrlModule = null; 144 protected IUrlModule m_UrlModule = null;
145 145
146 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 146 public void Initialize(
147 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
147 { 148 {
148 m_ScriptEngine = ScriptEngine; 149 m_ScriptEngine = scriptEngine;
149 m_host = host; 150 m_host = host;
150 m_item = item; 151 m_item = item;
151 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 152 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);