diff options
author | Sean Dague | 2008-11-04 20:48:35 +0000 |
---|---|---|
committer | Sean Dague | 2008-11-04 20:48:35 +0000 |
commit | ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5 (patch) | |
tree | 624703525f12a0dd375ddb1d0b58c204e5235f46 /OpenSim | |
parent | * Stop a non WebException in an XMLRPC request from bringing down the whole sim (diff) | |
download | opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.zip opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.gz opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.bz2 opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.xz |
From: Rob Smart <SMARTROB@uk.ibm.com>
This patch allows an object to directly message another object given its
key using the method osMessageObject(key objectUUID,string message).
to communicate with an object it must implement the dataserver listener
method. The dataserver method is passed the key of the calling object
and a string message.
Diffstat (limited to 'OpenSim')
3 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ee95342..ead88d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -31,6 +31,7 @@ using System.Runtime.Remoting.Lifetime; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim; | 33 | using OpenSim; |
34 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
@@ -41,6 +42,13 @@ using OpenSim.Region.ScriptEngine.Interfaces; | |||
41 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 42 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
42 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 43 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
43 | 44 | ||
45 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
46 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
47 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
48 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
49 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
50 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
51 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
44 | 52 | ||
45 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 53 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
46 | { | 54 | { |
@@ -91,6 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
91 | public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi | 99 | public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi |
92 | { | 100 | { |
93 | internal IEventReceiver m_ScriptEngine; | 101 | internal IEventReceiver m_ScriptEngine; |
102 | internal ILSL_Api m_LSL_Api; // get a reference to the LSL API so we can call methods housed there | ||
94 | internal SceneObjectPart m_host; | 103 | internal SceneObjectPart m_host; |
95 | internal uint m_localID; | 104 | internal uint m_localID; |
96 | internal UUID m_itemID; | 105 | internal UUID m_itemID; |
@@ -106,6 +115,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
106 | m_host = host; | 115 | m_host = host; |
107 | m_localID = localID; | 116 | m_localID = localID; |
108 | m_itemID = itemID; | 117 | m_itemID = itemID; |
118 | |||
119 | |||
109 | 120 | ||
110 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 121 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
111 | m_OSFunctionsEnabled = true; | 122 | m_OSFunctionsEnabled = true; |
@@ -932,5 +943,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
932 | 943 | ||
933 | return jsondata; | 944 | return jsondata; |
934 | } | 945 | } |
946 | |||
947 | // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function | ||
948 | // the dataserver function is passed the ID of the calling function and a string message | ||
949 | public void osMessageObject(LSL_Key objectUUID,string message) | ||
950 | { | ||
951 | CheckThreatLevel(ThreatLevel.Low,"osMessageObject"); | ||
952 | m_host.AddScriptLPS(1); | ||
953 | |||
954 | |||
955 | object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()),new LSL_Types.LSLString(message) }; | ||
956 | |||
957 | SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); | ||
958 | |||
959 | m_ScriptEngine.PostObjectEvent( | ||
960 | sceneOP.LocalId, new EventParams( | ||
961 | "dataserver", resobj, | ||
962 | new DetectParams[0])); | ||
963 | |||
964 | } | ||
965 | |||
935 | } | 966 | } |
967 | |||
968 | |||
936 | } | 969 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 92b77a4..b1749f9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -26,6 +26,11 @@ | |||
26 | */ | 26 | */ |
27 | using System.Collections; | 27 | using System.Collections; |
28 | using OpenSim.Region.ScriptEngine.Interfaces; | 28 | using OpenSim.Region.ScriptEngine.Interfaces; |
29 | |||
30 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
31 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
32 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
33 | |||
29 | namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | 34 | namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces |
30 | { | 35 | { |
31 | public enum ThreatLevel | 36 | public enum ThreatLevel |
@@ -89,5 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
89 | void osSetParcelMediaTime(double time); | 94 | void osSetParcelMediaTime(double time); |
90 | Hashtable osParseJSON(string JSON); | 95 | Hashtable osParseJSON(string JSON); |
91 | 96 | ||
97 | void osMessageObject(key objectUUID,string message); | ||
98 | |||
92 | } | 99 | } |
93 | } | 100 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d92ae7f..35a8830 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -35,9 +35,9 @@ using OpenSim.Region.Environment.Interfaces; | |||
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 35 | using OpenSim.Region.ScriptEngine.Interfaces; |
36 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 36 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
37 | using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | 37 | using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
38 | using key = System.String; | ||
39 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 38 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
40 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | 39 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
40 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
41 | 41 | ||
42 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | 42 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase |
43 | { | 43 | { |
@@ -231,6 +231,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
231 | { | 231 | { |
232 | return m_OSSL_Functions.osParseJSON(JSON); | 232 | return m_OSSL_Functions.osParseJSON(JSON); |
233 | } | 233 | } |
234 | |||
235 | public void osMessageObject(key objectUUID,string message) | ||
236 | { | ||
237 | m_OSSL_Functions.osMessageObject(objectUUID,message); | ||
238 | } | ||
234 | 239 | ||
235 | public OSSLPrim Prim; | 240 | public OSSLPrim Prim; |
236 | 241 | ||