diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 72646f6..d483219 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -46,13 +46,15 @@ using OpenSim.Framework; | |||
46 | using OpenSim.Framework.Console; | 46 | using OpenSim.Framework.Console; |
47 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
48 | using OpenSim.Region.Framework.Interfaces; | 48 | using OpenSim.Region.Framework.Interfaces; |
49 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
49 | using OpenSim.Region.ScriptEngine.Shared; | 50 | using OpenSim.Region.ScriptEngine.Shared; |
50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 51 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
51 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 52 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
52 | using OpenSim.Region.ScriptEngine.Shared.Instance; | 53 | using OpenSim.Region.ScriptEngine.Shared.Instance; |
53 | using OpenSim.Region.ScriptEngine.Shared.Api; | 54 | using OpenSim.Region.ScriptEngine.Shared.Api; |
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 55 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
55 | using OpenSim.Region.ScriptEngine.Interfaces; | 56 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
57 | using OpenSim.Region.ScriptEngine.XEngine.ScriptBase; | ||
56 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; | 58 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; |
57 | 59 | ||
58 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; | 60 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; |
@@ -176,6 +178,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
176 | get { return "XEngine"; } | 178 | get { return "XEngine"; } |
177 | } | 179 | } |
178 | 180 | ||
181 | public string ScriptClassName { get; private set; } | ||
182 | |||
183 | public string ScriptBaseClassName { get; private set; } | ||
184 | |||
185 | public ParameterInfo[] ScriptBaseClassParameters { get; private set; } | ||
186 | |||
187 | public string[] ScriptReferencedAssemblies { get; private set; } | ||
188 | |||
179 | public Scene World | 189 | public Scene World |
180 | { | 190 | { |
181 | get { return m_Scene; } | 191 | get { return m_Scene; } |
@@ -230,21 +240,35 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
230 | 240 | ||
231 | m_ScriptConfig = configSource.Configs["XEngine"]; | 241 | m_ScriptConfig = configSource.Configs["XEngine"]; |
232 | m_ConfigSource = configSource; | 242 | m_ConfigSource = configSource; |
243 | |||
244 | string rawScriptStopStrategy = m_ScriptConfig.GetString("ScriptStopStrategy", "abort"); | ||
245 | |||
246 | m_log.InfoFormat("[XEngine]: Script stop strategy is {0}", rawScriptStopStrategy); | ||
247 | |||
248 | if (rawScriptStopStrategy == "co-op") | ||
249 | { | ||
250 | ScriptClassName = "XEngineScript"; | ||
251 | ScriptBaseClassName = typeof(XEngineScriptBase).FullName; | ||
252 | ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters(); | ||
253 | ScriptReferencedAssemblies = new string[] { Path.GetFileName(typeof(XEngineScriptBase).Assembly.Location) }; | ||
254 | } | ||
255 | else | ||
256 | { | ||
257 | ScriptClassName = "Script"; | ||
258 | ScriptBaseClassName = typeof(ScriptBaseClass).FullName; | ||
259 | } | ||
260 | |||
261 | // Console.WriteLine("ASSEMBLY NAME: {0}", ScriptReferencedAssemblies[0]); | ||
233 | } | 262 | } |
234 | 263 | ||
235 | public void AddRegion(Scene scene) | 264 | public void AddRegion(Scene scene) |
236 | { | 265 | { |
237 | if (m_ScriptConfig == null) | 266 | if (m_ScriptConfig == null) |
238 | return; | 267 | return; |
268 | |||
239 | m_ScriptFailCount = 0; | 269 | m_ScriptFailCount = 0; |
240 | m_ScriptErrorMessage = String.Empty; | 270 | m_ScriptErrorMessage = String.Empty; |
241 | 271 | ||
242 | if (m_ScriptConfig == null) | ||
243 | { | ||
244 | // m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled"); | ||
245 | return; | ||
246 | } | ||
247 | |||
248 | m_Enabled = m_ScriptConfig.GetBoolean("Enabled", true); | 272 | m_Enabled = m_ScriptConfig.GetBoolean("Enabled", true); |
249 | 273 | ||
250 | if (!m_Enabled) | 274 | if (!m_Enabled) |
@@ -1109,7 +1133,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1109 | } | 1133 | } |
1110 | 1134 | ||
1111 | m_log.DebugFormat( | 1135 | m_log.DebugFormat( |
1112 | "[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", | 1136 | "[XEngine]: Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", |
1113 | part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, | 1137 | part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, |
1114 | part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); | 1138 | part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); |
1115 | 1139 | ||
@@ -1130,6 +1154,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1130 | lock (m_AddingAssemblies) | 1154 | lock (m_AddingAssemblies) |
1131 | { | 1155 | { |
1132 | m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); | 1156 | m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); |
1157 | |||
1133 | if (!m_AddingAssemblies.ContainsKey(assembly)) { | 1158 | if (!m_AddingAssemblies.ContainsKey(assembly)) { |
1134 | m_AddingAssemblies[assembly] = 1; | 1159 | m_AddingAssemblies[assembly] = 1; |
1135 | } else { | 1160 | } else { |
@@ -1179,7 +1204,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1179 | } | 1204 | } |
1180 | catch (Exception e) | 1205 | catch (Exception e) |
1181 | { | 1206 | { |
1182 | // m_log.ErrorFormat("[XEngine]: Exception when rezzing script {0}{1}", e.Message, e.StackTrace); | 1207 | // m_log.ErrorFormat( |
1208 | // "[XEngine]: Exception when rezzing script with item ID {0}, {1}{2}", | ||
1209 | // itemID, e.Message, e.StackTrace); | ||
1183 | 1210 | ||
1184 | // try | 1211 | // try |
1185 | // { | 1212 | // { |
@@ -1288,7 +1315,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1288 | startParam, postOnRez, | 1315 | startParam, postOnRez, |
1289 | m_MaxScriptQueue); | 1316 | m_MaxScriptQueue); |
1290 | 1317 | ||
1291 | instance.Load(m_AppDomains[appDomain], assembly, stateSource); | 1318 | if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource)) |
1319 | return false; | ||
1292 | 1320 | ||
1293 | // if (DebugLevel >= 1) | 1321 | // if (DebugLevel >= 1) |
1294 | // m_log.DebugFormat( | 1322 | // m_log.DebugFormat( |