Added osGetRegionSize(), which returns the region size in meters and recognizes megaregions
parent
f7172095e0
commit
2cf224166f
|
@ -2926,6 +2926,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return ret;
|
||||
}
|
||||
|
||||
public LSL_Vector osGetRegionSize()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.None, "osGetRegionSize");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
bool isMegaregion;
|
||||
IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>();
|
||||
if (rcMod != null)
|
||||
isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID);
|
||||
else
|
||||
isMegaregion = false;
|
||||
|
||||
if (isMegaregion)
|
||||
{
|
||||
Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID);
|
||||
return new LSL_Vector(size.X, size.Y, Constants.RegionHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int osGetSimulatorMemory()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory");
|
||||
|
|
|
@ -337,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
key osGetMapTexture();
|
||||
key osGetRegionMapTexture(string regionName);
|
||||
LSL_List osGetRegionStats();
|
||||
vector osGetRegionSize();
|
||||
|
||||
int osGetSimulatorMemory();
|
||||
void osKickAvatar(string FirstName,string SurName,string alert);
|
||||
|
|
|
@ -863,6 +863,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_OSSL_Functions.osGetRegionStats();
|
||||
}
|
||||
|
||||
public vector osGetRegionSize()
|
||||
{
|
||||
return m_OSSL_Functions.osGetRegionSize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of memory in use by the Simulator Daemon.
|
||||
/// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware)
|
||||
|
|
Loading…
Reference in New Issue