aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorDahlia Trimble2009-03-29 23:59:14 +0000
committerDahlia Trimble2009-03-29 23:59:14 +0000
commitd468b7f2d33ac2562048f60de599e2e07cac270d (patch)
tree17becf9a6d316fba9209fc6fe392742dd18e241c /OpenSim/Region/ScriptEngine/Shared/Api
parentAdded Authorization client code that interfaces with HGLoginAuthService. Impr... (diff)
downloadopensim-SC-d468b7f2d33ac2562048f60de599e2e07cac270d.zip
opensim-SC-d468b7f2d33ac2562048f60de599e2e07cac270d.tar.gz
opensim-SC-d468b7f2d33ac2562048f60de599e2e07cac270d.tar.bz2
opensim-SC-d468b7f2d33ac2562048f60de599e2e07cac270d.tar.xz
Thank you Flyte Xevious for Mantis #3361 - Implementation of llEdgeOfWorld
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs62
1 files changed, 60 insertions, 2 deletions
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>