aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorSean Dague2007-10-05 19:33:26 +0000
committerSean Dague2007-10-05 19:33:26 +0000
commit29aa41daa004531cc41649c1818e4e432600cc32 (patch)
tree6d2e3574b7222137a83fc6ba6502b197efb89bfc /OpenSim/Region/ScriptEngine
parentgetting all our line endings consistant again (diff)
downloadopensim-SC-29aa41daa004531cc41649c1818e4e432600cc32.zip
opensim-SC-29aa41daa004531cc41649c1818e4e432600cc32.tar.gz
opensim-SC-29aa41daa004531cc41649c1818e4e432600cc32.tar.bz2
opensim-SC-29aa41daa004531cc41649c1818e4e432600cc32.tar.xz
Code from Illumious Beltran (IBM) implementing more LSL
The functions implemented are: llListen llListenControl llListenRemove llOpenRemoteDataChannel llCloseRemoteDataChannel llRemoteDataReply The events implemented are: listen remote_data
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs67
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs61
2 files changed, 120 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 6838f47..3985273 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -177,14 +177,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
177 //type for whisper is 0 177 //type for whisper is 0
178 World.SimChat(Helpers.StringToField(text), 178 World.SimChat(Helpers.StringToField(text),
179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
180
181 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
182 wComm.DeliverMessage(m_host.UUID.ToString(), 0, channelID, m_host.Name, text);
180 } 183 }
181 184
182 public void llSay(int channelID, string text) 185 public void llSay(int channelID, string text)
183 { 186 {
184 //type for say is 1 187 //type for say is 1
185
186 World.SimChat(Helpers.StringToField(text), 188 World.SimChat(Helpers.StringToField(text),
187 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 189 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
190
191 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
192 wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text);
188 } 193 }
189 194
190 public void llShout(int channelID, string text) 195 public void llShout(int channelID, string text)
@@ -192,11 +197,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
192 //type for shout is 2 197 //type for shout is 2
193 World.SimChat(Helpers.StringToField(text), 198 World.SimChat(Helpers.StringToField(text),
194 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 199 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
200
201 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
202 wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text);
203 }
204
205 public int llListen(int channelID, string name, string ID, string msg) {
206
207 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
208 return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg);
209
210 }
211
212 public void llListenControl(int number, int active) {
213
214 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
215 wComm.ListenControl(number, active);
216
217 }
218
219 public void llListenRemove(int number) {
220
221 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
222 wComm.ListenRemove(number);
223
195 } 224 }
196 225
197 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; }
198 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; }
199 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; }
200 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 226 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; }
201 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 227 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; }
202 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 228 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; }
@@ -927,10 +953,37 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
927 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 953 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); }
928 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 954 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); }
929 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 955 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); }
930 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } 956
957 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
958 // Not sure where these constants should live:
959 // REMOTE_DATA_CHANNEL = 1
960 // REMOTE_DATA_REQUEST = 2
961 // REMOTE_DATA_REPLY = 3
962 public void llOpenRemoteDataChannel() {
963
964 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
965 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID);
966 object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" };
967 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj);
968
969 }
970
931 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 971 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; }
932 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } 972
933 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } 973 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
974 {
975
976 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
977 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
978
979 }
980
981 public void llCloseRemoteDataChannel(string channel) {
982
983 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
984 xmlrpcMod.CloseXMLRPCChannel(channel);
985
986 }
934 987
935 public string llMD5String(string src, int nonce) 988 public string llMD5String(string src, int nonce)
936 { 989 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index 8ab0c30..5b92ff0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -4,6 +4,8 @@ using System.Text;
4using System.Threading; 4using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Region.ScriptEngine.Common; 6using OpenSim.Region.ScriptEngine.Common;
7using OpenSim.Region.Environment.Modules;
8using OpenSim.Region.Environment.Interfaces;
7 9
8namespace OpenSim.Region.ScriptEngine.DotNetEngine 10namespace OpenSim.Region.ScriptEngine.DotNetEngine
9{ 11{
@@ -26,6 +28,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
26 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 28 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
27 cmdHandlerThread.IsBackground = true; 29 cmdHandlerThread.IsBackground = true;
28 cmdHandlerThread.Start(); 30 cmdHandlerThread.Start();
31
29 } 32 }
30 ~LSLLongCmdHandler() 33 ~LSLLongCmdHandler()
31 { 34 {
@@ -50,11 +53,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
50 { 53 {
51 // Check timers 54 // Check timers
52 CheckTimerEvents(); 55 CheckTimerEvents();
56 Thread.Sleep(25);
53 // Check HttpRequests 57 // Check HttpRequests
54 CheckHttpRequests(); 58 CheckHttpRequests();
59 Thread.Sleep(25);
60 // Check XMLRPCRequests
61 CheckXMLRPCRequests();
62 Thread.Sleep(25);
63 // Check Listeners
64 CheckListeners();
65 Thread.Sleep(25);
55 66
56 // Sleep before next cycle 67 // Sleep before next cycle
57 Thread.Sleep(cmdHandlerThreadCycleSleepms); 68 //Thread.Sleep(cmdHandlerThreadCycleSleepms);
58 } 69 }
59 } 70 }
60 71
@@ -258,5 +269,53 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
258 } 269 }
259 #endregion 270 #endregion
260 271
272 public void CheckXMLRPCRequests()
273 {
274
275 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
276
277 while (xmlrpc.hasRequests())
278 {
279 RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
280 System.Console.WriteLine("PICKED REQUEST");
281
282 //Deliver data to prim's remote_data handler
283 object[] resobj = new object[] {
284 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal()
285 };
286 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
287 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj
288 );
289
290 }
291
292 }
293
294 public void CheckListeners()
295 {
296
297 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
298
299 while (comms.HasMessages())
300 {
301 ListenerInfo lInfo = comms.GetNextMessage();
302 System.Console.WriteLine("PICKED LISTENER");
303
304 //Deliver data to prim's listen handler
305 object[] resobj = new object[] {
306 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
307 };
308
309 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
310 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj
311 );
312
313 }
314
315 }
316
317
318
319
261 } 320 }
262} 321}