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/Region/ScriptEngine/Shared/Api/Implementation | |
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/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 33 |
1 files changed, 33 insertions, 0 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 | } |