more to go, fix lsl funtions for parcels env

master
UbitUmarov 2020-06-18 13:47:34 +01:00
parent f708b413a1
commit cca383b452
6 changed files with 107 additions and 48 deletions

View File

@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
catch ( Exception e)
{
m_DefaultEnv = null;
m_log.WarnFormat("[Enviroment {0}]: failed to decode default enviroment asset: {1}", m_scene.Name, e.Message);
m_log.WarnFormat("[Environment {0}]: failed to decode default environment asset: {1}", m_scene.Name, e.Message);
}
}
}
@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
}
catch (Exception e)
{
m_log.ErrorFormat("[Enviroment {0}] failed to load initial enviroment {1}", m_scene.Name, e.Message);
m_log.ErrorFormat("[Environment {0}] failed to load initial Environment {1}", m_scene.Name, e.Message);
scene.RegionEnvironment = null;
m_regionEnvVersion = -1;
}
@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
}
catch (Exception e)
{
m_log.ErrorFormat("[Enviroment {0}] failed to store enviroment {1}", m_scene.Name, e.Message);
m_log.ErrorFormat("[Environment {0}] failed to store Environment {1}", m_scene.Name, e.Message);
}
}
@ -424,14 +424,14 @@ namespace OpenSim.Region.CoreModules.World.LightShare
ViewerEnvironment VEnv;
if (parcel == -1)
VEnv = GetRegionEnviroment();
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
VEnv = GetRegionEnviroment();
VEnv = GetRegionEnvironment();
}
OSDMap map = new OSDMap();
@ -491,7 +491,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
}
if (track != -1)
{
message = "Enviroment Track not suported";
message = "Environment Track not suported";
goto Error;
}
}
@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
if (!m_scene.Permissions.CanEditParcelProperties(agentID, lchannel, 0, true)) // wrong
{
message = "No permission to change parcel enviroment";
message = "No permission to change parcel environment";
goto Error;
}
VEnv = lchannel.LandData.Environment;
@ -562,13 +562,13 @@ namespace OpenSim.Region.CoreModules.World.LightShare
if(lchannel == null)
{
StoreOnRegion(VEnv);
m_log.InfoFormat("[{0}]: ExtEnviroment region {1} settings from agentID {2} saved",
m_log.InfoFormat("[{0}]: ExtEnvironment region {1} settings from agentID {2} saved",
Name, caps.RegionName, agentID);
}
else
{
lchannel.StoreEnvironment(VEnv);
m_log.InfoFormat("[{0}]: ExtEnviroment parcel {1} of region {2} settings from agentID {3} saved",
m_log.InfoFormat("[{0}]: ExtEnvironment parcel {1} of region {2} settings from agentID {3} saved",
Name, parcel, caps.RegionName, agentID);
}
@ -585,7 +585,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
WindlightRefresh(0);
m_log.InfoFormat("[{0}]: ExtEnviroment region {1} settings from agentID {2} saved",
m_log.InfoFormat("[{0}]: ExtEnvironment region {1} settings from agentID {2} saved",
Name, caps.RegionName, agentID);
LLSDxmlEncode.AddMap(sb);
@ -638,7 +638,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
if (land != null && land.LandData != null && land.LandData.Environment != null)
VEnv = land.LandData.Environment;
else
VEnv = GetRegionEnviroment();
VEnv = GetRegionEnvironment();
OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
string env = OSDParser.SerializeLLSDXmlString(d);
@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
if (land != null && land.LandData != null && land.LandData.Environment != null)
{
fail_reason = "The parcel where you are has own enviroment set. You need a updated viewer to change enviroment";
fail_reason = "The parcel where you are has own environment set. You need a updated viewer to change environment";
goto Error;
}
try
@ -829,7 +829,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
uint vflags = client.GetViewerCaps();
if((vflags & 0x8000) != 0)
return;
if(m_scene.RegionInfo.EstateSettings.AllowEnviromentOverride)
if(m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
m_eventQueue.WindlightRefreshEvent(1, client.AgentId);
}
@ -848,7 +848,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
if(m_scene.GetNumberOfClients() == 0)
return;
ViewerEnvironment env = GetRegionEnviroment();
ViewerEnvironment env = GetRegionEnvironment();
float dayFrac = GetDayFractionTime(env);
float wldayFrac = dayFrac;
@ -891,7 +891,27 @@ namespace OpenSim.Region.CoreModules.World.LightShare
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public ViewerEnvironment GetRegionEnviroment()
public ViewerEnvironment GetEnvironment(Vector3 pos)
{
ILandObject lo = m_landChannel.GetLandObject(pos.X, pos.Y);
if (lo != null && lo.LandData != null && lo.LandData.Environment != null)
return lo.LandData.Environment;
return m_scene.RegionEnvironment == null ? m_DefaultEnv : m_scene.RegionEnvironment;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public ViewerEnvironment GetEnvironment(float x, float y)
{
ILandObject lo = m_landChannel.GetLandObject(x, y);
if (lo != null && lo.LandData != null && lo.LandData.Environment != null)
return lo.LandData.Environment;
return m_scene.RegionEnvironment == null ? m_DefaultEnv : m_scene.RegionEnvironment;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public ViewerEnvironment GetRegionEnvironment()
{
return m_scene.RegionEnvironment == null ? m_DefaultEnv : m_scene.RegionEnvironment;
}
@ -907,7 +927,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public float GetRegionDayFractionTime()
{
return GetDayFractionTime(GetRegionEnviroment());
return GetDayFractionTime(GetRegionEnvironment());
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
@ -953,38 +973,75 @@ namespace OpenSim.Region.CoreModules.World.LightShare
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetRegionDayLength()
{
return GetRegionEnviroment().DayLength;
return GetRegionEnvironment().DayLength;
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetRegionDayOffset()
{
return GetRegionEnviroment().DayOffset;
return GetRegionEnvironment().DayOffset;
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3 GetRegionSunDir(float altitude)
{
return GetSunDir(GetRegionEnviroment(), altitude);
return GetSunDir(GetRegionEnvironment(), altitude);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Quaternion GetRegionSunRot(float altitude)
{
return GetSunRot(GetRegionEnviroment(), altitude);
return GetSunRot(GetRegionEnvironment(), altitude);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3 GetRegionMoonDir(float altitude)
{
return GetMoonDir(GetRegionEnviroment(), altitude);
return GetMoonDir(GetRegionEnvironment(), altitude);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Quaternion GetRegionMoonRot(float altitude)
{
return GetMoonRot(GetRegionEnviroment(), altitude);
return GetMoonRot(GetRegionEnvironment(), altitude);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetDayLength(Vector3 pos)
{
return GetEnvironment(pos.X, pos.Y).DayLength;
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetDayOffset(Vector3 pos)
{
return GetEnvironment(pos.X, pos.Y).DayOffset;
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3 GetSunDir(Vector3 pos)
{
return GetSunDir(GetEnvironment(pos.X, pos.Y), pos.Z);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Quaternion GetSunRot(Vector3 pos)
{
return GetSunRot(GetEnvironment(pos.X, pos.Y), pos.Z);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3 GetMoonDir(Vector3 pos)
{
return GetMoonDir(GetEnvironment(pos.X, pos.Y), pos.Z);
}
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public Quaternion GetMoonRot(Vector3 pos)
{
return GetMoonRot(GetEnvironment(pos.X, pos.Y), pos.Z);
}
}
}

View File

@ -43,7 +43,13 @@ namespace OpenSim.Region.Framework.Interfaces
int GetRegionDayOffset();
Vector3 GetRegionSunDir(float altitude);
Quaternion GetRegionSunRot(float altitude);
Vector3 GetRegionMoonDir(float altitude);
Vector3 GetRegionMoonDir(float altitude);
Quaternion GetRegionMoonRot(float altitude);
int GetDayLength(Vector3 pos);
int GetDayOffset(Vector3 pos);
Vector3 GetSunDir(Vector3 pos);
Quaternion GetSunRot(Vector3 pos);
Vector3 GetMoonDir(Vector3 pos);
Quaternion GetMoonRot(Vector3 pos);
}
}

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool IsTerrainXfer(ulong xferID);
bool handleEstateChangeInfoCap(string estateName, UUID invoice,
bool externallyVisible, bool allowDirectTeleport, bool denyAnonymous, bool denyAgeUnverified,
bool alloVoiceChat, bool overridePublicAccess, bool allowEnviromentOverride);
bool alloVoiceChat, bool overridePublicAccess, bool allowEnvironmentOverride);
void HandleRegionInfoRequest(IClientAPI remote_client);
}
}

View File

@ -5884,14 +5884,14 @@ Environment.Exit(1);
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
bool parcelEnvOvr = RegionInfo.EstateSettings.AllowEnviromentOverride;
bool parcelEnvOvr = RegionInfo.EstateSettings.AllowEnvironmentOverride;
RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
if(parcelEnvOvr && !RegionInfo.EstateSettings.AllowEnviromentOverride)
ClearAllParcelEnviroments();
if(parcelEnvOvr && !RegionInfo.EstateSettings.AllowEnvironmentOverride)
ClearAllParcelEnvironments();
}
}
public void ClearAllParcelEnviroments()
public void ClearAllParcelEnvironments()
{
IEnvironmentModule envM = RequestModuleInterface<IEnvironmentModule>();
if(LandChannel != null && envM != null)

View File

@ -17487,7 +17487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return 14400;
return m_envModule.GetRegionDayLength();
return m_envModule.GetDayLength(m_host.GetWorldPosition());
}
public LSL_Integer llGetRegionDayLength()
@ -17507,7 +17507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return 57600;
return m_envModule.GetRegionDayOffset();
return m_envModule.GetDayOffset(m_host.GetWorldPosition());
}
public LSL_Integer llGetRegionDayOffset()
@ -17527,8 +17527,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return Vector3.Zero;
float z = m_host.GetWorldPosition().Z;
return m_envModule.GetRegionSunDir(z);
return m_envModule.GetSunDir(m_host.GetWorldPosition());
}
public LSL_Vector llGetRegionSunDirection()
@ -17549,8 +17548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return Vector3.Zero;
float z = m_host.GetWorldPosition().Z;
return m_envModule.GetRegionMoonDir(z);
return m_envModule.GetMoonDir(m_host.GetWorldPosition());
}
public LSL_Vector llGetRegionMoonDirection()
@ -17571,8 +17569,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return Quaternion.Identity;
float z = m_host.GetWorldPosition().Z;
return m_envModule.GetRegionSunRot(z);
return m_envModule.GetSunRot(m_host.GetWorldPosition());
}
public LSL_Rotation llGetRegionSunRotation()
@ -17593,8 +17590,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_envModule == null)
return Quaternion.Identity;
float z = m_host.GetWorldPosition().Z;
return m_envModule.GetRegionMoonRot(z);
return m_envModule.GetMoonRot(m_host.GetWorldPosition());
}
public LSL_Rotation llGetRegionMoonRotation()

View File

@ -62,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal bool m_LSFunctionsEnabled = false;
internal IScriptModuleComms m_comms = null;
internal IConfig m_osslconfig;
internal IEnvironmentModule m_enviroment = null;
internal IEnvironmentModule m_environment = null;
public void Initialize(IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_comms == null)
m_LSFunctionsEnabled = false;
m_enviroment = m_ScriptEngine.World.RequestModuleInterface<IEnvironmentModule>();
m_environment = m_ScriptEngine.World.RequestModuleInterface<IEnvironmentModule>();
}
public override Object InitializeLifetimeService()
@ -122,7 +122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns>List of windlight parameters</returns>
public LSL_List lsGetWindlightScene(LSL_List rules)
{
if (!m_LSFunctionsEnabled || m_enviroment == null)
if (!m_LSFunctionsEnabled || m_environment == null)
{
LSShoutError("LightShare functions are not enabled.");
return new LSL_List();
@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
RegionLightShareData wl = m_enviroment.ToLightShare();
RegionLightShareData wl = m_environment.ToLightShare();
LSL_List values = new LSL_List();
int idx = 0;
@ -268,7 +268,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
{
RegionLightShareData wl = m_enviroment.ToLightShare();
RegionLightShareData wl = m_environment.ToLightShare();
int idx = 0;
while (idx < rules.Length)
@ -719,7 +719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns>success: true or false</returns>
public int lsSetWindlightScene(LSL_List rules)
{
if (!m_LSFunctionsEnabled || m_enviroment == null)
if (!m_LSFunctionsEnabled || m_environment == null)
{
LSShoutError("LightShare functions are not enabled.");
return 0;
@ -741,7 +741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
RegionLightShareData wl = getWindlightProfileFromRules(rules);
m_enviroment.FromLightShare(wl);
m_environment.FromLightShare(wl);
}
catch(InvalidCastException e)
{
@ -754,7 +754,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void lsClearWindlightScene()
{
if (!m_LSFunctionsEnabled || m_enviroment == null)
if (!m_LSFunctionsEnabled || m_environment == null)
{
LSShoutError("LightShare functions are not enabled.");
return;
@ -773,7 +773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
m_enviroment.ResetEnvironmentSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
m_environment.ResetEnvironmentSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
}
/// <summary>
@ -807,7 +807,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int success = 0;
m_host.AddScriptLPS(1);
if (m_enviroment != null)
if (m_environment != null)
{
RegionLightShareData wl;
try