aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-04-02 14:53:52 +0100
committerMelanie2010-04-02 14:53:52 +0100
commita004d88bf3d7f753d8660009c019e252f6cf627b (patch)
tree874a0133087b5300fa32528d7943e50252640c09 /OpenSim/Region
parentAdding the groups update (Mantis #4646) (diff)
parentMerge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-a004d88bf3d7f753d8660009c019e252f6cf627b.zip
opensim-SC-a004d88bf3d7f753d8660009c019e252f6cf627b.tar.gz
opensim-SC-a004d88bf3d7f753d8660009c019e252f6cf627b.tar.bz2
opensim-SC-a004d88bf3d7f753d8660009c019e252f6cf627b.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/LightShare/LightShareModule.cs293
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs73
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs142
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs504
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs76
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp2
17 files changed, 1228 insertions, 75 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9ba99d6..25f6ef0 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -845,17 +845,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
845 } 845 }
846 } 846 }
847 847
848 public void SendGenericMessage(string method, List<string> message) 848 public void SendGenericMessage(string method, List<byte[]> message)
849 { 849 {
850 GenericMessagePacket gmp = new GenericMessagePacket(); 850 GenericMessagePacket gmp = new GenericMessagePacket();
851 gmp.MethodData.Method = Util.StringToBytes256(method); 851 gmp.MethodData.Method = Util.StringToBytes256(method);
852 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; 852 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
853 int i = 0; 853 int i = 0;
854 foreach (string val in message) 854 foreach (byte[] val in message)
855 { 855 {
856 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); 856 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
857 gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); 857 gmp.ParamList[i++].Parameter = val;
858 } 858 }
859
859 OutPacket(gmp, ThrottleOutPacketType.Task); 860 OutPacket(gmp, ThrottleOutPacketType.Task);
860 } 861 }
861 862
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index e37da9f..36dae6b 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -173,11 +173,11 @@ namespace OpenSim.Region.CoreModules.Framework.Library
173 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); 173 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
174 simpleName = GetInventoryPathFromName(simpleName); 174 simpleName = GetInventoryPathFromName(simpleName);
175 175
176 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName);
176 try 177 try
177 { 178 {
178 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName);
179 List<InventoryNodeBase> nodes = archread.Execute(); 179 List<InventoryNodeBase> nodes = archread.Execute();
180 if (nodes.Count == 0) 180 if (nodes != null && nodes.Count == 0)
181 { 181 {
182 // didn't find the subfolder with the given name; place it on the top 182 // didn't find the subfolder with the given name; place it on the top
183 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); 183 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
@@ -185,16 +185,33 @@ namespace OpenSim.Region.CoreModules.Framework.Library
185 archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName); 185 archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName);
186 archread.Execute(); 186 archread.Execute();
187 } 187 }
188 archread.Close(); 188 foreach (InventoryNodeBase node in nodes)
189 FixPerms(node);
189 } 190 }
190 catch (Exception e) 191 catch (Exception e)
191 { 192 {
192 m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message); 193 m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace);
194 }
195 finally
196 {
197 archread.Close();
193 } 198 }
194 } 199 }
195 200
196 } 201 }
197 202
203 private void FixPerms(InventoryNodeBase node)
204 {
205 if (node is InventoryItemBase)
206 {
207 InventoryItemBase item = (InventoryItemBase)node;
208 item.BasePermissions = 0x7FFFFFFF;
209 item.EveryOnePermissions = 0x7FFFFFFF;
210 item.CurrentPermissions = 0x7FFFFFFF;
211 item.NextPermissions = 0x7FFFFFFF;
212 }
213 }
214
198 private void DumpLibrary() 215 private void DumpLibrary()
199 { 216 {
200 InventoryFolderImpl lib = m_Library.LibraryRootFolder; 217 InventoryFolderImpl lib = m_Library.LibraryRootFolder;
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
new file mode 100644
index 0000000..e6cab1d
--- /dev/null
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -0,0 +1,293 @@
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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using OpenMetaverse;
33using log4net;
34using Nini.Config;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40
41
42namespace OpenSim.Region.CoreModules.World.LightShare
43{
44 public class LightShareModule : IRegionModule, ICommandableModule
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private readonly Commander m_commander = new Commander("windlight");
48 private Scene m_scene;
49 private static bool m_enableWindlight;
50
51 #region ICommandableModule Members
52
53 public ICommander CommandInterface
54 {
55 get { return m_commander; }
56 }
57
58 #endregion
59
60 #region IRegionModule Members
61
62 public static bool EnableWindlight
63 {
64 get
65 {
66 return m_enableWindlight;
67 }
68 set
69 {
70 }
71 }
72
73 public void Initialise(Scene scene, IConfigSource config)
74 {
75 m_scene = scene;
76 m_scene.RegisterModuleInterface<IRegionModule>(this);
77 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
78
79 // ini file settings
80 try
81 {
82 m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false);
83 }
84 catch (Exception)
85 {
86 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
87 }
88
89 if (m_enableWindlight)
90 {
91 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
92 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
93 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
94 }
95
96 InstallCommands();
97
98 m_log.Debug("[WINDLIGHT]: Initialised windlight module");
99 }
100
101 private List<byte[]> compileWindlightSettings(RegionLightShareData wl)
102 {
103 byte[] mBlock = new Byte[249];
104 int pos = 0;
105
106 wl.waterColor.ToBytes(mBlock, 0); pos += 12;
107 Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
108 Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4;
109 wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12;
110 Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4;
111 Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4;
112 Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
113 Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
114 Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4;
115 wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8;
116 wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8;
117 wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16;
118 wl.horizon.ToBytes(mBlock, pos); pos += 16;
119 Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4;
120 wl.blueDensity.ToBytes(mBlock, pos); pos += 16;
121 Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4;
122 Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4;
123 Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
124 wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16;
125 Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4;
126 wl.ambient.ToBytes(mBlock, pos); pos += 16;
127 Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4;
128 Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4;
129 Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4;
130 Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4;
131 Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4;
132 wl.cloudColor.ToBytes(mBlock, pos); pos += 16;
133 wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12;
134 Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4;
135 Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4;
136 wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12;
137 Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4;
138 Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4;
139 Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2;
140 mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
141 mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
142 mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;
143 List<byte[]> param = new List<byte[]>();
144 param.Add(mBlock);
145 return param;
146 }
147 public void SendProfileToClient(ScenePresence presence)
148 {
149 IClientAPI client = presence.ControllingClient;
150 if (m_enableWindlight)
151 {
152 if (presence.IsChildAgent == false)
153 {
154 List<byte[]> param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings);
155 client.SendGenericMessage("Windlight", param);
156 }
157 }
158 else
159 {
160 //We probably don't want to spam chat with this.. probably
161 //m_log.Debug("[WINDLIGHT]: Module disabled");
162 }
163 }
164 public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
165 {
166 IClientAPI client = presence.ControllingClient;
167 if (m_enableWindlight)
168 {
169 if (presence.IsChildAgent == false)
170 {
171 List<byte[]> param = compileWindlightSettings(wl);
172 client.SendGenericMessage("Windlight", param);
173 }
174 }
175 else
176 {
177 //We probably don't want to spam chat with this.. probably
178 //m_log.Debug("[WINDLIGHT]: Module disabled");
179 }
180 }
181 private void EventManager_OnMakeRootAgent(ScenePresence presence)
182 {
183 m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
184 SendProfileToClient(presence);
185 }
186 private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
187 {
188 ScenePresence Sc;
189 if (m_scene.TryGetScenePresence(pUUID,out Sc))
190 {
191 SendProfileToClient(Sc,wl);
192 }
193 }
194 private void EventManager_OnSaveNewWindlightProfile()
195 {
196 m_scene.ForEachScenePresence(SendProfileToClient);
197 }
198
199 public void PostInitialise()
200 {
201
202 }
203
204 public void Close()
205 {
206 }
207
208 public string Name
209 {
210 get { return "LightShareModule"; }
211 }
212
213 public bool IsSharedModule
214 {
215 get { return false; }
216 }
217
218 #endregion
219
220 #region events
221
222 #endregion
223
224 #region ICommandableModule Members
225
226 private void InstallCommands()
227 {
228 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
229 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
230 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin");
231
232 m_commander.RegisterCommand("load", wlload);
233 m_commander.RegisterCommand("enable", wlenable);
234 m_commander.RegisterCommand("disable", wldisable);
235
236 m_scene.RegisterModuleCommander(m_commander);
237 }
238
239 private void HandleLoad(Object[] args)
240 {
241 if (!m_enableWindlight)
242 {
243 m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first.");
244 }
245 else
246 {
247 m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database");
248 m_scene.LoadWindlightProfile();
249 m_log.InfoFormat("[WINDLIGHT]: Load complete");
250 }
251 }
252
253 private void HandleDisable(Object[] args)
254 {
255 m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled");
256 m_enableWindlight=false;
257 }
258
259 private void HandleEnable(Object[] args)
260 {
261 m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled");
262 m_enableWindlight = true;
263 }
264
265 /// <summary>
266 /// Processes commandline input. Do not call directly.
267 /// </summary>
268 /// <param name="args">Commandline arguments</param>
269 private void EventManager_OnPluginConsole(string[] args)
270 {
271 if (args[0] == "windlight")
272 {
273 if (args.Length == 1)
274 {
275 m_commander.ProcessConsoleCommand("add", new string[0]);
276 return;
277 }
278
279 string[] tmpArgs = new string[args.Length - 2];
280 int i;
281 for (i = 2; i < args.Length; i++)
282 {
283 tmpArgs[i - 2] = args[i];
284 }
285
286 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
287 }
288 }
289 #endregion
290
291 }
292}
293
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index d052f38..8d27f9c 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -460,7 +460,7 @@ namespace OpenSim.Region.Examples.SimpleModule
460 460
461 } 461 }
462 462
463 public void SendGenericMessage(string method, List<string> message) 463 public void SendGenericMessage(string method, List<byte[]> message)
464 { 464 {
465 465
466 } 466 }
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs
new file mode 100644
index 0000000..f158236
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs
@@ -0,0 +1,73 @@
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
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 /// <summary>
34 /// Provide mechanisms for messaging groups.
35 /// </summary>
36 ///
37 /// TODO: Provide a mechanism for receiving group messages as well as sending them
38 ///
39 public interface IGroupsMessagingModule
40 {
41 /// <summary>
42 /// Start a group chat session.
43 /// </summary>
44 /// You must call this before calling SendMessageToGroup(). If a chat session for this group is already taking
45 /// place then the agent will added to that session.
46 /// <param name="agentID">
47 /// A UUID that represents the agent being added. If you are agentless (e.g. you are
48 /// a region module), then you can use any random ID.
49 /// </param>
50 /// <param name="groupID">
51 /// The ID for the group to join. Currently, the session ID used is identical to the
52 /// group ID.
53 /// </param>
54 /// <returns>
55 /// True if the chat session was started successfully, false otherwise.
56 /// </returns>
57 bool StartGroupChatSession(UUID agentID, UUID groupID);
58
59 /// <summary>
60 /// Send a message to an entire group.
61 /// </summary>
62 /// <param name="im">
63 /// The message itself. The fields that must be populated are
64 ///
65 /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical)
66 /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog
67 /// message - The message itself
68 /// dialog - This must be (byte)InstantMessageDialog.SessionSend
69 /// </param>
70 /// <param name="groupID"></param>
71 void SendMessageToGroup(GridInstantMessage im, UUID groupID);
72 }
73} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
index 78bd622..3e8e196 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
@@ -103,6 +103,8 @@ namespace OpenSim.Region.Framework.Interfaces
103 103
104 void StoreRegionSettings(RegionSettings rs); 104 void StoreRegionSettings(RegionSettings rs);
105 RegionSettings LoadRegionSettings(UUID regionUUID); 105 RegionSettings LoadRegionSettings(UUID regionUUID);
106 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
107 void StoreRegionWindlightSettings(RegionLightShareData wl);
106 108
107 void Shutdown(); 109 void Shutdown();
108 } 110 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index dc9ae19..ef125cd 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -206,7 +206,11 @@ namespace OpenSim.Region.Framework.Scenes
206 public event OnMakeChildAgentDelegate OnMakeChildAgent; 206 public event OnMakeChildAgentDelegate OnMakeChildAgent;
207 207
208 public delegate void OnMakeRootAgentDelegate(ScenePresence presence); 208 public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
209 public delegate void OnSaveNewWindlightProfileDelegate();
210 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
209 public event OnMakeRootAgentDelegate OnMakeRootAgent; 211 public event OnMakeRootAgentDelegate OnMakeRootAgent;
212 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
213 public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
210 214
211 /// <summary> 215 /// <summary>
212 /// Triggered when an object or attachment enters a scene 216 /// Triggered when an object or attachment enters a scene
@@ -1216,6 +1220,24 @@ namespace OpenSim.Region.Framework.Scenes
1216 } 1220 }
1217 } 1221 }
1218 1222
1223 public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user)
1224 {
1225 OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted;
1226 if (handlerSendNewWindlightProfileTargeted != null)
1227 {
1228 handlerSendNewWindlightProfileTargeted(wl, user);
1229 }
1230 }
1231
1232 public void TriggerOnSaveNewWindlightProfile()
1233 {
1234 OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
1235 if (handlerSaveNewWindlightProfile != null)
1236 {
1237 handlerSaveNewWindlightProfile();
1238 }
1239 }
1240
1219 public void TriggerOnMakeRootAgent(ScenePresence presence) 1241 public void TriggerOnMakeRootAgent(ScenePresence presence)
1220 { 1242 {
1221 OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent; 1243 OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent;
@@ -1992,4 +2014,4 @@ namespace OpenSim.Region.Framework.Scenes
1992 } 2014 }
1993 } 2015 }
1994 } 2016 }
1995} \ No newline at end of file 2017}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0085df3..fc915a3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1715,6 +1715,19 @@ namespace OpenSim.Region.Framework.Scenes
1715 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1715 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1716 } 1716 }
1717 1717
1718 public void StoreWindlightProfile(RegionLightShareData wl)
1719 {
1720 m_regInfo.WindlightSettings = wl;
1721 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1722 m_eventManager.TriggerOnSaveNewWindlightProfile();
1723 }
1724
1725 public void LoadWindlightProfile()
1726 {
1727 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID);
1728 m_eventManager.TriggerOnSaveNewWindlightProfile();
1729 }
1730
1718 /// <summary> 1731 /// <summary>
1719 /// Loads the World heightmap 1732 /// Loads the World heightmap
1720 /// </summary> 1733 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index c77220c..8b2d387 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -101,7 +101,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
101 { 101 {
102 throw new NotImplementedException(); 102 throw new NotImplementedException();
103 } 103 }
104 104 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
105 {
106 //This connector doesn't support the windlight module yet
107 //Return default LL windlight settings
108 return new RegionLightShareData();
109 }
110 public void StoreRegionWindlightSettings(RegionLightShareData wl)
111 {
112 //This connector doesn't support the windlight module yet
113 }
105 public RegionSettings LoadRegionSettings(UUID regionUUID) 114 public RegionSettings LoadRegionSettings(UUID regionUUID)
106 { 115 {
107 return null; 116 return null;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 1885946..f5b148f 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -964,7 +964,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
964 // TODO 964 // TODO
965 } 965 }
966 966
967 public void SendGenericMessage(string method, List<string> message) 967 public void SendGenericMessage(string method, List<byte[]> message)
968 { 968 {
969 969
970 } 970 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 00fe5df..533815f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -28,29 +28,23 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31
32
33using log4net; 31using log4net;
34using Mono.Addins; 32using Mono.Addins;
35using Nini.Config; 33using Nini.Config;
36
37using OpenMetaverse; 34using OpenMetaverse;
38using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
39
40using OpenSim.Framework; 36using OpenSim.Framework;
41using OpenSim.Region.CoreModules.Framework.EventQueue; 37using OpenSim.Region.CoreModules.Framework.EventQueue;
42using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
44 40
45
46using Caps = OpenSim.Framework.Capabilities.Caps; 41using Caps = OpenSim.Framework.Capabilities.Caps;
47 42
48namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 43namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
49{ 44{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class GroupsMessagingModule : ISharedRegionModule 46 public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule
52 { 47 {
53
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 49
56 private List<Scene> m_sceneList = new List<Scene>(); 50 private List<Scene> m_sceneList = new List<Scene>();
@@ -108,8 +102,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
108 102
109 public void AddRegion(Scene scene) 103 public void AddRegion(Scene scene)
110 { 104 {
111 // NoOp 105 if (!m_groupMessagingEnabled)
106 return;
107
108 scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
112 } 109 }
110
113 public void RegionLoaded(Scene scene) 111 public void RegionLoaded(Scene scene)
114 { 112 {
115 if (!m_groupMessagingEnabled) 113 if (!m_groupMessagingEnabled)
@@ -197,6 +195,73 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
197 195
198 #endregion 196 #endregion
199 197
198 public bool StartGroupChatSession(UUID agentID, UUID groupID)
199 {
200 if (m_debugEnabled)
201 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
202
203 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
204
205 if (groupInfo != null)
206 {
207 AddAgentToGroupSession(agentID.Guid, groupID.Guid);
208 return true;
209 }
210 else
211 {
212 return false;
213 }
214 }
215
216 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
217 {
218 if (m_debugEnabled)
219 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
220
221 foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID))
222 {
223 if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid))
224 {
225 // Don't deliver messages to people who have dropped this session
226 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
227 continue;
228 }
229
230 // Copy Message
231 GridInstantMessage msg = new GridInstantMessage();
232 msg.imSessionID = im.imSessionID;
233 msg.fromAgentName = im.fromAgentName;
234 msg.message = im.message;
235 msg.dialog = im.dialog;
236 msg.offline = im.offline;
237 msg.ParentEstateID = im.ParentEstateID;
238 msg.Position = im.Position;
239 msg.RegionID = im.RegionID;
240 msg.binaryBucket = im.binaryBucket;
241 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
242
243 // Updat Pertinate fields to make it a "group message"
244 msg.fromAgentID = groupID.Guid;
245 msg.fromGroup = true;
246
247 msg.toAgentID = member.AgentID.Guid;
248
249 IClientAPI client = GetActiveClient(member.AgentID);
250 if (client == null)
251 {
252 // If they're not local, forward across the grid
253 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
254 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
255 }
256 else
257 {
258 // Deliver locally, directly
259 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
260 ProcessMessageFromGroupSession(msg);
261 }
262 }
263 }
264
200 #region SimGridEventHandlers 265 #region SimGridEventHandlers
201 266
202 private void OnNewClient(IClientAPI client) 267 private void OnNewClient(IClientAPI client)
@@ -370,7 +435,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
370 m_agentsDroppedSession.Add(sessionID, new List<Guid>()); 435 m_agentsDroppedSession.Add(sessionID, new List<Guid>());
371 } 436 }
372 } 437 }
373 438
374 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 439 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
375 { 440 {
376 if (m_debugEnabled) 441 if (m_debugEnabled)
@@ -384,13 +449,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
384 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 449 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
385 { 450 {
386 UUID groupID = new UUID(im.toAgentID); 451 UUID groupID = new UUID(im.toAgentID);
387
388 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); 452 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
453
389 if (groupInfo != null) 454 if (groupInfo != null)
390 { 455 {
391 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Start Group Session for {0}", groupInfo.GroupName); 456 AddAgentToGroupSession(im.fromAgentID, groupInfo.GroupID.Guid);
392
393 AddAgentToGroupSession(im.fromAgentID, im.imSessionID);
394 457
395 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID); 458 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID);
396 459
@@ -411,7 +474,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
411 { 474 {
412 UUID groupID = new UUID(im.toAgentID); 475 UUID groupID = new UUID(im.toAgentID);
413 476
414 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString()); 477 if (m_debugEnabled)
478 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString());
415 479
416 SendMessageToGroup(im, groupID); 480 SendMessageToGroup(im, groupID);
417 } 481 }
@@ -419,54 +483,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
419 483
420 #endregion 484 #endregion
421 485
422 private void SendMessageToGroup(GridInstantMessage im, UUID groupID)
423 {
424 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
425
426 foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID))
427 {
428 if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid))
429 {
430 // Don't deliver messages to people who have dropped this session
431 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
432 continue;
433 }
434
435 // Copy Message
436 GridInstantMessage msg = new GridInstantMessage();
437 msg.imSessionID = im.imSessionID;
438 msg.fromAgentName = im.fromAgentName;
439 msg.message = im.message;
440 msg.dialog = im.dialog;
441 msg.offline = im.offline;
442 msg.ParentEstateID = im.ParentEstateID;
443 msg.Position = im.Position;
444 msg.RegionID = im.RegionID;
445 msg.binaryBucket = im.binaryBucket;
446 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
447
448 // Updat Pertinate fields to make it a "group message"
449 msg.fromAgentID = groupID.Guid;
450 msg.fromGroup = true;
451
452 msg.toAgentID = member.AgentID.Guid;
453
454 IClientAPI client = GetActiveClient(member.AgentID);
455 if (client == null)
456 {
457 // If they're not local, forward across the grid
458 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
459 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
460 }
461 else
462 {
463 // Deliver locally, directly
464 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
465 ProcessMessageFromGroupSession(msg);
466 }
467 }
468 }
469
470 void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) 486 void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID)
471 { 487 {
472 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 488 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 77958eb..338c04b 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -550,7 +550,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
550 550
551 } 551 }
552 552
553 public void SendGenericMessage(string method, List<string> message) 553 public void SendGenericMessage(string method, List<byte[]> message)
554 { 554 {
555 555
556 } 556 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
new file mode 100644
index 0000000..880ca1b
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -0,0 +1,504 @@
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
28using System;
29using System.Reflection;
30using System.Collections;
31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime;
33using OpenMetaverse;
34using Nini.Config;
35using OpenSim;
36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.World.LightShare;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.ScriptEngine.Shared;
41using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
42using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
43using OpenSim.Region.ScriptEngine.Interfaces;
44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
45
46using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
47using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
48using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
50using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
51using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
52using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
53
54namespace OpenSim.Region.ScriptEngine.Shared.Api
55{
56 [Serializable]
57 public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi
58 {
59 internal IScriptEngine m_ScriptEngine;
60 internal SceneObjectPart m_host;
61 internal uint m_localID;
62 internal UUID m_itemID;
63 internal bool m_CMFunctionsEnabled = false;
64 internal IScriptModuleComms m_comms = null;
65
66 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
67 {
68 m_ScriptEngine = ScriptEngine;
69 m_host = host;
70 m_localID = localID;
71 m_itemID = itemID;
72
73 if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
74 m_CMFunctionsEnabled = true;
75
76 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
77 if (m_comms == null)
78 m_CMFunctionsEnabled = false;
79 }
80
81 public override Object InitializeLifetimeService()
82 {
83 ILease lease = (ILease)base.InitializeLifetimeService();
84
85 if (lease.CurrentState == LeaseState.Initial)
86 {
87 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
88 // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
89 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
90 }
91 return lease;
92 }
93
94 public Scene World
95 {
96 get { return m_ScriptEngine.World; }
97 }
98
99 //
100 //Dumps an error message on the debug console.
101 //
102
103 internal void CMShoutError(string message)
104 {
105 if (message.Length > 1023)
106 message = message.Substring(0, 1023);
107
108 World.SimChat(Utils.StringToBytes(message),
109 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
110
111 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
112 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
113 }
114
115 /// <summary>
116 /// Get the current Windlight scene
117 /// </summary>
118 /// <returns>List of windlight parameters</returns>
119 public LSL_List cmGetWindlightScene(LSL_List rules)
120 {
121 if (!m_CMFunctionsEnabled)
122 {
123 CMShoutError("Careminster functions are not enabled.");
124 return new LSL_List();
125 }
126 m_host.AddScriptLPS(1);
127 RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
128
129 LSL_List values = new LSL_List();
130 int idx = 0;
131 while (idx < rules.Length)
132 {
133 uint rule = (uint)rules.GetLSLIntegerItem(idx);
134 LSL_List toadd = new LSL_List();
135
136 switch (rule)
137 {
138 case (int)ScriptBaseClass.WL_AMBIENT:
139 toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
140 break;
141 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
142 toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
143 break;
144 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
145 toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
146 break;
147 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
148 toadd.Add(new LSL_Float(wl.blurMultiplier));
149 break;
150 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
151 toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
152 break;
153 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
154 toadd.Add(new LSL_Float(wl.cloudCoverage));
155 break;
156 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
157 toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
158 break;
159 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
160 toadd.Add(new LSL_Float(wl.cloudScale));
161 break;
162 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
163 toadd.Add(new LSL_Float(wl.cloudScrollX));
164 break;
165 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
166 toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
167 break;
168 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
169 toadd.Add(new LSL_Float(wl.cloudScrollY));
170 break;
171 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
172 toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
173 break;
174 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
175 toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
176 break;
177 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
178 toadd.Add(new LSL_Float(wl.densityMultiplier));
179 break;
180 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
181 toadd.Add(new LSL_Float(wl.distanceMultiplier));
182 break;
183 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
184 toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
185 break;
186 case (int)ScriptBaseClass.WL_EAST_ANGLE:
187 toadd.Add(new LSL_Float(wl.eastAngle));
188 break;
189 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
190 toadd.Add(new LSL_Float(wl.fresnelOffset));
191 break;
192 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
193 toadd.Add(new LSL_Float(wl.fresnelScale));
194 break;
195 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
196 toadd.Add(new LSL_Float(wl.hazeDensity));
197 break;
198 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
199 toadd.Add(new LSL_Float(wl.hazeHorizon));
200 break;
201 case (int)ScriptBaseClass.WL_HORIZON:
202 toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
203 break;
204 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
205 toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
206 break;
207 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
208 toadd.Add(new LSL_Integer(wl.maxAltitude));
209 break;
210 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
211 toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
212 break;
213 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
214 toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
215 break;
216 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
217 toadd.Add(new LSL_Float(wl.refractScaleAbove));
218 break;
219 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
220 toadd.Add(new LSL_Float(wl.refractScaleBelow));
221 break;
222 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
223 toadd.Add(new LSL_Float(wl.sceneGamma));
224 break;
225 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
226 toadd.Add(new LSL_Float(wl.starBrightness));
227 break;
228 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
229 toadd.Add(new LSL_Float(wl.sunGlowFocus));
230 break;
231 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
232 toadd.Add(new LSL_Float(wl.sunGlowSize));
233 break;
234 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
235 toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
236 break;
237 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
238 toadd.Add(new LSL_Float(wl.underwaterFogModifier));
239 break;
240 case (int)ScriptBaseClass.WL_WATER_COLOR:
241 toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
242 break;
243 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
244 toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
245 break;
246 }
247
248 if (toadd.Length > 0)
249 {
250 values.Add(rule);
251 values.Add(toadd.Data[0]);
252 }
253 idx++;
254 }
255
256
257 return values;
258
259 }
260
261 private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
262 {
263 RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
264
265 LSL_List values = new LSL_List();
266 int idx = 0;
267 while (idx < rules.Length)
268 {
269 uint rule = (uint)rules.GetLSLIntegerItem(idx);
270 LSL_Types.Quaternion iQ;
271 LSL_Types.Vector3 iV;
272 switch (rule)
273 {
274 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
275 idx++;
276 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
277 break;
278 case (int)ScriptBaseClass.WL_AMBIENT:
279 idx++;
280 iQ = rules.GetQuaternionItem(idx);
281 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
282 break;
283 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
284 idx++;
285 iV = rules.GetVector3Item(idx);
286 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
287 break;
288 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
289 idx++;
290 iQ = rules.GetQuaternionItem(idx);
291 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
292 break;
293 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
294 idx++;
295 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
296 break;
297 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
298 idx++;
299 iQ = rules.GetQuaternionItem(idx);
300 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
301 break;
302 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
303 idx++;
304 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
305 break;
306 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
307 idx++;
308 iV = rules.GetVector3Item(idx);
309 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
310 break;
311 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
312 idx++;
313 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
314 break;
315 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
316 idx++;
317 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
318 break;
319 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
320 idx++;
321 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
322 break;
323 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
324 idx++;
325 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
326 break;
327 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
328 idx++;
329 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
330 break;
331 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
332 idx++;
333 iV = rules.GetVector3Item(idx);
334 wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
335 break;
336 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
337 idx++;
338 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
339 break;
340 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
341 idx++;
342 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
343 break;
344 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
345 idx++;
346 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
347 break;
348 case (int)ScriptBaseClass.WL_EAST_ANGLE:
349 idx++;
350 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
351 break;
352 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
353 idx++;
354 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
355 break;
356 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
357 idx++;
358 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
359 break;
360 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
361 idx++;
362 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
363 break;
364 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
365 idx++;
366 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
367 break;
368 case (int)ScriptBaseClass.WL_HORIZON:
369 idx++;
370 iQ = rules.GetQuaternionItem(idx);
371 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
372 break;
373 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
374 idx++;
375 iV = rules.GetVector3Item(idx);
376 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
377 break;
378 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
379 idx++;
380 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
381 break;
382 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
383 idx++;
384 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
385 break;
386 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
387 idx++;
388 iV = rules.GetVector3Item(idx);
389 wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
390 break;
391 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
392 idx++;
393 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
394 break;
395 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
396 idx++;
397 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
398 break;
399 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
400 idx++;
401 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
402 break;
403 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
404 idx++;
405 wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
406 break;
407 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
408 idx++;
409 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
410 break;
411 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
412 idx++;
413 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
414 break;
415 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
416 idx++;
417 iQ = rules.GetQuaternionItem(idx);
418 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
419 break;
420 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
421 idx++;
422 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
423 break;
424 case (int)ScriptBaseClass.WL_WATER_COLOR:
425 idx++;
426 iV = rules.GetVector3Item(idx);
427 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
428 break;
429 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
430 idx++;
431 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
432 break;
433 }
434 idx++;
435 }
436 return wl;
437 }
438 /// <summary>
439 /// Set the current Windlight scene
440 /// </summary>
441 /// <param name="rules"></param>
442 /// <returns>success: true or false</returns>
443 public int cmSetWindlightScene(LSL_List rules)
444 {
445 if (!m_CMFunctionsEnabled)
446 {
447 CMShoutError("Careminster functions are not enabled.");
448 return 0;
449 }
450 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
451 {
452 CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
453 return 0;
454 }
455 int success = 0;
456 m_host.AddScriptLPS(1);
457 if (LightShareModule.EnableWindlight)
458 {
459 RegionLightShareData wl = getWindlightProfileFromRules(rules);
460 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
461 success = 1;
462 }
463 else
464 {
465 CMShoutError("Windlight module is disabled");
466 return 0;
467 }
468 return success;
469 }
470 /// <summary>
471 /// Set the current Windlight scene to a target avatar
472 /// </summary>
473 /// <param name="rules"></param>
474 /// <returns>success: true or false</returns>
475 public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
476 {
477 if (!m_CMFunctionsEnabled)
478 {
479 CMShoutError("Careminster functions are not enabled.");
480 return 0;
481 }
482 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
483 {
484 CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
485 return 0;
486 }
487 int success = 0;
488 m_host.AddScriptLPS(1);
489 if (LightShareModule.EnableWindlight)
490 {
491 RegionLightShareData wl = getWindlightProfileFromRules(rules);
492 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
493 success = 1;
494 }
495 else
496 {
497 CMShoutError("Windlight module is disabled");
498 return 0;
499 }
500 return success;
501 }
502
503 }
504}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
new file mode 100644
index 0000000..f13b6e5
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -0,0 +1,48 @@
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
28using System.Collections;
29using OpenSim.Region.ScriptEngine.Interfaces;
30
31using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
32using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
36using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
37using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
38
39namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
40{
41 public interface ICM_Api
42 {
43 // Windlight Functions
44 LSL_List cmGetWindlightScene(LSL_List rules);
45 int cmSetWindlightScene(LSL_List rules);
46 int cmSetWindlightSceneTargeted(LSL_List rules, key target);
47 }
48}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
new file mode 100644
index 0000000..f94ef4a
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
@@ -0,0 +1,77 @@
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
28using System;
29using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
30using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
31using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
32
33namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
34{
35 public partial class ScriptBaseClass
36 {
37 // Constants for cmWindlight*
38 public const int WL_WATER_COLOR = 0;
39 public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
40 public const int WL_UNDERWATER_FOG_MODIFIER = 2;
41 public const int WL_REFLECTION_WAVELET_SCALE = 3;
42 public const int WL_FRESNEL_SCALE = 4;
43 public const int WL_FRESNEL_OFFSET = 5;
44 public const int WL_REFRACT_SCALE_ABOVE = 6;
45 public const int WL_REFRACT_SCALE_BELOW = 7;
46 public const int WL_BLUR_MULTIPLIER = 8;
47 public const int WL_BIG_WAVE_DIRECTION = 9;
48 public const int WL_LITTLE_WAVE_DIRECTION = 10;
49 public const int WL_NORMAL_MAP_TEXTURE = 11;
50 public const int WL_HORIZON = 12;
51 public const int WL_HAZE_HORIZON = 13;
52 public const int WL_BLUE_DENSITY = 14;
53 public const int WL_HAZE_DENSITY = 15;
54 public const int WL_DENSITY_MULTIPLIER = 16;
55 public const int WL_DISTANCE_MULTIPLIER = 17;
56 public const int WL_MAX_ALTITUDE = 18;
57 public const int WL_SUN_MOON_COLOR = 19;
58 public const int WL_AMBIENT = 20;
59 public const int WL_EAST_ANGLE = 21;
60 public const int WL_SUN_GLOW_FOCUS = 22;
61 public const int WL_SUN_GLOW_SIZE = 23;
62 public const int WL_SCENE_GAMMA = 24;
63 public const int WL_STAR_BRIGHTNESS = 25;
64 public const int WL_CLOUD_COLOR = 26;
65 public const int WL_CLOUD_XY_DENSITY = 27;
66 public const int WL_CLOUD_COVERAGE = 28;
67 public const int WL_CLOUD_SCALE = 29;
68 public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
69 public const int WL_CLOUD_SCROLL_X = 31;
70 public const int WL_CLOUD_SCROLL_Y = 32;
71 public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
72 public const int WL_CLOUD_SCROLL_X_LOCK = 34;
73 public const int WL_DRAW_CLASSIC_CLOUDS = 35;
74 public const int WL_SUN_MOON_POSITION = 36;
75
76 }
77}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
new file mode 100644
index 0000000..c0edaae
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -0,0 +1,76 @@
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
28using System;
29using System.Runtime.Remoting.Lifetime;
30using System.Threading;
31using System.Reflection;
32using System.Collections;
33using System.Collections.Generic;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.ScriptEngine.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
38using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
39using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
40using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
41using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
42using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
43using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
44using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
45using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
46
47namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
48{
49 public partial class ScriptBaseClass : MarshalByRefObject
50 {
51 public ICM_Api m_CM_Functions;
52
53 public void ApiTypeCM(IScriptApi api)
54 {
55 if (!(api is ICM_Api))
56 return;
57
58 m_CM_Functions = (ICM_Api)api;
59 }
60
61 public LSL_List cmGetWindlightScene(LSL_List rules)
62 {
63 return m_CM_Functions.cmGetWindlightScene(rules);
64 }
65
66 public int cmSetWindlightScene(LSL_List rules)
67 {
68 return m_CM_Functions.cmSetWindlightScene(rules);
69 }
70
71 public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
72 {
73 return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
74 }
75 }
76}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
index 98bbc68..23138ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
@@ -17,6 +17,8 @@
17 <excludeFiles /> 17 <excludeFiles />
18 </DeploymentInformation> 18 </DeploymentInformation>
19 <Contents> 19 <Contents>
20 <File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
21 <File name="./CM_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
20 <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 22 <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
21 <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 23 <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
22 <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 24 <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />