aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs150
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs13
7 files changed, 151 insertions, 26 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 48a7953..f7c44d1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.World.Land;
46using OpenSim.Region.CoreModules.World.Terrain; 46using OpenSim.Region.CoreModules.World.Terrain;
47using OpenSim.Region.Framework.Interfaces; 47using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Framework.Scenes.Serialization;
49using OpenSim.Region.Framework.Scenes.Animation; 50using OpenSim.Region.Framework.Scenes.Animation;
50using OpenSim.Region.Physics.Manager; 51using OpenSim.Region.Physics.Manager;
51using OpenSim.Region.ScriptEngine.Shared; 52using OpenSim.Region.ScriptEngine.Shared;
@@ -3635,12 +3636,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3635 return m_ScriptEngine.GetStartParameter(m_itemID); 3636 return m_ScriptEngine.GetStartParameter(m_itemID);
3636 } 3637 }
3637 3638
3638 public void llGodLikeRezObject(string inventory, LSL_Vector pos)
3639 {
3640 m_host.AddScriptLPS(1);
3641 NotImplemented("llGodLikeRezObject");
3642 }
3643
3644 public void llRequestPermissions(string agent, int perm) 3639 public void llRequestPermissions(string agent, int perm)
3645 { 3640 {
3646 UUID agentID = new UUID(); 3641 UUID agentID = new UUID();
@@ -4305,7 +4300,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4305 m_host.AbsolutePosition.ToString(), 4300 m_host.AbsolutePosition.ToString(),
4306 agentItem.ID, true, m_host.AbsolutePosition, 4301 agentItem.ID, true, m_host.AbsolutePosition,
4307 bucket); 4302 bucket);
4308
4309 if (m_TransferModule != null) 4303 if (m_TransferModule != null)
4310 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 4304 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
4311 4305
@@ -4618,12 +4612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4618 m_host.CollisionSoundVolume = (float)impact_volume; 4612 m_host.CollisionSoundVolume = (float)impact_volume;
4619 } 4613 }
4620 4614
4621 public void llCollisionSprite(string impact_sprite)
4622 {
4623 m_host.AddScriptLPS(1);
4624 NotImplemented("llCollisionSprite");
4625 }
4626
4627 public LSL_String llGetAnimation(string id) 4615 public LSL_String llGetAnimation(string id)
4628 { 4616 {
4629 // This should only return a value if the avatar is in the same region 4617 // This should only return a value if the avatar is in the same region
@@ -4887,6 +4875,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4887 return result; 4875 return result;
4888 } 4876 }
4889 4877
4878 public LSL_Integer llGetLinkNumberOfSides(int link)
4879 {
4880 m_host.AddScriptLPS(1);
4881
4882 SceneObjectPart linkedPart;
4883
4884 if (link == ScriptBaseClass.LINK_ROOT)
4885 linkedPart = m_host.ParentGroup.RootPart;
4886 else if (link == ScriptBaseClass.LINK_THIS)
4887 linkedPart = m_host;
4888 else
4889 linkedPart = m_host.ParentGroup.GetLinkNumPart(link);
4890
4891 return GetNumberOfSides(linkedPart);
4892 }
4893
4890 public LSL_Integer llGetNumberOfSides() 4894 public LSL_Integer llGetNumberOfSides()
4891 { 4895 {
4892 m_host.AddScriptLPS(1); 4896 m_host.AddScriptLPS(1);
@@ -5947,11 +5951,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5947 ScriptSleep(100); 5951 ScriptSleep(100);
5948 } 5952 }
5949 5953
5950 public void llSetSoundQueueing(int queue)
5951 {
5952 m_host.AddScriptLPS(1);
5953 }
5954
5955 public void llSetSoundRadius(double radius) 5954 public void llSetSoundRadius(double radius)
5956 { 5955 {
5957 m_host.AddScriptLPS(1); 5956 m_host.AddScriptLPS(1);
@@ -10984,6 +10983,121 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10984 { 10983 {
10985 m_SayShoutCount = 0; 10984 m_SayShoutCount = 0;
10986 } 10985 }
10986
10987 #region Not Implemented
10988 //
10989 // Listing the unimplemented lsl functions here, please move
10990 // them from this region as they are completed
10991 //
10992 public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
10993 {
10994 m_host.AddScriptLPS(1);
10995 NotImplemented("llCastRay");
10996
10997 }
10998
10999 public void llGetEnv(LSL_String name)
11000 {
11001 m_host.AddScriptLPS(1);
11002 NotImplemented("llGetEnv");
11003
11004 }
11005
11006 public void llGetSPMaxMemory()
11007 {
11008 m_host.AddScriptLPS(1);
11009 NotImplemented("llGetSPMaxMemory");
11010
11011 }
11012
11013 public virtual LSL_Integer llGetUsedMemory()
11014 {
11015 m_host.AddScriptLPS(1);
11016 NotImplemented("llGetUsedMemory");
11017 return 0;
11018 }
11019
11020 public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg )
11021 {
11022 m_host.AddScriptLPS(1);
11023 NotImplemented("llRegionSayTo");
11024
11025 }
11026
11027 public void llScriptProfiler( LSL_Integer flags )
11028 {
11029 m_host.AddScriptLPS(1);
11030 //NotImplemented("llScriptProfiler");
11031
11032 }
11033
11034 public void llSetSoundQueueing(int queue)
11035 {
11036 m_host.AddScriptLPS(1);
11037 }
11038
11039 public void llCollisionSprite(string impact_sprite)
11040 {
11041 m_host.AddScriptLPS(1);
11042 NotImplemented("llCollisionSprite");
11043 }
11044
11045 public void llGodLikeRezObject(string inventory, LSL_Vector pos)
11046 {
11047 m_host.AddScriptLPS(1);
11048
11049 if (!World.Permissions.IsGod(m_host.OwnerID))
11050 NotImplemented("llGodLikeRezObject");
11051
11052 AssetBase rezAsset = World.AssetService.Get(inventory);
11053 if (rezAsset == null)
11054 {
11055 llSay(0, "Asset not found");
11056 return;
11057 }
11058
11059 SceneObjectGroup group = null;
11060
11061 try
11062 {
11063 string xmlData = Utils.BytesToString(rezAsset.Data);
11064 group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
11065 }
11066 catch
11067 {
11068 llSay(0, "Asset not found");
11069 return;
11070 }
11071
11072 if (group == null)
11073 {
11074 llSay(0, "Asset not found");
11075 return;
11076 }
11077
11078 group.RootPart.AttachPoint = group.RootPart.Shape.State;
11079 group.RootPart.AttachOffset = group.AbsolutePosition;
11080
11081 group.ResetIDs();
11082
11083 Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
11084 World.AddNewSceneObject(group, true, llpos, Quaternion.Identity, Vector3.Zero);
11085 group.CreateScriptInstances(0, true, World.DefaultScriptEngine, 3);
11086 group.ScheduleGroupForFullUpdate();
11087
11088 // objects rezzed with this method are die_at_edge by default.
11089 group.RootPart.SetDieAtEdge(true);
11090
11091 group.ResumeScripts();
11092
11093 m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
11094 "object_rez", new Object[] {
11095 new LSL_String(
11096 group.RootPart.UUID.ToString()) },
11097 new DetectParams[0]));
11098 }
11099
11100 #endregion
10987 } 11101 }
10988 11102
10989 public class NotecardCache 11103 public class NotecardCache
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 0ae2388..ce13d6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -121,6 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
121 LSL_Float llGetEnergy(); 121 LSL_Float llGetEnergy();
122 LSL_Vector llGetForce(); 122 LSL_Vector llGetForce();
123 LSL_Integer llGetFreeMemory(); 123 LSL_Integer llGetFreeMemory();
124 LSL_Integer llGetUsedMemory();
124 LSL_Integer llGetFreeURLs(); 125 LSL_Integer llGetFreeURLs();
125 LSL_Vector llGetGeometricCenter(); 126 LSL_Vector llGetGeometricCenter();
126 LSL_Float llGetGMTclock(); 127 LSL_Float llGetGMTclock();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 63cac9a..7d7e54e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -461,6 +461,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
461 return m_LSL_Functions.llGetFreeMemory(); 461 return m_LSL_Functions.llGetFreeMemory();
462 } 462 }
463 463
464 public LSL_Integer llGetUsedMemory()
465 {
466 return m_LSL_Functions.llGetUsedMemory();
467 }
468
464 public LSL_Integer llGetFreeURLs() 469 public LSL_Integer llGetFreeURLs()
465 { 470 {
466 return m_LSL_Functions.llGetFreeURLs(); 471 return m_LSL_Functions.llGetFreeURLs();
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 665f4a6..6bfee91 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1530,6 +1530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1530 public struct LSLInteger 1530 public struct LSLInteger
1531 { 1531 {
1532 public int value; 1532 public int value;
1533 private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)");
1533 1534
1534 #region Constructors 1535 #region Constructors
1535 public LSLInteger(int i) 1536 public LSLInteger(int i)
@@ -1549,9 +1550,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
1549 1550
1550 public LSLInteger(string s) 1551 public LSLInteger(string s)
1551 { 1552 {
1552 Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)"); 1553 Match m = castRegex.Match(s);
1553 Match m = r.Match(s);
1554 string v = m.Groups[0].Value; 1554 string v = m.Groups[0].Value;
1555 // Leading plus sign is allowed, but ignored
1556 v = v.Replace("+", "");
1555 1557
1556 if (v == String.Empty) 1558 if (v == String.Empty)
1557 { 1559 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 1d55b95..80b60a4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -29,7 +29,6 @@ using System.Collections.Generic;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenSim.Tests.Common; 30using OpenSim.Tests.Common;
31using OpenSim.Region.ScriptEngine.Shared; 31using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Tests.Common.Setup;
33using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
34using Nini.Config; 33using Nini.Config;
35using OpenSim.Region.ScriptEngine.Shared.Api; 34using OpenSim.Region.ScriptEngine.Shared.Api;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index 045abb4..b635d5c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenSim.Tests.Common.Setup;
33using OpenSim.Tests.Common.Mock; 32using OpenSim.Tests.Common.Mock;
34using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
35using OpenMetaverse; 34using OpenMetaverse;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9a78a42..4f3432d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -461,11 +461,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
461 return 0; 461 return 0;
462 } 462 }
463 463
464 public object DoMaintenance(object p) 464 public void SaveAllState()
465 { 465 {
466 object[] parms = (object[])p;
467 int sleepTime = (int)parms[0];
468
469 foreach (IScriptInstance inst in m_Scripts.Values) 466 foreach (IScriptInstance inst in m_Scripts.Values)
470 { 467 {
471 if (inst.EventTime() > m_EventLimit) 468 if (inst.EventTime() > m_EventLimit)
@@ -475,6 +472,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
475 inst.Start(); 472 inst.Start();
476 } 473 }
477 } 474 }
475 }
476
477 public object DoMaintenance(object p)
478 {
479 object[] parms = (object[])p;
480 int sleepTime = (int)parms[0];
481
482 SaveAllState();
478 483
479 System.Threading.Thread.Sleep(sleepTime); 484 System.Threading.Thread.Sleep(sleepTime);
480 485