Added osGetRegionSize(), which returns the region size in meters and recognizes megaregions

master-beforevarregion^2
Oren Hurvitz 2014-01-15 17:38:09 +02:00 committed by Justin Clark-Casey (justincc)
parent f7172095e0
commit 2cf224166f
3 changed files with 29 additions and 0 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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)