diff options
author | Tedd Hansen | 2007-12-30 22:37:07 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-12-30 22:37:07 +0000 |
commit | 6055db2bc3beadcfd3e06c74b0fffb42ae4545a7 (patch) | |
tree | debac78168e81bc1995c39ffd8134f61613652c1 /OpenSim/Region/ScriptEngine/RemoteServer | |
parent | Add an extra check that we don't create new inventory folders for a user that... (diff) | |
download | opensim-SC_OLD-6055db2bc3beadcfd3e06c74b0fffb42ae4545a7.zip opensim-SC_OLD-6055db2bc3beadcfd3e06c74b0fffb42ae4545a7.tar.gz opensim-SC_OLD-6055db2bc3beadcfd3e06c74b0fffb42ae4545a7.tar.bz2 opensim-SC_OLD-6055db2bc3beadcfd3e06c74b0fffb42ae4545a7.tar.xz |
server->script event path almost ready for remote scriptengine (translation table between local script ID and remote script ID missing)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/RemoteServer')
3 files changed, 86 insertions, 39 deletions
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs index b4ac615..f0a3aa1 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
38 | internal class EventManager | 38 | internal class EventManager |
39 | { | 39 | { |
40 | 40 | ||
41 | System.Collections.Generic.Dictionary<uint, EventManager> remoteScript = new System.Collections.Generic.Dictionary<uint, EventManager>(); | 41 | System.Collections.Generic.Dictionary<uint, OpenSim.Grid.ScriptServer.RemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, OpenSim.Grid.ScriptServer.RemotingObject>(); |
42 | 42 | ||
43 | 43 | ||
44 | private ScriptEngine myScriptEngine; | 44 | private ScriptEngine myScriptEngine; |
@@ -47,179 +47,185 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
47 | myScriptEngine = _ScriptEngine; | 47 | myScriptEngine = _ScriptEngine; |
48 | 48 | ||
49 | myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); | 49 | myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); |
50 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 50 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
51 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 51 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
52 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 52 | //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
53 | |||
54 | |||
53 | } | 55 | } |
54 | 56 | ||
55 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 57 | |
58 | public void OnRezScript(uint localID, LLUUID itemID, string script) | ||
56 | { | 59 | { |
57 | remoteScript[localID].touch_start(localID, offsetPos, remoteClient); | 60 | // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID |
61 | OpenSim.Grid.ScriptServer.RemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); | ||
62 | remoteScript.Add(localID, obj); | ||
63 | remoteScript[localID].ScriptEngine.m_EventManager.OnRezScript(localID, itemID, script); | ||
58 | } | 64 | } |
59 | 65 | ||
60 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 66 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
61 | { | 67 | { |
62 | remoteScript[localID].OnRezScript(localID, itemID, script); | 68 | remoteScript[localID].ScriptEngine.m_EventManager.touch_start(localID, offsetPos, remoteClient); |
63 | } | 69 | } |
64 | 70 | ||
65 | public void OnRemoveScript(uint localID, LLUUID itemID) | 71 | public void OnRemoveScript(uint localID, LLUUID itemID) |
66 | { | 72 | { |
67 | remoteScript[localID].OnRemoveScript(localID, itemID); | 73 | remoteScript[localID].ScriptEngine.m_EventManager.OnRemoveScript(localID, itemID); |
68 | } | 74 | } |
69 | 75 | ||
70 | public void state_exit(uint localID, LLUUID itemID) | 76 | public void state_exit(uint localID, LLUUID itemID) |
71 | { | 77 | { |
72 | remoteScript[localID].state_exit(localID, itemID); | 78 | remoteScript[localID].ScriptEngine.m_EventManager.state_exit(localID, itemID); |
73 | } | 79 | } |
74 | 80 | ||
75 | public void touch(uint localID, LLUUID itemID) | 81 | public void touch(uint localID, LLUUID itemID) |
76 | { | 82 | { |
77 | remoteScript[localID].touch(localID, itemID); | 83 | remoteScript[localID].ScriptEngine.m_EventManager.touch(localID, itemID); |
78 | } | 84 | } |
79 | 85 | ||
80 | public void touch_end(uint localID, LLUUID itemID) | 86 | public void touch_end(uint localID, LLUUID itemID) |
81 | { | 87 | { |
82 | remoteScript[localID].touch_end(localID, itemID); | 88 | remoteScript[localID].ScriptEngine.m_EventManager.touch_end(localID, itemID); |
83 | } | 89 | } |
84 | 90 | ||
85 | public void collision_start(uint localID, LLUUID itemID) | 91 | public void collision_start(uint localID, LLUUID itemID) |
86 | { | 92 | { |
87 | remoteScript[localID].collision_start(localID, itemID); | 93 | remoteScript[localID].ScriptEngine.m_EventManager.collision_start(localID, itemID); |
88 | } | 94 | } |
89 | 95 | ||
90 | public void collision(uint localID, LLUUID itemID) | 96 | public void collision(uint localID, LLUUID itemID) |
91 | { | 97 | { |
92 | remoteScript[localID].collision(localID, itemID); | 98 | remoteScript[localID].ScriptEngine.m_EventManager.collision(localID, itemID); |
93 | } | 99 | } |
94 | 100 | ||
95 | public void collision_end(uint localID, LLUUID itemID) | 101 | public void collision_end(uint localID, LLUUID itemID) |
96 | { | 102 | { |
97 | remoteScript[localID].collision_end(localID, itemID); | 103 | remoteScript[localID].ScriptEngine.m_EventManager.collision_end(localID, itemID); |
98 | } | 104 | } |
99 | 105 | ||
100 | public void land_collision_start(uint localID, LLUUID itemID) | 106 | public void land_collision_start(uint localID, LLUUID itemID) |
101 | { | 107 | { |
102 | remoteScript[localID].land_collision_start(localID, itemID); | 108 | remoteScript[localID].ScriptEngine.m_EventManager.land_collision_start(localID, itemID); |
103 | } | 109 | } |
104 | 110 | ||
105 | public void land_collision(uint localID, LLUUID itemID) | 111 | public void land_collision(uint localID, LLUUID itemID) |
106 | { | 112 | { |
107 | remoteScript[localID].land_collision(localID, itemID); | 113 | remoteScript[localID].ScriptEngine.m_EventManager.land_collision(localID, itemID); |
108 | } | 114 | } |
109 | 115 | ||
110 | public void land_collision_end(uint localID, LLUUID itemID) | 116 | public void land_collision_end(uint localID, LLUUID itemID) |
111 | { | 117 | { |
112 | remoteScript[localID].land_collision_end(localID, itemID); | 118 | remoteScript[localID].ScriptEngine.m_EventManager.land_collision_end(localID, itemID); |
113 | } | 119 | } |
114 | 120 | ||
115 | public void timer(uint localID, LLUUID itemID) | 121 | public void timer(uint localID, LLUUID itemID) |
116 | { | 122 | { |
117 | remoteScript[localID].timer(localID, itemID); | 123 | remoteScript[localID].ScriptEngine.m_EventManager.timer(localID, itemID); |
118 | } | 124 | } |
119 | 125 | ||
120 | public void listen(uint localID, LLUUID itemID) | 126 | public void listen(uint localID, LLUUID itemID) |
121 | { | 127 | { |
122 | remoteScript[localID].listen(localID, itemID); | 128 | remoteScript[localID].ScriptEngine.m_EventManager.listen(localID, itemID); |
123 | } | 129 | } |
124 | 130 | ||
125 | public void on_rez(uint localID, LLUUID itemID) | 131 | public void on_rez(uint localID, LLUUID itemID) |
126 | { | 132 | { |
127 | remoteScript[localID].on_rez(localID, itemID); | 133 | remoteScript[localID].ScriptEngine.m_EventManager.on_rez(localID, itemID); |
128 | } | 134 | } |
129 | 135 | ||
130 | public void sensor(uint localID, LLUUID itemID) | 136 | public void sensor(uint localID, LLUUID itemID) |
131 | { | 137 | { |
132 | remoteScript[localID].sensor(localID, itemID); | 138 | remoteScript[localID].ScriptEngine.m_EventManager.sensor(localID, itemID); |
133 | } | 139 | } |
134 | 140 | ||
135 | public void no_sensor(uint localID, LLUUID itemID) | 141 | public void no_sensor(uint localID, LLUUID itemID) |
136 | { | 142 | { |
137 | remoteScript[localID].no_sensor(localID, itemID); | 143 | remoteScript[localID].ScriptEngine.m_EventManager.no_sensor(localID, itemID); |
138 | } | 144 | } |
139 | 145 | ||
140 | public void control(uint localID, LLUUID itemID) | 146 | public void control(uint localID, LLUUID itemID) |
141 | { | 147 | { |
142 | remoteScript[localID].control(localID, itemID); | 148 | remoteScript[localID].ScriptEngine.m_EventManager.control(localID, itemID); |
143 | } | 149 | } |
144 | 150 | ||
145 | public void money(uint localID, LLUUID itemID) | 151 | public void money(uint localID, LLUUID itemID) |
146 | { | 152 | { |
147 | remoteScript[localID].money(localID, itemID); | 153 | remoteScript[localID].ScriptEngine.m_EventManager.money(localID, itemID); |
148 | } | 154 | } |
149 | 155 | ||
150 | public void email(uint localID, LLUUID itemID) | 156 | public void email(uint localID, LLUUID itemID) |
151 | { | 157 | { |
152 | remoteScript[localID].email(localID, itemID); | 158 | remoteScript[localID].ScriptEngine.m_EventManager.email(localID, itemID); |
153 | } | 159 | } |
154 | 160 | ||
155 | public void at_target(uint localID, LLUUID itemID) | 161 | public void at_target(uint localID, LLUUID itemID) |
156 | { | 162 | { |
157 | remoteScript[localID].at_target(localID, itemID); | 163 | remoteScript[localID].ScriptEngine.m_EventManager.at_target(localID, itemID); |
158 | } | 164 | } |
159 | 165 | ||
160 | public void not_at_target(uint localID, LLUUID itemID) | 166 | public void not_at_target(uint localID, LLUUID itemID) |
161 | { | 167 | { |
162 | remoteScript[localID].not_at_target(localID, itemID); | 168 | remoteScript[localID].ScriptEngine.m_EventManager.not_at_target(localID, itemID); |
163 | } | 169 | } |
164 | 170 | ||
165 | public void at_rot_target(uint localID, LLUUID itemID) | 171 | public void at_rot_target(uint localID, LLUUID itemID) |
166 | { | 172 | { |
167 | remoteScript[localID].at_rot_target(localID, itemID); | 173 | remoteScript[localID].ScriptEngine.m_EventManager.at_rot_target(localID, itemID); |
168 | } | 174 | } |
169 | 175 | ||
170 | public void not_at_rot_target(uint localID, LLUUID itemID) | 176 | public void not_at_rot_target(uint localID, LLUUID itemID) |
171 | { | 177 | { |
172 | remoteScript[localID].not_at_rot_target(localID, itemID); | 178 | remoteScript[localID].ScriptEngine.m_EventManager.not_at_rot_target(localID, itemID); |
173 | } | 179 | } |
174 | 180 | ||
175 | public void run_time_permissions(uint localID, LLUUID itemID) | 181 | public void run_time_permissions(uint localID, LLUUID itemID) |
176 | { | 182 | { |
177 | remoteScript[localID].run_time_permissions(localID, itemID); | 183 | remoteScript[localID].ScriptEngine.m_EventManager.run_time_permissions(localID, itemID); |
178 | } | 184 | } |
179 | 185 | ||
180 | public void changed(uint localID, LLUUID itemID) | 186 | public void changed(uint localID, LLUUID itemID) |
181 | { | 187 | { |
182 | remoteScript[localID].changed(localID, itemID); | 188 | remoteScript[localID].ScriptEngine.m_EventManager.changed(localID, itemID); |
183 | } | 189 | } |
184 | 190 | ||
185 | public void attach(uint localID, LLUUID itemID) | 191 | public void attach(uint localID, LLUUID itemID) |
186 | { | 192 | { |
187 | remoteScript[localID].attach(localID, itemID); | 193 | remoteScript[localID].ScriptEngine.m_EventManager.attach(localID, itemID); |
188 | } | 194 | } |
189 | 195 | ||
190 | public void dataserver(uint localID, LLUUID itemID) | 196 | public void dataserver(uint localID, LLUUID itemID) |
191 | { | 197 | { |
192 | remoteScript[localID].dataserver(localID, itemID); | 198 | remoteScript[localID].ScriptEngine.m_EventManager.dataserver(localID, itemID); |
193 | } | 199 | } |
194 | 200 | ||
195 | public void link_message(uint localID, LLUUID itemID) | 201 | public void link_message(uint localID, LLUUID itemID) |
196 | { | 202 | { |
197 | remoteScript[localID].link_message(localID, itemID); | 203 | remoteScript[localID].ScriptEngine.m_EventManager.link_message(localID, itemID); |
198 | } | 204 | } |
199 | 205 | ||
200 | public void moving_start(uint localID, LLUUID itemID) | 206 | public void moving_start(uint localID, LLUUID itemID) |
201 | { | 207 | { |
202 | remoteScript[localID].moving_start(localID, itemID); | 208 | remoteScript[localID].ScriptEngine.m_EventManager.moving_start(localID, itemID); |
203 | } | 209 | } |
204 | 210 | ||
205 | public void moving_end(uint localID, LLUUID itemID) | 211 | public void moving_end(uint localID, LLUUID itemID) |
206 | { | 212 | { |
207 | remoteScript[localID].moving_end(localID, itemID); | 213 | remoteScript[localID].ScriptEngine.m_EventManager.moving_end(localID, itemID); |
208 | } | 214 | } |
209 | 215 | ||
210 | public void object_rez(uint localID, LLUUID itemID) | 216 | public void object_rez(uint localID, LLUUID itemID) |
211 | { | 217 | { |
212 | remoteScript[localID].object_rez(localID, itemID); | 218 | remoteScript[localID].ScriptEngine.m_EventManager.object_rez(localID, itemID); |
213 | } | 219 | } |
214 | 220 | ||
215 | public void remote_data(uint localID, LLUUID itemID) | 221 | public void remote_data(uint localID, LLUUID itemID) |
216 | { | 222 | { |
217 | remoteScript[localID].remote_data(localID, itemID); | 223 | remoteScript[localID].ScriptEngine.m_EventManager.remote_data(localID, itemID); |
218 | } | 224 | } |
219 | 225 | ||
220 | public void http_response(uint localID, LLUUID itemID) | 226 | public void http_response(uint localID, LLUUID itemID) |
221 | { | 227 | { |
222 | remoteScript[localID].http_response(localID, itemID); | 228 | remoteScript[localID].ScriptEngine.m_EventManager.http_response(localID, itemID); |
223 | } | 229 | } |
224 | 230 | ||
225 | } | 231 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs new file mode 100644 index 0000000..423e6be --- /dev/null +++ b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Runtime.Remoting; | ||
5 | using System.Runtime.Remoting.Channels; | ||
6 | using System.Runtime.Remoting.Channels.Tcp; | ||
7 | |||
8 | namespace OpenSim.Region.ScriptEngine.RemoteServer | ||
9 | { | ||
10 | class RemoteServer | ||
11 | { | ||
12 | |||
13 | public OpenSim.Grid.ScriptServer.RemotingObject Connect(string hostname, int port) | ||
14 | { | ||
15 | // Create a channel for communicating w/ the remote object | ||
16 | // Notice no port is specified on the client | ||
17 | TcpChannel chan = new TcpChannel(); | ||
18 | ChannelServices.RegisterChannel(chan, true); | ||
19 | |||
20 | // Create an instance of the remote object | ||
21 | OpenSim.Grid.ScriptServer.RemotingObject obj = (OpenSim.Grid.ScriptServer.RemotingObject)Activator.GetObject( | ||
22 | typeof(OpenSim.Grid.ScriptServer.RemotingObject), | ||
23 | "tcp://" + hostname + ":" + port + "/DotNetEngine"); | ||
24 | |||
25 | // Use the object | ||
26 | if (obj.Equals(null)) | ||
27 | { | ||
28 | System.Console.WriteLine("Error: unable to locate server"); | ||
29 | } | ||
30 | else | ||
31 | { | ||
32 | return obj; | ||
33 | } | ||
34 | return null; | ||
35 | |||
36 | } | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs index ae29ad5..679d5d4 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs | |||
@@ -43,6 +43,7 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
43 | { | 43 | { |
44 | internal Scene World; | 44 | internal Scene World; |
45 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 45 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
46 | internal RemoteServer m_RemoteServer; | ||
46 | 47 | ||
47 | private LogBase m_log; | 48 | private LogBase m_log; |
48 | 49 | ||
@@ -64,6 +65,8 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
64 | Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); | 65 | Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); |
65 | // Create all objects we'll be using | 66 | // Create all objects we'll be using |
66 | m_EventManager = new EventManager(this); | 67 | m_EventManager = new EventManager(this); |
68 | m_RemoteServer = new RemoteServer(); | ||
69 | m_RemoteServer.Connect("localhost", 1234); | ||
67 | } | 70 | } |
68 | 71 | ||
69 | public void Shutdown() | 72 | public void Shutdown() |