diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules')
10 files changed, 29 insertions, 335 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index a484300..f3382b2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -890,10 +890,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
890 | 890 | ||
891 | public void Close() | 891 | public void Close() |
892 | { | 892 | { |
893 | Close(true); | 893 | Close(true, false); |
894 | } | 894 | } |
895 | 895 | ||
896 | public void Close(bool sendStop) | 896 | public void Close(bool sendStop, bool force) |
897 | { | 897 | { |
898 | Disconnect(); | 898 | Disconnect(); |
899 | } | 899 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs index 31d0034..17971e3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs | |||
@@ -130,37 +130,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
130 | SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val)); | 130 | SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val)); |
131 | } | 131 | } |
132 | 132 | ||
133 | private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) | 133 | private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) |
134 | { | 134 | { |
135 | SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); | 135 | SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); |
136 | 136 | ||
137 | if (hostPart == null) | 137 | if (hostPart == null) |
138 | return; | 138 | return 0; |
139 | 139 | ||
140 | if (hostPart.ParentGroup.IsAttachment) | 140 | if (hostPart.ParentGroup.IsAttachment) |
141 | return; | 141 | return 0; |
142 | 142 | ||
143 | IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>(); | 143 | IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>(); |
144 | if (attachmentsModule == null) | 144 | if (attachmentsModule == null) |
145 | return; | 145 | return 0; |
146 | 146 | ||
147 | TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script); | 147 | TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script); |
148 | if (item == null) | 148 | if (item == null) |
149 | return; | 149 | return 0; |
150 | 150 | ||
151 | if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH | 151 | if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH |
152 | return; | 152 | return 0; |
153 | 153 | ||
154 | ScenePresence target; | 154 | ScenePresence target; |
155 | if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) | 155 | if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) |
156 | return; | 156 | return 0; |
157 | 157 | ||
158 | if (target.UUID != hostPart.ParentGroup.OwnerID) | 158 | if (target.UUID != hostPart.ParentGroup.OwnerID) |
159 | { | 159 | { |
160 | uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); | 160 | uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); |
161 | 161 | ||
162 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | 162 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) |
163 | return; | 163 | return 0; |
164 | 164 | ||
165 | hostPart.ParentGroup.SetOwnerId(target.UUID); | 165 | hostPart.ParentGroup.SetOwnerId(target.UUID); |
166 | hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); | 166 | hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); |
@@ -183,7 +183,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
183 | hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); | 183 | hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); |
184 | } | 184 | } |
185 | 185 | ||
186 | attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true); | 186 | return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true) ? 1 : 0; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs index ca956fb..a014798 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs | |||
@@ -231,12 +231,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
231 | if (m_server == null || m_baseNick == null || m_ircChannel == null || m_user == null) | 231 | if (m_server == null || m_baseNick == null || m_ircChannel == null || m_user == null) |
232 | throw new Exception("Invalid connector configuration"); | 232 | throw new Exception("Invalid connector configuration"); |
233 | 233 | ||
234 | // Generate an initial nickname if randomizing is enabled | 234 | // Generate an initial nickname |
235 | 235 | ||
236 | if (m_randomizeNick) | 236 | if (m_randomizeNick) |
237 | { | ||
238 | m_nick = m_baseNick + Util.RandomClass.Next(1, 99); | 237 | m_nick = m_baseNick + Util.RandomClass.Next(1, 99); |
239 | } | 238 | else |
239 | m_nick = m_baseNick; | ||
240 | 240 | ||
241 | m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn); | 241 | m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn); |
242 | 242 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 7b20446..f292a75 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -447,7 +447,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
447 | // settings allow voice, then whether parcel allows | 447 | // settings allow voice, then whether parcel allows |
448 | // voice, if all do retrieve or obtain the parcel | 448 | // voice, if all do retrieve or obtain the parcel |
449 | // voice channel | 449 | // voice channel |
450 | LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 450 | LandData land = scene.GetLandData(avatar.AbsolutePosition); |
451 | 451 | ||
452 | //m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", | 452 | //m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", |
453 | // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); | 453 | // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index a30a38d..8a8a31c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -623,7 +623,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
623 | // settings allow voice, then whether parcel allows | 623 | // settings allow voice, then whether parcel allows |
624 | // voice, if all do retrieve or obtain the parcel | 624 | // voice, if all do retrieve or obtain the parcel |
625 | // voice channel | 625 | // voice channel |
626 | LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 626 | LandData land = scene.GetLandData(avatar.AbsolutePosition); |
627 | 627 | ||
628 | // m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", | 628 | // m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", |
629 | // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); | 629 | // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 311531c..732c28f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -175,14 +175,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
175 | /// | 175 | /// |
176 | /// </summary> | 176 | /// </summary> |
177 | // ----------------------------------------------------------------- | 177 | // ----------------------------------------------------------------- |
178 | public bool CreateStore(string value, out UUID result) | 178 | public bool CreateStore(string value, ref UUID result) |
179 | { | 179 | { |
180 | result = UUID.Zero; | 180 | if (result == UUID.Zero) |
181 | result = UUID.Random(); | ||
182 | |||
183 | JsonStore map = null; | ||
181 | 184 | ||
182 | if (! m_enabled) return false; | 185 | if (! m_enabled) return false; |
183 | 186 | ||
184 | UUID uuid = UUID.Random(); | ||
185 | JsonStore map = null; | ||
186 | 187 | ||
187 | try | 188 | try |
188 | { | 189 | { |
@@ -195,9 +196,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
195 | } | 196 | } |
196 | 197 | ||
197 | lock (m_JsonValueStore) | 198 | lock (m_JsonValueStore) |
198 | m_JsonValueStore.Add(uuid,map); | 199 | m_JsonValueStore.Add(result,map); |
199 | 200 | ||
200 | result = uuid; | ||
201 | return true; | 201 | return true; |
202 | } | 202 | } |
203 | 203 | ||
@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
231 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | 231 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) |
232 | { | 232 | { |
233 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | 233 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); |
234 | return true; | 234 | return false; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index eaba816..6910d14 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
227 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) | 227 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) |
228 | { | 228 | { |
229 | UUID uuid = UUID.Zero; | 229 | UUID uuid = UUID.Zero; |
230 | if (! m_store.CreateStore(value, out uuid)) | 230 | if (! m_store.CreateStore(value, ref uuid)) |
231 | GenerateRuntimeError("Failed to create Json store"); | 231 | GenerateRuntimeError("Failed to create Json store"); |
232 | 232 | ||
233 | return uuid; | 233 | return uuid; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index fff3a32..bad75f7 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | void OnOarFileLoaded(Guid requestId, string message) | 184 | void OnOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message) |
185 | { | 185 | { |
186 | m_oarFileLoading = true; | 186 | m_oarFileLoading = true; |
187 | 187 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs deleted file mode 100644 index 705a847..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ /dev/null | |||
@@ -1,308 +0,0 @@ | |||
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 OpenSimulator 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 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections.Generic; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using Mono.Addins; | ||
37 | using OpenMetaverse; | ||
38 | using System.Linq; | ||
39 | using System.Linq.Expressions; | ||
40 | |||
41 | namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | ||
42 | { | ||
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] | ||
44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private Dictionary<string,object> m_constants = new Dictionary<string,object>(); | ||
50 | |||
51 | #region ScriptInvocation | ||
52 | protected class ScriptInvocationData | ||
53 | { | ||
54 | public Delegate ScriptInvocationDelegate { get; private set; } | ||
55 | public string FunctionName { get; private set; } | ||
56 | public Type[] TypeSignature { get; private set; } | ||
57 | public Type ReturnType { get; private set; } | ||
58 | |||
59 | public ScriptInvocationData(string fname, Delegate fn, Type[] callsig, Type returnsig) | ||
60 | { | ||
61 | FunctionName = fname; | ||
62 | ScriptInvocationDelegate = fn; | ||
63 | TypeSignature = callsig; | ||
64 | ReturnType = returnsig; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | private Dictionary<string,ScriptInvocationData> m_scriptInvocation = new Dictionary<string,ScriptInvocationData>(); | ||
69 | #endregion | ||
70 | |||
71 | private IScriptModule m_scriptModule = null; | ||
72 | public event ScriptCommand OnScriptCommand; | ||
73 | |||
74 | #region RegionModuleInterface | ||
75 | public void Initialise(IConfigSource config) | ||
76 | { | ||
77 | } | ||
78 | |||
79 | public void AddRegion(Scene scene) | ||
80 | { | ||
81 | scene.RegisterModuleInterface<IScriptModuleComms>(this); | ||
82 | } | ||
83 | |||
84 | public void RemoveRegion(Scene scene) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | m_scriptModule = scene.RequestModuleInterface<IScriptModule>(); | ||
91 | |||
92 | if (m_scriptModule != null) | ||
93 | m_log.Info("[MODULE COMMANDS]: Script engine found, module active"); | ||
94 | } | ||
95 | |||
96 | public string Name | ||
97 | { | ||
98 | get { return "ScriptModuleCommsModule"; } | ||
99 | } | ||
100 | |||
101 | public Type ReplaceableInterface | ||
102 | { | ||
103 | get { return null; } | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | #endregion | ||
110 | |||
111 | #region ScriptModuleComms | ||
112 | |||
113 | public void RaiseEvent(UUID script, string id, string module, string command, string k) | ||
114 | { | ||
115 | ScriptCommand c = OnScriptCommand; | ||
116 | |||
117 | if (c == null) | ||
118 | return; | ||
119 | |||
120 | c(script, id, module, command, k); | ||
121 | } | ||
122 | |||
123 | public void DispatchReply(UUID script, int code, string text, string k) | ||
124 | { | ||
125 | if (m_scriptModule == null) | ||
126 | return; | ||
127 | |||
128 | Object[] args = new Object[] {-1, code, text, k}; | ||
129 | |||
130 | m_scriptModule.PostScriptEvent(script, "link_message", args); | ||
131 | } | ||
132 | |||
133 | public void RegisterScriptInvocation(object target, string meth) | ||
134 | { | ||
135 | MethodInfo mi = target.GetType().GetMethod(meth, | ||
136 | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
137 | if (mi == null) | ||
138 | { | ||
139 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); | ||
140 | return; | ||
141 | } | ||
142 | |||
143 | RegisterScriptInvocation(target, mi); | ||
144 | } | ||
145 | |||
146 | public void RegisterScriptInvocation(object target, string[] meth) | ||
147 | { | ||
148 | foreach (string m in meth) | ||
149 | RegisterScriptInvocation(target, m); | ||
150 | } | ||
151 | |||
152 | public void RegisterScriptInvocation(object target, MethodInfo mi) | ||
153 | { | ||
154 | m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name); | ||
155 | |||
156 | Type delegateType; | ||
157 | var typeArgs = mi.GetParameters() | ||
158 | .Select(p => p.ParameterType) | ||
159 | .ToList(); | ||
160 | |||
161 | if (mi.ReturnType == typeof(void)) | ||
162 | { | ||
163 | delegateType = Expression.GetActionType(typeArgs.ToArray()); | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | typeArgs.Add(mi.ReturnType); | ||
168 | delegateType = Expression.GetFuncType(typeArgs.ToArray()); | ||
169 | } | ||
170 | |||
171 | Delegate fcall = Delegate.CreateDelegate(delegateType, target, mi); | ||
172 | |||
173 | lock (m_scriptInvocation) | ||
174 | { | ||
175 | ParameterInfo[] parameters = fcall.Method.GetParameters (); | ||
176 | if (parameters.Length < 2) // Must have two UUID params | ||
177 | return; | ||
178 | |||
179 | // Hide the first two parameters | ||
180 | Type[] parmTypes = new Type[parameters.Length - 2]; | ||
181 | for (int i = 2 ; i < parameters.Length ; i++) | ||
182 | parmTypes[i - 2] = parameters[i].ParameterType; | ||
183 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | public Delegate[] GetScriptInvocationList() | ||
188 | { | ||
189 | List<Delegate> ret = new List<Delegate>(); | ||
190 | |||
191 | lock (m_scriptInvocation) | ||
192 | { | ||
193 | foreach (ScriptInvocationData d in m_scriptInvocation.Values) | ||
194 | ret.Add(d.ScriptInvocationDelegate); | ||
195 | } | ||
196 | return ret.ToArray(); | ||
197 | } | ||
198 | |||
199 | public string LookupModInvocation(string fname) | ||
200 | { | ||
201 | lock (m_scriptInvocation) | ||
202 | { | ||
203 | ScriptInvocationData sid; | ||
204 | if (m_scriptInvocation.TryGetValue(fname,out sid)) | ||
205 | { | ||
206 | if (sid.ReturnType == typeof(string)) | ||
207 | return "modInvokeS"; | ||
208 | else if (sid.ReturnType == typeof(int)) | ||
209 | return "modInvokeI"; | ||
210 | else if (sid.ReturnType == typeof(float)) | ||
211 | return "modInvokeF"; | ||
212 | else if (sid.ReturnType == typeof(UUID)) | ||
213 | return "modInvokeK"; | ||
214 | else if (sid.ReturnType == typeof(OpenMetaverse.Vector3)) | ||
215 | return "modInvokeV"; | ||
216 | else if (sid.ReturnType == typeof(OpenMetaverse.Quaternion)) | ||
217 | return "modInvokeR"; | ||
218 | else if (sid.ReturnType == typeof(object[])) | ||
219 | return "modInvokeL"; | ||
220 | |||
221 | m_log.WarnFormat("[MODULE COMMANDS] failed to find match for {0} with return type {1}",fname,sid.ReturnType.Name); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | return null; | ||
226 | } | ||
227 | |||
228 | public Delegate LookupScriptInvocation(string fname) | ||
229 | { | ||
230 | lock (m_scriptInvocation) | ||
231 | { | ||
232 | ScriptInvocationData sid; | ||
233 | if (m_scriptInvocation.TryGetValue(fname,out sid)) | ||
234 | return sid.ScriptInvocationDelegate; | ||
235 | } | ||
236 | |||
237 | return null; | ||
238 | } | ||
239 | |||
240 | public Type[] LookupTypeSignature(string fname) | ||
241 | { | ||
242 | lock (m_scriptInvocation) | ||
243 | { | ||
244 | ScriptInvocationData sid; | ||
245 | if (m_scriptInvocation.TryGetValue(fname,out sid)) | ||
246 | return sid.TypeSignature; | ||
247 | } | ||
248 | |||
249 | return null; | ||
250 | } | ||
251 | |||
252 | public Type LookupReturnType(string fname) | ||
253 | { | ||
254 | lock (m_scriptInvocation) | ||
255 | { | ||
256 | ScriptInvocationData sid; | ||
257 | if (m_scriptInvocation.TryGetValue(fname,out sid)) | ||
258 | return sid.ReturnType; | ||
259 | } | ||
260 | |||
261 | return null; | ||
262 | } | ||
263 | |||
264 | public object InvokeOperation(UUID hostid, UUID scriptid, string fname, params object[] parms) | ||
265 | { | ||
266 | List<object> olist = new List<object>(); | ||
267 | olist.Add(hostid); | ||
268 | olist.Add(scriptid); | ||
269 | foreach (object o in parms) | ||
270 | olist.Add(o); | ||
271 | Delegate fn = LookupScriptInvocation(fname); | ||
272 | return fn.DynamicInvoke(olist.ToArray()); | ||
273 | } | ||
274 | |||
275 | /// <summary> | ||
276 | /// Operation to for a region module to register a constant to be used | ||
277 | /// by the script engine | ||
278 | /// </summary> | ||
279 | public void RegisterConstant(string cname, object value) | ||
280 | { | ||
281 | m_log.DebugFormat("[MODULE COMMANDS] register constant <{0}> with value {1}",cname,value.ToString()); | ||
282 | lock (m_constants) | ||
283 | { | ||
284 | m_constants.Add(cname,value); | ||
285 | } | ||
286 | } | ||
287 | |||
288 | /// <summary> | ||
289 | /// Operation to check for a registered constant | ||
290 | /// </summary> | ||
291 | public object LookupModConstant(string cname) | ||
292 | { | ||
293 | // m_log.DebugFormat("[MODULE COMMANDS] lookup constant <{0}>",cname); | ||
294 | |||
295 | lock (m_constants) | ||
296 | { | ||
297 | object value = null; | ||
298 | if (m_constants.TryGetValue(cname,out value)) | ||
299 | return value; | ||
300 | } | ||
301 | |||
302 | return null; | ||
303 | } | ||
304 | |||
305 | #endregion | ||
306 | |||
307 | } | ||
308 | } | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 7c693b6..bb3748e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -909,11 +909,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
909 | 909 | ||
910 | public void Close() | 910 | public void Close() |
911 | { | 911 | { |
912 | Close(true); | 912 | Close(true, false); |
913 | } | 913 | } |
914 | 914 | ||
915 | public void Close(bool sendStop) | 915 | public void Close(bool sendStop, bool force) |
916 | { | 916 | { |
917 | // Remove ourselves from the scene | ||
918 | m_scene.RemoveClient(AgentId, false); | ||
917 | } | 919 | } |
918 | 920 | ||
919 | public void Start() | 921 | public void Start() |