diff options
author | Justin Clark-Casey (justincc) | 2012-02-15 02:41:50 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-15 02:41:50 +0000 |
commit | 96843f2b17e60dfb275b6564facf7000e1451ea0 (patch) | |
tree | 23e28153e45d69480a7184484e89a35cd2e16856 /OpenSim/Region/ScriptEngine/Shared | |
parent | Merge branch 'master' into 0.7.3-post-fixes (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-96843f2b17e60dfb275b6564facf7000e1451ea0.zip opensim-SC-96843f2b17e60dfb275b6564facf7000e1451ea0.tar.gz opensim-SC-96843f2b17e60dfb275b6564facf7000e1451ea0.tar.bz2 opensim-SC-96843f2b17e60dfb275b6564facf7000e1451ea0.tar.xz |
Merge branch 'master' into 0.7.3-post-fixes
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
5 files changed, 43 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 3e0e452..850f50b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -445,17 +445,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
445 | Vector3 toRegionPos; | 445 | Vector3 toRegionPos; |
446 | double dis; | 446 | double dis; |
447 | 447 | ||
448 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) | 448 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => |
449 | { | 449 | { |
450 | if ((ts.type & NPC) == 0 | 450 | if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) |
451 | && presence.PresenceType == PresenceType.Npc | 451 | { |
452 | && !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent) | 452 | INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); |
453 | return; | 453 | if (npcData == null || !npcData.SenseAsAgent) |
454 | return; | ||
455 | } | ||
454 | 456 | ||
455 | if ((ts.type & AGENT) == 0 | 457 | if ((ts.type & AGENT) == 0) |
456 | && (presence.PresenceType == PresenceType.User | 458 | { |
457 | || npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)) | 459 | if (presence.PresenceType == PresenceType.User) |
458 | return; | 460 | { |
461 | return; | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); | ||
466 | if (npcData != null && npcData.SenseAsAgent) | ||
467 | return; | ||
468 | } | ||
469 | } | ||
459 | 470 | ||
460 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) | 471 | if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) |
461 | return; | 472 | return; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs index 130e197..e35f79f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
44 | string dirName = myDomain.FriendlyName; | 44 | string dirName = myDomain.FriendlyName; |
45 | string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; | 45 | string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; |
46 | 46 | ||
47 | string[] pathList = new string[] {"bin", ScriptEnginesPath, | 47 | string[] pathList = new string[] {"", "bin", ScriptEnginesPath, |
48 | Path.Combine(ScriptEnginesPath, dirName)}; | 48 | Path.Combine(ScriptEnginesPath, dirName)}; |
49 | 49 | ||
50 | string assemblyName = args.Name; | 50 | string assemblyName = args.Name; |
@@ -56,6 +56,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
56 | string path = Path.Combine(Directory.GetCurrentDirectory(), | 56 | string path = Path.Combine(Directory.GetCurrentDirectory(), |
57 | Path.Combine(s, assemblyName))+".dll"; | 57 | Path.Combine(s, assemblyName))+".dll"; |
58 | 58 | ||
59 | // Console.WriteLine("Trying to resolve {0}", path); | ||
60 | |||
59 | if (File.Exists(path)) | 61 | if (File.Exists(path)) |
60 | return Assembly.LoadFrom(path); | 62 | return Assembly.LoadFrom(path); |
61 | } | 63 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index b1fb6c2..8b88588 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -28,12 +28,16 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | ||
32 | using log4net; | ||
31 | using Tools; | 33 | using Tools; |
32 | 34 | ||
33 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | 35 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools |
34 | { | 36 | { |
35 | public class CSCodeGenerator : ICodeConverter | 37 | public class CSCodeGenerator : ICodeConverter |
36 | { | 38 | { |
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
37 | private SYMBOL m_astRoot = null; | 41 | private SYMBOL m_astRoot = null; |
38 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; | 42 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; |
39 | private int m_indentWidth = 4; // for indentation | 43 | private int m_indentWidth = 4; // for indentation |
@@ -87,6 +91,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
87 | /// <returns>String containing the generated C# code.</returns> | 91 | /// <returns>String containing the generated C# code.</returns> |
88 | public string Convert(string script) | 92 | public string Convert(string script) |
89 | { | 93 | { |
94 | // m_log.DebugFormat("[CS CODE GENERATOR]: Converting to C#\n{0}", script); | ||
95 | |||
90 | m_warnings.Clear(); | 96 | m_warnings.Clear(); |
91 | ResetCounters(); | 97 | ResetCounters(); |
92 | Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); | 98 | Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 734d4d5..c10143b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -291,6 +291,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
291 | public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, | 291 | public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, |
292 | out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) | 292 | out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) |
293 | { | 293 | { |
294 | // m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script); | ||
295 | |||
294 | linemap = null; | 296 | linemap = null; |
295 | m_warnings.Clear(); | 297 | m_warnings.Clear(); |
296 | 298 | ||
@@ -357,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
357 | if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture)) | 359 | if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture)) |
358 | language = enumCompileType.yp; | 360 | language = enumCompileType.yp; |
359 | 361 | ||
362 | // m_log.DebugFormat("[Compiler]: Compile language is {0}", language); | ||
363 | |||
360 | if (!AllowedCompilers.ContainsKey(language.ToString())) | 364 | if (!AllowedCompilers.ContainsKey(language.ToString())) |
361 | { | 365 | { |
362 | // Not allowed to compile to this language! | 366 | // Not allowed to compile to this language! |
@@ -417,7 +421,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
417 | } | 421 | } |
418 | 422 | ||
419 | assembly = CompileFromDotNetText(compileScript, language, asset, assembly); | 423 | assembly = CompileFromDotNetText(compileScript, language, asset, assembly); |
420 | return; | ||
421 | } | 424 | } |
422 | 425 | ||
423 | public string[] GetWarnings() | 426 | public string[] GetWarnings() |
@@ -491,6 +494,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
491 | /// <returns>Filename to .dll assembly</returns> | 494 | /// <returns>Filename to .dll assembly</returns> |
492 | internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly) | 495 | internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly) |
493 | { | 496 | { |
497 | // m_log.DebugFormat("[Compiler]: Compiling to assembly\n{0}", Script); | ||
498 | |||
494 | string ext = "." + lang.ToString(); | 499 | string ext = "." + lang.ToString(); |
495 | 500 | ||
496 | // Output assembly name | 501 | // Output assembly name |
@@ -531,8 +536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
531 | 536 | ||
532 | parameters.IncludeDebugInformation = true; | 537 | parameters.IncludeDebugInformation = true; |
533 | 538 | ||
534 | string rootPath = | 539 | string rootPath = AppDomain.CurrentDomain.BaseDirectory; |
535 | Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | ||
536 | 540 | ||
537 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, | 541 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, |
538 | "OpenSim.Region.ScriptEngine.Shared.dll")); | 542 | "OpenSim.Region.ScriptEngine.Shared.dll")); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 9b93135..bc1902b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -537,6 +537,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
537 | 537 | ||
538 | public bool Stop(int timeout) | 538 | public bool Stop(int timeout) |
539 | { | 539 | { |
540 | // m_log.DebugFormat( | ||
541 | // "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout); | ||
542 | |||
540 | IScriptWorkItem result; | 543 | IScriptWorkItem result; |
541 | 544 | ||
542 | lock (m_EventQueue) | 545 | lock (m_EventQueue) |
@@ -769,7 +772,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
769 | } | 772 | } |
770 | catch (Exception e) | 773 | catch (Exception e) |
771 | { | 774 | { |
772 | // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); | 775 | // m_log.DebugFormat( |
776 | // "[SCRIPT] Exception in script {0} {1}: {2}{3}", | ||
777 | // ScriptName, ItemID, e.Message, e.StackTrace); | ||
778 | |||
773 | m_InEvent = false; | 779 | m_InEvent = false; |
774 | m_CurrentEvent = String.Empty; | 780 | m_CurrentEvent = String.Empty; |
775 | 781 | ||