diff options
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 62 |
2 files changed, 61 insertions, 2 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 82babb7..722360b 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -58,6 +58,7 @@ Patches | |||
58 | * Godfrey | 58 | * Godfrey |
59 | * Grumly57 | 59 | * Grumly57 |
60 | * Fly-Man | 60 | * Fly-Man |
61 | * Flyte Xevious | ||
61 | * jhurliman | 62 | * jhurliman |
62 | * jimbo2120 (IBM) | 63 | * jimbo2120 (IBM) |
63 | * John R Sohn (XenReborn) | 64 | * John R Sohn (XenReborn) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9819ce0..3c1b87f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4991,8 +4991,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4991 | public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir) | 4991 | public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir) |
4992 | { | 4992 | { |
4993 | m_host.AddScriptLPS(1); | 4993 | m_host.AddScriptLPS(1); |
4994 | NotImplemented("llEdgeOfWorld"); | 4994 | |
4995 | return 0; | 4995 | // edge will be used to pass the Region Coordinates offset |
4996 | // we want to check for a neighboring sim | ||
4997 | LSL_Vector edge = new LSL_Vector(0, 0, 0); | ||
4998 | |||
4999 | if (dir.x == 0) | ||
5000 | { | ||
5001 | if (dir.y == 0) | ||
5002 | { | ||
5003 | // Direction vector is 0,0 so return | ||
5004 | // false since we're staying in the sim | ||
5005 | return 0; | ||
5006 | } | ||
5007 | else | ||
5008 | { | ||
5009 | // Y is the only valid direction | ||
5010 | edge.y = dir.y / Math.Abs(dir.y); | ||
5011 | } | ||
5012 | } | ||
5013 | else | ||
5014 | { | ||
5015 | LSL_Float mag; | ||
5016 | if (dir.x > 0) | ||
5017 | { | ||
5018 | mag = (Constants.RegionSize - pos.x) / dir.x; | ||
5019 | } | ||
5020 | else | ||
5021 | { | ||
5022 | mag = (pos.x/dir.x); | ||
5023 | } | ||
5024 | |||
5025 | mag = Math.Abs(mag); | ||
5026 | |||
5027 | edge.y = pos.y + (dir.y * mag); | ||
5028 | |||
5029 | if (edge.y > Constants.RegionSize || edge.y < 0) | ||
5030 | { | ||
5031 | // Y goes out of bounds first | ||
5032 | edge.y = dir.y / Math.Abs(dir.y); | ||
5033 | } | ||
5034 | else | ||
5035 | { | ||
5036 | // X goes out of bounds first or its a corner exit | ||
5037 | edge.y = 0; | ||
5038 | edge.x = dir.x / Math.Abs(dir.x); | ||
5039 | } | ||
5040 | } | ||
5041 | |||
5042 | List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); | ||
5043 | |||
5044 | uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; | ||
5045 | uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; | ||
5046 | |||
5047 | foreach (SimpleRegionInfo sri in neighbors) | ||
5048 | { | ||
5049 | if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) | ||
5050 | return 0; | ||
5051 | } | ||
5052 | |||
5053 | return 1; | ||
4996 | } | 5054 | } |
4997 | 5055 | ||
4998 | /// <summary> | 5056 | /// <summary> |