aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorlbsa712008-06-24 21:09:49 +0000
committerlbsa712008-06-24 21:09:49 +0000
commit6b7930104bdb845d3b9c085dc04f52b6446f23b1 (patch)
tree05ee45781a455817fa400bb99f30f4d19d4eb1f8 /OpenSim/Region/ScriptEngine/XEngine
parentbased on positive feedback on performance of making keys fixed length (diff)
downloadopensim-SC_OLD-6b7930104bdb845d3b9c085dc04f52b6446f23b1.zip
opensim-SC_OLD-6b7930104bdb845d3b9c085dc04f52b6446f23b1.tar.gz
opensim-SC_OLD-6b7930104bdb845d3b9c085dc04f52b6446f23b1.tar.bz2
opensim-SC_OLD-6b7930104bdb845d3b9c085dc04f52b6446f23b1.tar.xz
* Applied patch from Melanie, mantis issue #1581 - "Refactor LSL language, api and compiler out of XEngine"
"First stage in a major Script Engine refactor, that will result in the LSL implementaions ebing reconverged. Not there yet, but one major part is done." Thank you, Melanie!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/IScript.cs)17
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs)66
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs)72
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs)342
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/OSSL_ScriptCommands.cs)76
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs)9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs)14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Listener.cs)9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs)30
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs)7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs)22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/ILSL_ScriptCommands.cs)16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/IOSSL_ScriptCommands.cs)4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs)697
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs)2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Compiler.cs)70
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/LSL2CSConverter.cs)6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs (renamed from OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs)21
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs99
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Executor.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs234
22 files changed, 560 insertions, 1288 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/IScript.cs b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
index e5d0b33..efb05d3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/IScript.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
@@ -25,22 +25,15 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Reflection;
29using System; 28using System;
30using System.Collections;
31using System.Collections.Generic; 29using System.Collections.Generic;
32using OpenSim.Region.Environment.Interfaces; 30using Nini.Config;
33 31
34namespace OpenSim.Region.ScriptEngine.XEngine.Script 32namespace OpenSim.Region.ScriptEngine.Interfaces
35{ 33{
36 public interface IScript 34 public interface ICompiler
37 { 35 {
38 Type Start(ILSL_ScriptCommands lsl, IOSSL_ScriptCommands ossl); 36 void Configure(IConfig configSource);
39 37 void Compile(string text, string outFile, List<IScriptApi> apiList);
40 Dictionary<string, object> GetVars();
41 void SetVars(Dictionary<string, object> vars);
42 void ResetVars();
43
44 string State { get; set; }
45 } 38 }
46} 39}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index dab7a0a..2fa67a4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -25,51 +25,35 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net;
28using System; 29using System;
29using System.Collections; 30using OpenSim.Region.ScriptEngine.Shared;
30using System.Collections.Generic;
31using libsecondlife;
32using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using libsecondlife;
33using Nini.Config;
34using OpenSim.Region.ScriptEngine.Interfaces;
33 35
34namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 36namespace OpenSim.Region.ScriptEngine.Interfaces
35{ 37{
36 public class Eventstream 38 public interface IScriptEngine
37 { 39 {
38 public AsyncCommandManager m_CmdManager; 40 //
39 41 // An interface for a script API module to communicate with
40 private class Event 42 // the engine it's running under
41 { 43 //
42 public uint LocalID; 44
43 public string EventName; 45 Scene World { get; }
44 public Dictionary<LLUUID, XDetectParams> DetectParams; 46 IConfig Config { get; }
45 } 47 Object AsyncCommands { get; }
46 48 ILog Log { get; }
47 private Dictionary<uint, Dictionary<string, Event> > m_Events = 49
48 new Dictionary<uint, Dictionary<string, Event> >(); 50 bool PostScriptEvent(LLUUID itemID, EventParams parms);
49 51 bool PostObjectEvent(uint localID, EventParams parms);
50 public Eventstream(AsyncCommandManager CmdManager) 52 void ResetScript(LLUUID itemID);
51 { 53 void SetScriptState(LLUUID itemID, bool state);
52 m_CmdManager = CmdManager; 54 bool GetScriptState(LLUUID itemID);
53 } 55 void SetState(LLUUID itemID, string newState);
54 56
55 public void AddObjectEvent(uint localID, string eventName, XDetectParams det) 57 DetectParams GetDetectParams(LLUUID item, int number);
56 {
57 SceneObjectPart part = m_CmdManager.m_ScriptEngine.World.
58 GetSceneObjectPart(localID);
59
60 if (part == null) // Can't register events for non-prims
61 return;
62
63 if (!part.ContainsScripts())
64 return;
65 }
66
67 public void RemoveObjectEvent(uint localID, string eventName, LLUUID id)
68 {
69 }
70
71 public void RemoveObjects(uint localID)
72 {
73 }
74 } 58 }
75} 59}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index fdad5b0..8c967a2 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -32,11 +32,12 @@ using System.Threading;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins; 35using OpenSim.Region.ScriptEngine.Interfaces;
36using Timer=OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins.Timer; 36using OpenSim.Region.ScriptEngine.Shared;
37using Dataserver=OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins.Dataserver; 37using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
38using Timer=OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
38 39
39namespace OpenSim.Region.ScriptEngine.XEngine 40namespace OpenSim.Region.ScriptEngine.Shared.Api
40{ 41{
41 /// <summary> 42 /// <summary>
42 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. 43 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
@@ -46,18 +47,57 @@ namespace OpenSim.Region.ScriptEngine.XEngine
46 private static Thread cmdHandlerThread; 47 private static Thread cmdHandlerThread;
47 private static int cmdHandlerThreadCycleSleepms; 48 private static int cmdHandlerThreadCycleSleepms;
48 49
49 public XEngine m_ScriptEngine; 50 private static List<AsyncCommandManager> m_Managers = new List<AsyncCommandManager>();
51 public IScriptEngine m_ScriptEngine;
50 52
51 public Dataserver m_Dataserver; 53 private Dataserver m_Dataserver;
52 public Timer m_Timer; 54 private Timer m_Timer;
53 public HttpRequest m_HttpRequest; 55 private HttpRequest m_HttpRequest;
54 public Listener m_Listener; 56 private Listener m_Listener;
55 public SensorRepeat m_SensorRepeat; 57 private SensorRepeat m_SensorRepeat;
56 public XmlRequest m_XmlRequest; 58 private XmlRequest m_XmlRequest;
57 59
58 public AsyncCommandManager(XEngine _ScriptEngine) 60 public Dataserver DataserverPlugin
61 {
62 get { return m_Dataserver; }
63 }
64
65 public Timer TimerPlugin
66 {
67 get { return m_Timer; }
68 }
69
70 public HttpRequest HttpRequestPlugin
71 {
72 get { return m_HttpRequest; }
73 }
74
75 public Listener ListenerPlugin
76 {
77 get { return m_Listener; }
78 }
79
80 public SensorRepeat SensorRepeatPlugin
81 {
82 get { return m_SensorRepeat; }
83 }
84
85 public XmlRequest XmlRequestPlugin
86 {
87 get { return m_XmlRequest; }
88 }
89
90 public AsyncCommandManager[] Managers
91 {
92 get { return m_Managers.ToArray(); }
93 }
94
95 public AsyncCommandManager(IScriptEngine _ScriptEngine)
59 { 96 {
60 m_ScriptEngine = _ScriptEngine; 97 m_ScriptEngine = _ScriptEngine;
98 if(!m_Managers.Contains(this))
99 m_Managers.Add(this);
100
61 ReadConfig(); 101 ReadConfig();
62 102
63 // Create instances of all plugins 103 // Create instances of all plugins
@@ -87,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
87 127
88 public void ReadConfig() 128 public void ReadConfig()
89 { 129 {
90 cmdHandlerThreadCycleSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("AsyncLLCommandLoopms", 100); 130 cmdHandlerThreadCycleSleepms = m_ScriptEngine.Config.GetInt("AsyncLLCommandLoopms", 100);
91 } 131 }
92 132
93 ~AsyncCommandManager() 133 ~AsyncCommandManager()
@@ -119,9 +159,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
119 { 159 {
120 Thread.Sleep(cmdHandlerThreadCycleSleepms); 160 Thread.Sleep(cmdHandlerThreadCycleSleepms);
121 161
122 foreach (XEngine xe in XEngine.ScriptEngines) 162 foreach (AsyncCommandManager m in m_Managers)
123 { 163 {
124 xe.m_ASYNCLSLCommandManager.DoOneCmdHandlerPass(); 164 m.DoOneCmdHandlerPass();
125 } 165 }
126 } 166 }
127 } 167 }
@@ -131,7 +171,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
131 } 171 }
132 } 172 }
133 173
134 internal void DoOneCmdHandlerPass() 174 public void DoOneCmdHandlerPass()
135 { 175 {
136 // Check timers 176 // Check timers
137 m_Timer.CheckTimerEvents(); 177 m_Timer.CheckTimerEvents();
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9c660c1..7832633 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -41,65 +41,50 @@ using OpenSim.Region.Environment.Interfaces;
41using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 41using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
42using OpenSim.Region.Environment.Modules.World.Land; 42using OpenSim.Region.Environment.Modules.World.Land;
43using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
44using OpenSim.Region.ScriptEngine.XEngine; 44using OpenSim.Region.ScriptEngine.Shared;
45using OpenSim.Region.ScriptEngine.XEngine.Script; 45using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
46using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
47using OpenSim.Region.ScriptEngine.Interfaces;
48using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
46 49
47 50namespace OpenSim.Region.ScriptEngine.Shared.Api
48namespace OpenSim.Region.ScriptEngine.XEngine
49{ 51{
50 /// <summary> 52 /// <summary>
51 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 53 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
52 /// </summary> 54 /// </summary>
53 public class LSL_ScriptCommands : MarshalByRefObject, ILSL_ScriptCommands 55 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
54 { 56 {
55 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 57 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
56 58
57 internal XEngine m_ScriptEngine; 59 internal IScriptEngine m_ScriptEngine;
58 internal XScriptInstance m_Instance;
59 internal SceneObjectPart m_host; 60 internal SceneObjectPart m_host;
60 internal uint m_localID; 61 internal uint m_localID;
61 internal LLUUID m_itemID; 62 internal LLUUID m_itemID;
62 internal bool throwErrorOnNotImplemented = true; 63 internal bool throwErrorOnNotImplemented = true;
64 internal static AsyncCommandManager AsyncCommands = null;
63 65
64 public LSL_ScriptCommands(XEngine ScriptEngine, XScriptInstance instance, SceneObjectPart host, uint localID, LLUUID itemID) 66 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = ScriptEngine;
67 m_Instance = instance;
68 m_host = host; 69 m_host = host;
69 m_localID = localID; 70 m_localID = localID;
70 m_itemID = itemID; 71 m_itemID = itemID;
71 72
72 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 73 AsyncCommands = (AsyncCommandManager)ScriptEngine.AsyncCommands;
73 } 74 }
74 75
75 private DateTime m_timer = DateTime.Now; 76 private DateTime m_timer = DateTime.Now;
76 private string m_state = "default";
77 private bool m_waitingForScriptAnswer=false; 77 private bool m_waitingForScriptAnswer=false;
78 78
79 79
80 public string State
81 {
82 get { return m_Instance.State; }
83 set { m_Instance.State = value; }
84 }
85
86 public void state(string newState)
87 {
88 m_Instance.SetState(newState);
89 }
90
91 // Object never expires 80 // Object never expires
92 public override Object InitializeLifetimeService() 81 public override Object InitializeLifetimeService()
93 { 82 {
94 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
95 // return null;
96 ILease lease = (ILease)base.InitializeLifetimeService(); 83 ILease lease = (ILease)base.InitializeLifetimeService();
97 84
98 if (lease.CurrentState == LeaseState.Initial) 85 if (lease.CurrentState == LeaseState.Initial)
99 { 86 {
100 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); 87 lease.InitialLeaseTime = TimeSpan.Zero;
101 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
102 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
103 } 88 }
104 return lease; 89 return lease;
105 } 90 }
@@ -109,6 +94,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
109 get { return m_ScriptEngine.World; } 94 get { return m_ScriptEngine.World; }
110 } 95 }
111 96
97 public void state(string newState)
98 {
99 m_ScriptEngine.SetState(m_itemID, newState);
100 }
101
112 public void llSay(int channelID, string text) 102 public void llSay(int channelID, string text)
113 { 103 {
114 m_host.AddScriptLPS(1); 104 m_host.AddScriptLPS(1);
@@ -501,7 +491,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
501 LLUUID keyID = LLUUID.Zero; 491 LLUUID keyID = LLUUID.Zero;
502 LLUUID.TryParse(id, out keyID); 492 LLUUID.TryParse(id, out keyID);
503 493
504 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); 494 AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host);
505 } 495 }
506 496
507 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) 497 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
@@ -510,13 +500,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
510 LLUUID keyID = LLUUID.Zero; 500 LLUUID keyID = LLUUID.Zero;
511 LLUUID.TryParse(id, out keyID); 501 LLUUID.TryParse(id, out keyID);
512 502
513 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); 503 AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host);
514 } 504 }
515 505
516 public void llSensorRemove() 506 public void llSensorRemove()
517 { 507 {
518 m_host.AddScriptLPS(1); 508 m_host.AddScriptLPS(1);
519 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.UnSetSenseRepeaterEvents(m_localID, m_itemID); 509 AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID);
520 } 510 }
521 511
522 public string resolveName(LLUUID objecUUID) 512 public string resolveName(LLUUID objecUUID)
@@ -550,7 +540,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
550 public string llDetectedName(int number) 540 public string llDetectedName(int number)
551 { 541 {
552 m_host.AddScriptLPS(1); 542 m_host.AddScriptLPS(1);
553 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 543 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
554 if (d == null) 544 if (d == null)
555 return String.Empty; 545 return String.Empty;
556 return d.Name; 546 return d.Name;
@@ -559,7 +549,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
559 public string llDetectedKey(int number) 549 public string llDetectedKey(int number)
560 { 550 {
561 m_host.AddScriptLPS(1); 551 m_host.AddScriptLPS(1);
562 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 552 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
563 if (d == null) 553 if (d == null)
564 return String.Empty; 554 return String.Empty;
565 return d.Key.ToString(); 555 return d.Key.ToString();
@@ -568,7 +558,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
568 public string llDetectedOwner(int number) 558 public string llDetectedOwner(int number)
569 { 559 {
570 m_host.AddScriptLPS(1); 560 m_host.AddScriptLPS(1);
571 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 561 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
572 if (d == null) 562 if (d == null)
573 return String.Empty; 563 return String.Empty;
574 return d.Owner.ToString(); 564 return d.Owner.ToString();
@@ -577,7 +567,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
577 public LSL_Types.LSLInteger llDetectedType(int number) 567 public LSL_Types.LSLInteger llDetectedType(int number)
578 { 568 {
579 m_host.AddScriptLPS(1); 569 m_host.AddScriptLPS(1);
580 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 570 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
581 if (d == null) 571 if (d == null)
582 return 0; 572 return 0;
583 return new LSL_Types.LSLInteger(d.Type); 573 return new LSL_Types.LSLInteger(d.Type);
@@ -586,7 +576,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
586 public LSL_Types.Vector3 llDetectedPos(int number) 576 public LSL_Types.Vector3 llDetectedPos(int number)
587 { 577 {
588 m_host.AddScriptLPS(1); 578 m_host.AddScriptLPS(1);
589 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 579 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
590 if (d == null) 580 if (d == null)
591 return new LSL_Types.Vector3(); 581 return new LSL_Types.Vector3();
592 return d.Position; 582 return d.Position;
@@ -595,7 +585,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
595 public LSL_Types.Vector3 llDetectedVel(int number) 585 public LSL_Types.Vector3 llDetectedVel(int number)
596 { 586 {
597 m_host.AddScriptLPS(1); 587 m_host.AddScriptLPS(1);
598 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 588 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
599 if (d == null) 589 if (d == null)
600 return new LSL_Types.Vector3(); 590 return new LSL_Types.Vector3();
601 return d.Velocity; 591 return d.Velocity;
@@ -604,7 +594,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
604 public LSL_Types.Vector3 llDetectedGrab(int number) 594 public LSL_Types.Vector3 llDetectedGrab(int number)
605 { 595 {
606 m_host.AddScriptLPS(1); 596 m_host.AddScriptLPS(1);
607 XDetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); 597 DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number);
608 if (parms == null) 598 if (parms == null)
609 return new LSL_Types.Vector3(0, 0, 0); 599 return new LSL_Types.Vector3(0, 0, 0);
610 600
@@ -614,7 +604,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
614 public LSL_Types.Quaternion llDetectedRot(int number) 604 public LSL_Types.Quaternion llDetectedRot(int number)
615 { 605 {
616 m_host.AddScriptLPS(1); 606 m_host.AddScriptLPS(1);
617 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 607 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
618 if (d == null) 608 if (d == null)
619 return new LSL_Types.Quaternion(); 609 return new LSL_Types.Quaternion();
620 return d.Rotation; 610 return d.Rotation;
@@ -623,7 +613,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
623 public LSL_Types.LSLInteger llDetectedGroup(int number) 613 public LSL_Types.LSLInteger llDetectedGroup(int number)
624 { 614 {
625 m_host.AddScriptLPS(1); 615 m_host.AddScriptLPS(1);
626 XDetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number); 616 DetectParams d = m_ScriptEngine.GetDetectParams(m_itemID, number);
627 if (d == null) 617 if (d == null)
628 return new LSL_Types.LSLInteger(0); 618 return new LSL_Types.LSLInteger(0);
629 if (m_host.GroupID == d.Group) 619 if (m_host.GroupID == d.Group)
@@ -634,7 +624,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
634 public LSL_Types.LSLInteger llDetectedLinkNumber(int number) 624 public LSL_Types.LSLInteger llDetectedLinkNumber(int number)
635 { 625 {
636 m_host.AddScriptLPS(1); 626 m_host.AddScriptLPS(1);
637 XDetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); 627 DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number);
638 if (parms == null) 628 if (parms == null)
639 return new LSL_Types.LSLInteger(0); 629 return new LSL_Types.LSLInteger(0);
640 630
@@ -675,7 +665,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
675 665
676 int statusrotationaxis = 0; 666 int statusrotationaxis = 0;
677 667
678 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHYSICS) == BuiltIn_Commands_BaseClass.STATUS_PHYSICS) 668 if ((status & ScriptBaseClass.STATUS_PHYSICS) == ScriptBaseClass.STATUS_PHYSICS)
679 { 669 {
680 if (value == 1) 670 if (value == 1)
681 m_host.ScriptSetPhysicsStatus(true); 671 m_host.ScriptSetPhysicsStatus(true);
@@ -683,7 +673,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
683 m_host.ScriptSetPhysicsStatus(false); 673 m_host.ScriptSetPhysicsStatus(false);
684 } 674 }
685 675
686 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) 676 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
687 { 677 {
688 if (value == 1) 678 if (value == 1)
689 m_host.ScriptSetPhantomStatus(true); 679 m_host.ScriptSetPhantomStatus(true);
@@ -691,32 +681,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine
691 m_host.ScriptSetPhantomStatus(false); 681 m_host.ScriptSetPhantomStatus(false);
692 } 682 }
693 683
694 if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) 684 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
695 { 685 {
696 m_host.AddFlag(LLObject.ObjectFlags.CastShadows); 686 m_host.AddFlag(LLObject.ObjectFlags.CastShadows);
697 } 687 }
698 688
699 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) 689 if ((status & ScriptBaseClass.STATUS_ROTATE_X) == ScriptBaseClass.STATUS_ROTATE_X)
700 { 690 {
701 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; 691 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_X;
702 } 692 }
703 693
704 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) 694 if ((status & ScriptBaseClass.STATUS_ROTATE_Y) == ScriptBaseClass.STATUS_ROTATE_Y)
705 { 695 {
706 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; 696 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_Y;
707 } 697 }
708 698
709 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) 699 if ((status & ScriptBaseClass.STATUS_ROTATE_Z) == ScriptBaseClass.STATUS_ROTATE_Z)
710 { 700 {
711 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; 701 statusrotationaxis |= ScriptBaseClass.STATUS_ROTATE_Z;
712 } 702 }
713 703
714 if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) 704 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
715 { 705 {
716 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); 706 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB");
717 } 707 }
718 708
719 if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) 709 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
720 { 710 {
721 if (value == 1) 711 if (value == 1)
722 m_host.SetDieAtEdge(true); 712 m_host.SetDieAtEdge(true);
@@ -724,12 +714,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
724 m_host.SetDieAtEdge(false); 714 m_host.SetDieAtEdge(false);
725 } 715 }
726 716
727 if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) 717 if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE)
728 { 718 {
729 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); 719 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE");
730 } 720 }
731 721
732 if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) 722 if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX)
733 { 723 {
734 NotImplemented("llSetStatus - STATUS_SANDBOX"); 724 NotImplemented("llSetStatus - STATUS_SANDBOX");
735 } 725 }
@@ -746,54 +736,54 @@ namespace OpenSim.Region.ScriptEngine.XEngine
746 // Console.WriteLine(m_host.UUID.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString()); 736 // Console.WriteLine(m_host.UUID.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString());
747 switch (status) 737 switch (status)
748 { 738 {
749 case BuiltIn_Commands_BaseClass.STATUS_PHYSICS: 739 case ScriptBaseClass.STATUS_PHYSICS:
750 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == (uint)LLObject.ObjectFlags.Physics) 740 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == (uint)LLObject.ObjectFlags.Physics)
751 { 741 {
752 return 1; 742 return 1;
753 } 743 }
754 return 0; 744 return 0;
755 745
756 case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: 746 case ScriptBaseClass.STATUS_PHANTOM:
757 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) 747 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom)
758 { 748 {
759 return 1; 749 return 1;
760 } 750 }
761 return 0; 751 return 0;
762 752
763 case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: 753 case ScriptBaseClass.STATUS_CAST_SHADOWS:
764 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) 754 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows)
765 { 755 {
766 return 1; 756 return 1;
767 } 757 }
768 return 0; 758 return 0;
769 759
770 case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: 760 case ScriptBaseClass.STATUS_BLOCK_GRAB:
771 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); 761 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB");
772 return 0; 762 return 0;
773 763
774 case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE: 764 case ScriptBaseClass.STATUS_DIE_AT_EDGE:
775 if (m_host.GetDieAtEdge()) 765 if (m_host.GetDieAtEdge())
776 return 1; 766 return 1;
777 else 767 else
778 return 0; 768 return 0;
779 769
780 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: 770 case ScriptBaseClass.STATUS_RETURN_AT_EDGE:
781 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 771 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
782 return 0; 772 return 0;
783 773
784 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: 774 case ScriptBaseClass.STATUS_ROTATE_X:
785 NotImplemented("llGetStatus - STATUS_ROTATE_X"); 775 NotImplemented("llGetStatus - STATUS_ROTATE_X");
786 return 0; 776 return 0;
787 777
788 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: 778 case ScriptBaseClass.STATUS_ROTATE_Y:
789 NotImplemented("llGetStatus - STATUS_ROTATE_Y"); 779 NotImplemented("llGetStatus - STATUS_ROTATE_Y");
790 return 0; 780 return 0;
791 781
792 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: 782 case ScriptBaseClass.STATUS_ROTATE_Z:
793 NotImplemented("llGetStatus - STATUS_ROTATE_Z"); 783 NotImplemented("llGetStatus - STATUS_ROTATE_Z");
794 return 0; 784 return 0;
795 785
796 case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: 786 case ScriptBaseClass.STATUS_SANDBOX:
797 NotImplemented("llGetStatus - STATUS_SANDBOX"); 787 NotImplemented("llGetStatus - STATUS_SANDBOX");
798 return 0; 788 return 0;
799 } 789 }
@@ -1743,7 +1733,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1743 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 1733 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
1744 return 0; 1734 return 0;
1745 1735
1746 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) 1736 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
1747 { 1737 {
1748 LSLError("No permissions to give money"); 1738 LSLError("No permissions to give money");
1749 return 0; 1739 return 0;
@@ -1840,11 +1830,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1840 // objects rezzed with this method are die_at_edge by default. 1830 // objects rezzed with this method are die_at_edge by default.
1841 new_group.RootPart.SetDieAtEdge(true); 1831 new_group.RootPart.SetDieAtEdge(true);
1842 1832
1843 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 1833 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
1844 "object_rez", new Object[] { 1834 "object_rez", new Object[] {
1845 new LSL_Types.LSLString( 1835 new LSL_Types.LSLString(
1846 new_group.RootPart.UUID.ToString()) }, 1836 new_group.RootPart.UUID.ToString()) },
1847 new XDetectParams[0])); 1837 new DetectParams[0]));
1848 1838
1849 float groupmass = new_group.GetMass(); 1839 float groupmass = new_group.GetMass();
1850 1840
@@ -1876,7 +1866,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1876 { 1866 {
1877 m_host.AddScriptLPS(1); 1867 m_host.AddScriptLPS(1);
1878 // Setting timer repeat 1868 // Setting timer repeat
1879 m_ScriptEngine.m_ASYNCLSLCommandManager.m_Timer.SetTimerEvent(m_localID, m_itemID, sec); 1869 AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec);
1880 } 1870 }
1881 1871
1882 public void llSleep(double sec) 1872 public void llSleep(double sec)
@@ -1910,7 +1900,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1910 1900
1911 if (presence != null) 1901 if (presence != null)
1912 { 1902 {
1913 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) 1903 if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
1914 { 1904 {
1915 presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); 1905 presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
1916 1906
@@ -1937,12 +1927,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1937 1927
1938 if (presence != null) 1928 if (presence != null)
1939 { 1929 {
1940 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) 1930 if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
1941 { 1931 {
1942 // Unregister controls from Presence 1932 // Unregister controls from Presence
1943 presence.UnRegisterControlEventsToScript(m_localID, m_itemID); 1933 presence.UnRegisterControlEventsToScript(m_localID, m_itemID);
1944 // Remove Take Control permission. 1934 // Remove Take Control permission.
1945 m_host.TaskInventory[InventorySelf()].PermsMask &= ~BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS; 1935 m_host.TaskInventory[InventorySelf()].PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
1946 } 1936 }
1947 } 1937 }
1948 } 1938 }
@@ -2110,7 +2100,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2110 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 2100 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
2111 return; 2101 return;
2112 2102
2113 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 2103 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
2114 { 2104 {
2115 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); 2105 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
2116 2106
@@ -2137,7 +2127,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2137 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 2127 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
2138 return; 2128 return;
2139 2129
2140 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 2130 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
2141 { 2131 {
2142 LLUUID animID = new LLUUID(); 2132 LLUUID animID = new LLUUID();
2143 2133
@@ -2212,10 +2202,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2212 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; 2202 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero;
2213 m_host.TaskInventory[invItemID].PermsMask=0; 2203 m_host.TaskInventory[invItemID].PermsMask=0;
2214 2204
2215 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 2205 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2216 "run_time_permissions", new Object[] { 2206 "run_time_permissions", new Object[] {
2217 new LSL_Types.LSLInteger(0) }, 2207 new LSL_Types.LSLInteger(0) },
2218 new XDetectParams[0])); 2208 new DetectParams[0]));
2219 2209
2220 return; 2210 return;
2221 } 2211 }
@@ -2225,19 +2215,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2225 if (m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar) 2215 if (m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar)
2226 { 2216 {
2227 // When attached, certain permissions are implicit if requested from owner 2217 // When attached, certain permissions are implicit if requested from owner
2228 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | 2218 int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
2229 BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2219 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
2230 BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; 2220 ScriptBaseClass.PERMISSION_ATTACH;
2231 2221
2232 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2222 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2233 { 2223 {
2234 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2224 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2235 m_host.TaskInventory[invItemID].PermsMask=perm; 2225 m_host.TaskInventory[invItemID].PermsMask=perm;
2236 2226
2237 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 2227 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2238 "run_time_permissions", new Object[] { 2228 "run_time_permissions", new Object[] {
2239 new LSL_Types.LSLInteger(perm) }, 2229 new LSL_Types.LSLInteger(perm) },
2240 new XDetectParams[0])); 2230 new DetectParams[0]));
2241 2231
2242 return; 2232 return;
2243 } 2233 }
@@ -2245,18 +2235,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2245 else if (m_host.m_sitTargetAvatar == agentID) // Sitting avatar 2235 else if (m_host.m_sitTargetAvatar == agentID) // Sitting avatar
2246 { 2236 {
2247 // When agent is sitting, certain permissions are implicit if requested from sitting agent 2237 // When agent is sitting, certain permissions are implicit if requested from sitting agent
2248 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2238 int implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
2249 BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; 2239 ScriptBaseClass.PERMISSION_TRACK_CAMERA;
2250 2240
2251 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2241 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2252 { 2242 {
2253 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2243 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2254 m_host.TaskInventory[invItemID].PermsMask=perm; 2244 m_host.TaskInventory[invItemID].PermsMask=perm;
2255 2245
2256 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 2246 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2257 "run_time_permissions", new Object[] { 2247 "run_time_permissions", new Object[] {
2258 new LSL_Types.LSLInteger(perm) }, 2248 new LSL_Types.LSLInteger(perm) },
2259 new XDetectParams[0])); 2249 new DetectParams[0]));
2260 2250
2261 return; 2251 return;
2262 } 2252 }
@@ -2283,10 +2273,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2283 } 2273 }
2284 2274
2285 // Requested agent is not in range, refuse perms 2275 // Requested agent is not in range, refuse perms
2286 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 2276 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2287 "run_time_permissions", new Object[] { 2277 "run_time_permissions", new Object[] {
2288 new LSL_Types.LSLInteger(0) }, 2278 new LSL_Types.LSLInteger(0) },
2289 new XDetectParams[0])); 2279 new DetectParams[0]));
2290 } 2280 }
2291 2281
2292 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) 2282 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
@@ -2303,10 +2293,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2303 m_waitingForScriptAnswer=false; 2293 m_waitingForScriptAnswer=false;
2304 2294
2305 m_host.TaskInventory[invItemID].PermsMask=answer; 2295 m_host.TaskInventory[invItemID].PermsMask=answer;
2306 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 2296 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2307 "run_time_permissions", new Object[] { 2297 "run_time_permissions", new Object[] {
2308 new LSL_Types.LSLInteger(answer) }, 2298 new LSL_Types.LSLInteger(answer) },
2309 new XDetectParams[0])); 2299 new DetectParams[0]));
2310 } 2300 }
2311 2301
2312 public string llGetPermissionsKey() 2302 public string llGetPermissionsKey()
@@ -2631,12 +2621,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2631 2621
2632 LLUUID rq = LLUUID.Random(); 2622 LLUUID rq = LLUUID.Random();
2633 2623
2634 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 2624 LLUUID tid = AsyncCommands.
2635 m_Dataserver.RegisterRequest(m_localID, 2625 DataserverPlugin.RegisterRequest(m_localID,
2636 m_itemID, rq.ToString()); 2626 m_itemID, rq.ToString());
2637 2627
2638 m_ScriptEngine.m_ASYNCLSLCommandManager. 2628 AsyncCommands.
2639 m_Dataserver.DataserverReply(rq.ToString(), reply); 2629 DataserverPlugin.DataserverReply(rq.ToString(), reply);
2640 2630
2641 return tid.ToString(); 2631 return tid.ToString();
2642 } 2632 }
@@ -2649,8 +2639,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2649 { 2639 {
2650 if (item.Type == 3 && item.Name == name) 2640 if (item.Type == 3 && item.Name == name)
2651 { 2641 {
2652 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 2642 LLUUID tid = AsyncCommands.
2653 m_Dataserver.RegisterRequest(m_localID, 2643 DataserverPlugin.RegisterRequest(m_localID,
2654 m_itemID, item.AssetID.ToString()); 2644 m_itemID, item.AssetID.ToString());
2655 2645
2656 LLVector3 region = new LLVector3( 2646 LLVector3 region = new LLVector3(
@@ -2667,8 +2657,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2667 2657
2668 string reply = region.ToString(); 2658 string reply = region.ToString();
2669 2659
2670 m_ScriptEngine.m_ASYNCLSLCommandManager. 2660 AsyncCommands.
2671 m_Dataserver.DataserverReply(i.ToString(), 2661 DataserverPlugin.DataserverReply(i.ToString(),
2672 reply); 2662 reply);
2673 }, false); 2663 }, false);
2674 2664
@@ -2733,7 +2723,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2733 switch ((int)linknum) 2723 switch ((int)linknum)
2734 { 2724 {
2735 2725
2736 case (int)BuiltIn_Commands_BaseClass.LINK_ROOT: 2726 case (int)ScriptBaseClass.LINK_ROOT:
2737 2727
2738 SceneObjectPart part = m_host.ParentGroup.RootPart; 2728 SceneObjectPart part = m_host.ParentGroup.RootPart;
2739 2729
@@ -2750,14 +2740,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2750 }; 2740 };
2751 2741
2752 m_ScriptEngine.PostScriptEvent(partItemID, 2742 m_ScriptEngine.PostScriptEvent(partItemID,
2753 new XEventParams("link_message", 2743 new EventParams("link_message",
2754 resobj, new XDetectParams[0])); 2744 resobj, new DetectParams[0]));
2755 } 2745 }
2756 } 2746 }
2757 2747
2758 break; 2748 break;
2759 2749
2760 case (int)BuiltIn_Commands_BaseClass.LINK_SET: 2750 case (int)ScriptBaseClass.LINK_SET:
2761 2751
2762 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 2752 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2763 { 2753 {
@@ -2774,15 +2764,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2774 }; 2764 };
2775 2765
2776 m_ScriptEngine.PostScriptEvent(partItemID, 2766 m_ScriptEngine.PostScriptEvent(partItemID,
2777 new XEventParams("link_message", 2767 new EventParams("link_message",
2778 resobj, new XDetectParams[0])); 2768 resobj, new DetectParams[0]));
2779 } 2769 }
2780 } 2770 }
2781 } 2771 }
2782 2772
2783 break; 2773 break;
2784 2774
2785 case (int)BuiltIn_Commands_BaseClass.LINK_ALL_OTHERS: 2775 case (int)ScriptBaseClass.LINK_ALL_OTHERS:
2786 2776
2787 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 2777 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2788 { 2778 {
@@ -2802,8 +2792,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2802 }; 2792 };
2803 2793
2804 m_ScriptEngine.PostScriptEvent(partItemID, 2794 m_ScriptEngine.PostScriptEvent(partItemID,
2805 new XEventParams("link_message", 2795 new EventParams("link_message",
2806 resobj, new XDetectParams[0])); 2796 resobj, new DetectParams[0]));
2807 } 2797 }
2808 } 2798 }
2809 2799
@@ -2812,7 +2802,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2812 2802
2813 break; 2803 break;
2814 2804
2815 case (int)BuiltIn_Commands_BaseClass.LINK_ALL_CHILDREN: 2805 case (int)ScriptBaseClass.LINK_ALL_CHILDREN:
2816 2806
2817 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 2807 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2818 { 2808 {
@@ -2832,8 +2822,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2832 }; 2822 };
2833 2823
2834 m_ScriptEngine.PostScriptEvent(partItemID, 2824 m_ScriptEngine.PostScriptEvent(partItemID,
2835 new XEventParams("link_message", 2825 new EventParams("link_message",
2836 resobj, new XDetectParams[0])); 2826 resobj, new DetectParams[0]));
2837 } 2827 }
2838 } 2828 }
2839 2829
@@ -2842,7 +2832,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2842 2832
2843 break; 2833 break;
2844 2834
2845 case (int)BuiltIn_Commands_BaseClass.LINK_THIS: 2835 case (int)ScriptBaseClass.LINK_THIS:
2846 2836
2847 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 2837 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
2848 { 2838 {
@@ -2856,8 +2846,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2856 }; 2846 };
2857 2847
2858 m_ScriptEngine.PostScriptEvent(partItemID, 2848 m_ScriptEngine.PostScriptEvent(partItemID,
2859 new XEventParams("link_message", 2849 new EventParams("link_message",
2860 resobj, new XDetectParams[0])); 2850 resobj, new DetectParams[0]));
2861 } 2851 }
2862 } 2852 }
2863 2853
@@ -2883,8 +2873,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2883 }; 2873 };
2884 2874
2885 m_ScriptEngine.PostScriptEvent(partItemID, 2875 m_ScriptEngine.PostScriptEvent(partItemID,
2886 new XEventParams("link_message", 2876 new EventParams("link_message",
2887 resObjDef, new XDetectParams[0])); 2877 resObjDef, new DetectParams[0]));
2888 } 2878 }
2889 } 2879 }
2890 2880
@@ -4061,23 +4051,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4061 { 4051 {
4062 switch ((int)rules.Data[i]) 4052 switch ((int)rules.Data[i])
4063 { 4053 {
4064 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_FLAGS: 4054 case (int)ScriptBaseClass.PSYS_PART_FLAGS:
4065 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString())); 4055 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)((uint)Convert.ToInt32(rules.Data[i + 1].ToString()));
4066 break; 4056 break;
4067 4057
4068 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_COLOR: 4058 case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
4069 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4059 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4070 prules.PartStartColor.R = (float)tempv.x; 4060 prules.PartStartColor.R = (float)tempv.x;
4071 prules.PartStartColor.G = (float)tempv.y; 4061 prules.PartStartColor.G = (float)tempv.y;
4072 prules.PartStartColor.B = (float)tempv.z; 4062 prules.PartStartColor.B = (float)tempv.z;
4073 break; 4063 break;
4074 4064
4075 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_ALPHA: 4065 case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
4076 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4066 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4077 prules.PartStartColor.A = (float)tempf; 4067 prules.PartStartColor.A = (float)tempf;
4078 break; 4068 break;
4079 4069
4080 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR: 4070 case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
4081 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4071 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4082 //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1); 4072 //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1);
4083 4073
@@ -4086,36 +4076,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4086 prules.PartEndColor.B = (float)tempv.z; 4076 prules.PartEndColor.B = (float)tempv.z;
4087 break; 4077 break;
4088 4078
4089 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_ALPHA: 4079 case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
4090 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4080 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4091 prules.PartEndColor.A = (float)tempf; 4081 prules.PartEndColor.A = (float)tempf;
4092 break; 4082 break;
4093 4083
4094 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_SCALE: 4084 case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
4095 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4085 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4096 prules.PartStartScaleX = (float)tempv.x; 4086 prules.PartStartScaleX = (float)tempv.x;
4097 prules.PartStartScaleY = (float)tempv.y; 4087 prules.PartStartScaleY = (float)tempv.y;
4098 break; 4088 break;
4099 4089
4100 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_SCALE: 4090 case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
4101 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4091 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4102 prules.PartEndScaleX = (float)tempv.x; 4092 prules.PartEndScaleX = (float)tempv.x;
4103 prules.PartEndScaleY = (float)tempv.y; 4093 prules.PartEndScaleY = (float)tempv.y;
4104 break; 4094 break;
4105 4095
4106 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_MAX_AGE: 4096 case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
4107 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4097 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4108 prules.PartMaxAge = (float)tempf; 4098 prules.PartMaxAge = (float)tempf;
4109 break; 4099 break;
4110 4100
4111 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ACCEL: 4101 case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
4112 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4102 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4113 prules.PartAcceleration.X = (float)tempv.x; 4103 prules.PartAcceleration.X = (float)tempv.x;
4114 prules.PartAcceleration.Y = (float)tempv.y; 4104 prules.PartAcceleration.Y = (float)tempv.y;
4115 prules.PartAcceleration.Z = (float)tempv.z; 4105 prules.PartAcceleration.Z = (float)tempv.z;
4116 break; 4106 break;
4117 4107
4118 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_PATTERN: 4108 case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
4119 int tmpi = int.Parse(rules.Data[i + 1].ToString()); 4109 int tmpi = int.Parse(rules.Data[i + 1].ToString());
4120 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; 4110 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
4121 break; 4111 break;
@@ -4124,40 +4114,40 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4124 // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture 4114 // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture
4125 // "" = default texture. 4115 // "" = default texture.
4126 // 20080530 Updated to remove code duplication 4116 // 20080530 Updated to remove code duplication
4127 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: 4117 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
4128 prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); 4118 prules.Texture = KeyOrName(rules.Data[i + 1].ToString());
4129 break; 4119 break;
4130 4120
4131 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: 4121 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
4132 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4122 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4133 prules.BurstRate = (float)tempf; 4123 prules.BurstRate = (float)tempf;
4134 break; 4124 break;
4135 4125
4136 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_PART_COUNT: 4126 case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
4137 prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString()); 4127 prules.BurstPartCount = (byte)Convert.ToByte(rules.Data[i + 1].ToString());
4138 break; 4128 break;
4139 4129
4140 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RADIUS: 4130 case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
4141 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4131 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4142 prules.BurstRadius = (float)tempf; 4132 prules.BurstRadius = (float)tempf;
4143 break; 4133 break;
4144 4134
4145 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MIN: 4135 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
4146 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4136 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4147 prules.BurstSpeedMin = (float)tempf; 4137 prules.BurstSpeedMin = (float)tempf;
4148 break; 4138 break;
4149 4139
4150 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_SPEED_MAX: 4140 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
4151 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4141 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4152 prules.BurstSpeedMax = (float)tempf; 4142 prules.BurstSpeedMax = (float)tempf;
4153 break; 4143 break;
4154 4144
4155 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_MAX_AGE: 4145 case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
4156 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4146 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4157 prules.MaxAge = (float)tempf; 4147 prules.MaxAge = (float)tempf;
4158 break; 4148 break;
4159 4149
4160 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TARGET_KEY: 4150 case (int)ScriptBaseClass.PSYS_SRC_TARGET_KEY:
4161 LLUUID key = LLUUID.Zero; 4151 LLUUID key = LLUUID.Zero;
4162 if (LLUUID.TryParse(rules.Data[i + 1].ToString(), out key)) 4152 if (LLUUID.TryParse(rules.Data[i + 1].ToString(), out key))
4163 { 4153 {
@@ -4169,7 +4159,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4169 } 4159 }
4170 break; 4160 break;
4171 4161
4172 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_OMEGA: 4162 case (int)ScriptBaseClass.PSYS_SRC_OMEGA:
4173 // AL: This is an assumption, since it is the only thing that would match. 4163 // AL: This is an assumption, since it is the only thing that would match.
4174 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 4164 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
4175 prules.AngularVelocity.X = (float)tempv.x; 4165 prules.AngularVelocity.X = (float)tempv.x;
@@ -4178,12 +4168,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4178 //cast?? prules.MaxAge = (float)rules[i + 1]; 4168 //cast?? prules.MaxAge = (float)rules[i + 1];
4179 break; 4169 break;
4180 4170
4181 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_BEGIN: 4171 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
4182 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4172 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4183 prules.InnerAngle = (float)tempf; 4173 prules.InnerAngle = (float)tempf;
4184 break; 4174 break;
4185 4175
4186 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_END: 4176 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
4187 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4177 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
4188 prules.OuterAngle = (float)tempf; 4178 prules.OuterAngle = (float)tempf;
4189 break; 4179 break;
@@ -4444,9 +4434,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
4444 { 4434 {
4445 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, LLUUID.Zero); 4435 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, LLUUID.Zero);
4446 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; 4436 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) };
4447 m_ScriptEngine.PostScriptEvent(m_itemID, new XEventParams( 4437 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
4448 "remote_data", resobj, 4438 "remote_data", resobj,
4449 new XDetectParams[0])); 4439 new DetectParams[0]));
4450 } 4440 }
4451 } 4441 }
4452 4442
@@ -5472,27 +5462,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5472 5462
5473 int permmask = 0; 5463 int permmask = 0;
5474 5464
5475 if (mask == BuiltIn_Commands_BaseClass.MASK_BASE)//0 5465 if (mask == ScriptBaseClass.MASK_BASE)//0
5476 { 5466 {
5477 permmask = (int)m_host.BaseMask; 5467 permmask = (int)m_host.BaseMask;
5478 } 5468 }
5479 5469
5480 else if (mask == BuiltIn_Commands_BaseClass.MASK_OWNER)//1 5470 else if (mask == ScriptBaseClass.MASK_OWNER)//1
5481 { 5471 {
5482 permmask = (int)m_host.OwnerMask; 5472 permmask = (int)m_host.OwnerMask;
5483 } 5473 }
5484 5474
5485 else if (mask == BuiltIn_Commands_BaseClass.MASK_GROUP)//2 5475 else if (mask == ScriptBaseClass.MASK_GROUP)//2
5486 { 5476 {
5487 permmask = (int)m_host.GroupMask; 5477 permmask = (int)m_host.GroupMask;
5488 } 5478 }
5489 5479
5490 else if (mask == BuiltIn_Commands_BaseClass.MASK_EVERYONE)//3 5480 else if (mask == ScriptBaseClass.MASK_EVERYONE)//3
5491 { 5481 {
5492 permmask = (int)m_host.EveryoneMask; 5482 permmask = (int)m_host.EveryoneMask;
5493 } 5483 }
5494 5484
5495 else if (mask == BuiltIn_Commands_BaseClass.MASK_NEXT)//4 5485 else if (mask == ScriptBaseClass.MASK_NEXT)//4
5496 { 5486 {
5497 permmask = (int)m_host.NextOwnerMask; 5487 permmask = (int)m_host.NextOwnerMask;
5498 } 5488 }
@@ -5511,27 +5501,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5511 { 5501 {
5512 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) 5502 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
5513 { 5503 {
5514 if (mask == BuiltIn_Commands_BaseClass.MASK_BASE)//0 5504 if (mask == ScriptBaseClass.MASK_BASE)//0
5515 { 5505 {
5516 m_host.BaseMask = (uint)value; 5506 m_host.BaseMask = (uint)value;
5517 } 5507 }
5518 5508
5519 else if (mask == BuiltIn_Commands_BaseClass.MASK_OWNER)//1 5509 else if (mask == ScriptBaseClass.MASK_OWNER)//1
5520 { 5510 {
5521 m_host.OwnerMask = (uint)value; 5511 m_host.OwnerMask = (uint)value;
5522 } 5512 }
5523 5513
5524 else if (mask == BuiltIn_Commands_BaseClass.MASK_GROUP)//2 5514 else if (mask == ScriptBaseClass.MASK_GROUP)//2
5525 { 5515 {
5526 m_host.GroupMask = (uint)value; 5516 m_host.GroupMask = (uint)value;
5527 } 5517 }
5528 5518
5529 else if (mask == BuiltIn_Commands_BaseClass.MASK_EVERYONE)//3 5519 else if (mask == ScriptBaseClass.MASK_EVERYONE)//3
5530 { 5520 {
5531 m_host.EveryoneMask = (uint)value; 5521 m_host.EveryoneMask = (uint)value;
5532 } 5522 }
5533 5523
5534 else if (mask == BuiltIn_Commands_BaseClass.MASK_NEXT)//4 5524 else if (mask == ScriptBaseClass.MASK_NEXT)//4
5535 { 5525 {
5536 m_host.NextOwnerMask = (uint)value; 5526 m_host.NextOwnerMask = (uint)value;
5537 } 5527 }
@@ -5635,12 +5625,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5635 } 5625 }
5636 LLUUID rq = LLUUID.Random(); 5626 LLUUID rq = LLUUID.Random();
5637 5627
5638 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 5628 LLUUID tid = AsyncCommands.
5639 m_Dataserver.RegisterRequest(m_localID, 5629 DataserverPlugin.RegisterRequest(m_localID,
5640 m_itemID, rq.ToString()); 5630 m_itemID, rq.ToString());
5641 5631
5642 m_ScriptEngine.m_ASYNCLSLCommandManager. 5632 AsyncCommands.
5643 m_Dataserver.DataserverReply(rq.ToString(), reply); 5633 DataserverPlugin.DataserverReply(rq.ToString(), reply);
5644 5634
5645 return tid.ToString(); 5635 return tid.ToString();
5646 } 5636 }
@@ -5943,27 +5933,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5943 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src); 5933 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src);
5944 switch (operation) 5934 switch (operation)
5945 { 5935 {
5946 case BuiltIn_Commands_BaseClass.LIST_STAT_RANGE: 5936 case ScriptBaseClass.LIST_STAT_RANGE:
5947 return nums.Range(); 5937 return nums.Range();
5948 case BuiltIn_Commands_BaseClass.LIST_STAT_MIN: 5938 case ScriptBaseClass.LIST_STAT_MIN:
5949 return nums.Min(); 5939 return nums.Min();
5950 case BuiltIn_Commands_BaseClass.LIST_STAT_MAX: 5940 case ScriptBaseClass.LIST_STAT_MAX:
5951 return nums.Max(); 5941 return nums.Max();
5952 case BuiltIn_Commands_BaseClass.LIST_STAT_MEAN: 5942 case ScriptBaseClass.LIST_STAT_MEAN:
5953 return nums.Mean(); 5943 return nums.Mean();
5954 case BuiltIn_Commands_BaseClass.LIST_STAT_MEDIAN: 5944 case ScriptBaseClass.LIST_STAT_MEDIAN:
5955 return nums.Median(); 5945 return nums.Median();
5956 case BuiltIn_Commands_BaseClass.LIST_STAT_NUM_COUNT: 5946 case ScriptBaseClass.LIST_STAT_NUM_COUNT:
5957 return nums.NumericLength(); 5947 return nums.NumericLength();
5958 case BuiltIn_Commands_BaseClass.LIST_STAT_STD_DEV: 5948 case ScriptBaseClass.LIST_STAT_STD_DEV:
5959 return nums.StdDev(); 5949 return nums.StdDev();
5960 case BuiltIn_Commands_BaseClass.LIST_STAT_SUM: 5950 case ScriptBaseClass.LIST_STAT_SUM:
5961 return nums.Sum(); 5951 return nums.Sum();
5962 case BuiltIn_Commands_BaseClass.LIST_STAT_SUM_SQUARES: 5952 case ScriptBaseClass.LIST_STAT_SUM_SQUARES:
5963 return nums.SumSqrs(); 5953 return nums.SumSqrs();
5964 case BuiltIn_Commands_BaseClass.LIST_STAT_GEOMETRIC_MEAN: 5954 case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN:
5965 return nums.GeometricMean(); 5955 return nums.GeometricMean();
5966 case BuiltIn_Commands_BaseClass.LIST_STAT_HARMONIC_MEAN: 5956 case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN:
5967 return nums.HarmonicMean(); 5957 return nums.HarmonicMean();
5968 default: 5958 default:
5969 return 0.0; 5959 return 0.0;
@@ -6230,9 +6220,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6230 public string llStringTrim(string src, int type) 6220 public string llStringTrim(string src, int type)
6231 { 6221 {
6232 m_host.AddScriptLPS(1); 6222 m_host.AddScriptLPS(1);
6233 if (type == (int)BuiltIn_Commands_BaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); } 6223 if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
6234 if (type == (int)BuiltIn_Commands_BaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); } 6224 if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); }
6235 if (type == (int)BuiltIn_Commands_BaseClass.STRING_TRIM) { return src.Trim(); } 6225 if (type == (int)ScriptBaseClass.STRING_TRIM) { return src.Trim(); }
6236 return src; 6226 return src;
6237 } 6227 }
6238 6228
@@ -6331,7 +6321,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6331 6321
6332 internal void ShoutError(string msg) 6322 internal void ShoutError(string msg)
6333 { 6323 {
6334 llShout(BuiltIn_Commands_BaseClass.DEBUG_CHANNEL, msg); 6324 llShout(ScriptBaseClass.DEBUG_CHANNEL, msg);
6335 } 6325 }
6336 6326
6337 6327
@@ -6366,13 +6356,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6366 { 6356 {
6367 if (item.Type == 7 && item.Name == name) 6357 if (item.Type == 7 && item.Name == name)
6368 { 6358 {
6369 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 6359 LLUUID tid = AsyncCommands.
6370 m_Dataserver.RegisterRequest(m_localID, 6360 DataserverPlugin.RegisterRequest(m_localID,
6371 m_itemID, item.AssetID.ToString()); 6361 m_itemID, item.AssetID.ToString());
6372 if (NotecardCache.IsCached(item.AssetID)) 6362 if (NotecardCache.IsCached(item.AssetID))
6373 { 6363 {
6374 m_ScriptEngine.m_ASYNCLSLCommandManager. 6364 AsyncCommands.
6375 m_Dataserver.DataserverReply(item.AssetID.ToString(), 6365 DataserverPlugin.DataserverReply(item.AssetID.ToString(),
6376 NotecardCache.GetLines(item.AssetID).ToString()); 6366 NotecardCache.GetLines(item.AssetID).ToString());
6377 return tid.ToString(); 6367 return tid.ToString();
6378 } 6368 }
@@ -6383,8 +6373,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6383 string data = enc.GetString(a.Data); 6373 string data = enc.GetString(a.Data);
6384 //Console.WriteLine(data); 6374 //Console.WriteLine(data);
6385 NotecardCache.Cache(id, data); 6375 NotecardCache.Cache(id, data);
6386 m_ScriptEngine.m_ASYNCLSLCommandManager. 6376 AsyncCommands.
6387 m_Dataserver.DataserverReply(id.ToString(), 6377 DataserverPlugin.DataserverReply(id.ToString(),
6388 NotecardCache.GetLines(id).ToString()); 6378 NotecardCache.GetLines(id).ToString());
6389 }); 6379 });
6390 6380
@@ -6402,13 +6392,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6402 { 6392 {
6403 if (item.Type == 7 && item.Name == name) 6393 if (item.Type == 7 && item.Name == name)
6404 { 6394 {
6405 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 6395 LLUUID tid = AsyncCommands.
6406 m_Dataserver.RegisterRequest(m_localID, 6396 DataserverPlugin.RegisterRequest(m_localID,
6407 m_itemID, item.AssetID.ToString()); 6397 m_itemID, item.AssetID.ToString());
6408 if (NotecardCache.IsCached(item.AssetID)) 6398 if (NotecardCache.IsCached(item.AssetID))
6409 { 6399 {
6410 m_ScriptEngine.m_ASYNCLSLCommandManager. 6400 AsyncCommands.
6411 m_Dataserver.DataserverReply(item.AssetID.ToString(), 6401 DataserverPlugin.DataserverReply(item.AssetID.ToString(),
6412 NotecardCache.GetLine(item.AssetID, line)); 6402 NotecardCache.GetLine(item.AssetID, line));
6413 return tid.ToString(); 6403 return tid.ToString();
6414 } 6404 }
@@ -6419,8 +6409,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
6419 string data = enc.GetString(a.Data); 6409 string data = enc.GetString(a.Data);
6420 //Console.WriteLine(data); 6410 //Console.WriteLine(data);
6421 NotecardCache.Cache(id, data); 6411 NotecardCache.Cache(id, data);
6422 m_ScriptEngine.m_ASYNCLSLCommandManager. 6412 AsyncCommands.
6423 m_Dataserver.DataserverReply(id.ToString(), 6413 DataserverPlugin.DataserverReply(id.ToString(),
6424 NotecardCache.GetLine(id, line)); 6414 NotecardCache.GetLine(id, line));
6425 }); 6415 });
6426 6416
diff --git a/OpenSim/Region/ScriptEngine/XEngine/OSSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index bc4e8ba..dbb78a4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/OSSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,25 +31,25 @@ using Nini.Config;
31using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.ScriptEngine.XEngine.Script; 34using OpenSim.Region.ScriptEngine.Shared;
35using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
36using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
37using OpenSim.Region.ScriptEngine.Interfaces;
38using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
35 39
36namespace OpenSim.Region.ScriptEngine.XEngine 40namespace OpenSim.Region.ScriptEngine.Shared.Api
37{ 41{
38 [Serializable] 42 [Serializable]
39 public class OSSL_ScriptCommands : MarshalByRefObject, IOSSL_ScriptCommands 43 public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
40 { 44 {
41 internal XEngine m_ScriptEngine; 45 internal IScriptEngine m_ScriptEngine;
42 internal XScriptInstance m_Instance;
43 internal SceneObjectPart m_host; 46 internal SceneObjectPart m_host;
44 internal uint m_localID; 47 internal uint m_localID;
45 internal LLUUID m_itemID; 48 internal LLUUID m_itemID;
46 49
47 public OSSL_ScriptCommands(XEngine scriptEngine, 50 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
48 XScriptInstance instance, SceneObjectPart host,
49 uint localID, LLUUID itemID)
50 { 51 {
51 m_ScriptEngine = scriptEngine; 52 m_ScriptEngine = ScriptEngine;
52 m_Instance = instance;
53 m_host = host; 53 m_host = host;
54 m_localID = localID; 54 m_localID = localID;
55 m_itemID = itemID; 55 m_itemID = itemID;
@@ -62,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
62 62
63 public int osTerrainSetHeight(int x, int y, double val) 63 public int osTerrainSetHeight(int x, int y, double val)
64 { 64 {
65 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 65 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
66 { 66 {
67 OSSLError("osTerrainSetHeight: permission denied"); 67 OSSLError("osTerrainSetHeight: permission denied");
68 return 0; 68 return 0;
@@ -85,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
85 85
86 public double osTerrainGetHeight(int x, int y) 86 public double osTerrainGetHeight(int x, int y)
87 { 87 {
88 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 88 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
89 { 89 {
90 OSSLError("osTerrainGetHeight: permission denied"); 90 OSSLError("osTerrainGetHeight: permission denied");
91 return 0.0; 91 return 0.0;
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
100 100
101 public int osRegionRestart(double seconds) 101 public int osRegionRestart(double seconds)
102 { 102 {
103 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 103 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
104 { 104 {
105 OSSLError("osRegionRestart: permission denied"); 105 OSSLError("osRegionRestart: permission denied");
106 return 0; 106 return 0;
@@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
120 120
121 public void osRegionNotice(string msg) 121 public void osRegionNotice(string msg)
122 { 122 {
123 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 123 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
124 { 124 {
125 OSSLError("osRegionNotice: permission denied"); 125 OSSLError("osRegionNotice: permission denied");
126 return; 126 return;
@@ -132,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
132 132
133 public void osSetRot(LLUUID target, Quaternion rotation) 133 public void osSetRot(LLUUID target, Quaternion rotation)
134 { 134 {
135 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 135 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
136 { 136 {
137 OSSLError("osSetRot: permission denied"); 137 OSSLError("osSetRot: permission denied");
138 return; 138 return;
@@ -152,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
152 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, 152 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
153 int timer) 153 int timer)
154 { 154 {
155 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 155 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
156 { 156 {
157 OSSLError("osSetDynamicTextureURL: permission denied"); 157 OSSLError("osSetDynamicTextureURL: permission denied");
158 return String.Empty; 158 return String.Empty;
@@ -178,7 +178,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
178 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, 178 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
179 int timer, int alpha) 179 int timer, int alpha)
180 { 180 {
181 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 181 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
182 { 182 {
183 OSSLError("osSetDynamicTextureURLBlend: permission denied"); 183 OSSLError("osSetDynamicTextureURLBlend: permission denied");
184 return String.Empty; 184 return String.Empty;
@@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
204 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, 204 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
205 int timer) 205 int timer)
206 { 206 {
207 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 207 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
208 { 208 {
209 OSSLError("osSetDynamicTextureData: permission denied"); 209 OSSLError("osSetDynamicTextureData: permission denied");
210 return String.Empty; 210 return String.Empty;
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
233 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, 233 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
234 int timer, int alpha) 234 int timer, int alpha)
235 { 235 {
236 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 236 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
237 { 237 {
238 OSSLError("osSetDynamicTextureDataBlend: permission denied"); 238 OSSLError("osSetDynamicTextureDataBlend: permission denied");
239 return String.Empty; 239 return String.Empty;
@@ -262,7 +262,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
262 public bool osConsoleCommand(string command) 262 public bool osConsoleCommand(string command)
263 { 263 {
264 m_host.AddScriptLPS(1); 264 m_host.AddScriptLPS(1);
265 if (m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowosConsoleCommand", false)) 265 if (m_ScriptEngine.Config.GetBoolean("AllowosConsoleCommand", false))
266 { 266 {
267 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) 267 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
268 { 268 {
@@ -275,7 +275,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
275 } 275 }
276 public void osSetPrimFloatOnWater(int floatYN) 276 public void osSetPrimFloatOnWater(int floatYN)
277 { 277 {
278 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 278 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
279 { 279 {
280 OSSLError("osSetPrimFloatOnWater: permission denied"); 280 OSSLError("osSetPrimFloatOnWater: permission denied");
281 return; 281 return;
@@ -294,7 +294,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
294 // Adam's super super custom animation functions 294 // Adam's super super custom animation functions
295 public void osAvatarPlayAnimation(string avatar, string animation) 295 public void osAvatarPlayAnimation(string avatar, string animation)
296 { 296 {
297 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 297 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
298 { 298 {
299 OSSLError("osAvatarPlayAnimation: permission denied"); 299 OSSLError("osAvatarPlayAnimation: permission denied");
300 return; 300 return;
@@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
310 310
311 public void osAvatarStopAnimation(string avatar, string animation) 311 public void osAvatarStopAnimation(string avatar, string animation)
312 { 312 {
313 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 313 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
314 { 314 {
315 OSSLError("osAvatarStopAnimation: permission denied"); 315 OSSLError("osAvatarStopAnimation: permission denied");
316 return; 316 return;
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
327 //Texture draw functions 327 //Texture draw functions
328 public string osMovePen(string drawList, int x, int y) 328 public string osMovePen(string drawList, int x, int y)
329 { 329 {
330 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 330 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
331 { 331 {
332 OSSLError("osMovePen: permission denied"); 332 OSSLError("osMovePen: permission denied");
333 return String.Empty; 333 return String.Empty;
@@ -340,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
340 340
341 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) 341 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
342 { 342 {
343 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 343 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
344 { 344 {
345 OSSLError("osDrawLine: permission denied"); 345 OSSLError("osDrawLine: permission denied");
346 return String.Empty; 346 return String.Empty;
@@ -353,7 +353,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
353 353
354 public string osDrawLine(string drawList, int endX, int endY) 354 public string osDrawLine(string drawList, int endX, int endY)
355 { 355 {
356 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 356 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
357 { 357 {
358 OSSLError("osDrawLine: permission denied"); 358 OSSLError("osDrawLine: permission denied");
359 return String.Empty; 359 return String.Empty;
@@ -366,7 +366,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
366 366
367 public string osDrawText(string drawList, string text) 367 public string osDrawText(string drawList, string text)
368 { 368 {
369 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 369 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
370 { 370 {
371 OSSLError("osDrawText: permission denied"); 371 OSSLError("osDrawText: permission denied");
372 return String.Empty; 372 return String.Empty;
@@ -379,7 +379,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
379 379
380 public string osDrawEllipse(string drawList, int width, int height) 380 public string osDrawEllipse(string drawList, int width, int height)
381 { 381 {
382 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 382 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
383 { 383 {
384 OSSLError("osDrawEllipse: permission denied"); 384 OSSLError("osDrawEllipse: permission denied");
385 return String.Empty; 385 return String.Empty;
@@ -392,7 +392,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
392 392
393 public string osDrawRectangle(string drawList, int width, int height) 393 public string osDrawRectangle(string drawList, int width, int height)
394 { 394 {
395 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 395 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
396 { 396 {
397 OSSLError("osDrawRectangle: permission denied"); 397 OSSLError("osDrawRectangle: permission denied");
398 return String.Empty; 398 return String.Empty;
@@ -405,7 +405,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
405 405
406 public string osDrawFilledRectangle(string drawList, int width, int height) 406 public string osDrawFilledRectangle(string drawList, int width, int height)
407 { 407 {
408 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 408 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
409 { 409 {
410 OSSLError("osDrawFilledRectangle: permission denied"); 410 OSSLError("osDrawFilledRectangle: permission denied");
411 return String.Empty; 411 return String.Empty;
@@ -418,7 +418,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
418 418
419 public string osSetFontSize(string drawList, int fontSize) 419 public string osSetFontSize(string drawList, int fontSize)
420 { 420 {
421 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 421 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
422 { 422 {
423 OSSLError("osSetFontSize: permission denied"); 423 OSSLError("osSetFontSize: permission denied");
424 return String.Empty; 424 return String.Empty;
@@ -431,7 +431,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
431 431
432 public string osSetPenSize(string drawList, int penSize) 432 public string osSetPenSize(string drawList, int penSize)
433 { 433 {
434 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 434 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
435 { 435 {
436 OSSLError("osSetPenSize: permission denied"); 436 OSSLError("osSetPenSize: permission denied");
437 return String.Empty; 437 return String.Empty;
@@ -444,7 +444,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
444 444
445 public string osSetPenColour(string drawList, string colour) 445 public string osSetPenColour(string drawList, string colour)
446 { 446 {
447 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 447 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
448 { 448 {
449 OSSLError("osSetPenColour: permission denied"); 449 OSSLError("osSetPenColour: permission denied");
450 return String.Empty; 450 return String.Empty;
@@ -457,7 +457,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
457 457
458 public string osDrawImage(string drawList, int width, int height, string imageUrl) 458 public string osDrawImage(string drawList, int width, int height, string imageUrl)
459 { 459 {
460 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 460 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
461 { 461 {
462 OSSLError("osDrawImage: permission denied"); 462 OSSLError("osDrawImage: permission denied");
463 return String.Empty; 463 return String.Empty;
@@ -470,7 +470,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
470 470
471 public void osSetStateEvents(int events) 471 public void osSetStateEvents(int events)
472 { 472 {
473 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 473 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
474 { 474 {
475 OSSLError("osSetStateEvents: permission denied"); 475 OSSLError("osSetStateEvents: permission denied");
476 return; 476 return;
@@ -481,7 +481,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
481 481
482 public void osSetRegionWaterHeight(double height) 482 public void osSetRegionWaterHeight(double height)
483 { 483 {
484 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 484 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
485 { 485 {
486 OSSLError("osSetRegionWaterHeight: permission denied"); 486 OSSLError("osSetRegionWaterHeight: permission denied");
487 return; 487 return;
@@ -498,7 +498,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
498 498
499 public double osList2Double(LSL_Types.list src, int index) 499 public double osList2Double(LSL_Types.list src, int index)
500 { 500 {
501 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 501 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
502 { 502 {
503 OSSLError("osList2Double: permission denied"); 503 OSSLError("osList2Double: permission denied");
504 return 0.0; 504 return 0.0;
@@ -518,7 +518,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
518 518
519 public void osSetParcelMediaURL(string url) 519 public void osSetParcelMediaURL(string url)
520 { 520 {
521 if (!m_ScriptEngine.ScriptConfigSource.GetBoolean("AllowOSFunctions", false)) 521 if (!m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
522 { 522 {
523 OSSLError("osSetParcelMediaURL: permission denied"); 523 OSSLError("osSetParcelMediaURL: permission denied");
524 return; 524 return;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
index 47ab420..6c88ae86 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
@@ -29,9 +29,10 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Region.ScriptEngine.XEngine.Script; 32using OpenSim.Region.ScriptEngine.Shared;
33using OpenSim.Region.ScriptEngine.Shared.Api;
33 34
34namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 35namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
35{ 36{
36 public class Dataserver 37 public class Dataserver
37 { 38 {
@@ -94,10 +95,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
94 } 95 }
95 96
96 m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID, 97 m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID,
97 new XEventParams("dataserver", new Object[] 98 new EventParams("dataserver", new Object[]
98 { new LSL_Types.LSLString(ds.ID.ToString()), 99 { new LSL_Types.LSLString(ds.ID.ToString()),
99 new LSL_Types.LSLString(reply)}, 100 new LSL_Types.LSLString(reply)},
100 new XDetectParams[0])); 101 new DetectParams[0]));
101 } 102 }
102 103
103 public void RemoveEvents(uint localID, LLUUID itemID) 104 public void RemoveEvents(uint localID, LLUUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs
index 089e016..92f603d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs
@@ -28,9 +28,11 @@
28using System; 28using System;
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Modules.Scripting.HttpRequest; 30using OpenSim.Region.Environment.Modules.Scripting.HttpRequest;
31using OpenSim.Region.ScriptEngine.XEngine.Script; 31using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Region.ScriptEngine.Interfaces;
33using OpenSim.Region.ScriptEngine.Shared.Api;
32 34
33namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 35namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
34{ 36{
35 public class HttpRequest 37 public class HttpRequest
36 { 38 {
@@ -75,11 +77,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
75 new LSL_Types.LSLString(httpInfo.response_body) 77 new LSL_Types.LSLString(httpInfo.response_body)
76 }; 78 };
77 79
78 foreach (XEngine xe in XEngine.ScriptEngines) 80 foreach (AsyncCommandManager m in m_CmdManager.Managers)
79 { 81 {
80 if (xe.PostObjectEvent(httpInfo.localID, 82 if (m.m_ScriptEngine.PostObjectEvent(httpInfo.localID,
81 new XEventParams("http_response", 83 new EventParams("http_response",
82 resobj, new XDetectParams[0]))) 84 resobj, new DetectParams[0])))
83 break; 85 break;
84 } 86 }
85 httpInfo = iHttpReq.GetNextCompletedRequest(); 87 httpInfo = iHttpReq.GetNextCompletedRequest();
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index 1144c00..11b45b1 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -29,9 +29,10 @@ using System;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Modules.Scripting.WorldComm; 31using OpenSim.Region.Environment.Modules.Scripting.WorldComm;
32using OpenSim.Region.ScriptEngine.XEngine.Script; 32using OpenSim.Region.ScriptEngine.Shared;
33using OpenSim.Region.ScriptEngine.Shared.Api;
33 34
34namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 35namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
35{ 36{
36 public class Listener 37 public class Listener
37 { 38 {
@@ -66,9 +67,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
66 }; 67 };
67 68
68 m_CmdManager.m_ScriptEngine.PostScriptEvent( 69 m_CmdManager.m_ScriptEngine.PostScriptEvent(
69 lInfo.GetItemID(), new XEventParams( 70 lInfo.GetItemID(), new EventParams(
70 "listen", resobj, 71 "listen", resobj,
71 new XDetectParams[0])); 72 new DetectParams[0]));
72 } 73 }
73 } 74 }
74 } 75 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 8a25098..5833512 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -30,9 +30,10 @@ using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33using OpenSim.Region.ScriptEngine.XEngine.Script; 33using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.Region.ScriptEngine.Shared.Api;
34 35
35namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 36namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
36{ 37{
37 public class SensorRepeat 38 public class SensorRepeat
38 { 39 {
@@ -72,8 +73,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
72 string name, LLUUID keyID, int type, double range, 73 string name, LLUUID keyID, int type, double range,
73 double arc, double sec, SceneObjectPart host) 74 double arc, double sec, SceneObjectPart host)
74 { 75 {
75 Console.WriteLine("SetSensorEvent");
76
77 // Always remove first, in case this is a re-set 76 // Always remove first, in case this is a re-set
78 UnSetSenseRepeaterEvents(m_localID, m_itemID); 77 UnSetSenseRepeaterEvents(m_localID, m_itemID);
79 if (sec == 0) // Disabling timer 78 if (sec == 0) // Disabling timer
@@ -163,7 +162,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
163 Dictionary<LLUUID, LSL_Types.list> Obj = null; 162 Dictionary<LLUUID, LSL_Types.list> Obj = null;
164 if (!SenseEvents.TryGetValue(m_localID, out Obj)) 163 if (!SenseEvents.TryGetValue(m_localID, out Obj))
165 { 164 {
166 m_CmdManager.m_ScriptEngine.Log.Info("[AsyncLSL]: GetSensorList missing localID: " + m_localID);
167 return null; 165 return null;
168 } 166 }
169 lock (Obj) 167 lock (Obj)
@@ -172,7 +170,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
172 LSL_Types.list SenseList = null; 170 LSL_Types.list SenseList = null;
173 if (!Obj.TryGetValue(m_itemID, out SenseList)) 171 if (!Obj.TryGetValue(m_itemID, out SenseList))
174 { 172 {
175 m_CmdManager.m_ScriptEngine.Log.Info("[AsyncLSL]: GetSensorList missing itemID: " + m_itemID);
176 return null; 173 return null;
177 } 174 }
178 return SenseList; 175 return SenseList;
@@ -182,15 +179,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
182 179
183 private void SensorSweep(SenseRepeatClass ts) 180 private void SensorSweep(SenseRepeatClass ts)
184 { 181 {
185 //m_ScriptEngine.Log.Info("[AsyncLSL]:Enter SensorSweep");
186 SceneObjectPart SensePoint = ts.host; 182 SceneObjectPart SensePoint = ts.host;
187 183
188 if (SensePoint == null) 184 if (SensePoint == null)
189 { 185 {
190 //m_ScriptEngine.Log.Info("[AsyncLSL]: Enter SensorSweep (SensePoint == null) for "+ts.itemID.ToString());
191 return; 186 return;
192 } 187 }
193 //m_ScriptEngine.Log.Info("[AsyncLSL]: Enter SensorSweep Scan");
194 188
195 LLVector3 sensorPos = SensePoint.AbsolutePosition; 189 LLVector3 sensorPos = SensePoint.AbsolutePosition;
196 LLVector3 regionPos = new LLVector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0); 190 LLVector3 regionPos = new LLVector3(m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocX * Constants.RegionSize, m_CmdManager.m_ScriptEngine.World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
@@ -220,7 +214,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
220 objtype |= 0x04; // passive non-moving 214 objtype |= 0x04; // passive non-moving
221 else 215 else
222 objtype |= 0x02; // active moving 216 objtype |= 0x02; // active moving
223 if (ent is IScript) objtype |= 0x08; // Scripted. It COULD have one hidden ... 217
218 SceneObjectPart part = m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(ent.UUID);
219
220 if (part != null && part.ContainsScripts()) objtype |= 0x08; // Scripted. It COULD have one hidden ...
224 221
225 if (((ts.type & objtype) != 0) || ((ts.type & objtype) == ts.type)) 222 if (((ts.type & objtype) != 0) || ((ts.type & objtype) == ts.type))
226 { 223 {
@@ -288,7 +285,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
288 } 285 }
289 } 286 }
290 } 287 }
291 //m_ScriptEngine.Log.Info("[AsyncLSL]: Enter SensorSweep SenseLock");
292 288
293 lock (SenseLock) 289 lock (SenseLock)
294 { 290 {
@@ -311,24 +307,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
311 // send a "no_sensor" 307 // send a "no_sensor"
312 // Add it to queue 308 // Add it to queue
313 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, 309 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
314 new XEventParams("no_sensor", new Object[0], 310 new EventParams("no_sensor", new Object[0],
315 new XDetectParams[0])); 311 new DetectParams[0]));
316 } 312 }
317 else 313 else
318 { 314 {
319 XDetectParams[] detect = 315 DetectParams[] detect =
320 new XDetectParams[SensedObjects.Length]; 316 new DetectParams[SensedObjects.Length];
321 317
322 int idx; 318 int idx;
323 for (idx = 0; idx < SensedObjects.Length; idx++) 319 for (idx = 0; idx < SensedObjects.Length; idx++)
324 { 320 {
325 detect[idx] = new XDetectParams(); 321 detect[idx] = new DetectParams();
326 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]); 322 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]);
327 detect[idx].Populate(m_CmdManager.m_ScriptEngine.World); 323 detect[idx].Populate(m_CmdManager.m_ScriptEngine.World);
328 } 324 }
329 325
330 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, 326 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
331 new XEventParams("sensor", 327 new EventParams("sensor",
332 new Object[] { 328 new Object[] {
333 new LSL_Types.LSLInteger(SensedObjects.Length) }, 329 new LSL_Types.LSLInteger(SensedObjects.Length) },
334 detect)); 330 detect));
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index 3dd875a..36e992b 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -29,8 +29,9 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Region.ScriptEngine.Shared.Api;
32 33
33namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 34namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
34{ 35{
35 public class Timer 36 public class Timer
36 { 37 {
@@ -110,8 +111,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
110 // Console.WriteLine("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next); 111 // Console.WriteLine("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
111 // Add it to queue 112 // Add it to queue
112 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, 113 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
113 new XEventParams("timer", new Object[0], 114 new EventParams("timer", new Object[0],
114 new XDetectParams[0])); 115 new DetectParams[0]));
115 // set next interval 116 // set next interval
116 117
117 //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 118 //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs
index 288349e..89bf51c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs
@@ -28,9 +28,11 @@
28using System; 28using System;
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Modules.Scripting.XMLRPC; 30using OpenSim.Region.Environment.Modules.Scripting.XMLRPC;
31using OpenSim.Region.ScriptEngine.XEngine.Script; 31using OpenSim.Region.ScriptEngine.Interfaces;
32using OpenSim.Region.ScriptEngine.Shared;
33using OpenSim.Region.ScriptEngine.Shared.Api;
32 34
33namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins 35namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
34{ 36{
35 public class XmlRequest 37 public class XmlRequest
36 { 38 {
@@ -69,12 +71,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
69 new LSL_Types.LSLString(rInfo.GetStrVal()) 71 new LSL_Types.LSLString(rInfo.GetStrVal())
70 }; 72 };
71 73
72 foreach (XEngine xe in XEngine.ScriptEngines) 74 foreach (AsyncCommandManager m in m_CmdManager.Managers)
73 { 75 {
74 if (xe.PostScriptEvent( 76 if (m.m_ScriptEngine.PostScriptEvent(
75 rInfo.GetItemID(), new XEventParams( 77 rInfo.GetItemID(), new EventParams(
76 "remote_data", resobj, 78 "remote_data", resobj,
77 new XDetectParams[0]))) 79 new DetectParams[0])))
78 break; 80 break;
79 } 81 }
80 82
@@ -98,12 +100,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
98 new LSL_Types.LSLString(srdInfo.sdata) 100 new LSL_Types.LSLString(srdInfo.sdata)
99 }; 101 };
100 102
101 foreach (XEngine xe in XEngine.ScriptEngines) 103 foreach (AsyncCommandManager m in m_CmdManager.Managers)
102 { 104 {
103 if (xe.PostScriptEvent( 105 if (m.m_ScriptEngine.PostScriptEvent(
104 srdInfo.m_itemID, new XEventParams( 106 srdInfo.m_itemID, new EventParams(
105 "remote_data", resobj, 107 "remote_data", resobj,
106 new XDetectParams[0]))) 108 new DetectParams[0])))
107 break; 109 break;
108 } 110 }
109 111
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/ILSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 9e8965c..75672a1 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/ILSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -25,20 +25,16 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using OpenSim.Region.Environment.Interfaces; 28using System;
29using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
30using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
29 31
30namespace OpenSim.Region.ScriptEngine.XEngine.Script 32
33namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
31{ 34{
32 public interface ILSL_ScriptCommands 35 public interface ILSL_Api
33 { 36 {
34 // Interface used for loading and executing scripts
35
36 string State { get; set ; }
37
38 void state(string newState); 37 void state(string newState);
39
40 ICommander GetCommander(string name);
41
42 void llSay(int channelID, string text); 38 void llSay(int channelID, string text);
43 double llSin(double f); 39 double llSin(double f);
44 double llCos(double f); 40 double llCos(double f);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/IOSSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 82d4673..1e14c63 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/IOSSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -25,9 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Region.ScriptEngine.XEngine.Script 28namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
29{ 29{
30 public interface IOSSL_ScriptCommands 30 public interface IOSSL_Api
31 { 31 {
32 //OpenSim functions 32 //OpenSim functions
33 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); 33 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index fc9f8fc..7b3907f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -31,100 +31,25 @@ using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using System.Collections; 32using System.Collections;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.ScriptEngine.Interfaces;
35using integer = OpenSim.Region.ScriptEngine.XEngine.Script.LSL_Types.LSLInteger; 35using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
36using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
36using key = System.String; 37using key = System.String;
37using vector = OpenSim.Region.ScriptEngine.XEngine.Script.LSL_Types.Vector3; 38using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
38using rotation = OpenSim.Region.ScriptEngine.XEngine.Script.LSL_Types.Quaternion; 39using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
39 40
40namespace OpenSim.Region.ScriptEngine.XEngine.Script 41namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
41{ 42{
42 public class BuiltIn_Commands_BaseClass : MarshalByRefObject, IOSSL_ScriptCommands, ILSL_ScriptCommands, IScript 43 public partial class ScriptBaseClass : MarshalByRefObject
43 { 44 {
44 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 public ILSL_Api m_LSL_Functions;
45 46
46 // Object never expires 47 public void ApiTypeLSL(IScriptApi api)
47 public override Object InitializeLifetimeService()
48 { 48 {
49 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); 49 if(!(api is ILSL_Api))
50 // return null; 50 return;
51 ILease lease = (ILease)base.InitializeLifetimeService();
52 51
53 if (lease.CurrentState == LeaseState.Initial) 52 m_LSL_Functions = (ILSL_Api)api;
54 {
55 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
56 //lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
57 //lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
58 }
59 return lease;
60 }
61
62 public ILSL_ScriptCommands m_LSL_Functions;
63 public IOSSL_ScriptCommands m_OSSL_Functions;
64
65 public BuiltIn_Commands_BaseClass()
66 {
67 }
68
69 public Type Start(ILSL_ScriptCommands LSL_Functions, IOSSL_ScriptCommands OSSL_Functions)
70 {
71 m_LSL_Functions = LSL_Functions;
72 m_OSSL_Functions = OSSL_Functions;
73 m_InitialValues=GetVars();
74 return GetType();
75 }
76
77 private Dictionary<string, object> m_InitialValues =
78 new Dictionary<string, object>();
79 private Dictionary<string, FieldInfo> m_Fields =
80 new Dictionary<string, FieldInfo>();
81
82 public Dictionary<string, object> GetVars()
83 {
84 Dictionary<string, object> vars = new Dictionary<string, object>();
85
86 if (m_Fields == null)
87 return vars;
88
89 m_Fields.Clear();
90
91 Type t = GetType();
92
93 FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic |
94 BindingFlags.Public |
95 BindingFlags.Instance |
96 BindingFlags.DeclaredOnly);
97
98 foreach (FieldInfo field in fields)
99 {
100 m_Fields[field.Name]=field;
101
102 vars[field.Name]=field.GetValue(this);
103 }
104
105 return vars;
106 }
107
108 public void SetVars(Dictionary<string, object> vars)
109 {
110 foreach (KeyValuePair<string, object> var in vars)
111 {
112 if (m_Fields.ContainsKey(var.Key))
113 {
114 m_Fields[var.Key].SetValue(this, var.Value);
115 }
116 }
117 }
118
119 public void ResetVars()
120 {
121 SetVars(m_InitialValues);
122 }
123
124 public string State
125 {
126 get { return m_LSL_Functions.State; }
127 set { m_LSL_Functions.State = value; }
128 } 53 }
129 54
130 public void state(string newState) 55 public void state(string newState)
@@ -132,26 +57,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
132 m_LSL_Functions.state(newState); 57 m_LSL_Functions.state(newState);
133 } 58 }
134 59
135 public void llSay(int channelID, string text)
136 {
137 m_LSL_Functions.llSay(channelID, text);
138 }
139
140 //
141 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
142 // 60 //
143 // They are only forwarders to LSL_BuiltIn_Commands.cs 61 // Script functions
144 // 62 //
145 63 public void llSay(int channelID, string text)
146 public ICommander GetCommander(string name)
147 { 64 {
148 return m_LSL_Functions.GetCommander(name); 65 m_LSL_Functions.llSay(channelID, text);
149 } 66 }
150 67
151 public double llSin(double f) 68 public double llSin(double f)
152 { 69 {
153 return m_LSL_Functions.llSin(f); 70 return m_LSL_Functions.llSin(f);
154 } 71 }
72
155 public double llCos(double f) 73 public double llCos(double f)
156 { 74 {
157 return m_LSL_Functions.llCos(f); 75 return m_LSL_Functions.llCos(f);
@@ -262,9 +180,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
262 m_LSL_Functions.llWhisper(channelID, text); 180 m_LSL_Functions.llWhisper(channelID, text);
263 } 181 }
264 182
265 //
266 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
267 //
268 public void llShout(int channelID, string text) 183 public void llShout(int channelID, string text)
269 { 184 {
270 m_LSL_Functions.llShout(channelID, text); 185 m_LSL_Functions.llShout(channelID, text);
@@ -355,9 +270,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
355 return m_LSL_Functions.llDetectedLinkNumber(number); 270 return m_LSL_Functions.llDetectedLinkNumber(number);
356 } 271 }
357 272
358 //
359 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
360 //
361 public void llDie() 273 public void llDie()
362 { 274 {
363 m_LSL_Functions.llDie(); 275 m_LSL_Functions.llDie();
@@ -443,9 +355,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
443 return m_LSL_Functions.llGetTexture(face); 355 return m_LSL_Functions.llGetTexture(face);
444 } 356 }
445 357
446 //
447 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
448 //
449 public void llSetPos(vector pos) 358 public void llSetPos(vector pos)
450 { 359 {
451 m_LSL_Functions.llSetPos(pos); 360 m_LSL_Functions.llSetPos(pos);
@@ -521,9 +430,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
521 m_LSL_Functions.llApplyImpulse(force, local); 430 m_LSL_Functions.llApplyImpulse(force, local);
522 } 431 }
523 432
524 //
525 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
526 //
527 public void llApplyRotationalImpulse(vector force, int local) 433 public void llApplyRotationalImpulse(vector force, int local)
528 { 434 {
529 m_LSL_Functions.llApplyRotationalImpulse(force, local); 435 m_LSL_Functions.llApplyRotationalImpulse(force, local);
@@ -614,9 +520,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
614 m_LSL_Functions.llPlaySoundSlave(sound, volume); 520 m_LSL_Functions.llPlaySoundSlave(sound, volume);
615 } 521 }
616 522
617 //
618 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
619 //
620 public void llTriggerSound(string sound, double volume) 523 public void llTriggerSound(string sound, double volume)
621 { 524 {
622 m_LSL_Functions.llTriggerSound(sound, volume); 525 m_LSL_Functions.llTriggerSound(sound, volume);
@@ -707,9 +610,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
707 m_LSL_Functions.llSleep(sec); 610 m_LSL_Functions.llSleep(sec);
708 } 611 }
709 612
710 //
711 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
712 //
713 public double llGetMass() 613 public double llGetMass()
714 { 614 {
715 return m_LSL_Functions.llGetMass(); 615 return m_LSL_Functions.llGetMass();
@@ -805,9 +705,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
805 m_LSL_Functions.llRotLookAt(target, strength, damping); 705 m_LSL_Functions.llRotLookAt(target, strength, damping);
806 } 706 }
807 707
808 //
809 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
810 //
811 public LSL_Types.LSLInteger llStringLength(string str) 708 public LSL_Types.LSLInteger llStringLength(string str)
812 { 709 {
813 return m_LSL_Functions.llStringLength(str); 710 return m_LSL_Functions.llStringLength(str);
@@ -908,9 +805,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
908 return m_LSL_Functions.llGetInventoryName(type, number); 805 return m_LSL_Functions.llGetInventoryName(type, number);
909 } 806 }
910 807
911 //
912 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
913 //
914 public void llSetScriptState(string name, int run) 808 public void llSetScriptState(string name, int run)
915 { 809 {
916 m_LSL_Functions.llSetScriptState(name, run); 810 m_LSL_Functions.llSetScriptState(name, run);
@@ -1016,9 +910,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1016 return m_LSL_Functions.llGetNumberOfSides(); 910 return m_LSL_Functions.llGetNumberOfSides();
1017 } 911 }
1018 912
1019 //
1020 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1021 //
1022 public rotation llAxisAngle2Rot(vector axis, double angle) 913 public rotation llAxisAngle2Rot(vector axis, double angle)
1023 { 914 {
1024 return m_LSL_Functions.llAxisAngle2Rot(axis, angle); 915 return m_LSL_Functions.llAxisAngle2Rot(axis, angle);
@@ -1104,9 +995,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1104 return m_LSL_Functions.llGetListLength(src); 995 return m_LSL_Functions.llGetListLength(src);
1105 } 996 }
1106 997
1107 //
1108 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1109 //
1110 public LSL_Types.LSLInteger llList2Integer(LSL_Types.list src, int index) 998 public LSL_Types.LSLInteger llList2Integer(LSL_Types.list src, int index)
1111 { 999 {
1112 return m_LSL_Functions.llList2Integer(src, index); 1000 return m_LSL_Functions.llList2Integer(src, index);
@@ -1207,9 +1095,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1207 return m_LSL_Functions.llGetAgentInfo(id); 1095 return m_LSL_Functions.llGetAgentInfo(id);
1208 } 1096 }
1209 1097
1210 //
1211 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1212 //
1213 public void llAdjustSoundVolume(double volume) 1098 public void llAdjustSoundVolume(double volume)
1214 { 1099 {
1215 m_LSL_Functions.llAdjustSoundVolume(volume); 1100 m_LSL_Functions.llAdjustSoundVolume(volume);
@@ -1320,9 +1205,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1320 return m_LSL_Functions.llGetRegionFPS(); 1205 return m_LSL_Functions.llGetRegionFPS();
1321 } 1206 }
1322 1207
1323 //
1324 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1325 //
1326 public void llParticleSystem(LSL_Types.list rules) 1208 public void llParticleSystem(LSL_Types.list rules)
1327 { 1209 {
1328 m_LSL_Functions.llParticleSystem(rules); 1210 m_LSL_Functions.llParticleSystem(rules);
@@ -1453,9 +1335,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1453 m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); 1335 m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param);
1454 } 1336 }
1455 1337
1456 //
1457 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1458 //
1459 public void llOpenRemoteDataChannel() 1338 public void llOpenRemoteDataChannel()
1460 { 1339 {
1461 m_LSL_Functions.llOpenRemoteDataChannel(); 1340 m_LSL_Functions.llOpenRemoteDataChannel();
@@ -1590,9 +1469,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1590 return m_LSL_Functions.llGetPrimitiveParams(rules); 1469 return m_LSL_Functions.llGetPrimitiveParams(rules);
1591 } 1470 }
1592 1471
1593 //
1594 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1595 //
1596 public string llIntegerToBase64(int number) 1472 public string llIntegerToBase64(int number)
1597 { 1473 {
1598 return m_LSL_Functions.llIntegerToBase64(number); 1474 return m_LSL_Functions.llIntegerToBase64(number);
@@ -1698,9 +1574,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1698 return m_LSL_Functions.llModPow(a, b, c); 1574 return m_LSL_Functions.llModPow(a, b, c);
1699 } 1575 }
1700 1576
1701 //
1702 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1703 //
1704 public LSL_Types.LSLInteger llGetInventoryType(string name) 1577 public LSL_Types.LSLInteger llGetInventoryType(string name)
1705 { 1578 {
1706 return m_LSL_Functions.llGetInventoryType(name); 1579 return m_LSL_Functions.llGetInventoryType(name);
@@ -1826,9 +1699,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1826 return m_LSL_Functions.llGetObjectPrimCount(object_id); 1699 return m_LSL_Functions.llGetObjectPrimCount(object_id);
1827 } 1700 }
1828 1701
1829 //
1830 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1831 //
1832 public LSL_Types.LSLInteger llGetParcelMaxPrims(vector pos, int sim_wide) 1702 public LSL_Types.LSLInteger llGetParcelMaxPrims(vector pos, int sim_wide)
1833 { 1703 {
1834 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); 1704 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
@@ -1858,540 +1728,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1858 { 1728 {
1859 return m_LSL_Functions.llList2Float(src, index); 1729 return m_LSL_Functions.llList2Float(src, index);
1860 } 1730 }
1861
1862 // LSL CONSTANTS
1863 public const int TRUE = 1;
1864 public const int FALSE = 0;
1865
1866 public const int STATUS_PHYSICS = 1;
1867 public const int STATUS_ROTATE_X = 2;
1868 public const int STATUS_ROTATE_Y = 4;
1869 public const int STATUS_ROTATE_Z = 8;
1870 public const int STATUS_PHANTOM = 16;
1871 public const int STATUS_SANDBOX = 32;
1872 public const int STATUS_BLOCK_GRAB = 64;
1873 public const int STATUS_DIE_AT_EDGE = 128;
1874 public const int STATUS_RETURN_AT_EDGE = 256;
1875 public const int STATUS_CAST_SHADOWS = 512;
1876
1877 public const int AGENT = 1;
1878 public const int ACTIVE = 2;
1879 public const int PASSIVE = 4;
1880 public const int SCRIPTED = 8;
1881
1882 public const int CONTROL_FWD = 1;
1883 public const int CONTROL_BACK = 2;
1884 public const int CONTROL_LEFT = 4;
1885 public const int CONTROL_RIGHT = 8;
1886 public const int CONTROL_UP = 16;
1887 public const int CONTROL_DOWN = 32;
1888 public const int CONTROL_ROT_LEFT = 256;
1889 public const int CONTROL_ROT_RIGHT = 512;
1890 public const int CONTROL_LBUTTON = 268435456;
1891 public const int CONTROL_ML_LBUTTON = 1073741824;
1892
1893 //Permissions
1894 public const int PERMISSION_DEBIT = 2;
1895 public const int PERMISSION_TAKE_CONTROLS = 4;
1896 public const int PERMISSION_REMAP_CONTROLS = 8;
1897 public const int PERMISSION_TRIGGER_ANIMATION = 16;
1898 public const int PERMISSION_ATTACH = 32;
1899 public const int PERMISSION_RELEASE_OWNERSHIP = 64;
1900 public const int PERMISSION_CHANGE_LINKS = 128;
1901 public const int PERMISSION_CHANGE_JOINTS = 256;
1902 public const int PERMISSION_CHANGE_PERMISSIONS = 512;
1903 public const int PERMISSION_TRACK_CAMERA = 1024;
1904
1905 public const int AGENT_FLYING = 1;
1906 public const int AGENT_ATTACHMENTS = 2;
1907 public const int AGENT_SCRIPTED = 4;
1908 public const int AGENT_MOUSELOOK = 8;
1909 public const int AGENT_SITTING = 16;
1910 public const int AGENT_ON_OBJECT = 32;
1911 public const int AGENT_AWAY = 64;
1912 public const int AGENT_WALKING = 128;
1913 public const int AGENT_IN_AIR = 256;
1914 public const int AGENT_TYPING = 512;
1915 public const int AGENT_CROUCHING = 1024;
1916 public const int AGENT_BUSY = 2048;
1917 public const int AGENT_ALWAYS_RUN = 4096;
1918
1919 //Particle Systems
1920 public const int PSYS_PART_INTERP_COLOR_MASK = 1;
1921 public const int PSYS_PART_INTERP_SCALE_MASK = 2;
1922 public const int PSYS_PART_BOUNCE_MASK = 4;
1923 public const int PSYS_PART_WIND_MASK = 8;
1924 public const int PSYS_PART_FOLLOW_SRC_MASK = 16;
1925 public const int PSYS_PART_FOLLOW_VELOCITY_MASK = 32;
1926 public const int PSYS_PART_TARGET_POS_MASK = 64;
1927 public const int PSYS_PART_TARGET_LINEAR_MASK = 128;
1928 public const int PSYS_PART_EMISSIVE_MASK = 256;
1929 public const int PSYS_PART_FLAGS = 0;
1930 public const int PSYS_PART_START_COLOR = 1;
1931 public const int PSYS_PART_START_ALPHA = 2;
1932 public const int PSYS_PART_END_COLOR = 3;
1933 public const int PSYS_PART_END_ALPHA = 4;
1934 public const int PSYS_PART_START_SCALE = 5;
1935 public const int PSYS_PART_END_SCALE = 6;
1936 public const int PSYS_PART_MAX_AGE = 7;
1937 public const int PSYS_SRC_ACCEL = 8;
1938 public const int PSYS_SRC_PATTERN = 9;
1939 public const int PSYS_SRC_INNERANGLE = 10;
1940 public const int PSYS_SRC_OUTERANGLE = 11;
1941 public const int PSYS_SRC_TEXTURE = 12;
1942 public const int PSYS_SRC_BURST_RATE = 13;
1943 public const int PSYS_SRC_BURST_PART_COUNT = 15;
1944 public const int PSYS_SRC_BURST_RADIUS = 16;
1945 public const int PSYS_SRC_BURST_SPEED_MIN = 17;
1946 public const int PSYS_SRC_BURST_SPEED_MAX = 18;
1947 public const int PSYS_SRC_MAX_AGE = 19;
1948 public const int PSYS_SRC_TARGET_KEY = 20;
1949 public const int PSYS_SRC_OMEGA = 21;
1950 public const int PSYS_SRC_ANGLE_BEGIN = 22;
1951 public const int PSYS_SRC_ANGLE_END = 23;
1952 public const int PSYS_SRC_PATTERN_DROP = 1;
1953 public const int PSYS_SRC_PATTERN_EXPLODE = 2;
1954 public const int PSYS_SRC_PATTERN_ANGLE = 4;
1955 public const int PSYS_SRC_PATTERN_ANGLE_CONE = 8;
1956 public const int PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY = 16;
1957
1958 public const int VEHICLE_TYPE_NONE = 0;
1959 public const int VEHICLE_TYPE_SLED = 1;
1960 public const int VEHICLE_TYPE_CAR = 2;
1961 public const int VEHICLE_TYPE_BOAT = 3;
1962 public const int VEHICLE_TYPE_AIRPLANE = 4;
1963 public const int VEHICLE_TYPE_BALLOON = 5;
1964 public const int VEHICLE_LINEAR_FRICTION_TIMESCALE = 16;
1965 public const int VEHICLE_ANGULAR_FRICTION_TIMESCALE = 17;
1966 public const int VEHICLE_LINEAR_MOTOR_DIRECTION = 18;
1967 public const int VEHICLE_LINEAR_MOTOR_OFFSET = 20;
1968 public const int VEHICLE_ANGULAR_MOTOR_DIRECTION = 19;
1969 public const int VEHICLE_HOVER_HEIGHT = 24;
1970 public const int VEHICLE_HOVER_EFFICIENCY = 25;
1971 public const int VEHICLE_HOVER_TIMESCALE = 26;
1972 public const int VEHICLE_BUOYANCY = 27;
1973 public const int VEHICLE_LINEAR_DEFLECTION_EFFICIENCY = 28;
1974 public const int VEHICLE_LINEAR_DEFLECTION_TIMESCALE = 29;
1975 public const int VEHICLE_LINEAR_MOTOR_TIMESCALE = 30;
1976 public const int VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE = 31;
1977 public const int VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY = 32;
1978 public const int VEHICLE_ANGULAR_DEFLECTION_TIMESCALE = 33;
1979 public const int VEHICLE_ANGULAR_MOTOR_TIMESCALE = 34;
1980 public const int VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE = 35;
1981 public const int VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY = 36;
1982 public const int VEHICLE_VERTICAL_ATTRACTION_TIMESCALE = 37;
1983 public const int VEHICLE_BANKING_EFFICIENCY = 38;
1984 public const int VEHICLE_BANKING_MIX = 39;
1985 public const int VEHICLE_BANKING_TIMESCALE = 40;
1986 public const int VEHICLE_REFERENCE_FRAME = 44;
1987 public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1;
1988 public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2;
1989 public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4;
1990 public const int VEHICLE_FLAG_HOVER_TERRAIN_ONLY = 8;
1991 public const int VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT = 16;
1992 public const int VEHICLE_FLAG_HOVER_UP_ONLY = 32;
1993 public const int VEHICLE_FLAG_LIMIT_MOTOR_UP = 64;
1994 public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128;
1995 public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256;
1996 public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512;
1997
1998 public const int INVENTORY_ALL = -1;
1999 public const int INVENTORY_NONE = -1;
2000 public const int INVENTORY_TEXTURE = 0;
2001 public const int INVENTORY_SOUND = 1;
2002 public const int INVENTORY_LANDMARK = 3;
2003 public const int INVENTORY_CLOTHING = 5;
2004 public const int INVENTORY_OBJECT = 6;
2005 public const int INVENTORY_NOTECARD = 7;
2006 public const int INVENTORY_SCRIPT = 10;
2007 public const int INVENTORY_BODYPART = 13;
2008 public const int INVENTORY_ANIMATION = 20;
2009 public const int INVENTORY_GESTURE = 21;
2010
2011 public const int ATTACH_CHEST = 1;
2012 public const int ATTACH_HEAD = 2;
2013 public const int ATTACH_LSHOULDER = 3;
2014 public const int ATTACH_RSHOULDER = 4;
2015 public const int ATTACH_LHAND = 5;
2016 public const int ATTACH_RHAND = 6;
2017 public const int ATTACH_LFOOT = 7;
2018 public const int ATTACH_RFOOT = 8;
2019 public const int ATTACH_BACK = 9;
2020 public const int ATTACH_PELVIS = 10;
2021 public const int ATTACH_MOUTH = 11;
2022 public const int ATTACH_CHIN = 12;
2023 public const int ATTACH_LEAR = 13;
2024 public const int ATTACH_REAR = 14;
2025 public const int ATTACH_LEYE = 15;
2026 public const int ATTACH_REYE = 16;
2027 public const int ATTACH_NOSE = 17;
2028 public const int ATTACH_RUARM = 18;
2029 public const int ATTACH_RLARM = 19;
2030 public const int ATTACH_LUARM = 20;
2031 public const int ATTACH_LLARM = 21;
2032 public const int ATTACH_RHIP = 22;
2033 public const int ATTACH_RULEG = 23;
2034 public const int ATTACH_RLLEG = 24;
2035 public const int ATTACH_LHIP = 25;
2036 public const int ATTACH_LULEG = 26;
2037 public const int ATTACH_LLLEG = 27;
2038 public const int ATTACH_BELLY = 28;
2039 public const int ATTACH_RPEC = 29;
2040 public const int ATTACH_LPEC = 30;
2041
2042 public const int LAND_LEVEL = 0;
2043 public const int LAND_RAISE = 1;
2044 public const int LAND_LOWER = 2;
2045 public const int LAND_SMOOTH = 3;
2046 public const int LAND_NOISE = 4;
2047 public const int LAND_REVERT = 5;
2048 public const int LAND_SMALL_BRUSH = 1;
2049 public const int LAND_MEDIUM_BRUSH = 2;
2050 public const int LAND_LARGE_BRUSH = 3;
2051
2052 //Agent Dataserver
2053 public const int DATA_ONLINE = 1;
2054 public const int DATA_NAME = 2;
2055 public const int DATA_BORN = 3;
2056 public const int DATA_RATING = 4;
2057 public const int DATA_SIM_POS = 5;
2058 public const int DATA_SIM_STATUS = 6;
2059 public const int DATA_SIM_RATING = 7;
2060 public const int DATA_PAYINFO = 8;
2061
2062 public const int ANIM_ON = 1;
2063 public const int LOOP = 2;
2064 public const int REVERSE = 4;
2065 public const int PING_PONG = 8;
2066 public const int SMOOTH = 16;
2067 public const int ROTATE = 32;
2068 public const int SCALE = 64;
2069 public const int ALL_SIDES = -1;
2070 public const int LINK_SET = -1;
2071 public const int LINK_ROOT = 1;
2072 public const int LINK_ALL_OTHERS = -2;
2073 public const int LINK_ALL_CHILDREN = -3;
2074 public const int LINK_THIS = -4;
2075 public const int CHANGED_INVENTORY = 1;
2076 public const int CHANGED_COLOR = 2;
2077 public const int CHANGED_SHAPE = 4;
2078 public const int CHANGED_SCALE = 8;
2079 public const int CHANGED_TEXTURE = 16;
2080 public const int CHANGED_LINK = 32;
2081 public const int CHANGED_ALLOWED_DROP = 64;
2082 public const int CHANGED_OWNER = 128;
2083 public const int CHANGED_REGION_RESTART = 256;
2084 public const int TYPE_INVALID = 0;
2085 public const int TYPE_INTEGER = 1;
2086 public const int TYPE_double = 2;
2087 public const int TYPE_STRING = 3;
2088 public const int TYPE_KEY = 4;
2089 public const int TYPE_VECTOR = 5;
2090 public const int TYPE_ROTATION = 6;
2091
2092 //XML RPC Remote Data Channel
2093 public const int REMOTE_DATA_CHANNEL = 1;
2094 public const int REMOTE_DATA_REQUEST = 2;
2095 public const int REMOTE_DATA_REPLY = 3;
2096
2097 //llHTTPRequest
2098 public const int HTTP_METHOD = 0;
2099 public const int HTTP_MIMETYPE = 1;
2100 public const int HTTP_BODY_MAXLENGTH = 2;
2101 public const int HTTP_VERIFY_CERT = 3;
2102
2103 public const int PRIM_MATERIAL = 2;
2104 public const int PRIM_PHYSICS = 3;
2105 public const int PRIM_TEMP_ON_REZ = 4;
2106 public const int PRIM_PHANTOM = 5;
2107 public const int PRIM_POSITION = 6;
2108 public const int PRIM_SIZE = 7;
2109 public const int PRIM_ROTATION = 8;
2110 public const int PRIM_TYPE = 9;
2111 public const int PRIM_TEXTURE = 17;
2112 public const int PRIM_COLOR = 18;
2113 public const int PRIM_BUMP_SHINY = 19;
2114 public const int PRIM_FULLBRIGHT = 20;
2115 public const int PRIM_FLEXIBLE = 21;
2116 public const int PRIM_TEXGEN = 22;
2117 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
2118 public const int PRIM_POINT_LIGHT = 23; // Huh?
2119 public const int PRIM_TEXGEN_DEFAULT = 0;
2120 public const int PRIM_TEXGEN_PLANAR = 1;
2121
2122 public const int PRIM_TYPE_BOX = 0;
2123 public const int PRIM_TYPE_CYLINDER = 1;
2124 public const int PRIM_TYPE_PRISM = 2;
2125 public const int PRIM_TYPE_SPHERE = 3;
2126 public const int PRIM_TYPE_TORUS = 4;
2127 public const int PRIM_TYPE_TUBE = 5;
2128 public const int PRIM_TYPE_RING = 6;
2129 public const int PRIM_TYPE_SCULPT = 7;
2130
2131 public const int PRIM_HOLE_DEFAULT = 0;
2132 public const int PRIM_HOLE_CIRCLE = 16;
2133 public const int PRIM_HOLE_SQUARE = 32;
2134 public const int PRIM_HOLE_TRIANGLE = 48;
2135
2136 public const int PRIM_MATERIAL_STONE = 0;
2137 public const int PRIM_MATERIAL_METAL = 1;
2138 public const int PRIM_MATERIAL_GLASS = 2;
2139 public const int PRIM_MATERIAL_WOOD = 3;
2140 public const int PRIM_MATERIAL_FLESH = 4;
2141 public const int PRIM_MATERIAL_PLASTIC = 5;
2142 public const int PRIM_MATERIAL_RUBBER = 6;
2143 public const int PRIM_MATERIAL_LIGHT = 7;
2144
2145 public const int PRIM_SHINY_NONE = 0;
2146 public const int PRIM_SHINY_LOW = 1;
2147 public const int PRIM_SHINY_MEDIUM = 2;
2148 public const int PRIM_SHINY_HIGH = 3;
2149 public const int PRIM_BUMP_NONE = 0;
2150 public const int PRIM_BUMP_BRIGHT = 1;
2151 public const int PRIM_BUMP_DARK = 2;
2152 public const int PRIM_BUMP_WOOD = 3;
2153 public const int PRIM_BUMP_BARK = 4;
2154 public const int PRIM_BUMP_BRICKS = 5;
2155 public const int PRIM_BUMP_CHECKER = 6;
2156 public const int PRIM_BUMP_CONCRETE = 7;
2157 public const int PRIM_BUMP_TILE = 8;
2158 public const int PRIM_BUMP_STONE = 9;
2159 public const int PRIM_BUMP_DISKS = 10;
2160 public const int PRIM_BUMP_GRAVEL = 11;
2161 public const int PRIM_BUMP_BLOBS = 12;
2162 public const int PRIM_BUMP_SIDING = 13;
2163 public const int PRIM_BUMP_LARGETILE = 14;
2164 public const int PRIM_BUMP_STUCCO = 15;
2165 public const int PRIM_BUMP_SUCTION = 16;
2166 public const int PRIM_BUMP_WEAVE = 17;
2167
2168 public const int PRIM_SCULPT_TYPE_SPHERE = 1;
2169 public const int PRIM_SCULPT_TYPE_TORUS = 2;
2170 public const int PRIM_SCULPT_TYPE_PLANE = 3;
2171 public const int PRIM_SCULPT_TYPE_CYLINDER = 4;
2172
2173 public const int MASK_BASE = 0;
2174 public const int MASK_OWNER = 1;
2175 public const int MASK_GROUP = 2;
2176 public const int MASK_EVERYONE = 3;
2177 public const int MASK_NEXT = 4;
2178
2179 public const int PERM_TRANSFER = 8192;
2180 public const int PERM_MODIFY = 16384;
2181 public const int PERM_COPY = 32768;
2182 public const int PERM_MOVE = 524288;
2183 public const int PERM_ALL = 2147483647;
2184
2185 public const int PARCEL_MEDIA_COMMAND_STOP = 0;
2186 public const int PARCEL_MEDIA_COMMAND_PAUSE = 1;
2187 public const int PARCEL_MEDIA_COMMAND_PLAY = 2;
2188 public const int PARCEL_MEDIA_COMMAND_LOOP = 3;
2189 public const int PARCEL_MEDIA_COMMAND_TEXTURE = 4;
2190 public const int PARCEL_MEDIA_COMMAND_URL = 5;
2191 public const int PARCEL_MEDIA_COMMAND_TIME = 6;
2192 public const int PARCEL_MEDIA_COMMAND_AGENT = 7;
2193 public const int PARCEL_MEDIA_COMMAND_UNLOAD = 8;
2194 public const int PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9;
2195
2196 public const int PAY_HIDE = -1;
2197 public const int PAY_DEFAULT = -2;
2198
2199 public const string NULL_KEY = "00000000-0000-0000-0000-000000000000";
2200 public const string EOF = "\n\n\n";
2201 public const double PI = 3.14159274f;
2202 public const double TWO_PI = 6.28318548f;
2203 public const double PI_BY_TWO = 1.57079637f;
2204 public const double DEG_TO_RAD = 0.01745329238f;
2205 public const double RAD_TO_DEG = 57.29578f;
2206 public const double SQRT2 = 1.414213538f;
2207 public const int STRING_TRIM_HEAD = 1;
2208 public const int STRING_TRIM_TAIL = 2;
2209 public const int STRING_TRIM = 3;
2210 public const int LIST_STAT_RANGE = 0;
2211 public const int LIST_STAT_MIN = 1;
2212 public const int LIST_STAT_MAX = 2;
2213 public const int LIST_STAT_MEAN = 3;
2214 public const int LIST_STAT_MEDIAN = 4;
2215 public const int LIST_STAT_STD_DEV = 5;
2216 public const int LIST_STAT_SUM = 6;
2217 public const int LIST_STAT_SUM_SQUARES = 7;
2218 public const int LIST_STAT_NUM_COUNT = 8;
2219 public const int LIST_STAT_GEOMETRIC_MEAN = 9;
2220 public const int LIST_STAT_HARMONIC_MEAN = 100;
2221
2222 //ParcelPrim Categories
2223 public const int PARCEL_COUNT_TOTAL = 0;
2224 public const int PARCEL_COUNT_OWNER = 1;
2225 public const int PARCEL_COUNT_GROUP = 2;
2226 public const int PARCEL_COUNT_OTHER = 3;
2227 public const int PARCEL_COUNT_SELECTED = 4;
2228 public const int PARCEL_COUNT_TEMP = 5;
2229
2230 public const int DEBUG_CHANNEL = 0x7FFFFFFF;
2231 public const int PUBLIC_CHANNEL = 0x00000000;
2232
2233 public const int OBJECT_NAME = 1;
2234 public const int OBJECT_DESC = 2;
2235 public const int OBJECT_POS = 3;
2236 public const int OBJECT_ROT = 4;
2237 public const int OBJECT_VELOCITY = 5;
2238 public const int OBJECT_OWNER = 6;
2239 public const int OBJECT_GROUP = 7;
2240 public const int OBJECT_CREATOR = 8;
2241
2242 // Can not be public const?
2243 public vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
2244 public rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0);
2245
2246
2247 //
2248 // OSSL
2249 //
2250 // FIXME: Refactor so we don't need to pull the script engine
2251 // into the app domain
2252 //
2253
2254 public void osSetRegionWaterHeight(double height)
2255 {
2256 m_OSSL_Functions.osSetRegionWaterHeight(height);
2257 }
2258
2259 public double osList2Double(LSL_Types.list src, int index)
2260 {
2261 return m_OSSL_Functions.osList2Double(src, index);
2262 }
2263
2264 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
2265 int timer)
2266 {
2267 return m_OSSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer);
2268 }
2269
2270 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
2271 int timer)
2272 {
2273 return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer);
2274 }
2275
2276 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
2277 int timer, int alpha)
2278 {
2279 return m_OSSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha);
2280 }
2281
2282 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
2283 int timer, int alpha)
2284 {
2285 return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha);
2286 }
2287
2288 public double osTerrainGetHeight(int x, int y)
2289 {
2290 return m_OSSL_Functions.osTerrainGetHeight(x, y);
2291 }
2292
2293 public int osTerrainSetHeight(int x, int y, double val)
2294 {
2295 return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
2296 }
2297
2298 public int osRegionRestart(double seconds)
2299 {
2300 return m_OSSL_Functions.osRegionRestart(seconds);
2301 }
2302
2303 public void osRegionNotice(string msg)
2304 {
2305 m_OSSL_Functions.osRegionNotice(msg);
2306 }
2307
2308 public bool osConsoleCommand(string Command)
2309 {
2310 return m_OSSL_Functions.osConsoleCommand(Command);
2311 }
2312
2313 public void osSetParcelMediaURL(string url)
2314 {
2315 m_OSSL_Functions.osSetParcelMediaURL(url);
2316 }
2317
2318 public void osSetPrimFloatOnWater(int floatYN)
2319 {
2320 m_OSSL_Functions.osSetPrimFloatOnWater(floatYN);
2321 }
2322
2323 // Animation Functions
2324
2325 public void osAvatarPlayAnimation(string avatar, string animation)
2326 {
2327 m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation);
2328 }
2329
2330 public void osAvatarStopAnimation(string avatar, string animation)
2331 {
2332 m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
2333 }
2334
2335
2336 //Texture Draw functions
2337
2338 public string osMovePen(string drawList, int x, int y)
2339 {
2340 return m_OSSL_Functions.osMovePen(drawList, x, y);
2341 }
2342
2343 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
2344 {
2345 return m_OSSL_Functions.osDrawLine(drawList, startX, startY, endX, endY);
2346 }
2347
2348 public string osDrawLine(string drawList, int endX, int endY)
2349 {
2350 return m_OSSL_Functions.osDrawLine(drawList, endX, endY);
2351 }
2352
2353 public string osDrawText(string drawList, string text)
2354 {
2355 return m_OSSL_Functions.osDrawText(drawList, text);
2356 }
2357
2358 public string osDrawEllipse(string drawList, int width, int height)
2359 {
2360 return m_OSSL_Functions.osDrawEllipse(drawList, width, height);
2361 }
2362
2363 public string osDrawRectangle(string drawList, int width, int height)
2364 {
2365 return m_OSSL_Functions.osDrawRectangle(drawList, width, height);
2366 }
2367
2368 public string osDrawFilledRectangle(string drawList, int width, int height)
2369 {
2370 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
2371 }
2372
2373 public string osSetFontSize(string drawList, int fontSize)
2374 {
2375 return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
2376 }
2377
2378 public string osSetPenSize(string drawList, int penSize)
2379 {
2380 return m_OSSL_Functions.osSetPenSize(drawList, penSize);
2381 }
2382
2383 public string osSetPenColour(string drawList, string colour)
2384 {
2385 return m_OSSL_Functions.osSetPenColour(drawList, colour);
2386 }
2387
2388 public string osDrawImage(string drawList, int width, int height, string imageUrl)
2389 {
2390 return m_OSSL_Functions.osDrawImage(drawList, width, height, imageUrl);
2391 }
2392 public void osSetStateEvents(int events)
2393 {
2394 m_OSSL_Functions.osSetStateEvents(events);
2395 }
2396 } 1731 }
2397} 1732}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
index cf15b67..f9b160d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
@@ -29,7 +29,7 @@ using System;
29using System.IO; 29using System.IO;
30using System.Reflection; 30using System.Reflection;
31 31
32namespace OpenSim.Region.ScriptEngine.XEngine.Script 32namespace OpenSim.Region.ScriptEngine.Shared
33{ 33{
34 [Serializable] 34 [Serializable]
35 public class AssemblyResolver 35 public class AssemblyResolver
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 68fb1dd..2edcee0 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -34,8 +34,9 @@ using Microsoft.CSharp;
34using Microsoft.JScript; 34using Microsoft.JScript;
35using Microsoft.VisualBasic; 35using Microsoft.VisualBasic;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.ScriptEngine.Interfaces;
37 38
38namespace OpenSim.Region.ScriptEngine.XEngine 39namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
39{ 40{
40 public class Compiler 41 public class Compiler
41 { 42 {
@@ -78,8 +79,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
78 private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files 79 private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
79 private static UInt64 scriptCompileCounter = 0; // And a counter 80 private static UInt64 scriptCompileCounter = 0; // And a counter
80 81
81 public XEngine m_scriptEngine; 82 public IScriptEngine m_scriptEngine;
82 public Compiler(XEngine scriptEngine) 83 public Compiler(IScriptEngine scriptEngine)
83 { 84 {
84 m_scriptEngine = scriptEngine; 85 m_scriptEngine = scriptEngine;
85 ReadConfig(); 86 ReadConfig();
@@ -89,11 +90,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
89 { 90 {
90 91
91 // Get some config 92 // Get some config
92 WriteScriptSourceToDebugFile = m_scriptEngine.ScriptConfigSource.GetBoolean("WriteScriptSourceToDebugFile", true); 93 WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", true);
93 CompileWithDebugInformation = m_scriptEngine.ScriptConfigSource.GetBoolean("CompileWithDebugInformation", true); 94 CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true);
94 95
95 // Get file prefix from scriptengine name and make it file system safe: 96 // Get file prefix from scriptengine name and make it file system safe:
96 FilePrefix = m_scriptEngine.ScriptEngineName; 97 FilePrefix = "CommonCompiler";
97 foreach (char c in Path.GetInvalidFileNameChars()) 98 foreach (char c in Path.GetInvalidFileNameChars())
98 { 99 {
99 FilePrefix = FilePrefix.Replace(c, '_'); 100 FilePrefix = FilePrefix.Replace(c, '_');
@@ -113,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
113 LanguageMapping.Add(enumCompileType.js.ToString(), enumCompileType.js); 114 LanguageMapping.Add(enumCompileType.js.ToString(), enumCompileType.js);
114 115
115 // Allowed compilers 116 // Allowed compilers
116 string allowComp = m_scriptEngine.ScriptConfigSource.GetString("AllowedCompilers", "lsl,cs,vb,js"); 117 string allowComp = m_scriptEngine.Config.GetString("AllowedCompilers", "lsl,cs,vb,js");
117 AllowedCompilers.Clear(); 118 AllowedCompilers.Clear();
118 119
119#if DEBUG 120#if DEBUG
120 m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp); 121 m_scriptEngine.Log.Debug("[Compiler]: Allowed languages: " + allowComp);
121#endif 122#endif
122 123
123 124
@@ -126,26 +127,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
126 string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); 127 string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
127 if (!LanguageMapping.ContainsKey(strlan)) 128 if (!LanguageMapping.ContainsKey(strlan))
128 { 129 {
129 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recognize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 130 m_scriptEngine.Log.Error("[Compiler]: Config error. Compiler is unable to recognize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
130 } 131 }
131 else 132 else
132 { 133 {
133#if DEBUG 134#if DEBUG
134 //m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recognized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); 135 //m_scriptEngine.Log.Debug("[Compiler]: Config OK. Compiler recognized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
135#endif 136#endif
136 } 137 }
137 AllowedCompilers.Add(strlan, true); 138 AllowedCompilers.Add(strlan, true);
138 } 139 }
139 if (AllowedCompilers.Count == 0) 140 if (AllowedCompilers.Count == 0)
140 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); 141 m_scriptEngine.Log.Error("[Compiler]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!");
141 142
142 // Default language 143 // Default language
143 string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); 144 string defaultCompileLanguage = m_scriptEngine.Config.GetString("DefaultCompileLanguage", "lsl").ToLower();
144 145
145 // Is this language recognized at all? 146 // Is this language recognized at all?
146 if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) 147 if (!LanguageMapping.ContainsKey(defaultCompileLanguage))
147 { 148 {
148 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + 149 m_scriptEngine.Log.Error("[Compiler]: " +
149 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); 150 "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\".");
150 defaultCompileLanguage = "lsl"; 151 defaultCompileLanguage = "lsl";
151 } 152 }
@@ -153,13 +154,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
153 // Is this language in allow-list? 154 // Is this language in allow-list?
154 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) 155 if (!AllowedCompilers.ContainsKey(defaultCompileLanguage))
155 { 156 {
156 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + 157 m_scriptEngine.Log.Error("[Compiler]: " +
157 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); 158 "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!");
158 } 159 }
159 else 160 else
160 { 161 {
161#if DEBUG 162#if DEBUG
162// m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " + 163// m_scriptEngine.Log.Debug("[Compiler]: " +
163// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); 164// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
164#endif 165#endif
165 // LANGUAGE IS IN ALLOW-LIST 166 // LANGUAGE IS IN ALLOW-LIST
@@ -185,7 +186,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
185 } 186 }
186 catch (Exception ex) 187 catch (Exception ex)
187 { 188 {
188 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); 189 m_scriptEngine.Log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString());
189 } 190 }
190 } 191 }
191 192
@@ -199,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
199 } 200 }
200 catch (Exception ex) 201 catch (Exception ex)
201 { 202 {
202 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath, 203 m_scriptEngine.Log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath,
203 m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString()); 204 m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString());
204 } 205 }
205 } 206 }
@@ -207,7 +208,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
207 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, 208 foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
208 m_scriptEngine.World.RegionInfo.RegionID.ToString()))) 209 m_scriptEngine.World.RegionInfo.RegionID.ToString())))
209 { 210 {
210 //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file); 211 //m_scriptEngine.Log.Error("[Compiler]: FILE FOUND: " + file);
211 212
212 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || 213 if (file.ToLower().StartsWith(FilePrefix + "_compiled_") ||
213 file.ToLower().StartsWith(FilePrefix + "_source_")) 214 file.ToLower().StartsWith(FilePrefix + "_source_"))
@@ -218,7 +219,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
218 } 219 }
219 catch (Exception ex) 220 catch (Exception ex)
220 { 221 {
221 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString()); 222 m_scriptEngine.Log.Error("[Compiler]: Exception trying delete old script file \"" + file + "\": " + ex.ToString());
222 } 223 }
223 224
224 } 225 }
@@ -233,10 +234,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
233 // { 234 // {
234 // case ".txt": 235 // case ".txt":
235 // case ".lsl": 236 // case ".lsl":
236 // Common.ScriptEngineBase.Common.SendToDebug("Source code is LSL, converting to CS"); 237 // Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS");
237 // return CompileFromLSLText(File.ReadAllText(LSOFileName)); 238 // return CompileFromLSLText(File.ReadAllText(LSOFileName));
238 // case ".cs": 239 // case ".cs":
239 // Common.ScriptEngineBase.Common.SendToDebug("Source code is CS"); 240 // Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS");
240 // return CompileFromCSText(File.ReadAllText(LSOFileName)); 241 // return CompileFromCSText(File.ReadAllText(LSOFileName));
241 // default: 242 // default:
242 // throw new Exception("Unknown script type."); 243 // throw new Exception("Unknown script type.");
@@ -258,7 +259,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
258 259
259 if (File.Exists(OutFile)) 260 if (File.Exists(OutFile))
260 { 261 {
261 m_scriptEngine.Log.DebugFormat("[XEngine] Returning existing assembly for {0}", asset); 262 m_scriptEngine.Log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
262 return OutFile; 263 return OutFile;
263 } 264 }
264 265
@@ -359,9 +360,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
359 private static string CreateJSCompilerScript(string compileScript) 360 private static string CreateJSCompilerScript(string compileScript)
360 { 361 {
361 compileScript = String.Empty + 362 compileScript = String.Empty +
362 "import OpenSim.Region.ScriptEngine.XEngine.Script; import System.Collections.Generic;\r\n" + 363 "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
363 "package SecondLife {\r\n" + 364 "package SecondLife {\r\n" +
364 "class Script extends OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" + 365 "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
365 compileScript + 366 compileScript +
366 "} }\r\n"; 367 "} }\r\n";
367 return compileScript; 368 return compileScript;
@@ -370,9 +371,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
370 private static string CreateCSCompilerScript(string compileScript) 371 private static string CreateCSCompilerScript(string compileScript)
371 { 372 {
372 compileScript = String.Empty + 373 compileScript = String.Empty +
373 "using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" + 374 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
374 String.Empty + "namespace SecondLife { " + 375 String.Empty + "namespace SecondLife { " +
375 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" + 376 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
376 @"public Script() { } " + 377 @"public Script() { } " +
377 compileScript + 378 compileScript +
378 "} }\r\n"; 379 "} }\r\n";
@@ -382,9 +383,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
382 private static string CreateVBCompilerScript(string compileScript) 383 private static string CreateVBCompilerScript(string compileScript)
383 { 384 {
384 compileScript = String.Empty + 385 compileScript = String.Empty +
385 "Imports OpenSim.Region.ScriptEngine.XEngine.Script: Imports System.Collections.Generic: " + 386 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
386 String.Empty + "NameSpace SecondLife:" + 387 String.Empty + "NameSpace SecondLife:" +
387 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass: " + 388 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " +
388 "\r\nPublic Sub New()\r\nEnd Sub: " + 389 "\r\nPublic Sub New()\r\nEnd Sub: " +
389 compileScript + 390 compileScript +
390 ":End Class :End Namespace\r\n"; 391 ":End Class :End Namespace\r\n";
@@ -406,7 +407,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
406 m_scriptEngine.World.RegionInfo.RegionID.ToString(), 407 m_scriptEngine.World.RegionInfo.RegionID.ToString(),
407 FilePrefix + "_compiled_" + asset + ".dll")); 408 FilePrefix + "_compiled_" + asset + ".dll"));
408#if DEBUG 409#if DEBUG
409// m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); 410// m_scriptEngine.Log.Debug("[Compiler]: Starting compile of \"" + OutFile + "\".");
410#endif 411#endif
411 try 412 try
412 { 413 {
@@ -414,7 +415,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
414 } 415 }
415 catch (Exception e) // NOTLEGIT - Should be just catching FileIOException 416 catch (Exception e) // NOTLEGIT - Should be just catching FileIOException
416 { 417 {
417 //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); 418 //m_scriptEngine.Log.Error("[Compiler]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
418 throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); 419 throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
419 } 420 }
420 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); 421 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
@@ -432,7 +433,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
432 } 433 }
433 catch (Exception ex) // NOTLEGIT - Should be just catching FileIOException 434 catch (Exception ex) // NOTLEGIT - Should be just catching FileIOException
434 { 435 {
435 m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); 436 m_scriptEngine.Log.Error("[Compiler]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString());
436 } 437 }
437 } 438 }
438 439
@@ -451,10 +452,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
451 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 452 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
452 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); 453 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
453 //Console.WriteLine("Assembly location: " + rootPath); 454 //Console.WriteLine("Assembly location: " + rootPath);
454 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.XEngine.Script.dll")); 455 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
455// parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.XEngine.dll")); 456 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
456 457
457 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
458 parameters.GenerateExecutable = false; 458 parameters.GenerateExecutable = false;
459 parameters.OutputAssembly = OutFile; 459 parameters.OutputAssembly = OutFile;
460 parameters.IncludeDebugInformation = CompileWithDebugInformation; 460 parameters.IncludeDebugInformation = CompileWithDebugInformation;
@@ -508,7 +508,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
508 errtext += "No compile error. But not able to locate compiled file."; 508 errtext += "No compile error. But not able to locate compiled file.";
509 throw new Exception(errtext); 509 throw new Exception(errtext);
510 } 510 }
511 m_scriptEngine.Log.DebugFormat("[XEngine] Compiled new assembly for {0}", asset); 511 m_scriptEngine.Log.DebugFormat("[Compiler] Compiled new assembly for {0}", asset);
512 return OutFile; 512 return OutFile;
513 } 513 }
514 } 514 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs
index 2dc8547..380686e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs
@@ -30,7 +30,7 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text.RegularExpressions; 31using System.Text.RegularExpressions;
32 32
33namespace OpenSim.Region.ScriptEngine.XEngine 33namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
34{ 34{
35 public class LSL2CSConverter 35 public class LSL2CSConverter
36 { 36 {
@@ -355,13 +355,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
355 355
356 //System.Console.WriteLine(Script); 356 //System.Console.WriteLine(Script);
357 Return = String.Empty;// + 357 Return = String.Empty;// +
358 //"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;"; 358 //"using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;";
359 359
360 //Return += String.Empty + 360 //Return += String.Empty +
361 // "namespace SecondLife { "; 361 // "namespace SecondLife { ";
362 //Return += String.Empty + 362 //Return += String.Empty +
363 // //"[Serializable] " + 363 // //"[Serializable] " +
364 // "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { "; 364 // "public class Script : OpenSim.Region.ScriptEngine.Shared.LSL_BaseClass { ";
365 //Return += @"public Script() { } "; 365 //Return += @"public Script() { } ";
366 Return += Script; 366 Return += Script;
367 //Return += "} }\r\n"; 367 //Return += "} }\r\n";
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 8bd3d73..6b080a0 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Text.RegularExpressions; 30using System.Text.RegularExpressions;
31 31
32namespace OpenSim.Region.ScriptEngine.XEngine.Script 32namespace OpenSim.Region.ScriptEngine.Shared
33{ 33{
34 [Serializable] 34 [Serializable]
35 public partial class LSL_Types 35 public partial class LSL_Types
@@ -1474,6 +1474,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1474 return f1.value != f2.value; 1474 return f1.value != f2.value;
1475 } 1475 }
1476 1476
1477 public override bool Equals(Object o)
1478 {
1479 if(!(o is LSLFloat))
1480 return false;
1481
1482 return value == ((LSLFloat)o).value;
1483 }
1484
1485 public override int GetHashCode()
1486 {
1487 return (int)value;
1488 }
1489
1477 static public LSLFloat operator ++(LSLFloat f) 1490 static public LSLFloat operator ++(LSLFloat f)
1478 { 1491 {
1479 f.value++; 1492 f.value++;
@@ -1491,12 +1504,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1491 return f.value; 1504 return f.value;
1492 } 1505 }
1493 1506
1494 static public explicit operator LSLString(LSLFloat f)
1495 {
1496 string v = String.Format("{0:0.000000}", f.value);
1497 return new LSLString(v);
1498 }
1499
1500 #endregion 1507 #endregion
1501 1508
1502 #region Overriders 1509 #region Overriders
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index c226a7e..8bfef79 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -33,7 +33,8 @@ using OpenSim.Framework;
33using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 33using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.ScriptEngine.XEngine.Script; 36using OpenSim.Region.ScriptEngine.Shared;
37using OpenSim.Region.ScriptEngine.Interfaces;
37using Axiom.Math; 38using Axiom.Math;
38 39
39namespace OpenSim.Region.ScriptEngine.XEngine 40namespace OpenSim.Region.ScriptEngine.XEngine
@@ -83,8 +84,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
83 IClientAPI remoteClient) 84 IClientAPI remoteClient)
84 { 85 {
85 // Add to queue for all scripts in ObjectID object 86 // Add to queue for all scripts in ObjectID object
86 XDetectParams[] det = new XDetectParams[1]; 87 DetectParams[] det = new DetectParams[1];
87 det[0] = new XDetectParams(); 88 det[0] = new DetectParams();
88 det[0].Key = remoteClient.AgentId; 89 det[0].Key = remoteClient.AgentId;
89 det[0].Populate(myScriptEngine.World); 90 det[0].Populate(myScriptEngine.World);
90 91
@@ -97,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
97 if (part.ParentGroup.Children.Count > 0) 98 if (part.ParentGroup.Children.Count > 0)
98 det[0].LinkNum = part.LinkNum + 1; 99 det[0].LinkNum = part.LinkNum + 1;
99 100
100 myScriptEngine.PostObjectEvent(localID, new XEventParams( 101 myScriptEngine.PostObjectEvent(localID, new EventParams(
101 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, 102 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
102 det)); 103 det));
103 } 104 }
@@ -106,8 +107,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
106 IClientAPI remoteClient) 107 IClientAPI remoteClient)
107 { 108 {
108 // Add to queue for all scripts in ObjectID object 109 // Add to queue for all scripts in ObjectID object
109 XDetectParams[] det = new XDetectParams[1]; 110 DetectParams[] det = new DetectParams[1];
110 det[0] = new XDetectParams(); 111 det[0] = new DetectParams();
111 det[0].Key = remoteClient.AgentId; 112 det[0].Key = remoteClient.AgentId;
112 det[0].Populate(myScriptEngine.World); 113 det[0].Populate(myScriptEngine.World);
113 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X, 114 det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
@@ -123,7 +124,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
123 if (part.ParentGroup.Children.Count > 0) 124 if (part.ParentGroup.Children.Count > 0)
124 det[0].LinkNum = part.LinkNum + 1; 125 det[0].LinkNum = part.LinkNum + 1;
125 126
126 myScriptEngine.PostObjectEvent(localID, new XEventParams( 127 myScriptEngine.PostObjectEvent(localID, new EventParams(
127 "touch", new Object[] { new LSL_Types.LSLInteger(1) }, 128 "touch", new Object[] { new LSL_Types.LSLInteger(1) },
128 det)); 129 det));
129 } 130 }
@@ -131,8 +132,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
131 public void touch_end(uint localID, IClientAPI remoteClient) 132 public void touch_end(uint localID, IClientAPI remoteClient)
132 { 133 {
133 // Add to queue for all scripts in ObjectID object 134 // Add to queue for all scripts in ObjectID object
134 XDetectParams[] det = new XDetectParams[1]; 135 DetectParams[] det = new DetectParams[1];
135 det[0] = new XDetectParams(); 136 det[0] = new DetectParams();
136 det[0].Key = remoteClient.AgentId; 137 det[0].Key = remoteClient.AgentId;
137 det[0].Populate(myScriptEngine.World); 138 det[0].Populate(myScriptEngine.World);
138 139
@@ -145,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
145 if (part.ParentGroup.Children.Count > 0) 146 if (part.ParentGroup.Children.Count > 0)
146 det[0].LinkNum = part.LinkNum + 1; 147 det[0].LinkNum = part.LinkNum + 1;
147 148
148 myScriptEngine.PostObjectEvent(localID, new XEventParams( 149 myScriptEngine.PostObjectEvent(localID, new EventParams(
149 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, 150 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) },
150 det)); 151 det));
151 } 152 }
@@ -153,9 +154,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
153 public void changed(uint localID, uint change) 154 public void changed(uint localID, uint change)
154 { 155 {
155 // Add to queue for all scripts in localID, Object pass change. 156 // Add to queue for all scripts in localID, Object pass change.
156 myScriptEngine.PostObjectEvent(localID, new XEventParams( 157 myScriptEngine.PostObjectEvent(localID, new EventParams(
157 "changed",new object[] { new LSL_Types.LSLInteger(change) }, 158 "changed",new object[] { new LSL_Types.LSLInteger(change) },
158 new XDetectParams[0])); 159 new DetectParams[0]));
159 } 160 }
160 161
161 // state_entry: not processed here 162 // state_entry: not processed here
@@ -163,27 +164,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
163 164
164 public void money(uint localID, LLUUID agentID, int amount) 165 public void money(uint localID, LLUUID agentID, int amount)
165 { 166 {
166 myScriptEngine.PostObjectEvent(localID, new XEventParams( 167 myScriptEngine.PostObjectEvent(localID, new EventParams(
167 "money", new object[] { 168 "money", new object[] {
168 new LSL_Types.LSLString(agentID.ToString()), 169 new LSL_Types.LSLString(agentID.ToString()),
169 new LSL_Types.LSLInteger(amount) }, 170 new LSL_Types.LSLInteger(amount) },
170 new XDetectParams[0])); 171 new DetectParams[0]));
171 } 172 }
172 173
173 public void collision_start(uint localID, ColliderArgs col) 174 public void collision_start(uint localID, ColliderArgs col)
174 { 175 {
175 // Add to queue for all scripts in ObjectID object 176 // Add to queue for all scripts in ObjectID object
176 List<XDetectParams> det = new List<XDetectParams>(); 177 List<DetectParams> det = new List<DetectParams>();
177 178
178 foreach (DetectedObject detobj in col.Colliders) 179 foreach (DetectedObject detobj in col.Colliders)
179 { 180 {
180 XDetectParams d = new XDetectParams(); 181 DetectParams d = new DetectParams();
181 d.Key =detobj.keyUUID; 182 d.Key =detobj.keyUUID;
182 d.Populate(myScriptEngine.World); 183 d.Populate(myScriptEngine.World);
183 det.Add(d); 184 det.Add(d);
184 } 185 }
185 186
186 myScriptEngine.PostObjectEvent(localID, new XEventParams( 187 myScriptEngine.PostObjectEvent(localID, new EventParams(
187 "collision_start", 188 "collision_start",
188 new Object[] { new LSL_Types.LSLInteger(1) }, 189 new Object[] { new LSL_Types.LSLInteger(1) },
189 det.ToArray())); 190 det.ToArray()));
@@ -192,17 +193,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
192 public void collision(uint localID, ColliderArgs col) 193 public void collision(uint localID, ColliderArgs col)
193 { 194 {
194 // Add to queue for all scripts in ObjectID object 195 // Add to queue for all scripts in ObjectID object
195 List<XDetectParams> det = new List<XDetectParams>(); 196 List<DetectParams> det = new List<DetectParams>();
196 197
197 foreach (DetectedObject detobj in col.Colliders) 198 foreach (DetectedObject detobj in col.Colliders)
198 { 199 {
199 XDetectParams d = new XDetectParams(); 200 DetectParams d = new DetectParams();
200 d.Key =detobj.keyUUID; 201 d.Key =detobj.keyUUID;
201 d.Populate(myScriptEngine.World); 202 d.Populate(myScriptEngine.World);
202 det.Add(d); 203 det.Add(d);
203 } 204 }
204 205
205 myScriptEngine.PostObjectEvent(localID, new XEventParams( 206 myScriptEngine.PostObjectEvent(localID, new EventParams(
206 "collision", new Object[] { new LSL_Types.LSLInteger(1) }, 207 "collision", new Object[] { new LSL_Types.LSLInteger(1) },
207 det.ToArray())); 208 det.ToArray()));
208 } 209 }
@@ -210,17 +211,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
210 public void collision_end(uint localID, ColliderArgs col) 211 public void collision_end(uint localID, ColliderArgs col)
211 { 212 {
212 // Add to queue for all scripts in ObjectID object 213 // Add to queue for all scripts in ObjectID object
213 List<XDetectParams> det = new List<XDetectParams>(); 214 List<DetectParams> det = new List<DetectParams>();
214 215
215 foreach (DetectedObject detobj in col.Colliders) 216 foreach (DetectedObject detobj in col.Colliders)
216 { 217 {
217 XDetectParams d = new XDetectParams(); 218 DetectParams d = new DetectParams();
218 d.Key =detobj.keyUUID; 219 d.Key =detobj.keyUUID;
219 d.Populate(myScriptEngine.World); 220 d.Populate(myScriptEngine.World);
220 det.Add(d); 221 det.Add(d);
221 } 222 }
222 223
223 myScriptEngine.PostObjectEvent(localID, new XEventParams( 224 myScriptEngine.PostObjectEvent(localID, new EventParams(
224 "collision_end", 225 "collision_end",
225 new Object[] { new LSL_Types.LSLInteger(1) }, 226 new Object[] { new LSL_Types.LSLInteger(1) },
226 det.ToArray())); 227 det.ToArray()));
@@ -228,26 +229,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
228 229
229 public void land_collision_start(uint localID, LLUUID itemID) 230 public void land_collision_start(uint localID, LLUUID itemID)
230 { 231 {
231 myScriptEngine.PostObjectEvent(localID, new XEventParams( 232 myScriptEngine.PostObjectEvent(localID, new EventParams(
232 "land_collision_start", 233 "land_collision_start",
233 new object[0], 234 new object[0],
234 new XDetectParams[0])); 235 new DetectParams[0]));
235 } 236 }
236 237
237 public void land_collision(uint localID, LLUUID itemID) 238 public void land_collision(uint localID, LLUUID itemID)
238 { 239 {
239 myScriptEngine.PostObjectEvent(localID, new XEventParams( 240 myScriptEngine.PostObjectEvent(localID, new EventParams(
240 "land_collision", 241 "land_collision",
241 new object[0], 242 new object[0],
242 new XDetectParams[0])); 243 new DetectParams[0]));
243 } 244 }
244 245
245 public void land_collision_end(uint localID, LLUUID itemID) 246 public void land_collision_end(uint localID, LLUUID itemID)
246 { 247 {
247 myScriptEngine.PostObjectEvent(localID, new XEventParams( 248 myScriptEngine.PostObjectEvent(localID, new EventParams(
248 "land_collision_end", 249 "land_collision_end",
249 new object[0], 250 new object[0],
250 new XDetectParams[0])); 251 new DetectParams[0]));
251 } 252 }
252 253
253 // timer: not handled here 254 // timer: not handled here
@@ -255,75 +256,75 @@ namespace OpenSim.Region.ScriptEngine.XEngine
255 256
256 public void on_rez(uint localID, LLUUID itemID, int startParam) 257 public void on_rez(uint localID, LLUUID itemID, int startParam)
257 { 258 {
258 myScriptEngine.PostObjectEvent(localID, new XEventParams( 259 myScriptEngine.PostObjectEvent(localID, new EventParams(
259 "on_rez",new object[] { 260 "on_rez",new object[] {
260 new LSL_Types.LSLInteger(startParam)}, 261 new LSL_Types.LSLInteger(startParam)},
261 new XDetectParams[0])); 262 new DetectParams[0]));
262 } 263 }
263 264
264 public void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change) 265 public void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change)
265 { 266 {
266 myScriptEngine.PostObjectEvent(localID, new XEventParams( 267 myScriptEngine.PostObjectEvent(localID, new EventParams(
267 "control",new object[] { 268 "control",new object[] {
268 new LSL_Types.LSLString(agentID.ToString()), 269 new LSL_Types.LSLString(agentID.ToString()),
269 new LSL_Types.LSLInteger(held), 270 new LSL_Types.LSLInteger(held),
270 new LSL_Types.LSLInteger(change)}, 271 new LSL_Types.LSLInteger(change)},
271 new XDetectParams[0])); 272 new DetectParams[0]));
272 } 273 }
273 274
274 public void email(uint localID, LLUUID itemID, string timeSent, 275 public void email(uint localID, LLUUID itemID, string timeSent,
275 string address, string subject, string message, int numLeft) 276 string address, string subject, string message, int numLeft)
276 { 277 {
277 myScriptEngine.PostObjectEvent(localID, new XEventParams( 278 myScriptEngine.PostObjectEvent(localID, new EventParams(
278 "email",new object[] { 279 "email",new object[] {
279 new LSL_Types.LSLString(timeSent), 280 new LSL_Types.LSLString(timeSent),
280 new LSL_Types.LSLString(address), 281 new LSL_Types.LSLString(address),
281 new LSL_Types.LSLString(subject), 282 new LSL_Types.LSLString(subject),
282 new LSL_Types.LSLString(message), 283 new LSL_Types.LSLString(message),
283 new LSL_Types.LSLInteger(numLeft)}, 284 new LSL_Types.LSLInteger(numLeft)},
284 new XDetectParams[0])); 285 new DetectParams[0]));
285 } 286 }
286 287
287 public void at_target(uint localID, uint handle, LLVector3 targetpos, 288 public void at_target(uint localID, uint handle, LLVector3 targetpos,
288 LLVector3 atpos) 289 LLVector3 atpos)
289 { 290 {
290 myScriptEngine.PostObjectEvent(localID, new XEventParams( 291 myScriptEngine.PostObjectEvent(localID, new EventParams(
291 "at_target", new object[] { 292 "at_target", new object[] {
292 new LSL_Types.LSLInteger(handle), 293 new LSL_Types.LSLInteger(handle),
293 new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z), 294 new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z),
294 new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) }, 295 new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) },
295 new XDetectParams[0])); 296 new DetectParams[0]));
296 } 297 }
297 298
298 public void not_at_target(uint localID) 299 public void not_at_target(uint localID)
299 { 300 {
300 myScriptEngine.PostObjectEvent(localID, new XEventParams( 301 myScriptEngine.PostObjectEvent(localID, new EventParams(
301 "not_at_target",new object[0], 302 "not_at_target",new object[0],
302 new XDetectParams[0])); 303 new DetectParams[0]));
303 } 304 }
304 305
305 public void at_rot_target(uint localID, LLUUID itemID) 306 public void at_rot_target(uint localID, LLUUID itemID)
306 { 307 {
307 myScriptEngine.PostObjectEvent(localID, new XEventParams( 308 myScriptEngine.PostObjectEvent(localID, new EventParams(
308 "at_rot_target",new object[0], 309 "at_rot_target",new object[0],
309 new XDetectParams[0])); 310 new DetectParams[0]));
310 } 311 }
311 312
312 public void not_at_rot_target(uint localID, LLUUID itemID) 313 public void not_at_rot_target(uint localID, LLUUID itemID)
313 { 314 {
314 myScriptEngine.PostObjectEvent(localID, new XEventParams( 315 myScriptEngine.PostObjectEvent(localID, new EventParams(
315 "not_at_rot_target",new object[0], 316 "not_at_rot_target",new object[0],
316 new XDetectParams[0])); 317 new DetectParams[0]));
317 } 318 }
318 319
319 // run_time_permissions: not handled here 320 // run_time_permissions: not handled here
320 321
321 public void attach(uint localID, LLUUID itemID, LLUUID avatar) 322 public void attach(uint localID, LLUUID itemID, LLUUID avatar)
322 { 323 {
323 myScriptEngine.PostObjectEvent(localID, new XEventParams( 324 myScriptEngine.PostObjectEvent(localID, new EventParams(
324 "attach",new object[] { 325 "attach",new object[] {
325 new LSL_Types.LSLString(avatar.ToString()) }, 326 new LSL_Types.LSLString(avatar.ToString()) },
326 new XDetectParams[0])); 327 new DetectParams[0]));
327 } 328 }
328 329
329 // dataserver: not handled here 330 // dataserver: not handled here
@@ -331,16 +332,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
331 332
332 public void moving_start(uint localID, LLUUID itemID) 333 public void moving_start(uint localID, LLUUID itemID)
333 { 334 {
334 myScriptEngine.PostObjectEvent(localID, new XEventParams( 335 myScriptEngine.PostObjectEvent(localID, new EventParams(
335 "moving_start",new object[0], 336 "moving_start",new object[0],
336 new XDetectParams[0])); 337 new DetectParams[0]));
337 } 338 }
338 339
339 public void moving_end(uint localID, LLUUID itemID) 340 public void moving_end(uint localID, LLUUID itemID)
340 { 341 {
341 myScriptEngine.PostObjectEvent(localID, new XEventParams( 342 myScriptEngine.PostObjectEvent(localID, new EventParams(
342 "moving_end",new object[0], 343 "moving_end",new object[0],
343 new XDetectParams[0])); 344 new DetectParams[0]));
344 } 345 }
345 346
346 // object_rez: not handled here 347 // object_rez: not handled here
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Executor.cs b/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
index 29336ac..e12f2bf 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
@@ -28,7 +28,8 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using OpenSim.Region.ScriptEngine.XEngine.Script; 31using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
32 33
33namespace OpenSim.Region.ScriptEngine.XEngine 34namespace OpenSim.Region.ScriptEngine.XEngine
34{ 35{
@@ -44,15 +45,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
44 } 45 }
45 46
46 47
47 protected override scriptEvents DoGetStateEventFlags() 48 protected override scriptEvents DoGetStateEventFlags(string state)
48 { 49 {
49 //Console.WriteLine("Get event flags for " + m_Script.State); 50 //Console.WriteLine("Get event flags for " + state);
50 51
51 // Check to see if we've already computed the flags for this state 52 // Check to see if we've already computed the flags for this state
52 scriptEvents eventFlags = scriptEvents.None; 53 scriptEvents eventFlags = scriptEvents.None;
53 if (m_stateEvents.ContainsKey(m_Script.State)) 54 if (m_stateEvents.ContainsKey(state))
54 { 55 {
55 m_stateEvents.TryGetValue(m_Script.State, out eventFlags); 56 m_stateEvents.TryGetValue(state, out eventFlags);
56 return eventFlags; 57 return eventFlags;
57 } 58 }
58 59
@@ -61,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
61 // Fill in the events for this state, cache the results in the map 62 // Fill in the events for this state, cache the results in the map
62 foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap) 63 foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap)
63 { 64 {
64 string evname = m_Script.State + "_event_" + kvp.Key; 65 string evname = state + "_event_" + kvp.Key;
65 //Console.WriteLine("Trying event "+evname); 66 //Console.WriteLine("Trying event "+evname);
66 try 67 try
67 { 68 {
@@ -80,18 +81,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
80 81
81 // Save the flags we just computed and return the result 82 // Save the flags we just computed and return the result
82 if (eventFlags != 0) 83 if (eventFlags != 0)
83 m_stateEvents.Add(m_Script.State, eventFlags); 84 m_stateEvents.Add(state, eventFlags);
84 85
85 //Console.WriteLine("Returning {0:x}", eventFlags); 86 //Console.WriteLine("Returning {0:x}", eventFlags);
86 return (eventFlags); 87 return (eventFlags);
87 } 88 }
88 89
89 protected override void DoExecuteEvent(string FunctionName, object[] args) 90 protected override void DoExecuteEvent(string state, string FunctionName, object[] args)
90 { 91 {
91 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. 92 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
92 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! 93 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
93 94
94 string EventName = m_Script.State + "_event_" + FunctionName; 95 string EventName = state + "_event_" + FunctionName;
95 96
96//#if DEBUG 97//#if DEBUG
97// Console.WriteLine("ScriptEngine: Script event function name: " + EventName); 98// Console.WriteLine("ScriptEngine: Script event function name: " + EventName);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs b/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
index 3775372..799005c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
@@ -28,7 +28,9 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Runtime.Remoting.Lifetime; 30using System.Runtime.Remoting.Lifetime;
31using OpenSim.Region.ScriptEngine.XEngine.Script; 31using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
33using OpenSim.Region.ScriptEngine.Interfaces;
32 34
33namespace OpenSim.Region.ScriptEngine.XEngine 35namespace OpenSim.Region.ScriptEngine.XEngine
34{ 36{
@@ -117,23 +119,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
117 /// </summary> 119 /// </summary>
118 /// <param name="FunctionName">Name of function to execute</param> 120 /// <param name="FunctionName">Name of function to execute</param>
119 /// <param name="args">Arguments to pass to function</param> 121 /// <param name="args">Arguments to pass to function</param>
120 public void ExecuteEvent(string FunctionName, object[] args) 122 public void ExecuteEvent(string state, string FunctionName, object[] args)
121 { 123 {
122 DoExecuteEvent(FunctionName, args); 124 DoExecuteEvent(state, FunctionName, args);
123 } 125 }
124 126
125 protected abstract void DoExecuteEvent(string FunctionName, object[] args); 127 protected abstract void DoExecuteEvent(string state, string FunctionName, object[] args);
126 128
127 /// <summary> 129 /// <summary>
128 /// Compute the events handled by the current state of the script 130 /// Compute the events handled by the current state of the script
129 /// </summary> 131 /// </summary>
130 /// <returns>state mask</returns> 132 /// <returns>state mask</returns>
131 public scriptEvents GetStateEventFlags() 133 public scriptEvents GetStateEventFlags(string state)
132 { 134 {
133 return DoGetStateEventFlags(); 135 return DoGetStateEventFlags(state);
134 } 136 }
135 137
136 protected abstract scriptEvents DoGetStateEventFlags(); 138 protected abstract scriptEvents DoGetStateEventFlags(string state);
137 139
138 protected void initEventFlags() 140 protected void initEventFlags()
139 { 141 {
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 0b0ff3d..709e3ee 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -14,11 +14,15 @@ using OpenSim.Framework;
14using OpenSim.Region.Environment; 14using OpenSim.Region.Environment;
15using OpenSim.Region.Environment.Scenes; 15using OpenSim.Region.Environment.Scenes;
16using OpenSim.Region.Environment.Interfaces; 16using OpenSim.Region.Environment.Interfaces;
17using OpenSim.Region.ScriptEngine.XEngine.Script; 17using OpenSim.Region.ScriptEngine.Shared;
18using OpenSim.Region.ScriptEngine.Shared.Api;
19using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
20using OpenSim.Region.ScriptEngine.Shared.CodeTools;
21using OpenSim.Region.ScriptEngine.Interfaces;
18 22
19namespace OpenSim.Region.ScriptEngine.XEngine 23namespace OpenSim.Region.ScriptEngine.XEngine
20{ 24{
21 public class XEngine : IRegionModule 25 public class XEngine : IRegionModule, IScriptEngine
22 { 26 {
23 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 27 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
24 28
@@ -30,10 +34,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
30 private EventManager m_EventManager; 34 private EventManager m_EventManager;
31 private int m_EventLimit; 35 private int m_EventLimit;
32 private bool m_KillTimedOutScripts; 36 private bool m_KillTimedOutScripts;
37 public AsyncCommandManager m_AsyncCommands;
33 38
34 private static List<XEngine> m_ScriptEngines = 39 private static List<XEngine> m_ScriptEngines =
35 new List<XEngine>(); 40 new List<XEngine>();
36 public AsyncCommandManager m_ASYNCLSLCommandManager;
37 41
38 // Maps the local id to the script inventory items in it 42 // Maps the local id to the script inventory items in it
39 43
@@ -87,11 +91,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
87 string Script; 91 string Script;
88 } 92 }
89 93
90 public IConfig ScriptConfigSource 94 public IConfig Config
91 { 95 {
92 get { return m_ScriptConfig; } 96 get { return m_ScriptConfig; }
93 } 97 }
94 98
99 public Object AsyncCommands
100 {
101 get { return (Object)m_AsyncCommands; }
102 }
103
95 // 104 //
96 // IRegionModule functions 105 // IRegionModule functions
97 // 106 //
@@ -155,7 +164,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
155 } 164 }
156 165
157 m_EventManager = new EventManager(this); 166 m_EventManager = new EventManager(this);
158 m_ASYNCLSLCommandManager = new AsyncCommandManager(this);
159 167
160 StartEngine(minThreads, maxThreads, idleTimeout, prio, 168 StartEngine(minThreads, maxThreads, idleTimeout, prio,
161 maxScriptQueue, stackSize); 169 maxScriptQueue, stackSize);
@@ -166,6 +174,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
166 m_Scene.EventManager.OnRemoveScript += OnRemoveScript; 174 m_Scene.EventManager.OnRemoveScript += OnRemoveScript;
167 m_Scene.EventManager.OnScriptReset += OnScriptReset; 175 m_Scene.EventManager.OnScriptReset += OnScriptReset;
168 176
177 m_AsyncCommands = new AsyncCommandManager(this);
178
169 if (sleepTime > 0) 179 if (sleepTime > 0)
170 { 180 {
171 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 181 m_ThreadPool.QueueWorkItem(new WorkItemCallback(
@@ -418,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
418 if (!m_Scripts.ContainsKey(itemID)) 428 if (!m_Scripts.ContainsKey(itemID))
419 return; 429 return;
420 430
421 m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); 431 m_AsyncCommands.RemoveScript(localID, itemID);
422 432
423 XScriptInstance instance=m_Scripts[itemID]; 433 XScriptInstance instance=m_Scripts[itemID];
424 m_Scripts.Remove(itemID); 434 m_Scripts.Remove(itemID);
@@ -552,7 +562,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
552 // 562 //
553 // Post event to an entire prim 563 // Post event to an entire prim
554 // 564 //
555 public bool PostObjectEvent(uint localID, XEventParams p) 565 public bool PostObjectEvent(uint localID, EventParams p)
556 { 566 {
557 bool result = false; 567 bool result = false;
558 568
@@ -577,7 +587,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
577 // 587 //
578 // Post an event to a single script 588 // Post an event to a single script
579 // 589 //
580 public bool PostScriptEvent(LLUUID itemID, XEventParams p) 590 public bool PostScriptEvent(LLUUID itemID, EventParams p)
581 { 591 {
582 if (m_Scripts.ContainsKey(itemID)) 592 if (m_Scripts.ContainsKey(itemID))
583 { 593 {
@@ -654,7 +664,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
654 instance.ResetScript(); 664 instance.ResetScript();
655 } 665 }
656 666
657 public XDetectParams GetDetectParams(LLUUID itemID, int idx) 667 public DetectParams GetDetectParams(LLUUID itemID, int idx)
658 { 668 {
659 XScriptInstance instance = GetInstance(itemID); 669 XScriptInstance instance = GetInstance(itemID);
660 if (instance != null) 670 if (instance != null)
@@ -669,115 +679,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
669 return instance.GetDetectID(idx); 679 return instance.GetDetectID(idx);
670 return LLUUID.Zero; 680 return LLUUID.Zero;
671 } 681 }
672 }
673
674 public class XDetectParams
675 {
676 public XDetectParams()
677 {
678 Key = LLUUID.Zero;
679 OffsetPos = new LSL_Types.Vector3();
680 LinkNum = 0;
681 Group = LLUUID.Zero;
682 Name = String.Empty;
683 Owner = LLUUID.Zero;
684 Position = new LSL_Types.Vector3();
685 Rotation = new LSL_Types.Quaternion();
686 Type = 0;
687 Velocity = new LSL_Types.Vector3();
688 }
689
690 public LLUUID Key;
691 public LSL_Types.Vector3 OffsetPos;
692 public int LinkNum;
693 public LLUUID Group;
694 public string Name;
695 public LLUUID Owner;
696 public LSL_Types.Vector3 Position;
697 public LSL_Types.Quaternion Rotation;
698 public int Type;
699 public LSL_Types.Vector3 Velocity;
700
701 public void Populate(Scene scene)
702 {
703 SceneObjectPart part = scene.GetSceneObjectPart(Key);
704 if (part == null) // Avatar, maybe?
705 {
706 ScenePresence presence = scene.GetScenePresence(Key);
707 if (presence == null)
708 return;
709
710 Name = presence.Firstname + " " + presence.Lastname;
711 Owner = Key;
712 Position = new LSL_Types.Vector3(
713 presence.AbsolutePosition.X,
714 presence.AbsolutePosition.X,
715 presence.AbsolutePosition.Z);
716 Rotation = new LSL_Types.Quaternion(
717 presence.Rotation.x,
718 presence.Rotation.y,
719 presence.Rotation.z,
720 presence.Rotation.w);
721 Velocity = new LSL_Types.Vector3(
722 presence.Velocity.X,
723 presence.Velocity.X,
724 presence.Velocity.Z);
725
726 Type = 0x01; // Avatar
727 if (presence.Velocity != LLVector3.Zero)
728 Type |= 0x02; // Active
729
730 Group = presence.ControllingClient.ActiveGroupId;
731 682
683 public void SetState(LLUUID itemID, string newState)
684 {
685 XScriptInstance instance = GetInstance(itemID);
686 if (instance == null)
732 return; 687 return;
733 } 688 instance.SetState(newState);
734
735 part=part.ParentGroup.RootPart; // We detect objects only
736
737 LinkNum = 0; // Not relevant
738
739 Group = part.GroupID;
740 Name = part.Name;
741 Owner = part.OwnerID;
742 if (part.Velocity == LLVector3.Zero)
743 Type = 0x04; // Passive
744 else
745 Type = 0x02; // Passive
746
747 foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
748 {
749 if (part.ContainsScripts())
750 {
751 Type |= 0x08; // Scripted
752 break;
753 }
754 }
755
756 Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
757 part.AbsolutePosition.Y,
758 part.AbsolutePosition.Z);
759
760 LLQuaternion wr = part.GetWorldRotation();
761 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
762
763 Velocity = new LSL_Types.Vector3(part.Velocity.X,
764 part.Velocity.Y,
765 part.Velocity.Z);
766 } 689 }
767 } 690 public string GetState(LLUUID itemID)
768
769 public class XEventParams
770 {
771 public XEventParams(string eventName, Object[] eventParams, XDetectParams[] detectParams)
772 { 691 {
773 EventName=eventName; 692 XScriptInstance instance = GetInstance(itemID);
774 Params=eventParams; 693 if (instance == null)
775 DetectParams=detectParams; 694 return "default";
695 return instance.State;
776 } 696 }
777
778 public string EventName;
779 public Object[] Params;
780 public XDetectParams[] DetectParams;
781 } 697 }
782 698
783 public class XScriptInstance 699 public class XScriptInstance
@@ -791,17 +707,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
791 private LLUUID m_ObjectID; 707 private LLUUID m_ObjectID;
792 private LLUUID m_AssetID; 708 private LLUUID m_AssetID;
793 private IScript m_Script; 709 private IScript m_Script;
794 private LSL_ScriptCommands m_LSLCommands;
795 private OSSL_ScriptCommands m_OSSLCommands;
796 private Executor m_Executor; 710 private Executor m_Executor;
797 private LLUUID m_AppDomain; 711 private LLUUID m_AppDomain;
798 private XDetectParams[] m_DetectParams; 712 private DetectParams[] m_DetectParams;
799 private bool m_TimerQueued; 713 private bool m_TimerQueued;
800 private DateTime m_EventStart; 714 private DateTime m_EventStart;
801 private bool m_InEvent; 715 private bool m_InEvent;
802 private string m_PrimName; 716 private string m_PrimName;
803 private string m_ScriptName; 717 private string m_ScriptName;
804 private string m_Assembly; 718 private string m_Assembly;
719 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
805 720
806 public enum StateSource 721 public enum StateSource
807 { 722 {
@@ -893,6 +808,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
893 m_ScriptName = scriptName; 808 m_ScriptName = scriptName;
894 m_Assembly = assembly; 809 m_Assembly = assembly;
895 810
811 ApiManager am = new ApiManager();
812
896 SceneObjectPart part=engine.World.GetSceneObjectPart(localID); 813 SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
897 if (part == null) 814 if (part == null)
898 { 815 {
@@ -900,10 +817,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
900 return; 817 return;
901 } 818 }
902 819
903 m_LSLCommands = new LSL_ScriptCommands(engine, this, part, localID, 820 foreach (string api in am.GetApis())
904 itemID); 821 {
905 m_OSSLCommands = new OSSL_ScriptCommands(engine, this, part, 822 m_Apis[api] = am.CreateApi(api);
906 localID, itemID); 823 m_Apis[api].Initialize(engine, part, localID, itemID);
824 }
907 825
908 try 826 try
909 { 827 {
@@ -918,14 +836,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
918 836
919 try 837 try
920 { 838 {
921 m_Script.Start(m_LSLCommands, m_OSSLCommands); 839 foreach (KeyValuePair<string,IScriptApi> kv in m_Apis)
840 {
841 m_Script.InitApi(kv.Key, kv.Value);
842 }
922 843
923 m_Executor = new Executor(m_Script); 844 m_Executor = new Executor(m_Script);
924 845
925// m_Engine.Log.Debug("[XEngine] Script instance created"); 846// m_Engine.Log.Debug("[XEngine] Script instance created");
926 847
927 part.SetScriptEvents(m_ItemID, 848 part.SetScriptEvents(m_ItemID,
928 (int)m_Executor.GetStateEventFlags()); 849 (int)m_Executor.GetStateEventFlags(State));
929 } 850 }
930 catch (Exception e) 851 catch (Exception e)
931 { 852 {
@@ -958,7 +879,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
958 879
959 ScriptSerializer.Deserialize(xml, this); 880 ScriptSerializer.Deserialize(xml, this);
960 881
961 m_Engine.m_ASYNCLSLCommandManager.CreateFromData( 882 m_Engine.m_AsyncCommands.CreateFromData(
962 m_LocalID, m_ItemID, m_ObjectID, 883 m_LocalID, m_ItemID, m_ObjectID,
963 PluginData); 884 PluginData);
964 885
@@ -976,32 +897,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine
976 if (stateSource == StateSource.NewRez) 897 if (stateSource == StateSource.NewRez)
977 { 898 {
978// m_Engine.Log.Debug("[XEngine] Posted changed(CHANGED_REGION_RESTART) to script"); 899// m_Engine.Log.Debug("[XEngine] Posted changed(CHANGED_REGION_RESTART) to script");
979 PostEvent(new XEventParams("changed", 900 PostEvent(new EventParams("changed",
980 new Object[] {new LSL_Types.LSLInteger(256)}, new XDetectParams[0])); 901 new Object[] {new LSL_Types.LSLInteger(256)}, new DetectParams[0]));
981 } 902 }
982 } 903 }
983 } 904 }
984 else 905 else
985 { 906 {
986 m_Engine.Log.Error("[XEngine] Unable to load script state: Memory limit exceeded"); 907 m_Engine.Log.Error("[XEngine] Unable to load script state: Memory limit exceeded");
987 PostEvent(new XEventParams("state_entry", 908 PostEvent(new EventParams("state_entry",
988 new Object[0], new XDetectParams[0])); 909 new Object[0], new DetectParams[0]));
989 Start(); 910 Start();
990 } 911 }
991 } 912 }
992 catch (Exception e) 913 catch (Exception e)
993 { 914 {
994 m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state from xml: {0}\n"+e.ToString(), xml); 915 m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state from xml: {0}\n"+e.ToString(), xml);
995 PostEvent(new XEventParams("state_entry", 916 PostEvent(new EventParams("state_entry",
996 new Object[0], new XDetectParams[0])); 917 new Object[0], new DetectParams[0]));
997 Start(); 918 Start();
998 } 919 }
999 } 920 }
1000 else 921 else
1001 { 922 {
1002 m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state, file not found"); 923 m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state, file not found");
1003 PostEvent(new XEventParams("state_entry", 924 PostEvent(new EventParams("state_entry",
1004 new Object[0], new XDetectParams[0])); 925 new Object[0], new DetectParams[0]));
1005 Start(); 926 Start();
1006 } 927 }
1007 } 928 }
@@ -1100,15 +1021,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1100 1021
1101 public void SetState(string state) 1022 public void SetState(string state)
1102 { 1023 {
1103 PostEvent(new XEventParams("state_exit", new Object[0], 1024 PostEvent(new EventParams("state_exit", new Object[0],
1104 new XDetectParams[0])); 1025 new DetectParams[0]));
1105 PostEvent(new XEventParams("state", new Object[] { state }, 1026 PostEvent(new EventParams("state", new Object[] { state },
1106 new XDetectParams[0])); 1027 new DetectParams[0]));
1107 PostEvent(new XEventParams("state_entry", new Object[0], 1028 PostEvent(new EventParams("state_entry", new Object[0],
1108 new XDetectParams[0])); 1029 new DetectParams[0]));
1109 } 1030 }
1110 1031
1111 public void PostEvent(XEventParams data) 1032 public void PostEvent(EventParams data)
1112 { 1033 {
1113// m_Engine.Log.DebugFormat("[XEngine] Posted event {2} in state {3} to {0}.{1}", 1034// m_Engine.Log.DebugFormat("[XEngine] Posted event {2} in state {3} to {0}.{1}",
1114// m_PrimName, m_ScriptName, data.EventName, m_State); 1035// m_PrimName, m_ScriptName, data.EventName, m_State);
@@ -1137,11 +1058,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1137 1058
1138 public object EventProcessor() 1059 public object EventProcessor()
1139 { 1060 {
1140 XEventParams data = null; 1061 EventParams data = null;
1141 1062
1142 lock (m_EventQueue) 1063 lock (m_EventQueue)
1143 { 1064 {
1144 data = (XEventParams) m_EventQueue.Dequeue(); 1065 data = (EventParams) m_EventQueue.Dequeue();
1145 if (data == null) // Shouldn't happen 1066 if (data == null) // Shouldn't happen
1146 { 1067 {
1147 m_CurrentResult = null; 1068 m_CurrentResult = null;
@@ -1158,7 +1079,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1158// m_Engine.Log.DebugFormat("[XEngine] Script {0}.{1} state set to {2}", 1079// m_Engine.Log.DebugFormat("[XEngine] Script {0}.{1} state set to {2}",
1159// m_PrimName, m_ScriptName, data.Params[0].ToString()); 1080// m_PrimName, m_ScriptName, data.Params[0].ToString());
1160 m_State=data.Params[0].ToString(); 1081 m_State=data.Params[0].ToString();
1161 m_Engine.m_ASYNCLSLCommandManager.RemoveScript( 1082 m_Engine.m_AsyncCommands.RemoveScript(
1162 m_LocalID, m_ItemID); 1083 m_LocalID, m_ItemID);
1163 1084
1164 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 1085 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
@@ -1166,7 +1087,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1166 if (part != null) 1087 if (part != null)
1167 { 1088 {
1168 part.SetScriptEvents(m_ItemID, 1089 part.SetScriptEvents(m_ItemID,
1169 (int)m_Executor.GetStateEventFlags()); 1090 (int)m_Executor.GetStateEventFlags(State));
1170 } 1091 }
1171 } 1092 }
1172 else 1093 else
@@ -1181,7 +1102,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1181 { 1102 {
1182 m_EventStart = DateTime.Now; 1103 m_EventStart = DateTime.Now;
1183 m_InEvent = true; 1104 m_InEvent = true;
1184 m_Executor.ExecuteEvent(data.EventName, data.Params); 1105 m_Executor.ExecuteEvent(State, data.EventName, data.Params);
1185 m_InEvent = false; 1106 m_InEvent = false;
1186 } 1107 }
1187 catch (Exception e) 1108 catch (Exception e)
@@ -1259,14 +1180,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1259 bool running = Running; 1180 bool running = Running;
1260 1181
1261 Stop(0); 1182 Stop(0);
1262 m_Engine.m_ASYNCLSLCommandManager.RemoveScript(m_LocalID, m_ItemID); 1183 m_Engine.m_AsyncCommands.RemoveScript(m_LocalID, m_ItemID);
1263 m_EventQueue.Clear(); 1184 m_EventQueue.Clear();
1264 m_Script.ResetVars(); 1185 m_Script.ResetVars();
1265 m_State = "default"; 1186 m_State = "default";
1266 if (running) 1187 if (running)
1267 Start(); 1188 Start();
1268 PostEvent(new XEventParams("state_entry", 1189 PostEvent(new EventParams("state_entry",
1269 new Object[0], new XDetectParams[0])); 1190 new Object[0], new DetectParams[0]));
1270 } 1191 }
1271 1192
1272 public Dictionary<string, object> GetVars() 1193 public Dictionary<string, object> GetVars()
@@ -1279,7 +1200,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1279 m_Script.SetVars(vars); 1200 m_Script.SetVars(vars);
1280 } 1201 }
1281 1202
1282 public XDetectParams GetDetectParams(int idx) 1203 public DetectParams GetDetectParams(int idx)
1283 { 1204 {
1284 if (idx < 0 || idx >= m_DetectParams.Length) 1205 if (idx < 0 || idx >= m_DetectParams.Length)
1285 return null; 1206 return null;
@@ -1298,7 +1219,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1298 public void SaveState(string assembly) 1219 public void SaveState(string assembly)
1299 { 1220 {
1300 PluginData = 1221 PluginData =
1301 m_Engine.m_ASYNCLSLCommandManager.GetSerializationData( 1222 m_Engine.m_AsyncCommands.GetSerializationData(
1302 m_ItemID); 1223 m_ItemID);
1303 1224
1304 string xml = ScriptSerializer.Serialize(this); 1225 string xml = ScriptSerializer.Serialize(this);
@@ -1368,7 +1289,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1368 1289
1369 while (count > 0) 1290 while (count > 0)
1370 { 1291 {
1371 XEventParams ep = (XEventParams)instance.EventQueue.Dequeue(); 1292 EventParams ep = (EventParams)instance.EventQueue.Dequeue();
1372 instance.EventQueue.Enqueue(ep); 1293 instance.EventQueue.Enqueue(ep);
1373 count--; 1294 count--;
1374 1295
@@ -1387,7 +1308,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1387 1308
1388 XmlElement detect = xmldoc.CreateElement("", "Detected", ""); 1309 XmlElement detect = xmldoc.CreateElement("", "Detected", "");
1389 1310
1390 foreach (XDetectParams det in ep.DetectParams) 1311 foreach (DetectParams det in ep.DetectParams)
1391 { 1312 {
1392 XmlElement objectElem = xmldoc.CreateElement("", "Object", 1313 XmlElement objectElem = xmldoc.CreateElement("", "Object",
1393 ""); 1314 "");
@@ -1449,9 +1370,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1449 rootElement.AppendChild(queue); 1370 rootElement.AppendChild(queue);
1450 1371
1451 XmlNode plugins = xmldoc.CreateElement("", "Plugins", ""); 1372 XmlNode plugins = xmldoc.CreateElement("", "Plugins", "");
1452 if (instance.PluginData.Length > 0) 1373 DumpList(xmldoc, plugins,
1453 DumpList(xmldoc, plugins, 1374 new LSL_Types.list(instance.PluginData));
1454 new LSL_Types.list(instance.PluginData));
1455 1375
1456 rootElement.AppendChild(plugins); 1376 rootElement.AppendChild(plugins);
1457 1377
@@ -1510,8 +1430,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1510 foreach (XmlNode item in itemL) 1430 foreach (XmlNode item in itemL)
1511 { 1431 {
1512 List<Object> parms = new List<Object>(); 1432 List<Object> parms = new List<Object>();
1513 List<XDetectParams> detected = 1433 List<DetectParams> detected =
1514 new List<XDetectParams>(); 1434 new List<DetectParams>();
1515 1435
1516 string eventName = 1436 string eventName =
1517 item.Attributes.GetNamedItem("event").Value; 1437 item.Attributes.GetNamedItem("event").Value;
@@ -1595,7 +1515,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1595 LLUUID.TryParse(det.InnerText, 1515 LLUUID.TryParse(det.InnerText,
1596 out uuid); 1516 out uuid);
1597 1517
1598 XDetectParams d = new XDetectParams(); 1518 DetectParams d = new DetectParams();
1599 d.Key = uuid; 1519 d.Key = uuid;
1600 d.OffsetPos = v; 1520 d.OffsetPos = v;
1601 d.LinkNum = d_linkNum; 1521 d.LinkNum = d_linkNum;
@@ -1612,7 +1532,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1612 break; 1532 break;
1613 } 1533 }
1614 } 1534 }
1615 XEventParams ep = new XEventParams( 1535 EventParams ep = new EventParams(
1616 eventName, parms.ToArray(), 1536 eventName, parms.ToArray(),
1617 detected.ToArray()); 1537 detected.ToArray());
1618 instance.EventQueue.Enqueue(ep); 1538 instance.EventQueue.Enqueue(ep);