aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-03-30 23:29:03 +0100
committerMelanie2010-03-30 23:29:03 +0100
commit7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4 (patch)
tree4fbeba0476276a867859d257d369689385d2b54c /OpenSim/Region
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4.zip
opensim-SC_OLD-7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4.tar.gz
opensim-SC_OLD-7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4.tar.bz2
opensim-SC_OLD-7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4.tar.xz
Rename Meta7Windlight to LightShare
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs274
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs116
8 files changed, 76 insertions, 351 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index b6afac6..7f6a0ad 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1532,7 +1532,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1532 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) 1532 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1533 { 1533 {
1534 ScenePresence SP; 1534 ScenePresence SP;
1535 ((Scene)client.Scene).TryGetAvatar(client.AgentId, out SP); 1535 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1536 List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); 1536 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1537 if (SP.GodLevel != 0) 1537 if (SP.GodLevel != 0)
1538 { 1538 {
@@ -1597,9 +1597,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1597 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) 1597 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1598 { 1598 {
1599 ScenePresence targetAvatar = null; 1599 ScenePresence targetAvatar = null;
1600 ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); 1600 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1601 ScenePresence parcelManager = null; 1601 ScenePresence parcelManager = null;
1602 ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); 1602 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1603 System.Threading.Timer Timer; 1603 System.Threading.Timer Timer;
1604 1604
1605 if (targetAvatar.GodLevel == 0) 1605 if (targetAvatar.GodLevel == 0)
@@ -1641,9 +1641,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1641 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) 1641 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1642 { 1642 {
1643 ScenePresence targetAvatar = null; 1643 ScenePresence targetAvatar = null;
1644 ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); 1644 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1645 ScenePresence parcelManager = null; 1645 ScenePresence parcelManager = null;
1646 ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); 1646 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1647 //Just eject 1647 //Just eject
1648 if (flags == 0) 1648 if (flags == 0)
1649 { 1649 {
diff --git a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs
deleted file mode 100644
index 72b0b38..0000000
--- a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * Copyright (c) Thomas Grimshaw and Magne Metaverse Research
3 *
4 * This module is not open source. All rights reserved.
5 * Unauthorised copying, distribution or public display is prohibited.
6 *
7 */
8
9using System;
10using System.Collections.Generic;
11using System.IO;
12using System.Reflection;
13using OpenMetaverse;
14using log4net;
15using Nini.Config;
16using OpenSim.Data;
17using OpenSim.Framework;
18using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
19using OpenSim.Region.Framework.Interfaces;
20using OpenSim.Region.Framework.Scenes;
21
22
23namespace OpenSim.Region.CoreModules.World.Meta7Windlight
24{
25 public class Meta7WindlightModule : IRegionModule, ICommandableModule
26 {
27 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
28 private readonly Commander m_commander = new Commander("windlight");
29 private Scene m_scene;
30 private static bool m_enableWindlight;
31
32 #region ICommandableModule Members
33
34 public ICommander CommandInterface
35 {
36 get { return m_commander; }
37 }
38
39 #endregion
40
41 #region IRegionModule Members
42
43 public static bool EnableWindlight
44 {
45 get
46 {
47 return m_enableWindlight;
48 }
49 set
50 {
51 }
52 }
53
54 public void Initialise(Scene scene, IConfigSource config)
55 {
56 m_scene = scene;
57 m_scene.RegisterModuleInterface<IRegionModule>(this);
58 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
59
60 // ini file settings
61 try
62 {
63 m_enableWindlight = config.Configs["Meta7Windlight"].GetBoolean("enable_windlight", false);
64 }
65 catch (Exception)
66 {
67 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
68 }
69
70 if (m_enableWindlight)
71 {
72 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
73 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
74 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
75 }
76
77 InstallCommands();
78
79 m_log.Debug("[WINDLIGHT]: Initialised windlight module");
80 }
81
82 private List<byte[]> compileWindlightSettings(RegionMeta7WindlightData wl)
83 {
84 byte[] mBlock = new Byte[249];
85 int pos = 0;
86
87 wl.waterColor.ToBytes(mBlock, 0); pos += 12;
88 Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
89 Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4;
90 wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12;
91 Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4;
92 Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4;
93 Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
94 Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
95 Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4;
96 wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8;
97 wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8;
98 wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16;
99 wl.horizon.ToBytes(mBlock, pos); pos += 16;
100 Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4;
101 wl.blueDensity.ToBytes(mBlock, pos); pos += 16;
102 Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4;
103 Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4;
104 Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
105 wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16;
106 Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4;
107 wl.ambient.ToBytes(mBlock, pos); pos += 16;
108 Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4;
109 Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4;
110 Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4;
111 Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4;
112 Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4;
113 wl.cloudColor.ToBytes(mBlock, pos); pos += 16;
114 wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12;
115 Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4;
116 Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4;
117 wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12;
118 Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4;
119 Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4;
120 Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2;
121 mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
122 mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
123 mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;
124 List<byte[]> param = new List<byte[]>();
125 param.Add(mBlock);
126 return param;
127 }
128 public void SendProfileToClient(ScenePresence presence)
129 {
130 IClientAPI client = presence.ControllingClient;
131 if (m_enableWindlight)
132 {
133 if (presence.IsChildAgent == false)
134 {
135 List<byte[]> param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings);
136 client.SendGenericMessage("Windlight", param);
137 }
138 }
139 else
140 {
141 //We probably don't want to spam chat with this.. probably
142 //m_log.Debug("[WINDLIGHT]: Module disabled");
143 }
144 }
145 public void SendProfileToClient(ScenePresence presence, RegionMeta7WindlightData wl)
146 {
147 IClientAPI client = presence.ControllingClient;
148 if (m_enableWindlight)
149 {
150 if (presence.IsChildAgent == false)
151 {
152 List<byte[]> param = compileWindlightSettings(wl);
153 client.SendGenericMessage("Windlight", param);
154 }
155 }
156 else
157 {
158 //We probably don't want to spam chat with this.. probably
159 //m_log.Debug("[WINDLIGHT]: Module disabled");
160 }
161 }
162 private void EventManager_OnMakeRootAgent(ScenePresence presence)
163 {
164 m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
165 SendProfileToClient(presence);
166 }
167 private void EventManager_OnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID pUUID)
168 {
169 ScenePresence Sc;
170 if (m_scene.TryGetAvatar(pUUID,out Sc))
171 {
172 SendProfileToClient(Sc,wl);
173 }
174 }
175 private void EventManager_OnSaveNewWindlightProfile()
176 {
177 m_scene.ForEachScenePresence(SendProfileToClient);
178 }
179
180 public void PostInitialise()
181 {
182
183 }
184
185 public void Close()
186 {
187 }
188
189 public string Name
190 {
191 get { return "Meta7WindlightModule"; }
192 }
193
194 public bool IsSharedModule
195 {
196 get { return false; }
197 }
198
199 #endregion
200
201 #region events
202
203 #endregion
204
205 #region ICommandableModule Members
206
207 private void InstallCommands()
208 {
209 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
210 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
211 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin");
212
213 m_commander.RegisterCommand("load", wlload);
214 m_commander.RegisterCommand("enable", wlenable);
215 m_commander.RegisterCommand("disable", wldisable);
216
217 m_scene.RegisterModuleCommander(m_commander);
218 }
219
220 private void HandleLoad(Object[] args)
221 {
222 if (!m_enableWindlight)
223 {
224 m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first.");
225 }
226 else
227 {
228 m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database");
229 m_scene.LoadWindlightProfile();
230 m_log.InfoFormat("[WINDLIGHT]: Load complete");
231 }
232 }
233
234 private void HandleDisable(Object[] args)
235 {
236 m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled");
237 m_enableWindlight=false;
238 }
239
240 private void HandleEnable(Object[] args)
241 {
242 m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled");
243 m_enableWindlight = true;
244 }
245
246 /// <summary>
247 /// Processes commandline input. Do not call directly.
248 /// </summary>
249 /// <param name="args">Commandline arguments</param>
250 private void EventManager_OnPluginConsole(string[] args)
251 {
252 if (args[0] == "windlight")
253 {
254 if (args.Length == 1)
255 {
256 m_commander.ProcessConsoleCommand("add", new string[0]);
257 return;
258 }
259
260 string[] tmpArgs = new string[args.Length - 2];
261 int i;
262 for (i = 2; i < args.Length; i++)
263 {
264 tmpArgs[i - 2] = args[i];
265 }
266
267 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
268 }
269 }
270 #endregion
271
272 }
273}
274
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
index 7312799..3e8e196 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
@@ -103,8 +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 RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID); 106 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
107 void StoreRegionWindlightSettings(RegionMeta7WindlightData wl); 107 void StoreRegionWindlightSettings(RegionLightShareData wl);
108 108
109 void Shutdown(); 109 void Shutdown();
110 } 110 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 37a51d9..ef125cd 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes
207 207
208 public delegate void OnMakeRootAgentDelegate(ScenePresence presence); 208 public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
209 public delegate void OnSaveNewWindlightProfileDelegate(); 209 public delegate void OnSaveNewWindlightProfileDelegate();
210 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionMeta7WindlightData wl, UUID user); 210 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
211 public event OnMakeRootAgentDelegate OnMakeRootAgent; 211 public event OnMakeRootAgentDelegate OnMakeRootAgent;
212 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; 212 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
213 public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; 213 public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
@@ -1220,7 +1220,7 @@ namespace OpenSim.Region.Framework.Scenes
1220 } 1220 }
1221 } 1221 }
1222 1222
1223 public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user) 1223 public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user)
1224 { 1224 {
1225 OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted; 1225 OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted;
1226 if (handlerSendNewWindlightProfileTargeted != null) 1226 if (handlerSendNewWindlightProfileTargeted != null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2b6f80b..1f604c5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Framework.Scenes
1729 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1729 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1730 } 1730 }
1731 1731
1732 public void StoreWindlightProfile(RegionMeta7WindlightData wl) 1732 public void StoreWindlightProfile(RegionLightShareData wl)
1733 { 1733 {
1734 m_regInfo.WindlightSettings = wl; 1734 m_regInfo.WindlightSettings = wl;
1735 m_storageManager.DataStore.StoreRegionWindlightSettings(wl); 1735 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3895d93..7ed29a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1370,21 +1370,20 @@ namespace OpenSim.Region.Framework.Scenes
1370 { 1370 {
1371// part.Inventory.RemoveScriptInstances(); 1371// part.Inventory.RemoveScriptInstances();
1372 1372
1373 List<ScenePresence> avatars = Scene.GetScenePresences(); 1373 Scene.ForEachScenePresence(delegate (ScenePresence sp)
1374 for (int i = 0; i < avatars.Count; i++)
1375 { 1374 {
1376 if (avatars[i].ParentID == LocalId) 1375 if (sp.ParentID == LocalId)
1377 { 1376 {
1378 avatars[i].StandUp(); 1377 sp.StandUp();
1379 } 1378 }
1380 1379
1381 if (!silent) 1380 if (!silent)
1382 { 1381 {
1383 part.UpdateFlag = 0; 1382 part.UpdateFlag = 0;
1384 if (part == m_rootPart) 1383 if (part == m_rootPart)
1385 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); 1384 sp.ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
1386 } 1385 }
1387 } 1386 });
1388 1387
1389 } 1388 }
1390 1389
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 68035ca..8b2d387 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -101,13 +101,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
101 { 101 {
102 throw new NotImplementedException(); 102 throw new NotImplementedException();
103 } 103 }
104 public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) 104 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
105 { 105 {
106 //This connector doesn't support the windlight module yet 106 //This connector doesn't support the windlight module yet
107 //Return default LL windlight settings 107 //Return default LL windlight settings
108 return new RegionMeta7WindlightData(); 108 return new RegionLightShareData();
109 } 109 }
110 public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) 110 public void StoreRegionWindlightSettings(RegionLightShareData wl)
111 { 111 {
112 //This connector doesn't support the windlight module yet 112 //This connector doesn't support the windlight module yet
113 } 113 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 99973b4..4e8a3c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -7,7 +7,7 @@ using OpenMetaverse;
7using Nini.Config; 7using Nini.Config;
8using OpenSim; 8using OpenSim;
9using OpenSim.Framework; 9using OpenSim.Framework;
10using OpenSim.Region.CoreModules.World.Meta7Windlight; 10using OpenSim.Region.CoreModules.World.LightShare;
11using OpenSim.Region.Framework.Interfaces; 11using OpenSim.Region.Framework.Interfaces;
12using OpenSim.Region.Framework.Scenes; 12using OpenSim.Region.Framework.Scenes;
13using OpenSim.Region.ScriptEngine.Shared; 13using OpenSim.Region.ScriptEngine.Shared;
@@ -97,7 +97,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
97 return new LSL_List(); 97 return new LSL_List();
98 } 98 }
99 m_host.AddScriptLPS(1); 99 m_host.AddScriptLPS(1);
100 RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; 100 RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
101 101
102 LSL_List values = new LSL_List(); 102 LSL_List values = new LSL_List();
103 int idx = 0; 103 int idx = 0;
@@ -229,11 +229,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
229 229
230 return values; 230 return values;
231 231
232 } 232 }
233 233
234 private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) 234 private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
235 { 235 {
236 RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); 236 RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
237 237
238 LSL_List values = new LSL_List(); 238 LSL_List values = new LSL_List();
239 int idx = 0; 239 int idx = 0;
@@ -244,9 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
244 LSL_Types.Vector3 iV; 244 LSL_Types.Vector3 iV;
245 switch (rule) 245 switch (rule)
246 { 246 {
247 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: 247 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
248 idx++; 248 idx++;
249 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); 249 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
250 break; 250 break;
251 case (int)ScriptBaseClass.WL_AMBIENT: 251 case (int)ScriptBaseClass.WL_AMBIENT:
252 idx++; 252 idx++;
@@ -419,58 +419,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
419 { 419 {
420 CMShoutError("Careminster functions are not enabled."); 420 CMShoutError("Careminster functions are not enabled.");
421 return 0; 421 return 0;
422 } 422 }
423 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) 423 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
424 { 424 {
425 CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); 425 CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
426 return 0; 426 return 0;
427 } 427 }
428 int success = 0; 428 int success = 0;
429 m_host.AddScriptLPS(1); 429 m_host.AddScriptLPS(1);
430 if (Meta7WindlightModule.EnableWindlight) 430 if (LightShareModule.EnableWindlight)
431 { 431 {
432 RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); 432 RegionLightShareData wl = getWindlightProfileFromRules(rules);
433 m_host.ParentGroup.Scene.StoreWindlightProfile(wl); 433 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
434 success = 1; 434 success = 1;
435 } 435 }
436 else 436 else
437 { 437 {
438 CMShoutError("Windlight module is disabled"); 438 CMShoutError("Windlight module is disabled");
439 return 0; 439 return 0;
440 }
441 return success;
442 }
443 /// <summary>
444 /// Set the current Windlight scene to a target avatar
445 /// </summary>
446 /// <param name="rules"></param>
447 /// <returns>success: true or false</returns>
448 public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
449 {
450 if (!m_CMFunctionsEnabled)
451 {
452 CMShoutError("Careminster functions are not enabled.");
453 return 0;
454 }
455 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
456 {
457 CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
458 return 0;
459 }
460 int success = 0;
461 m_host.AddScriptLPS(1);
462 if (LightShareModule.EnableWindlight)
463 {
464 RegionLightShareData wl = getWindlightProfileFromRules(rules);
465 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
466 success = 1;
467 }
468 else
469 {
470 CMShoutError("Windlight module is disabled");
471 return 0;
440 } 472 }
441 return success; 473 return success;
442 }
443 /// <summary>
444 /// Set the current Windlight scene to a target avatar
445 /// </summary>
446 /// <param name="rules"></param>
447 /// <returns>success: true or false</returns>
448 public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
449 {
450 if (!m_CMFunctionsEnabled)
451 {
452 CMShoutError("Careminster functions are not enabled.");
453 return 0;
454 }
455 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
456 {
457 CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
458 return 0;
459 }
460 int success = 0;
461 m_host.AddScriptLPS(1);
462 if (Meta7WindlightModule.EnableWindlight)
463 {
464 RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
465 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
466 success = 1;
467 }
468 else
469 {
470 CMShoutError("Windlight module is disabled");
471 return 0;
472 }
473 return success;
474 } 474 }
475 475
476 } 476 }