add LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String environment). note this is a hack, we cant do the ll* one
parent
d322248fd1
commit
e3ecf0ddbe
|
@ -1179,18 +1179,19 @@ namespace OpenSim.Framework
|
||||||
IsLegacy = false;
|
IsLegacy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CycleFromOSD(OSD osd)
|
public bool CycleFromOSD(OSD osd)
|
||||||
{
|
{
|
||||||
OSDMap map = osd as OSDMap;
|
OSDMap map = osd as OSDMap;
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return;
|
return false;
|
||||||
if(!map.TryGetValue("type", out OSD tmp))
|
if(!map.TryGetValue("type", out OSD tmp))
|
||||||
return;
|
return false;
|
||||||
string type = tmp.AsString();
|
string type = tmp.AsString();
|
||||||
if(type != "daycycle")
|
if(type != "daycycle")
|
||||||
return;
|
return false;
|
||||||
Cycle = new DayCycle();
|
Cycle = new DayCycle();
|
||||||
Cycle.FromOSD(map);
|
Cycle.FromOSD(map);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSD ToOSD()
|
public OSD ToOSD()
|
||||||
|
|
|
@ -255,14 +255,19 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
public void WindlightRefresh(int interpolate, bool notforparcel = true)
|
public void WindlightRefresh(int interpolate, bool notforparcel = true)
|
||||||
{
|
{
|
||||||
List<byte[]> ls = null;
|
List<byte[]> ls = null;
|
||||||
m_scene.ForEachClient(delegate (IClientAPI client)
|
m_scene.ForEachRootScenePresence(delegate (ScenePresence sp)
|
||||||
{
|
{
|
||||||
if(!client.IsActive)
|
if(sp.IsInTransit || sp.IsNPC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IClientAPI client = sp.ControllingClient;
|
||||||
|
|
||||||
|
if (!client.IsActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint vflags = client.GetViewerCaps();
|
uint vflags = client.GetViewerCaps();
|
||||||
|
|
||||||
if (notforparcel && (vflags & 0x8000) != 0 )
|
if (notforparcel && (vflags & 0x8000) != 0)
|
||||||
m_estateModule.HandleRegionInfoRequest(client);
|
m_estateModule.HandleRegionInfoRequest(client);
|
||||||
|
|
||||||
else if ((vflags & 0x4000) != 0)
|
else if ((vflags & 0x4000) != 0)
|
||||||
|
@ -270,13 +275,50 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ls == null)
|
if (ls == null)
|
||||||
ls = MakeLightShareData();
|
ls = MakeLightShareData();
|
||||||
SendLightShare(client, ls);
|
SendLightShare(client, ls);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WindlightRefresh(IScenePresence isp, int interpolate)
|
||||||
|
{
|
||||||
|
List<byte[]> ls = null;
|
||||||
|
|
||||||
|
IClientAPI client = isp.ControllingClient;
|
||||||
|
|
||||||
|
if (!client.IsActive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint vflags = client.GetViewerCaps();
|
||||||
|
|
||||||
|
if ((vflags & 0x8000) != 0)
|
||||||
|
{
|
||||||
|
ScenePresence sp = isp as ScenePresence;
|
||||||
|
if(sp.Environment != null)
|
||||||
|
m_estateModule.HandleRegionInfoRequest(client);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ILandObject lo = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
|
||||||
|
if (lo != null && lo.LandData != null && lo.LandData.Environment != null)
|
||||||
|
lo.SendLandUpdateToClient(client);
|
||||||
|
else
|
||||||
|
m_estateModule.HandleRegionInfoRequest(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((vflags & 0x4000) != 0)
|
||||||
|
m_eventQueue.WindlightRefreshEvent(interpolate, client.AgentId);
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ls == null)
|
||||||
|
ls = MakeLightShareData();
|
||||||
|
SendLightShare(client, ls);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void FromLightShare(RegionLightShareData ls)
|
public void FromLightShare(RegionLightShareData ls)
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
|
@ -397,7 +439,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
if (land != null && land.LandData != null)
|
if (land != null && land.LandData != null)
|
||||||
{
|
{
|
||||||
land.StoreEnvironment(null);
|
land.StoreEnvironment(null);
|
||||||
WindlightRefresh(0, false);
|
WindlightRefresh(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,8 +464,17 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||||
|
if (sp == null || sp.IsChildAgent || sp.IsNPC)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ViewerEnvironment VEnv;
|
ViewerEnvironment VEnv;
|
||||||
if (parcel == -1)
|
if(sp.Environment != null)
|
||||||
|
VEnv = sp.Environment;
|
||||||
|
else if (parcel == -1)
|
||||||
VEnv = GetRegionEnvironment();
|
VEnv = GetRegionEnvironment();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -431,7 +482,12 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
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
|
else
|
||||||
VEnv = GetRegionEnvironment();
|
{
|
||||||
|
OSD def = ViewerEnvironment.DefaultToOSD(regionID, parcel);
|
||||||
|
httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlToBytes(def);
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDMap map = new OSDMap();
|
OSDMap map = new OSDMap();
|
||||||
|
@ -496,6 +552,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewerEnvironment VEnv = m_scene.RegionEnvironment;
|
ViewerEnvironment VEnv = m_scene.RegionEnvironment;
|
||||||
ILandObject lchannel;
|
ILandObject lchannel;
|
||||||
if (parcel == -1)
|
if (parcel == -1)
|
||||||
|
@ -634,11 +691,16 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewerEnvironment VEnv;
|
ViewerEnvironment VEnv;
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
|
if (sp.Environment != null)
|
||||||
if (land != null && land.LandData != null && land.LandData.Environment != null)
|
VEnv = sp.Environment;
|
||||||
VEnv = land.LandData.Environment;
|
|
||||||
else
|
else
|
||||||
VEnv = GetRegionEnvironment();
|
{
|
||||||
|
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
|
||||||
|
VEnv = GetRegionEnvironment();
|
||||||
|
}
|
||||||
|
|
||||||
OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
|
OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
|
||||||
string env = OSDParser.SerializeLLSDXmlString(d);
|
string env = OSDParser.SerializeLLSDXmlString(d);
|
||||||
|
@ -680,6 +742,12 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sp.Environment != null)
|
||||||
|
{
|
||||||
|
fail_reason = "The environment you see is a forced one. Disable if on control object or tp out and back to region";
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -691,13 +759,14 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
ViewerEnvironment VEnv = new ViewerEnvironment();
|
ViewerEnvironment VEnv = new ViewerEnvironment();
|
||||||
OSD env = OSDParser.Deserialize(request.InputStream);
|
OSD env = OSDParser.Deserialize(request.InputStream);
|
||||||
VEnv.FromWLOSD(env);
|
VEnv.FromWLOSD(env);
|
||||||
|
|
||||||
StoreOnRegion(VEnv);
|
StoreOnRegion(VEnv);
|
||||||
success = true;
|
|
||||||
|
|
||||||
WindlightRefresh(0);
|
WindlightRefresh(0);
|
||||||
|
|
||||||
m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
|
m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
|
||||||
Name, agentID, m_scene.Name);
|
Name, agentID, m_scene.Name);
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -825,12 +894,17 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
|
|
||||||
private void OnAvatarEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
|
private void OnAvatarEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
|
||||||
{
|
{
|
||||||
|
if (sp.Environment != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
|
||||||
|
return;
|
||||||
|
|
||||||
IClientAPI client = sp.ControllingClient;
|
IClientAPI client = sp.ControllingClient;
|
||||||
uint vflags = client.GetViewerCaps();
|
uint vflags = client.GetViewerCaps();
|
||||||
if((vflags & 0x8000) != 0)
|
if((vflags & 0x8000) != 0)
|
||||||
return;
|
return;
|
||||||
if(m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
|
m_eventQueue.WindlightRefreshEvent(1, client.AgentId);
|
||||||
m_eventQueue.WindlightRefreshEvent(1, client.AgentId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateEnvTime()
|
private void UpdateEnvTime()
|
||||||
|
|
|
@ -37,6 +37,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
RegionLightShareData ToLightShare();
|
RegionLightShareData ToLightShare();
|
||||||
byte[] GetDefaultAssetData(int type);
|
byte[] GetDefaultAssetData(int type);
|
||||||
void WindlightRefresh(int interpolate, bool notforparcel = true);
|
void WindlightRefresh(int interpolate, bool notforparcel = true);
|
||||||
|
void WindlightRefresh(IScenePresence sp, int interpolate);
|
||||||
|
|
||||||
|
ViewerEnvironment GetRegionEnvironment();
|
||||||
|
|
||||||
float GetRegionDayFractionTime();
|
float GetRegionDayFractionTime();
|
||||||
int GetRegionDayLength();
|
int GetRegionDayLength();
|
||||||
|
|
|
@ -83,6 +83,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
|
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public int EnvironmentVersion = -1;
|
||||||
|
private ViewerEnvironment m_environment;
|
||||||
|
public ViewerEnvironment Environment
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_environment;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_environment = value;
|
||||||
|
if (value == null)
|
||||||
|
EnvironmentVersion = -1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(EnvironmentVersion <= 0)
|
||||||
|
EnvironmentVersion = 0x7000000;
|
||||||
|
else
|
||||||
|
++EnvironmentVersion;
|
||||||
|
m_environment.version = EnvironmentVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerScenePresenceUpdated()
|
public void TriggerScenePresenceUpdated()
|
||||||
{
|
{
|
||||||
if (m_scene != null)
|
if (m_scene != null)
|
||||||
|
|
|
@ -5882,5 +5882,52 @@ 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)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
// if(!string.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.Moderate, "osReplaceAgentEnvironment")))
|
||||||
|
// return -2;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UUID.TryParse(agentkey, out UUID agentid))
|
||||||
|
return -4;
|
||||||
|
|
||||||
|
ScenePresence sp = World.GetScenePresence(agentid);
|
||||||
|
if(sp == null || sp.IsChildAgent || sp.IsNPC || sp.IsInTransit)
|
||||||
|
return -4;
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(environment) || environment == UUID.Zero.ToString())
|
||||||
|
{
|
||||||
|
sp.Environment = null;
|
||||||
|
m_envModule.WindlightRefresh(sp, transition);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, environment);
|
||||||
|
if (envID == UUID.Zero)
|
||||||
|
return -3;
|
||||||
|
|
||||||
|
AssetBase asset = World.AssetService.Get(envID.ToString());
|
||||||
|
if(asset == null || asset.Type != (byte)AssetType.Settings)
|
||||||
|
return -3;
|
||||||
|
// cant use stupid broken asset flags for subtype
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OSD oenv = OSDParser.Deserialize(asset.Data);
|
||||||
|
ViewerEnvironment VEnv = m_envModule.GetRegionEnvironment().Clone();
|
||||||
|
if(!VEnv.CycleFromOSD(oenv))
|
||||||
|
return -3;
|
||||||
|
sp.Environment = VEnv;
|
||||||
|
m_envModule.WindlightRefresh(sp, transition);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
sp.Environment = null;
|
||||||
|
m_envModule.WindlightRefresh(sp, transition);
|
||||||
|
return -9;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -578,5 +578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_String osGetApparentTimeString(LSL_Integer format24);
|
LSL_String osGetApparentTimeString(LSL_Integer format24);
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1502,5 +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)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osReplaceAgentEnvironment(agentkey, transition, environment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue