diff --git a/OpenSim/Framework/ViewerEnvironment.cs b/OpenSim/Framework/ViewerEnvironment.cs index a4c7595209..f8078b07c2 100644 --- a/OpenSim/Framework/ViewerEnvironment.cs +++ b/OpenSim/Framework/ViewerEnvironment.cs @@ -898,7 +898,7 @@ namespace OpenSim.Framework public int DayOffset = 57600; public int Flags = 0; - float[] Altitudes = new float[3] {1000f, 2000f, 3000f }; + public float[] Altitudes = new float[3] {1000f, 2000f, 3000f }; //DayHash; public bool IsLegacy = false; @@ -1158,27 +1158,32 @@ namespace OpenSim.Framework for(int i = 0; i < alt.Count && i < 3; ++i) Altitudes[i] = alt[i]; - for(int i = 0; i < 2; ++i) - { - float h = Altitudes[i]; - for(int j = i + 1; j < 3; ++j) - { - if(h > Altitudes[j]) - { - Altitudes[i] = Altitudes[j]; - Altitudes[j] = h; - List tet = Cycle.skyTracks[i]; - Cycle.skyTracks[i] = Cycle.skyTracks[j]; - Cycle.skyTracks[j] = tet; - h = Altitudes[i]; - } - } - } + SortAltitudes(); } IsLegacy = false; } + public void SortAltitudes() + { + for (int i = 0; i < 2; ++i) + { + float h = Altitudes[i]; + for (int j = i + 1; j < 3; ++j) + { + if (h > Altitudes[j]) + { + Altitudes[i] = Altitudes[j]; + Altitudes[j] = h; + List tet = Cycle.skyTracks[i]; + Cycle.skyTracks[i] = Cycle.skyTracks[j]; + Cycle.skyTracks[j] = tet; + h = Altitudes[i]; + } + } + } + } + public bool CycleFromOSD(OSD osd) { OSDMap map = osd as OSDMap; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2c76cca2b3..31052f1fe2 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6565,8 +6565,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLSDxmlEncode.AddEndMapAndArray(sb); bool allowenvovr = (regionFlags & (uint)RegionFlags.AllowEnvironmentOverride) != 0; + int envVersion; + if(allowenvovr) + { + ScenePresence sp = SceneAgent as ScenePresence; + if(sp != null && sp .EnvironmentVersion > 0) + envVersion = sp.EnvironmentVersion; + else + envVersion = landData.EnvironmentVersion; + } + else + envVersion = -1; + LLSDxmlEncode.AddArrayAndMap("ParcelEnvironmentBlock", sb); - LLSDxmlEncode.AddElem("ParcelEnvironmentVersion", allowenvovr ? landData.EnvironmentVersion : -1, sb); + LLSDxmlEncode.AddElem("ParcelEnvironmentVersion", envVersion, sb); LLSDxmlEncode.AddElem("RegionAllowEnvironmentOverride", allowenvovr, sb); LLSDxmlEncode.AddEndMapAndArray(sb); diff --git a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs index c4cb6cfb88..63937d7b80 100644 --- a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs @@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare #endregion #region IEnvironmentModule - private void StoreOnRegion(ViewerEnvironment VEnv) + public void StoreOnRegion(ViewerEnvironment VEnv) { try { @@ -455,46 +455,48 @@ namespace OpenSim.Region.CoreModules.World.LightShare private void GetExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID) { - int parcel = -1; + int parcelid = -1; if (httpRequest.Query.Count > 0) { if (httpRequest.Query.ContainsKey("parcelid")) { - Int32.TryParse((string)httpRequest.Query["parcelid"], out parcel); + Int32.TryParse((string)httpRequest.Query["parcelid"], out parcelid); } } + ViewerEnvironment VEnv = null; ScenePresence sp = m_scene.GetScenePresence(agentID); - if (sp == null || sp.IsChildAgent || sp.IsNPC) - { - httpResponse.StatusCode = (int)HttpStatusCode.NotFound; - return; - } - ViewerEnvironment VEnv; - if(sp.Environment != null) + if(sp != null && sp.Environment != null) + { VEnv = sp.Environment; - else if (parcel == -1) + } + else if (parcelid == -1) VEnv = GetRegionEnvironment(); else { - ILandObject land = m_scene.LandChannel.GetLandObject(parcel); - if (land != null && land.LandData != null && land.LandData.Environment != null) - VEnv = land.LandData.Environment; - else + if (m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride) { - /* not working for some reason - OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcel); + ILandObject land = m_scene.LandChannel.GetLandObject(parcelid); + if(land != null && land.LandData != null && land.LandData.Environment != null) + VEnv = land.LandData.Environment; + } + if(VEnv == null) + { + OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcelid); httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlToBytes(def); httpResponse.StatusCode = (int)HttpStatusCode.OK; return; - */ - VEnv = GetRegionEnvironment(); } } OSDMap map = new OSDMap(); - map["environment"] = VEnv.ToOSD(); + OSDMap cenv = (OSDMap)VEnv.ToOSD(); + cenv["parcel_id"] = parcelid; + cenv["region_id"] = regionID; + map["environment"] = cenv; + map["parcel_id"] = parcelid; + map["success"] = true; string env = OSDParser.SerializeLLSDXmlString(map); @@ -560,7 +562,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare ILandObject lchannel; if (parcel == -1) { - if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false)) + if (!m_scene.Permissions.CanIssueEstateCommand(agentID, true)) { message = "Insufficient estate permissions, settings has not been saved."; goto Error; @@ -686,22 +688,19 @@ namespace OpenSim.Region.CoreModules.World.LightShare // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", // Name, agentID, caps.RegionName); + ViewerEnvironment VEnv = null; ScenePresence sp = m_scene.GetScenePresence(agentID); - if (sp == null || sp.IsChildAgent || sp.IsNPC) - { - response.StatusCode = (int)HttpStatusCode.NotFound; - return; - } - - ViewerEnvironment VEnv; - if (sp.Environment != null) + if (sp != null && sp.Environment != null) VEnv = sp.Environment; else { + if(m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride) + { ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y); if (land != null && land.LandData != null && land.LandData.Environment != null) VEnv = land.LandData.Environment; - else + } + if(VEnv == null) VEnv = GetRegionEnvironment(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index efcfb84754..378351e766 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -5883,7 +5883,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_host.ClearObjectAnimations(); } - public LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String environment) + public LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String daycycle) { m_host.AddScriptLPS(1); if(!string.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.Moderate, "osReplaceAgentEnvironment"))) @@ -5896,14 +5896,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(sp == null || sp.IsChildAgent || sp.IsNPC || sp.IsInTransit) return -4; - if(string.IsNullOrEmpty(environment) || environment == UUID.Zero.ToString()) + if(string.IsNullOrEmpty(daycycle) || daycycle == UUID.Zero.ToString()) { sp.Environment = null; m_envModule.WindlightRefresh(sp, transition); return 1; } - UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, environment); + UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, daycycle); if (envID == UUID.Zero) return -3; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 98143dac8f..5dadf0886c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -579,6 +579,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float osGetApparentRegionTime(); LSL_String osGetApparentRegionTimeString(LSL_Integer format24); - LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String environment); + LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String daycycle); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 265439fbda..e0498efda0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1502,9 +1502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetApparentRegionTimeString(format24); } - public LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String environment) + public LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String daycycle) { - return m_OSSL_Functions.osReplaceAgentEnvironment(agentkey, transition, environment); + return m_OSSL_Functions.osReplaceAgentEnvironment(agentkey, transition, daycycle); } } }