diff options
author | Melanie | 2013-01-16 16:52:57 +0000 |
---|---|---|
committer | Melanie | 2013-01-16 16:52:57 +0000 |
commit | 9c99ed26ebe7cd2e42c10487e4ddfde0c934d921 (patch) | |
tree | 536b2d6530fdda925203afddd27a4b9444e4d2a7 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Complete removal of the now unused state queue (diff) | |
parent | Changed a couple of debug messages at the request of osgrid. (diff) | |
download | opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.zip opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.gz opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.bz2 opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
4 files changed, 45 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea4e609..d47fd6b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -83,10 +83,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
84 | { | 84 | { |
85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
86 | |||
86 | protected IScriptEngine m_ScriptEngine; | 87 | protected IScriptEngine m_ScriptEngine; |
87 | protected SceneObjectPart m_host; | 88 | protected SceneObjectPart m_host; |
88 | 89 | ||
89 | /// <summary> | 90 | /// <summary> |
91 | /// Used for script sleeps when we are using co-operative script termination. | ||
92 | /// </summary> | ||
93 | /// <remarks>null if co-operative script termination is not active</remarks> | ||
94 | EventWaitHandle m_coopSleepHandle; | ||
95 | |||
96 | /// <summary> | ||
90 | /// The item that hosts this script | 97 | /// The item that hosts this script |
91 | /// </summary> | 98 | /// </summary> |
92 | protected TaskInventoryItem m_item; | 99 | protected TaskInventoryItem m_item; |
@@ -110,24 +117,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
110 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 117 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
111 | protected ISoundModule m_SoundModule = null; | 118 | protected ISoundModule m_SoundModule = null; |
112 | 119 | ||
113 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 120 | public void Initialize( |
121 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
114 | { | 122 | { |
115 | m_ScriptEngine = ScriptEngine; | 123 | m_ScriptEngine = scriptEngine; |
116 | m_host = host; | 124 | m_host = host; |
117 | m_item = item; | 125 | m_item = item; |
126 | m_coopSleepHandle = coopSleepHandle; | ||
118 | 127 | ||
119 | LoadLimits(); // read script limits from config. | 128 | LoadConfig(); |
120 | 129 | ||
121 | m_TransferModule = | 130 | m_TransferModule = |
122 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 131 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
123 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 132 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
124 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); | 133 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); |
125 | 134 | ||
126 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 135 | AsyncCommands = new AsyncCommandManager(m_ScriptEngine); |
127 | } | 136 | } |
128 | 137 | ||
129 | /* load configuration items that affect script, object and run-time behavior. */ | 138 | /// <summary> |
130 | private void LoadLimits() | 139 | /// Load configuration items that affect script, object and run-time behavior. */ |
140 | /// </summary> | ||
141 | private void LoadConfig() | ||
131 | { | 142 | { |
132 | m_ScriptDelayFactor = | 143 | m_ScriptDelayFactor = |
133 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 144 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
@@ -141,12 +152,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 152 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
142 | if (m_notecardLineReadCharsMax > 65535) | 153 | if (m_notecardLineReadCharsMax > 65535) |
143 | m_notecardLineReadCharsMax = 65535; | 154 | m_notecardLineReadCharsMax = 65535; |
155 | |||
144 | // load limits for particular subsystems. | 156 | // load limits for particular subsystems. |
145 | IConfig SMTPConfig; | 157 | IConfig SMTPConfig; |
146 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { | 158 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
147 | // there's an smtp config, so load in the snooze time. | 159 | // there's an smtp config, so load in the snooze time. |
148 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 160 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
149 | } | 161 | } |
162 | |||
150 | // Rezzing an object with a velocity can create recoil. This feature seems to have been | 163 | // Rezzing an object with a velocity can create recoil. This feature seems to have been |
151 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales | 164 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales |
152 | // it by this factor. May be zero to turn off recoil all together. | 165 | // it by this factor. May be zero to turn off recoil all together. |
@@ -171,7 +184,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
171 | delay = (int)((float)delay * m_ScriptDelayFactor); | 184 | delay = (int)((float)delay * m_ScriptDelayFactor); |
172 | if (delay == 0) | 185 | if (delay == 0) |
173 | return; | 186 | return; |
174 | System.Threading.Thread.Sleep(delay); | 187 | |
188 | Sleep(delay); | ||
189 | } | ||
190 | |||
191 | protected virtual void Sleep(int delay) | ||
192 | { | ||
193 | if (m_coopSleepHandle == null) | ||
194 | System.Threading.Thread.Sleep(delay); | ||
195 | else if (m_coopSleepHandle.WaitOne(delay)) | ||
196 | throw new ScriptCoopStopException(); | ||
175 | } | 197 | } |
176 | 198 | ||
177 | public Scene World | 199 | public Scene World |
@@ -2910,7 +2932,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2910 | { | 2932 | { |
2911 | // m_log.Info("llSleep snoozing " + sec + "s."); | 2933 | // m_log.Info("llSleep snoozing " + sec + "s."); |
2912 | m_host.AddScriptLPS(1); | 2934 | m_host.AddScriptLPS(1); |
2913 | Thread.Sleep((int)(sec * 1000)); | 2935 | |
2936 | Sleep((int)(sec * 1000)); | ||
2914 | } | 2937 | } |
2915 | 2938 | ||
2916 | public LSL_Float llGetMass() | 2939 | 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; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using 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; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using 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 958a448..25635ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -142,9 +142,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
142 | 142 | ||
143 | protected IUrlModule m_UrlModule = null; | 143 | protected IUrlModule m_UrlModule = null; |
144 | 144 | ||
145 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 145 | public void Initialize( |
146 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
146 | { | 147 | { |
147 | m_ScriptEngine = ScriptEngine; | 148 | m_ScriptEngine = scriptEngine; |
148 | m_host = host; | 149 | m_host = host; |
149 | m_item = item; | 150 | m_item = item; |
150 | 151 | ||