From 7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Mar 2010 23:29:03 +0100 Subject: Rename Meta7Windlight to LightShare --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 6 +- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 +- OpenSim/Data/Null/NullDataStore.cs | 6 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 6 +- OpenSim/Framework/RegionInfo.cs | 10 +- .../CoreModules/World/Land/LandManagementModule.cs | 10 +- .../World/Meta7Windlight/Meta7WindlightModule.cs | 274 --------------------- .../Framework/Interfaces/IRegionDataStore.cs | 4 +- OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 11 +- .../Region/Framework/Scenes/Tests/SceneTests.cs | 6 +- .../Shared/Api/Implementation/CM_Api.cs | 116 ++++----- 13 files changed, 93 insertions(+), 368 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index b1339b6..d6cb91f 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs @@ -691,13 +691,13 @@ VALUES cmd.ExecuteNonQuery(); } } - public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) { //This connector doesn't support the windlight module yet //Return default LL windlight settings - return new RegionMeta7WindlightData(); + return new RegionLightShareData(); } - public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet } diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index f84beb6..a395ddc 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -711,9 +711,9 @@ namespace OpenSim.Data.MySQL } } - public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) { - RegionMeta7WindlightData nWP = new RegionMeta7WindlightData(); + RegionLightShareData nWP = new RegionLightShareData(); nWP.OnSave += StoreRegionWindlightSettings; using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) @@ -845,7 +845,7 @@ namespace OpenSim.Data.MySQL return rs; } - public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) + public void StoreRegionWindlightSettings(RegionLightShareData wl) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs index 4b6d0f3..3ba44bb 100644 --- a/OpenSim/Data/Null/NullDataStore.cs +++ b/OpenSim/Data/Null/NullDataStore.cs @@ -50,13 +50,13 @@ namespace OpenSim.Data.Null public void StoreRegionSettings(RegionSettings rs) { } - public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) { //This connector doesn't support the windlight module yet //Return default LL windlight settings - return new RegionMeta7WindlightData(); + return new RegionLightShareData(); } - public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet } diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 81c0703..d2ba9ae 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -272,13 +272,13 @@ namespace OpenSim.Data.SQLite Commit(); } } - public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) { //This connector doesn't support the windlight module yet //Return default LL windlight settings - return new RegionMeta7WindlightData(); + return new RegionLightShareData(); } - public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet } diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 05f9cf9..5eacd73 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework { - public class RegionMeta7WindlightData : ICloneable + public class RegionLightShareData : ICloneable { public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); @@ -80,7 +80,7 @@ namespace OpenSim.Framework public bool cloudScrollYLock = false; public bool drawClassicClouds = true; - public delegate void SaveDelegate(RegionMeta7WindlightData wl); + public delegate void SaveDelegate(RegionLightShareData wl); public event SaveDelegate OnSave; public void Save() { @@ -356,7 +356,7 @@ namespace OpenSim.Framework private bool m_clampPrimSize = false; private int m_objectCapacity = 0; private string m_regionType = String.Empty; - private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData(); + private RegionLightShareData m_windlight = new RegionLightShareData(); protected uint m_httpPort; protected string m_serverURI; protected string m_regionName = String.Empty; @@ -495,13 +495,13 @@ namespace OpenSim.Framework set { m_regionSettings = value; } } - public RegionMeta7WindlightData WindlightSettings + public RegionLightShareData WindlightSettings { get { if (m_windlight == null) { - m_windlight = new RegionMeta7WindlightData(); + m_windlight = new RegionLightShareData(); } return m_windlight; 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 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) { ScenePresence SP; - ((Scene)client.Scene).TryGetAvatar(client.AgentId, out SP); + ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); List returns = new List(); if (SP.GodLevel != 0) { @@ -1597,9 +1597,9 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) { ScenePresence targetAvatar = null; - ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); + ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); ScenePresence parcelManager = null; - ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); + ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); System.Threading.Timer Timer; if (targetAvatar.GodLevel == 0) @@ -1641,9 +1641,9 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) { ScenePresence targetAvatar = null; - ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); + ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); ScenePresence parcelManager = null; - ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); + ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); //Just eject if (flags == 0) { 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 @@ -/* - * Copyright (c) Thomas Grimshaw and Magne Metaverse Research - * - * This module is not open source. All rights reserved. - * Unauthorised copying, distribution or public display is prohibited. - * - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using OpenMetaverse; -using log4net; -using Nini.Config; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Region.CoreModules.Framework.InterfaceCommander; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - - -namespace OpenSim.Region.CoreModules.World.Meta7Windlight -{ - public class Meta7WindlightModule : IRegionModule, ICommandableModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Commander m_commander = new Commander("windlight"); - private Scene m_scene; - private static bool m_enableWindlight; - - #region ICommandableModule Members - - public ICommander CommandInterface - { - get { return m_commander; } - } - - #endregion - - #region IRegionModule Members - - public static bool EnableWindlight - { - get - { - return m_enableWindlight; - } - set - { - } - } - - public void Initialise(Scene scene, IConfigSource config) - { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - - // ini file settings - try - { - m_enableWindlight = config.Configs["Meta7Windlight"].GetBoolean("enable_windlight", false); - } - catch (Exception) - { - m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); - } - - if (m_enableWindlight) - { - m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; - m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; - m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; - } - - InstallCommands(); - - m_log.Debug("[WINDLIGHT]: Initialised windlight module"); - } - - private List compileWindlightSettings(RegionMeta7WindlightData wl) - { - byte[] mBlock = new Byte[249]; - int pos = 0; - - wl.waterColor.ToBytes(mBlock, 0); pos += 12; - Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4; - wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12; - Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4; - wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8; - wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8; - wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16; - wl.horizon.ToBytes(mBlock, pos); pos += 16; - Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4; - wl.blueDensity.ToBytes(mBlock, pos); pos += 16; - Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4; - wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16; - Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4; - wl.ambient.ToBytes(mBlock, pos); pos += 16; - Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4; - wl.cloudColor.ToBytes(mBlock, pos); pos += 16; - wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12; - Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4; - wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12; - Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4; - Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4; - Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2; - mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++; - mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++; - mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++; - List param = new List(); - param.Add(mBlock); - return param; - } - public void SendProfileToClient(ScenePresence presence) - { - IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) - { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); - } - } - public void SendProfileToClient(ScenePresence presence, RegionMeta7WindlightData wl) - { - IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) - { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(wl); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); - } - } - private void EventManager_OnMakeRootAgent(ScenePresence presence) - { - m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); - SendProfileToClient(presence); - } - private void EventManager_OnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID pUUID) - { - ScenePresence Sc; - if (m_scene.TryGetAvatar(pUUID,out Sc)) - { - SendProfileToClient(Sc,wl); - } - } - private void EventManager_OnSaveNewWindlightProfile() - { - m_scene.ForEachScenePresence(SendProfileToClient); - } - - public void PostInitialise() - { - - } - - public void Close() - { - } - - public string Name - { - get { return "Meta7WindlightModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - - #endregion - - #region events - - #endregion - - #region ICommandableModule Members - - private void InstallCommands() - { - Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast"); - Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin"); - Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin"); - - m_commander.RegisterCommand("load", wlload); - m_commander.RegisterCommand("enable", wlenable); - m_commander.RegisterCommand("disable", wldisable); - - m_scene.RegisterModuleCommander(m_commander); - } - - private void HandleLoad(Object[] args) - { - if (!m_enableWindlight) - { - m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first."); - } - else - { - m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database"); - m_scene.LoadWindlightProfile(); - m_log.InfoFormat("[WINDLIGHT]: Load complete"); - } - } - - private void HandleDisable(Object[] args) - { - m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); - m_enableWindlight=false; - } - - private void HandleEnable(Object[] args) - { - m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled"); - m_enableWindlight = true; - } - - /// - /// Processes commandline input. Do not call directly. - /// - /// Commandline arguments - private void EventManager_OnPluginConsole(string[] args) - { - if (args[0] == "windlight") - { - if (args.Length == 1) - { - m_commander.ProcessConsoleCommand("add", new string[0]); - return; - } - - string[] tmpArgs = new string[args.Length - 2]; - int i; - for (i = 2; i < args.Length; i++) - { - tmpArgs[i - 2] = args[i]; - } - - m_commander.ProcessConsoleCommand(args[1], tmpArgs); - } - } - #endregion - - } -} - 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 void StoreRegionSettings(RegionSettings rs); RegionSettings LoadRegionSettings(UUID regionUUID); - RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID); - void StoreRegionWindlightSettings(RegionMeta7WindlightData wl); + RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); + void StoreRegionWindlightSettings(RegionLightShareData wl); void Shutdown(); } 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 public delegate void OnMakeRootAgentDelegate(ScenePresence presence); public delegate void OnSaveNewWindlightProfileDelegate(); - public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionMeta7WindlightData wl, UUID user); + public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); public event OnMakeRootAgentDelegate OnMakeRootAgent; public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; @@ -1220,7 +1220,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user) + public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user) { OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted; 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 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } - public void StoreWindlightProfile(RegionMeta7WindlightData wl) + public void StoreWindlightProfile(RegionLightShareData wl) { m_regInfo.WindlightSettings = wl; 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 { // part.Inventory.RemoveScriptInstances(); - List avatars = Scene.GetScenePresences(); - for (int i = 0; i < avatars.Count; i++) + Scene.ForEachScenePresence(delegate (ScenePresence sp) { - if (avatars[i].ParentID == LocalId) + if (sp.ParentID == LocalId) { - avatars[i].StandUp(); + sp.StandUp(); } if (!silent) { part.UpdateFlag = 0; if (part == m_rootPart) - avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); + sp.ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } - } + }); } 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 { throw new NotImplementedException(); } - public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID) + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) { //This connector doesn't support the windlight module yet //Return default LL windlight settings - return new RegionMeta7WindlightData(); + return new RegionLightShareData(); } - public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet } 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; using Nini.Config; using OpenSim; using OpenSim.Framework; -using OpenSim.Region.CoreModules.World.Meta7Windlight; +using OpenSim.Region.CoreModules.World.LightShare; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; @@ -97,7 +97,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); } m_host.AddScriptLPS(1); - RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; + RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; LSL_List values = new LSL_List(); int idx = 0; @@ -229,11 +229,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return values; - } - - private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) - { - RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); + } + + private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) + { + RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); LSL_List values = new LSL_List(); int idx = 0; @@ -244,9 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Types.Vector3 iV; switch (rule) { - case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: - idx++; - wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); + case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: + idx++; + wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); break; case (int)ScriptBaseClass.WL_AMBIENT: idx++; @@ -419,58 +419,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CMShoutError("Careminster functions are not enabled."); return 0; - } - if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) - { - CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); - return 0; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); + return 0; } int success = 0; - m_host.AddScriptLPS(1); - if (Meta7WindlightModule.EnableWindlight) - { - RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); - m_host.ParentGroup.Scene.StoreWindlightProfile(wl); - success = 1; - } - else - { - CMShoutError("Windlight module is disabled"); - return 0; + m_host.AddScriptLPS(1); + if (LightShareModule.EnableWindlight) + { + RegionLightShareData wl = getWindlightProfileFromRules(rules); + m_host.ParentGroup.Scene.StoreWindlightProfile(wl); + success = 1; + } + else + { + CMShoutError("Windlight module is disabled"); + return 0; + } + return success; + } + /// + /// Set the current Windlight scene to a target avatar + /// + /// + /// success: true or false + public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) + { + if (!m_CMFunctionsEnabled) + { + CMShoutError("Careminster functions are not enabled."); + return 0; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); + return 0; + } + int success = 0; + m_host.AddScriptLPS(1); + if (LightShareModule.EnableWindlight) + { + RegionLightShareData wl = getWindlightProfileFromRules(rules); + World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); + success = 1; + } + else + { + CMShoutError("Windlight module is disabled"); + return 0; } return success; - } - /// - /// Set the current Windlight scene to a target avatar - /// - /// - /// success: true or false - public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) - { - if (!m_CMFunctionsEnabled) - { - CMShoutError("Careminster functions are not enabled."); - return 0; - } - if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) - { - CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); - return 0; - } - int success = 0; - m_host.AddScriptLPS(1); - if (Meta7WindlightModule.EnableWindlight) - { - RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); - World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); - success = 1; - } - else - { - CMShoutError("Windlight module is disabled"); - return 0; - } - return success; } } -- cgit v1.1