aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2009-10-01 14:08:15 +0100
committerMelanie2009-10-01 14:08:15 +0100
commit41ff39414bc70ef645e2180693792c83d61a7539 (patch)
treedc711428d4c8fed07791263ff4dfea142d54e4e7 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'vehicles' of ssh://opensim@tor.k-grid.com/home/opensim/opensim ... (diff)
parent- adding new LandDataSerializer testcase to "test-xml" target as well (diff)
downloadopensim-SC-41ff39414bc70ef645e2180693792c83d61a7539.zip
opensim-SC-41ff39414bc70ef645e2180693792c83d61a7539.tar.gz
opensim-SC-41ff39414bc70ef645e2180693792c83d61a7539.tar.bz2
opensim-SC-41ff39414bc70ef645e2180693792c83d61a7539.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs50
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
6 files changed, 66 insertions, 63 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c41f2a5..3051609 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -50,6 +50,9 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
50using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 50using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
51using OpenSim.Region.ScriptEngine.Interfaces; 51using OpenSim.Region.ScriptEngine.Interfaces;
52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
53using OpenSim.Services.Interfaces;
54
55using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53 56
54using AssetLandmark = OpenSim.Framework.AssetLandmark; 57using AssetLandmark = OpenSim.Framework.AssetLandmark;
55 58
@@ -2010,10 +2013,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2010 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 2013 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
2011 } 2014 }
2012 else 2015 else
2013 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 2016 q = part.ParentGroup.Rotation; // Likely never get here but just in case
2014 } 2017 }
2015 else 2018 else
2016 q = part.ParentGroup.GroupRotation; // just the group rotation 2019 q = part.ParentGroup.Rotation; // just the group rotation
2017 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2020 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2018 } 2021 }
2019 q = part.GetWorldRotation(); 2022 q = part.GetWorldRotation();
@@ -5002,6 +5005,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5002 if (end > src.Length) 5005 if (end > src.Length)
5003 end = src.Length; 5006 end = src.Length;
5004 5007
5008 if (stride == 0)
5009 stride = 1;
5010
5005 // There may be one or two ranges to be considered 5011 // There may be one or two ranges to be considered
5006 5012
5007 if (start != end) 5013 if (start != end)
@@ -5028,9 +5034,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5028 // A negative stride reverses the direction of the 5034 // A negative stride reverses the direction of the
5029 // scan producing an inverted list as a result. 5035 // scan producing an inverted list as a result.
5030 5036
5031 if (stride == 0)
5032 stride = 1;
5033
5034 if (stride > 0) 5037 if (stride > 0)
5035 { 5038 {
5036 for (int i = 0; i < src.Length; i += stride) 5039 for (int i = 0; i < src.Length; i += stride)
@@ -5054,7 +5057,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5054 } 5057 }
5055 else 5058 else
5056 { 5059 {
5057 result.Add(src.Data[start]); 5060 if (start%stride == 0)
5061 {
5062 result.Add(src.Data[start]);
5063 }
5058 } 5064 }
5059 5065
5060 return result; 5066 return result;
@@ -5232,12 +5238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5232 } 5238 }
5233 } 5239 }
5234 5240
5235 List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); 5241 List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
5236 5242
5237 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; 5243 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
5238 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; 5244 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y;
5239 5245
5240 foreach (SimpleRegionInfo sri in neighbors) 5246 foreach (GridRegion sri in neighbors)
5241 { 5247 {
5242 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) 5248 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY)
5243 return 0; 5249 return 0;
@@ -7178,10 +7184,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7178 else 7184 else
7179 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 7185 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
7180 else 7186 else
7181 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case 7187 q = m_host.ParentGroup.Rotation; // Likely never get here but just in case
7182 } 7188 }
7183 else 7189 else
7184 q = m_host.ParentGroup.GroupRotation; // just the group rotation 7190 q = m_host.ParentGroup.Rotation; // just the group rotation
7185 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 7191 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
7186 } 7192 }
7187 7193
@@ -8184,7 +8190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8184 8190
8185 string reply = String.Empty; 8191 string reply = String.Empty;
8186 8192
8187 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); 8193 GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
8188 8194
8189 switch (data) 8195 switch (data)
8190 { 8196 {
@@ -8211,7 +8217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8211 ConditionalScriptSleep(1000); 8217 ConditionalScriptSleep(1000);
8212 return UUID.Zero.ToString(); 8218 return UUID.Zero.ToString();
8213 } 8219 }
8214 int access = info.RegionSettings.Maturity; 8220 int access = info.Maturity;
8215 if (access == 0) 8221 if (access == 0)
8216 reply = "PG"; 8222 reply = "PG";
8217 else if (access == 1) 8223 else if (access == 1)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index ccdd4c5..0b95abc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -48,6 +48,8 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
48using OpenSim.Region.ScriptEngine.Interfaces; 48using OpenSim.Region.ScriptEngine.Interfaces;
49using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 49using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
50using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 50using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
51using OpenSim.Services.Interfaces;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
51using System.Text.RegularExpressions; 53using System.Text.RegularExpressions;
52 54
53using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 55using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
@@ -599,17 +601,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
599 if (regionName.Contains(".") && regionName.Contains(":")) 601 if (regionName.Contains(".") && regionName.Contains(":"))
600 { 602 {
601 // Try to link the region 603 // Try to link the region
602 RegionInfo regInfo = HGHyperlink.TryLinkRegion(World, 604 IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>();
603 presence.ControllingClient, 605 if (hyperService != null)
604 regionName);
605 // Get the region name
606 if (regInfo != null)
607 { 606 {
608 regionName = regInfo.RegionName; 607 GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient,
609 } 608 regionName);
610 else 609 // Get the region name
611 { 610 if (regInfo != null)
612 // Might need to ping the client here in case of failure?? 611 {
612 regionName = regInfo.RegionName;
613 }
614 else
615 {
616 // Might need to ping the client here in case of failure??
617 }
613 } 618 }
614 } 619 }
615 presence.ControllingClient.SendTeleportLocationStart(); 620 presence.ControllingClient.SendTeleportLocationStart();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index d0df390..8dcb1f5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
95 return m_OSSL_Functions.osWindActiveModelPluginName(); 95 return m_OSSL_Functions.osWindActiveModelPluginName();
96 } 96 }
97 97
98// Not yet plugged in as available OSSL functions, so commented out 98// Not yet plugged in as available OSSL functions, so commented out
99// void osWindParamSet(string plugin, string param, float value) 99// void osWindParamSet(string plugin, string param, float value)
100// { 100// {
101// m_OSSL_Functions.osWindParamSet(plugin, param, value); 101// m_OSSL_Functions.osWindParamSet(plugin, param, value);
@@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
329 329
330 public string osGetSimulatorVersion() 330 public string osGetSimulatorVersion()
331 { 331 {
332 return m_OSSL_Functions.osGetSimulatorVersion(); 332 return m_OSSL_Functions.osGetSimulatorVersion();
333 } 333 }
334 334
335 public Hashtable osParseJSON(string JSON) 335 public Hashtable osParseJSON(string JSON)
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 5a94957..fe26429 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -546,11 +546,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
546 bool retried = false; 546 bool retried = false;
547 do 547 do
548 { 548 {
549 lock (CScodeProvider) 549 lock (CScodeProvider)
550 { 550 {
551 results = CScodeProvider.CompileAssemblyFromSource( 551 results = CScodeProvider.CompileAssemblyFromSource(
552 parameters, Script); 552 parameters, Script);
553 } 553 }
554 // Deal with an occasional segv in the compiler. 554 // Deal with an occasional segv in the compiler.
555 // Rarely, if ever, occurs twice in succession. 555 // Rarely, if ever, occurs twice in succession.
556 // Line # == 0 and no file name are indications that 556 // Line # == 0 and no file name are indications that
@@ -573,20 +573,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
573 { 573 {
574 complete = true; 574 complete = true;
575 } 575 }
576 } 576 } while (!complete);
577 while(!complete);
578 break; 577 break;
579 case enumCompileType.js: 578 case enumCompileType.js:
580 results = JScodeProvider.CompileAssemblyFromSource( 579 results = JScodeProvider.CompileAssemblyFromSource(
581 parameters, Script); 580 parameters, Script);
582 break; 581 break;
583 case enumCompileType.yp: 582 case enumCompileType.yp:
584 results = YPcodeProvider.CompileAssemblyFromSource( 583 results = YPcodeProvider.CompileAssemblyFromSource(
585 parameters, Script); 584 parameters, Script);
586 break; 585 break;
587 default: 586 default:
588 throw new Exception("Compiler is not able to recongnize "+ 587 throw new Exception("Compiler is not able to recongnize "+
589 "language type \"" + lang.ToString() + "\""); 588 "language type \"" + lang.ToString() + "\"");
590 } 589 }
591 590
592 // Check result 591 // Check result
@@ -602,12 +601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
602 { 601 {
603 foreach (CompilerError CompErr in results.Errors) 602 foreach (CompilerError CompErr in results.Errors)
604 { 603 {
605 604 string severity = CompErr.IsWarning ? "Warning" : "Error";
606 string severity = "Error";
607 if (CompErr.IsWarning)
608 {
609 severity = "Warning";
610 }
611 605
612 KeyValuePair<int, int> lslPos; 606 KeyValuePair<int, int> lslPos;
613 607
@@ -615,18 +609,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
615 609
616 if (severity == "Error") 610 if (severity == "Error")
617 { 611 {
618 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); 612 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column);
619 string text = CompErr.ErrorText; 613 string text = CompErr.ErrorText;
620 614
621 // Use LSL type names 615 // Use LSL type names
622 if (lang == enumCompileType.lsl) 616 if (lang == enumCompileType.lsl)
623 text = ReplaceTypes(CompErr.ErrorText); 617 text = ReplaceTypes(CompErr.ErrorText);
624 618
625 // The Second Life viewer's script editor begins 619 // The Second Life viewer's script editor begins
626 // countingn lines and columns at 0, so we subtract 1. 620 // countingn lines and columns at 0, so we subtract 1.
627 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", 621 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
628 lslPos.Key - 1, lslPos.Value - 1, 622 lslPos.Key - 1, lslPos.Value - 1,
629 CompErr.ErrorNumber, text, severity); 623 CompErr.ErrorNumber, text, severity);
630 hadErrors = true; 624 hadErrors = true;
631 } 625 }
632 } 626 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 4855d64..84ccafe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -218,16 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
218 } 218 }
219 } 219 }
220 220
221 Position = new LSL_Types.Vector3(part.AbsolutePosition.X, 221 Vector3 absPos = part.AbsolutePosition;
222 part.AbsolutePosition.Y, 222 Position = new LSL_Types.Vector3(absPos.X, absPos.Y, absPos.Z);
223 part.AbsolutePosition.Z);
224 223
225 Quaternion wr = part.ParentGroup.GroupRotation; 224 Quaternion wr = part.ParentGroup.Rotation;
226 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); 225 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
227 226
228 Velocity = new LSL_Types.Vector3(part.Velocity.X, 227 Vector3 vel = part.Velocity;
229 part.Velocity.Y, 228 Velocity = new LSL_Types.Vector3(vel.X, vel.Y, vel.Z);
230 part.Velocity.Z);
231 } 229 }
232 } 230 }
233 231
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 650d9fa..97166cf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
261 "SecondLife.Script"); 261 "SecondLife.Script");
262 262
263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
265// lease.Register(this); 265// lease.Register(this);
266 } 266 }
267 catch (Exception) 267 catch (Exception)
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
430 430
431 permsGranter = part.TaskInventory[m_ItemID].PermsGranter; 431 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
432 permsMask = part.TaskInventory[m_ItemID].PermsMask; 432 permsMask = part.TaskInventory[m_ItemID].PermsMask;
433 } 433 }
434 434
435 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 435 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
436 { 436 {
@@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
630 /// <summary> 630 /// <summary>
631 /// Process the next event queued for this script 631 /// Process the next event queued for this script
632 /// </summary> 632 /// </summary>
633 /// <returns></returns> 633 /// <returns></returns>
634 public object EventProcessor() 634 public object EventProcessor()
635 { 635 {
636 lock (m_Script) 636 lock (m_Script)
@@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
925 925
926 public override string ToString() 926 public override string ToString()
927 { 927 {
928 return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); 928 return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
929 } 929 }
930 930
931 string FormatException(Exception e) 931 string FormatException(Exception e)