diff options
author | Tedd Hansen | 2007-12-30 19:08:22 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-12-30 19:08:22 +0000 |
commit | c084c54fb557ca6b35f22ec544fc42aa4ada8f21 (patch) | |
tree | c3f5d79cfdb23f9af027ea2d990d0878059e5c7f /OpenSim/Region/ScriptEngine | |
parent | Shift default OpenSim library into its own directory (diff) | |
download | opensim-SC-c084c54fb557ca6b35f22ec544fc42aa4ada8f21.zip opensim-SC-c084c54fb557ca6b35f22ec544fc42aa4ada8f21.tar.gz opensim-SC-c084c54fb557ca6b35f22ec544fc42aa4ada8f21.tar.bz2 opensim-SC-c084c54fb557ca6b35f22ec544fc42aa4ada8f21.tar.xz |
Added ScriptEngine.RemoteServer module
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 424 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs new file mode 100644 index 0000000..906c157 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | /* Original code: Tedd Hansen */ | ||
29 | namespace OpenSim.Region.ScriptEngine.RemoteServer | ||
30 | { | ||
31 | public static class Common | ||
32 | { | ||
33 | public static bool debug = true; | ||
34 | public static ScriptEngine mySE; | ||
35 | |||
36 | // This class just contains some static log stuff used for debugging. | ||
37 | |||
38 | //public delegate void SendToDebugEventDelegate(string Message); | ||
39 | //public delegate void SendToLogEventDelegate(string Message); | ||
40 | //static public event SendToDebugEventDelegate SendToDebugEvent; | ||
41 | //static public event SendToLogEventDelegate SendToLogEvent; | ||
42 | |||
43 | public static void SendToDebug(string Message) | ||
44 | { | ||
45 | //if (Debug == true) | ||
46 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); | ||
47 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | ||
48 | } | ||
49 | |||
50 | public static void SendToLog(string Message) | ||
51 | { | ||
52 | //if (Debug == true) | ||
53 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); | ||
54 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | ||
55 | } | ||
56 | } | ||
57 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs new file mode 100644 index 0000000..b4ac615 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | /* Original code: Tedd Hansen */ | ||
29 | using System; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.RemoteServer | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// </summary> | ||
37 | [Serializable] | ||
38 | internal class EventManager | ||
39 | { | ||
40 | |||
41 | System.Collections.Generic.Dictionary<uint, EventManager> remoteScript = new System.Collections.Generic.Dictionary<uint, EventManager>(); | ||
42 | |||
43 | |||
44 | private ScriptEngine myScriptEngine; | ||
45 | public EventManager(ScriptEngine _ScriptEngine) | ||
46 | { | ||
47 | myScriptEngine = _ScriptEngine; | ||
48 | |||
49 | myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); | ||
50 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | ||
51 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | ||
52 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | ||
53 | } | ||
54 | |||
55 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | ||
56 | { | ||
57 | remoteScript[localID].touch_start(localID, offsetPos, remoteClient); | ||
58 | } | ||
59 | |||
60 | public void OnRezScript(uint localID, LLUUID itemID, string script) | ||
61 | { | ||
62 | remoteScript[localID].OnRezScript(localID, itemID, script); | ||
63 | } | ||
64 | |||
65 | public void OnRemoveScript(uint localID, LLUUID itemID) | ||
66 | { | ||
67 | remoteScript[localID].OnRemoveScript(localID, itemID); | ||
68 | } | ||
69 | |||
70 | public void state_exit(uint localID, LLUUID itemID) | ||
71 | { | ||
72 | remoteScript[localID].state_exit(localID, itemID); | ||
73 | } | ||
74 | |||
75 | public void touch(uint localID, LLUUID itemID) | ||
76 | { | ||
77 | remoteScript[localID].touch(localID, itemID); | ||
78 | } | ||
79 | |||
80 | public void touch_end(uint localID, LLUUID itemID) | ||
81 | { | ||
82 | remoteScript[localID].touch_end(localID, itemID); | ||
83 | } | ||
84 | |||
85 | public void collision_start(uint localID, LLUUID itemID) | ||
86 | { | ||
87 | remoteScript[localID].collision_start(localID, itemID); | ||
88 | } | ||
89 | |||
90 | public void collision(uint localID, LLUUID itemID) | ||
91 | { | ||
92 | remoteScript[localID].collision(localID, itemID); | ||
93 | } | ||
94 | |||
95 | public void collision_end(uint localID, LLUUID itemID) | ||
96 | { | ||
97 | remoteScript[localID].collision_end(localID, itemID); | ||
98 | } | ||
99 | |||
100 | public void land_collision_start(uint localID, LLUUID itemID) | ||
101 | { | ||
102 | remoteScript[localID].land_collision_start(localID, itemID); | ||
103 | } | ||
104 | |||
105 | public void land_collision(uint localID, LLUUID itemID) | ||
106 | { | ||
107 | remoteScript[localID].land_collision(localID, itemID); | ||
108 | } | ||
109 | |||
110 | public void land_collision_end(uint localID, LLUUID itemID) | ||
111 | { | ||
112 | remoteScript[localID].land_collision_end(localID, itemID); | ||
113 | } | ||
114 | |||
115 | public void timer(uint localID, LLUUID itemID) | ||
116 | { | ||
117 | remoteScript[localID].timer(localID, itemID); | ||
118 | } | ||
119 | |||
120 | public void listen(uint localID, LLUUID itemID) | ||
121 | { | ||
122 | remoteScript[localID].listen(localID, itemID); | ||
123 | } | ||
124 | |||
125 | public void on_rez(uint localID, LLUUID itemID) | ||
126 | { | ||
127 | remoteScript[localID].on_rez(localID, itemID); | ||
128 | } | ||
129 | |||
130 | public void sensor(uint localID, LLUUID itemID) | ||
131 | { | ||
132 | remoteScript[localID].sensor(localID, itemID); | ||
133 | } | ||
134 | |||
135 | public void no_sensor(uint localID, LLUUID itemID) | ||
136 | { | ||
137 | remoteScript[localID].no_sensor(localID, itemID); | ||
138 | } | ||
139 | |||
140 | public void control(uint localID, LLUUID itemID) | ||
141 | { | ||
142 | remoteScript[localID].control(localID, itemID); | ||
143 | } | ||
144 | |||
145 | public void money(uint localID, LLUUID itemID) | ||
146 | { | ||
147 | remoteScript[localID].money(localID, itemID); | ||
148 | } | ||
149 | |||
150 | public void email(uint localID, LLUUID itemID) | ||
151 | { | ||
152 | remoteScript[localID].email(localID, itemID); | ||
153 | } | ||
154 | |||
155 | public void at_target(uint localID, LLUUID itemID) | ||
156 | { | ||
157 | remoteScript[localID].at_target(localID, itemID); | ||
158 | } | ||
159 | |||
160 | public void not_at_target(uint localID, LLUUID itemID) | ||
161 | { | ||
162 | remoteScript[localID].not_at_target(localID, itemID); | ||
163 | } | ||
164 | |||
165 | public void at_rot_target(uint localID, LLUUID itemID) | ||
166 | { | ||
167 | remoteScript[localID].at_rot_target(localID, itemID); | ||
168 | } | ||
169 | |||
170 | public void not_at_rot_target(uint localID, LLUUID itemID) | ||
171 | { | ||
172 | remoteScript[localID].not_at_rot_target(localID, itemID); | ||
173 | } | ||
174 | |||
175 | public void run_time_permissions(uint localID, LLUUID itemID) | ||
176 | { | ||
177 | remoteScript[localID].run_time_permissions(localID, itemID); | ||
178 | } | ||
179 | |||
180 | public void changed(uint localID, LLUUID itemID) | ||
181 | { | ||
182 | remoteScript[localID].changed(localID, itemID); | ||
183 | } | ||
184 | |||
185 | public void attach(uint localID, LLUUID itemID) | ||
186 | { | ||
187 | remoteScript[localID].attach(localID, itemID); | ||
188 | } | ||
189 | |||
190 | public void dataserver(uint localID, LLUUID itemID) | ||
191 | { | ||
192 | remoteScript[localID].dataserver(localID, itemID); | ||
193 | } | ||
194 | |||
195 | public void link_message(uint localID, LLUUID itemID) | ||
196 | { | ||
197 | remoteScript[localID].link_message(localID, itemID); | ||
198 | } | ||
199 | |||
200 | public void moving_start(uint localID, LLUUID itemID) | ||
201 | { | ||
202 | remoteScript[localID].moving_start(localID, itemID); | ||
203 | } | ||
204 | |||
205 | public void moving_end(uint localID, LLUUID itemID) | ||
206 | { | ||
207 | remoteScript[localID].moving_end(localID, itemID); | ||
208 | } | ||
209 | |||
210 | public void object_rez(uint localID, LLUUID itemID) | ||
211 | { | ||
212 | remoteScript[localID].object_rez(localID, itemID); | ||
213 | } | ||
214 | |||
215 | public void remote_data(uint localID, LLUUID itemID) | ||
216 | { | ||
217 | remoteScript[localID].remote_data(localID, itemID); | ||
218 | } | ||
219 | |||
220 | public void http_response(uint localID, LLUUID itemID) | ||
221 | { | ||
222 | remoteScript[localID].http_response(localID, itemID); | ||
223 | } | ||
224 | |||
225 | } | ||
226 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b013562 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.InteropServices; | ||
3 | |||
4 | // General Information about an assembly is controlled through the following | ||
5 | // set of attributes. Change these attribute values to modify the information | ||
6 | // associated with an assembly. | ||
7 | |||
8 | [assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.RemoteServer")] | ||
9 | [assembly : AssemblyDescription("")] | ||
10 | [assembly : AssemblyConfiguration("")] | ||
11 | [assembly : AssemblyCompany("")] | ||
12 | [assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.RemoteServer")] | ||
13 | [assembly : AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly : AssemblyTrademark("")] | ||
15 | [assembly : AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | |||
21 | [assembly : ComVisible(false)] | ||
22 | |||
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
24 | |||
25 | [assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] | ||
26 | |||
27 | // Version information for an assembly consists of the following four values: | ||
28 | // | ||
29 | // Major Version | ||
30 | // Minor Version | ||
31 | // Build Number | ||
32 | // Revision | ||
33 | // | ||
34 | // You can specify all the values or you can default the Revision and Build Numbers | ||
35 | // by using the '*' as shown below: | ||
36 | |||
37 | [assembly : AssemblyVersion("1.0.0.0")] | ||
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs new file mode 100644 index 0000000..ae29ad5 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | /* Original code: Tedd Hansen */ | ||
29 | using System; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Region.Environment.Interfaces; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | |||
35 | namespace OpenSim.Region.ScriptEngine.RemoteServer | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// This is the root object for ScriptEngine. Objects access each other trough this class. | ||
39 | /// </summary> | ||
40 | /// | ||
41 | [Serializable] | ||
42 | public class ScriptEngine : IRegionModule | ||
43 | { | ||
44 | internal Scene World; | ||
45 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | ||
46 | |||
47 | private LogBase m_log; | ||
48 | |||
49 | public ScriptEngine() | ||
50 | { | ||
51 | Common.mySE = this; | ||
52 | } | ||
53 | |||
54 | public LogBase Log | ||
55 | { | ||
56 | get { return m_log; } | ||
57 | } | ||
58 | |||
59 | public void InitializeEngine(Scene Sceneworld, LogBase logger) | ||
60 | { | ||
61 | World = Sceneworld; | ||
62 | m_log = logger; | ||
63 | |||
64 | Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); | ||
65 | // Create all objects we'll be using | ||
66 | m_EventManager = new EventManager(this); | ||
67 | } | ||
68 | |||
69 | public void Shutdown() | ||
70 | { | ||
71 | // We are shutting down | ||
72 | } | ||
73 | |||
74 | |||
75 | #region IRegionModule | ||
76 | |||
77 | public void Initialise(Scene scene, IConfigSource config) | ||
78 | { | ||
79 | InitializeEngine(scene, MainLog.Instance); | ||
80 | } | ||
81 | |||
82 | public void PostInitialise() | ||
83 | { | ||
84 | } | ||
85 | |||
86 | public void Close() | ||
87 | { | ||
88 | } | ||
89 | |||
90 | public string Name | ||
91 | { | ||
92 | get { return "LSLScriptingModule"; } | ||
93 | } | ||
94 | |||
95 | public bool IsSharedModule | ||
96 | { | ||
97 | get { return false; } | ||
98 | } | ||
99 | |||
100 | #endregion | ||
101 | |||
102 | } | ||
103 | } \ No newline at end of file | ||