diff options
author | Oren Hurvitz | 2014-01-15 17:38:09 +0200 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-28 00:11:50 +0000 |
commit | 2cf224166f232076c6d51312aaae1a9a9c24bd1c (patch) | |
tree | eff9c48116b91a424107e025d5d325b953c73612 | |
parent | Convert tabs to spaces from previous commit 8c2b41b01 (diff) | |
download | opensim-SC_OLD-2cf224166f232076c6d51312aaae1a9a9c24bd1c.zip opensim-SC_OLD-2cf224166f232076c6d51312aaae1a9a9c24bd1c.tar.gz opensim-SC_OLD-2cf224166f232076c6d51312aaae1a9a9c24bd1c.tar.bz2 opensim-SC_OLD-2cf224166f232076c6d51312aaae1a9a9c24bd1c.tar.xz |
Added osGetRegionSize(), which returns the region size in meters and recognizes megaregions
3 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f4d5562..15fbbfd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2926,6 +2926,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2926 | return ret; | 2926 | return ret; |
2927 | } | 2927 | } |
2928 | 2928 | ||
2929 | public LSL_Vector osGetRegionSize() | ||
2930 | { | ||
2931 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); | ||
2932 | m_host.AddScriptLPS(1); | ||
2933 | |||
2934 | bool isMegaregion; | ||
2935 | IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>(); | ||
2936 | if (rcMod != null) | ||
2937 | isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID); | ||
2938 | else | ||
2939 | isMegaregion = false; | ||
2940 | |||
2941 | if (isMegaregion) | ||
2942 | { | ||
2943 | Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID); | ||
2944 | return new LSL_Vector(size.X, size.Y, Constants.RegionHeight); | ||
2945 | } | ||
2946 | else | ||
2947 | { | ||
2948 | return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight); | ||
2949 | } | ||
2950 | } | ||
2951 | |||
2929 | public int osGetSimulatorMemory() | 2952 | public int osGetSimulatorMemory() |
2930 | { | 2953 | { |
2931 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 2954 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 51d0581..519779e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -337,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
337 | key osGetMapTexture(); | 337 | key osGetMapTexture(); |
338 | key osGetRegionMapTexture(string regionName); | 338 | key osGetRegionMapTexture(string regionName); |
339 | LSL_List osGetRegionStats(); | 339 | LSL_List osGetRegionStats(); |
340 | vector osGetRegionSize(); | ||
340 | 341 | ||
341 | int osGetSimulatorMemory(); | 342 | int osGetSimulatorMemory(); |
342 | void osKickAvatar(string FirstName,string SurName,string alert); | 343 | void osKickAvatar(string FirstName,string SurName,string alert); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c9902e4..02a3541 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -863,6 +863,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
863 | return m_OSSL_Functions.osGetRegionStats(); | 863 | return m_OSSL_Functions.osGetRegionStats(); |
864 | } | 864 | } |
865 | 865 | ||
866 | public vector osGetRegionSize() | ||
867 | { | ||
868 | return m_OSSL_Functions.osGetRegionSize(); | ||
869 | } | ||
870 | |||
866 | /// <summary> | 871 | /// <summary> |
867 | /// Returns the amount of memory in use by the Simulator Daemon. | 872 | /// Returns the amount of memory in use by the Simulator Daemon. |
868 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) | 873 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) |