some fixes on env protocol, forced env, etc
parent
17e7e9b354
commit
5b56a09cb2
|
@ -898,7 +898,7 @@ namespace OpenSim.Framework
|
||||||
public int DayOffset = 57600;
|
public int DayOffset = 57600;
|
||||||
public int Flags = 0;
|
public int Flags = 0;
|
||||||
|
|
||||||
float[] Altitudes = new float[3] {1000f, 2000f, 3000f };
|
public float[] Altitudes = new float[3] {1000f, 2000f, 3000f };
|
||||||
|
|
||||||
//DayHash;
|
//DayHash;
|
||||||
public bool IsLegacy = false;
|
public bool IsLegacy = false;
|
||||||
|
@ -1158,27 +1158,32 @@ namespace OpenSim.Framework
|
||||||
for(int i = 0; i < alt.Count && i < 3; ++i)
|
for(int i = 0; i < alt.Count && i < 3; ++i)
|
||||||
Altitudes[i] = alt[i];
|
Altitudes[i] = alt[i];
|
||||||
|
|
||||||
for(int i = 0; i < 2; ++i)
|
SortAltitudes();
|
||||||
{
|
|
||||||
float h = Altitudes[i];
|
|
||||||
for(int j = i + 1; j < 3; ++j)
|
|
||||||
{
|
|
||||||
if(h > Altitudes[j])
|
|
||||||
{
|
|
||||||
Altitudes[i] = Altitudes[j];
|
|
||||||
Altitudes[j] = h;
|
|
||||||
List<DayCycle.TrackEntry> tet = Cycle.skyTracks[i];
|
|
||||||
Cycle.skyTracks[i] = Cycle.skyTracks[j];
|
|
||||||
Cycle.skyTracks[j] = tet;
|
|
||||||
h = Altitudes[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsLegacy = false;
|
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<DayCycle.TrackEntry> tet = Cycle.skyTracks[i];
|
||||||
|
Cycle.skyTracks[i] = Cycle.skyTracks[j];
|
||||||
|
Cycle.skyTracks[j] = tet;
|
||||||
|
h = Altitudes[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool CycleFromOSD(OSD osd)
|
public bool CycleFromOSD(OSD osd)
|
||||||
{
|
{
|
||||||
OSDMap map = osd as OSDMap;
|
OSDMap map = osd as OSDMap;
|
||||||
|
|
|
@ -6565,8 +6565,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||||
|
|
||||||
bool allowenvovr = (regionFlags & (uint)RegionFlags.AllowEnvironmentOverride) != 0;
|
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.AddArrayAndMap("ParcelEnvironmentBlock", sb);
|
||||||
LLSDxmlEncode.AddElem("ParcelEnvironmentVersion", allowenvovr ? landData.EnvironmentVersion : -1, sb);
|
LLSDxmlEncode.AddElem("ParcelEnvironmentVersion", envVersion, sb);
|
||||||
LLSDxmlEncode.AddElem("RegionAllowEnvironmentOverride", allowenvovr, sb);
|
LLSDxmlEncode.AddElem("RegionAllowEnvironmentOverride", allowenvovr, sb);
|
||||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEnvironmentModule
|
#region IEnvironmentModule
|
||||||
private void StoreOnRegion(ViewerEnvironment VEnv)
|
public void StoreOnRegion(ViewerEnvironment VEnv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -455,46 +455,48 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
|
|
||||||
private void GetExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID)
|
private void GetExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID)
|
||||||
{
|
{
|
||||||
int parcel = -1;
|
int parcelid = -1;
|
||||||
if (httpRequest.Query.Count > 0)
|
if (httpRequest.Query.Count > 0)
|
||||||
{
|
{
|
||||||
if (httpRequest.Query.ContainsKey("parcelid"))
|
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);
|
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||||
if (sp == null || sp.IsChildAgent || sp.IsNPC)
|
|
||||||
{
|
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewerEnvironment VEnv;
|
if(sp != null && sp.Environment != null)
|
||||||
if(sp.Environment != null)
|
{
|
||||||
VEnv = sp.Environment;
|
VEnv = sp.Environment;
|
||||||
else if (parcel == -1)
|
}
|
||||||
|
else if (parcelid == -1)
|
||||||
VEnv = GetRegionEnvironment();
|
VEnv = GetRegionEnvironment();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(parcel);
|
if (m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
|
||||||
if (land != null && land.LandData != null && land.LandData.Environment != null)
|
|
||||||
VEnv = land.LandData.Environment;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* not working for some reason
|
ILandObject land = m_scene.LandChannel.GetLandObject(parcelid);
|
||||||
OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcel);
|
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.RawBuffer = OSDParser.SerializeLLSDXmlToBytes(def);
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
return;
|
return;
|
||||||
*/
|
|
||||||
VEnv = GetRegionEnvironment();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDMap map = new OSDMap();
|
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);
|
string env = OSDParser.SerializeLLSDXmlString(map);
|
||||||
|
|
||||||
|
@ -560,7 +562,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
ILandObject lchannel;
|
ILandObject lchannel;
|
||||||
if (parcel == -1)
|
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.";
|
message = "Insufficient estate permissions, settings has not been saved.";
|
||||||
goto Error;
|
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}",
|
// m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
|
||||||
// Name, agentID, caps.RegionName);
|
// Name, agentID, caps.RegionName);
|
||||||
|
|
||||||
|
ViewerEnvironment VEnv = null;
|
||||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||||
if (sp == null || sp.IsChildAgent || sp.IsNPC)
|
if (sp != null && sp.Environment != null)
|
||||||
{
|
|
||||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewerEnvironment VEnv;
|
|
||||||
if (sp.Environment != null)
|
|
||||||
VEnv = sp.Environment;
|
VEnv = sp.Environment;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
|
||||||
|
{
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
|
ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
|
||||||
if (land != null && land.LandData != null && land.LandData.Environment != null)
|
if (land != null && land.LandData != null && land.LandData.Environment != null)
|
||||||
VEnv = land.LandData.Environment;
|
VEnv = land.LandData.Environment;
|
||||||
else
|
}
|
||||||
|
if(VEnv == null)
|
||||||
VEnv = GetRegionEnvironment();
|
VEnv = GetRegionEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5883,7 +5883,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return m_host.ClearObjectAnimations();
|
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);
|
m_host.AddScriptLPS(1);
|
||||||
if(!string.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.Moderate, "osReplaceAgentEnvironment")))
|
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)
|
if(sp == null || sp.IsChildAgent || sp.IsNPC || sp.IsInTransit)
|
||||||
return -4;
|
return -4;
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(environment) || environment == UUID.Zero.ToString())
|
if(string.IsNullOrEmpty(daycycle) || daycycle == UUID.Zero.ToString())
|
||||||
{
|
{
|
||||||
sp.Environment = null;
|
sp.Environment = null;
|
||||||
m_envModule.WindlightRefresh(sp, transition);
|
m_envModule.WindlightRefresh(sp, transition);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, environment);
|
UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, daycycle);
|
||||||
if (envID == UUID.Zero)
|
if (envID == UUID.Zero)
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
|
|
|
@ -579,6 +579,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_Float osGetApparentRegionTime();
|
LSL_Float osGetApparentRegionTime();
|
||||||
LSL_String osGetApparentRegionTimeString(LSL_Integer format24);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1502,9 +1502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_OSSL_Functions.osGetApparentRegionTimeString(format24);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue