aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs108
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs34
-rw-r--r--OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs150
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs15
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs15
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs70
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs13
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs58
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt25
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs39
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs100
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs157
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs17
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs15
-rw-r--r--TESTING.txt2
-rw-r--r--bin/OpenSimDefaults.ini8
-rw-r--r--prebuild.xml6
36 files changed, 839 insertions, 161 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 8a0340f..85b19c0 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -77,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer
77 // protected HttpListener m_httpListener; 77 // protected HttpListener m_httpListener;
78 protected CoolHTTPListener m_httpListener2; 78 protected CoolHTTPListener m_httpListener2;
79 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); 79 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
80 protected Dictionary<string, JsonRPCMethod> jsonRpcHandlers = new Dictionary<string, JsonRPCMethod>();
80 protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>(); 81 protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>();
81 protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/ 82 protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
82 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>(); 83 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
@@ -217,6 +218,37 @@ namespace OpenSim.Framework.Servers.HttpServer
217 return new List<string>(m_rpcHandlers.Keys); 218 return new List<string>(m_rpcHandlers.Keys);
218 } 219 }
219 220
221 // JsonRPC
222 public bool AddJsonRPCHandler(string method, JsonRPCMethod handler)
223 {
224 lock(jsonRpcHandlers)
225 {
226 jsonRpcHandlers.Add(method, handler);
227 }
228 return true;
229 }
230
231 public JsonRPCMethod GetJsonRPCHandler(string method)
232 {
233 lock (jsonRpcHandlers)
234 {
235 if (jsonRpcHandlers.ContainsKey(method))
236 {
237 return jsonRpcHandlers[method];
238 }
239 else
240 {
241 return null;
242 }
243 }
244 }
245
246 public List<string> GetJsonRpcHandlerKeys()
247 {
248 lock (jsonRpcHandlers)
249 return new List<string>(jsonRpcHandlers.Keys);
250 }
251
220 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) 252 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
221 { 253 {
222 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); 254 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
@@ -556,10 +588,18 @@ namespace OpenSim.Framework.Servers.HttpServer
556 588
557 buffer = HandleLLSDRequests(request, response); 589 buffer = HandleLLSDRequests(request, response);
558 break; 590 break;
591
592 case "application/json-rpc":
593 if (DebugLevel >= 3)
594 LogIncomingToContentTypeHandler(request);
595
596 buffer = HandleJsonRpcRequests(request, response);
597 break;
559 598
560 case "text/xml": 599 case "text/xml":
561 case "application/xml": 600 case "application/xml":
562 case "application/json": 601 case "application/json":
602
563 default: 603 default:
564 //m_log.Info("[Debug BASE HTTP SERVER]: in default handler"); 604 //m_log.Info("[Debug BASE HTTP SERVER]: in default handler");
565 // Point of note.. the DoWeHaveA methods check for an EXACT path 605 // Point of note.. the DoWeHaveA methods check for an EXACT path
@@ -985,6 +1025,74 @@ namespace OpenSim.Framework.Servers.HttpServer
985 return buffer; 1025 return buffer;
986 } 1026 }
987 1027
1028 // JsonRpc (v2.0 only)
1029 private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response)
1030 {
1031 Stream requestStream = request.InputStream;
1032 JsonRpcResponse jsonRpcResponse = new JsonRpcResponse();
1033 OSDMap jsonRpcRequest = null;
1034
1035 try
1036 {
1037 jsonRpcRequest = (OSDMap)OSDParser.DeserializeJson(requestStream);
1038 }
1039 catch (LitJson.JsonException e)
1040 {
1041 jsonRpcResponse.Error.Code = ErrorCode.InternalError;
1042 jsonRpcResponse.Error.Message = e.Message;
1043 }
1044
1045 requestStream.Close();
1046
1047 if (jsonRpcRequest != null)
1048 {
1049 if (jsonRpcRequest.ContainsKey("jsonrpc") || jsonRpcRequest["jsonrpc"].AsString() == "2.0")
1050 {
1051 jsonRpcResponse.JsonRpc = "2.0";
1052
1053 // If we have no id, then it's a "notification"
1054 if (jsonRpcRequest.ContainsKey("id"))
1055 {
1056 jsonRpcResponse.Id = jsonRpcRequest["id"].AsString();
1057 }
1058
1059 string methodname = jsonRpcRequest["method"];
1060 JsonRPCMethod method;
1061
1062 if (jsonRpcHandlers.ContainsKey(methodname))
1063 {
1064 lock(jsonRpcHandlers)
1065 {
1066 jsonRpcHandlers.TryGetValue(methodname, out method);
1067 }
1068
1069 method(jsonRpcRequest, ref jsonRpcResponse);
1070 }
1071 else // Error no hanlder defined for requested method
1072 {
1073 jsonRpcResponse.Error.Code = ErrorCode.InvalidRequest;
1074 jsonRpcResponse.Error.Message = string.Format ("No handler defined for {0}", methodname);
1075 }
1076 }
1077 else // not json-rpc 2.0 could be v1
1078 {
1079 jsonRpcResponse.Error.Code = ErrorCode.InvalidRequest;
1080 jsonRpcResponse.Error.Message = "Must be valid json-rpc 2.0 see: http://www.jsonrpc.org/specification";
1081
1082 if (jsonRpcRequest.ContainsKey("id"))
1083 jsonRpcResponse.Id = jsonRpcRequest["id"].AsString();
1084 }
1085 }
1086
1087 response.KeepAlive = true;
1088 string responseData = string.Empty;
1089
1090 responseData = jsonRpcResponse.Serialize();
1091
1092 byte[] buffer = Encoding.UTF8.GetBytes(responseData);
1093 return buffer;
1094 }
1095
988 private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) 1096 private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
989 { 1097 {
990 //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); 1098 //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index 0bd3aae..13b5dd3 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -97,6 +97,8 @@ namespace OpenSim.Framework.Servers.HttpServer
97 bool AddXmlRPCHandler(string method, XmlRpcMethod handler); 97 bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
98 bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); 98 bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
99 99
100 bool AddJsonRPCHandler(string method, JsonRPCMethod handler);
101
100 /// <summary> 102 /// <summary>
101 /// Gets the XML RPC handler for given method name 103 /// Gets the XML RPC handler for given method name
102 /// </summary> 104 /// </summary>
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs
new file mode 100644
index 0000000..7334049
--- /dev/null
+++ b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs
@@ -0,0 +1,34 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Net;
29using OpenMetaverse.StructuredData;
30
31namespace OpenSim.Framework.Servers.HttpServer
32{
33 public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
34}
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs
new file mode 100644
index 0000000..2c50587
--- /dev/null
+++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs
@@ -0,0 +1,150 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Net;
29using OpenMetaverse.StructuredData;
30
31namespace OpenSim.Framework.Servers.HttpServer
32{
33 public sealed class ErrorCode
34 {
35 private ErrorCode() {}
36
37 public const int ParseError = -32700;
38 public const int InvalidRequest = -32600;
39 public const int MethodNotFound = -32601;
40 public const int InvalidParams = -32602;
41 public const int InternalError = -32604;
42
43 }
44
45 public class JsonRpcError
46 {
47 internal OSDMap Error = new OSDMap();
48
49 public int Code
50 {
51 get
52 {
53 if (Error.ContainsKey("code"))
54 return Error["code"].AsInteger();
55 else
56 return 0;
57 }
58 set
59 {
60 Error["code"] = OSD.FromInteger(value);
61 }
62 }
63
64 public string Message
65 {
66 get
67 {
68 if (Error.ContainsKey("message"))
69 return Error["message"].AsString();
70 else
71 return null;
72 }
73 set
74 {
75 Error["message"] = OSD.FromString(value);
76 }
77 }
78
79 public OSD Data
80 {
81 get; set;
82 }
83 }
84
85 public class JsonRpcResponse
86 {
87 public string JsonRpc
88 {
89 get
90 {
91 return Reply["jsonrpc"].AsString();
92 }
93 set
94 {
95 Reply["jsonrpc"] = OSD.FromString(value);
96 }
97 }
98
99 public string Id
100 {
101 get
102 {
103 return Reply["id"].AsString();
104 }
105 set
106 {
107 Reply["id"] = OSD.FromString(value);
108 }
109 }
110
111 public OSD Result
112 {
113 get; set;
114 }
115
116 public JsonRpcError Error
117 {
118 get; set;
119 }
120
121 public OSDMap Reply = new OSDMap();
122
123 public JsonRpcResponse()
124 {
125 Error = new JsonRpcError();
126 }
127
128 public string Serialize()
129 {
130 if (Result != null)
131 Reply["result"] = Result;
132
133 if (Error.Code != 0)
134 {
135 Reply["error"] = (OSD)Error.Error;
136 }
137
138 string result = string.Empty;
139 try
140 {
141 result = OSDParser.SerializeJsonString(Reply);
142 }
143 catch
144 {
145
146 }
147 return result;
148 }
149 }
150}
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index ae7d515..293887f 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -230,6 +230,10 @@ namespace OpenSim.Framework.Servers
230 List<String> poll = httpServer.GetPollServiceHandlerKeys(); 230 List<String> poll = httpServer.GetPollServiceHandlerKeys();
231 foreach (String s in httpServer.GetHTTPHandlerKeys()) 231 foreach (String s in httpServer.GetHTTPHandlerKeys())
232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); 232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
233
234 handlers.AppendFormat("* JSONRPC:\n");
235 foreach (String s in httpServer.GetJsonRpcHandlerKeys())
236 handlers.AppendFormat("\t{0}\n", s);
233 237
234// handlers.AppendFormat("* Agent:\n"); 238// handlers.AppendFormat("* Agent:\n");
235// foreach (String s in httpServer.GetAgentHandlerKeys()) 239// foreach (String s in httpServer.GetAgentHandlerKeys())
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 77acacf..0ccd69a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -6427,19 +6427,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6427 #endregion 6427 #endregion
6428 6428
6429 AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; 6429 AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
6430 if (handlerAgentRequestSit != null)
6431 if (!(agentRequestSit.AgentData == null
6432 || agentRequestSit.TargetObject == null
6433 || agentRequestSit.TargetObject.TargetID == null
6434 || agentRequestSit.TargetObject.Offset == null))
6435 {
6436 var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID);
6437 if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting
6438 return true;
6439 6430
6440 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, 6431 if (handlerAgentRequestSit != null)
6441 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 6432 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
6442 } 6433 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
6443 } 6434 }
6444 return true; 6435 return true;
6445 } 6436 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 41ca13b..b188741 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -212,11 +212,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
212 protected override GridRegion GetFinalDestination(GridRegion region) 212 protected override GridRegion GetFinalDestination(GridRegion region)
213 { 213 {
214 int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); 214 int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
215 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); 215 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags);
216 216
217 if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) 217 if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
218 { 218 {
219 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); 219 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink");
220 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); 220 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
221 if (real_destination != null) 221 if (real_destination != null)
222 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); 222 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 5c8b097..92bf85a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1738,6 +1738,21 @@ namespace OpenSim.Region.Framework.Scenes
1738 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> 1738 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1739 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) 1739 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
1740 { 1740 {
1741 return RezNewScript(
1742 agentID,
1743 itemBase,
1744 "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
1745 }
1746
1747 /// <summary>
1748 /// Rez a new script from nothing with given script text.
1749 /// </summary>
1750 /// <param name="remoteClient"></param>
1751 /// <param name="itemBase">Template item.</param>
1752 /// <param name="scriptText"></param>
1753 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1754 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase, string scriptText)
1755 {
1741 // The part ID is the folder ID! 1756 // The part ID is the folder ID!
1742 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); 1757 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
1743 if (part == null) 1758 if (part == null)
@@ -1757,9 +1772,14 @@ namespace OpenSim.Region.Framework.Scenes
1757 return null; 1772 return null;
1758 } 1773 }
1759 1774
1760 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1775 AssetBase asset
1761 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), 1776 = CreateAsset(
1762 agentID); 1777 itemBase.Name,
1778 itemBase.Description,
1779 (sbyte)itemBase.AssetType,
1780 Encoding.ASCII.GetBytes(scriptText),
1781 agentID);
1782
1763 AssetService.Store(asset); 1783 AssetService.Store(asset);
1764 1784
1765 TaskInventoryItem taskItem = new TaskInventoryItem(); 1785 TaskInventoryItem taskItem = new TaskInventoryItem();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0219540..6979c33 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1954,6 +1954,10 @@ namespace OpenSim.Region.Framework.Scenes
1954 { 1954 {
1955 if (ParentID != 0) 1955 if (ParentID != 0)
1956 { 1956 {
1957 var targetPart = m_scene.GetSceneObjectPart(targetID);
1958 if (targetPart != null && targetPart.LocalId == ParentID)
1959 return; // already sitting here, ignore
1960
1957 StandUp(); 1961 StandUp();
1958 } 1962 }
1959 1963
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 9ff7084..ae54499 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -166,7 +166,7 @@ public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
166 166
167 // If Debug logging level, enable logging from the unmanaged code 167 // If Debug logging level, enable logging from the unmanaged code
168 m_DebugLogCallbackHandle = null; 168 m_DebugLogCallbackHandle = null;
169 if (BSScene.m_log.IsDebugEnabled || PhysicsScene.PhysicsLogging.Enabled) 169 if (BSScene.m_log.IsDebugEnabled && PhysicsScene.PhysicsLogging.Enabled)
170 { 170 {
171 BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); 171 BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader);
172 if (PhysicsScene.PhysicsLogging.Enabled) 172 if (PhysicsScene.PhysicsLogging.Enabled)
@@ -212,6 +212,19 @@ public override void Shutdown(BulletWorld world)
212{ 212{
213 BulletWorldUnman worldu = world as BulletWorldUnman; 213 BulletWorldUnman worldu = world as BulletWorldUnman;
214 BSAPICPP.Shutdown2(worldu.ptr); 214 BSAPICPP.Shutdown2(worldu.ptr);
215
216 if (m_paramsHandle.IsAllocated)
217 {
218 m_paramsHandle.Free();
219 }
220 if (m_collisionArrayPinnedHandle.IsAllocated)
221 {
222 m_collisionArrayPinnedHandle.Free();
223 }
224 if (m_updateArrayPinnedHandle.IsAllocated)
225 {
226 m_updateArrayPinnedHandle.Free();
227 }
215} 228}
216 229
217public override bool PushUpdate(BulletBody obj) 230public override bool PushUpdate(BulletBody obj)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index a5fec87..87a06c1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -215,7 +215,7 @@ public sealed class BSCharacter : BSPhysObject
215 // Add special movement force to allow avatars to walk up stepped surfaces. 215 // Add special movement force to allow avatars to walk up stepped surfaces.
216 moveForce += WalkUpStairs(); 216 moveForce += WalkUpStairs();
217 217
218 DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce); 218 // DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce);
219 PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce); 219 PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce);
220 }); 220 });
221 } 221 }
@@ -855,7 +855,10 @@ public sealed class BSCharacter : BSPhysObject
855 _rotationalVelocity = entprop.RotationalVelocity; 855 _rotationalVelocity = entprop.RotationalVelocity;
856 856
857 // Do some sanity checking for the avatar. Make sure it's above ground and inbounds. 857 // Do some sanity checking for the avatar. Make sure it's above ground and inbounds.
858 PositionSanityCheck(true); 858 if (PositionSanityCheck(true))
859 {
860 entprop.Position = _position;
861 }
859 862
860 // remember the current and last set values 863 // remember the current and last set values
861 LastEntityProperties = CurrentEntityProperties; 864 LastEntityProperties = CurrentEntityProperties;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index bcebaec..6601479 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -124,9 +124,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
124 static readonly float PIOverTwo = ((float)Math.PI) / 2f; 124 static readonly float PIOverTwo = ((float)Math.PI) / 2f;
125 125
126 // For debugging, flags to turn on and off individual corrections. 126 // For debugging, flags to turn on and off individual corrections.
127 private bool enableAngularVerticalAttraction = true; 127 private bool enableAngularVerticalAttraction;
128 private bool enableAngularDeflection = true; 128 private bool enableAngularDeflection;
129 private bool enableAngularBanking = true; 129 private bool enableAngularBanking;
130 130
131 public BSDynamics(BSScene myScene, BSPrim myPrim) 131 public BSDynamics(BSScene myScene, BSPrim myPrim)
132 { 132 {
@@ -141,8 +141,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
141 public void SetupVehicleDebugging() 141 public void SetupVehicleDebugging()
142 { 142 {
143 enableAngularVerticalAttraction = true; 143 enableAngularVerticalAttraction = true;
144 enableAngularDeflection = true; 144 enableAngularDeflection = false;
145 enableAngularBanking = true; 145 enableAngularBanking = false;
146 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) 146 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse)
147 { 147 {
148 enableAngularVerticalAttraction = false; 148 enableAngularVerticalAttraction = false;
@@ -649,6 +649,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
649 private Quaternion m_knownOrientation; 649 private Quaternion m_knownOrientation;
650 private Vector3 m_knownRotationalVelocity; 650 private Vector3 m_knownRotationalVelocity;
651 private Vector3 m_knownRotationalForce; 651 private Vector3 m_knownRotationalForce;
652 private Vector3 m_knownRotationalImpulse;
652 private Vector3 m_knownForwardVelocity; // vehicle relative forward speed 653 private Vector3 m_knownForwardVelocity; // vehicle relative forward speed
653 654
654 private const int m_knownChangedPosition = 1 << 0; 655 private const int m_knownChangedPosition = 1 << 0;
@@ -658,9 +659,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
658 private const int m_knownChangedOrientation = 1 << 4; 659 private const int m_knownChangedOrientation = 1 << 4;
659 private const int m_knownChangedRotationalVelocity = 1 << 5; 660 private const int m_knownChangedRotationalVelocity = 1 << 5;
660 private const int m_knownChangedRotationalForce = 1 << 6; 661 private const int m_knownChangedRotationalForce = 1 << 6;
661 private const int m_knownChangedTerrainHeight = 1 << 7; 662 private const int m_knownChangedRotationalImpulse = 1 << 7;
662 private const int m_knownChangedWaterLevel = 1 << 8; 663 private const int m_knownChangedTerrainHeight = 1 << 8;
663 private const int m_knownChangedForwardVelocity = 1 << 9; 664 private const int m_knownChangedWaterLevel = 1 << 9;
665 private const int m_knownChangedForwardVelocity = 1 <<10;
664 666
665 private void ForgetKnownVehicleProperties() 667 private void ForgetKnownVehicleProperties()
666 { 668 {
@@ -700,6 +702,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
700 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); 702 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
701 } 703 }
702 704
705 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0)
706 Prim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/);
707
703 if ((m_knownChanged & m_knownChangedRotationalForce) != 0) 708 if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
704 { 709 {
705 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); 710 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/);
@@ -843,6 +848,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
843 m_knownChanged |= m_knownChangedRotationalForce; 848 m_knownChanged |= m_knownChangedRotationalForce;
844 m_knownHas |= m_knownChangedRotationalForce; 849 m_knownHas |= m_knownChangedRotationalForce;
845 } 850 }
851 private void VehicleAddRotationalImpulse(Vector3 pImpulse)
852 {
853 if ((m_knownHas & m_knownChangedRotationalImpulse) == 0)
854 {
855 m_knownRotationalImpulse = Vector3.Zero;
856 m_knownHas |= m_knownChangedRotationalImpulse;
857 }
858 m_knownRotationalImpulse += pImpulse;
859 m_knownChanged |= m_knownChangedRotationalImpulse;
860 }
861
846 // Vehicle relative forward velocity 862 // Vehicle relative forward velocity
847 private Vector3 VehicleForwardVelocity 863 private Vector3 VehicleForwardVelocity
848 { 864 {
@@ -1031,16 +1047,32 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1031 else 1047 else
1032 { 1048 {
1033 // Error is positive if below the target and negative if above. 1049 // Error is positive if below the target and negative if above.
1034 float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; 1050 Vector3 hpos = VehiclePosition;
1035 float verticalCorrectionVelocity = verticalError / m_VhoverTimescale * pTimestep; 1051 float verticalError = m_VhoverTargetHeight - hpos.Z;
1052 float verticalCorrection = verticalError / m_VhoverTimescale;
1053 verticalCorrection *= m_VhoverEfficiency;
1054
1055 hpos.Z += verticalCorrection;
1056 VehiclePosition = hpos;
1057
1058 // Since we are hovering, we need to do the opposite of falling -- get rid of world Z
1059 Vector3 vel = VehicleVelocity;
1060 vel.Z = 0f;
1061 VehicleVelocity = vel;
1062
1063 /*
1064 float verticalCorrectionVelocity = verticalError / m_VhoverTimescale;
1065 Vector3 verticalCorrection = new Vector3(0f, 0f, verticalCorrectionVelocity);
1066 verticalCorrection *= m_vehicleMass;
1036 1067
1037 // TODO: implement m_VhoverEfficiency correctly 1068 // TODO: implement m_VhoverEfficiency correctly
1038 VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); 1069 VehicleAddForceImpulse(verticalCorrection);
1070 */
1039 1071
1040 VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corrVel={7}", 1072 VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}",
1041 Prim.LocalID, VehiclePosition, m_VhoverEfficiency, 1073 Prim.LocalID, VehiclePosition, m_VhoverEfficiency,
1042 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, 1074 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight,
1043 verticalError, verticalCorrectionVelocity); 1075 verticalError, verticalCorrection);
1044 } 1076 }
1045 1077
1046 } 1078 }
@@ -1128,8 +1160,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1128 if (!Prim.IsColliding && VehicleVelocity.Z > 0.1) 1160 if (!Prim.IsColliding && VehicleVelocity.Z > 0.1)
1129 { 1161 {
1130 // Get rid of any of the velocity vector that is pushing us up. 1162 // Get rid of any of the velocity vector that is pushing us up.
1131 VehicleVelocity += new Vector3(0, 0, -VehicleVelocity.Z); 1163 float upVelocity = VehicleVelocity.Z;
1164 VehicleVelocity += new Vector3(0, 0, -upVelocity);
1132 1165
1166 /*
1133 // If we're pointed up into the air, we should nose down 1167 // If we're pointed up into the air, we should nose down
1134 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; 1168 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation;
1135 // The rotation around the Y axis is pitch up or down 1169 // The rotation around the Y axis is pitch up or down
@@ -1143,11 +1177,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1143 VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2},corrFrc={3},aCorr={4}", 1177 VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2},corrFrc={3},aCorr={4}",
1144 Prim.LocalID, VehicleVelocity, pointingDirection, angularCorrectionForce, angularCorrectionVector); 1178 Prim.LocalID, VehicleVelocity, pointingDirection, angularCorrectionForce, angularCorrectionVector);
1145 } 1179 }
1146 else 1180 */
1147 { 1181 VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}",
1148 VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2}", 1182 Prim.LocalID, Prim.IsColliding, upVelocity, VehicleVelocity);
1149 Prim.LocalID, VehicleVelocity, pointingDirection);
1150 }
1151 } 1183 }
1152 } 1184 }
1153 } 1185 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 5a1b5c7..8c9a774 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -108,8 +108,8 @@ public sealed class BSLinksetCompound : BSLinkset
108 // Schedule a refresh to happen after all the other taint processing. 108 // Schedule a refresh to happen after all the other taint processing.
109 private void ScheduleRebuild(BSPhysObject requestor) 109 private void ScheduleRebuild(BSPhysObject requestor)
110 { 110 {
111 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2}", 111 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
112 requestor.LocalID, Rebuilding, HasAnyChildren); 112 requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
113 // When rebuilding, it is possible to set properties that would normally require a rebuild. 113 // When rebuilding, it is possible to set properties that would normally require a rebuild.
114 // If already rebuilding, don't request another rebuild. 114 // If already rebuilding, don't request another rebuild.
115 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. 115 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
@@ -195,8 +195,11 @@ public sealed class BSLinksetCompound : BSLinkset
195 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) 195 && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
196 { 196 {
197 // TODO: replace this with are calculation of the child prim's orientation and pos. 197 // TODO: replace this with are calculation of the child prim's orientation and pos.
198 updated.LinksetInfo = null; 198 // TODO: for the moment, don't rebuild the compound shape.
199 ScheduleRebuild(updated); 199 // This is often just the car turning its wheels. When we can just reorient the one
200 // member shape of the compound shape, the overhead of rebuilding won't be a problem.
201 // updated.LinksetInfo = null;
202 // ScheduleRebuild(updated);
200 } 203 }
201 } 204 }
202 205
@@ -308,7 +311,7 @@ public sealed class BSLinksetCompound : BSLinkset
308 else 311 else
309 { 312 {
310 // Rebuild the compound shape with the child removed 313 // Rebuild the compound shape with the child removed
311 ScheduleRebuild(child); 314 ScheduleRebuild(LinksetRoot);
312 } 315 }
313 } 316 }
314 return; 317 return;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 27ff047..3e80aa4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -94,16 +94,16 @@ public static class BSParam
94 public static float PID_D { get; private set; } // derivative 94 public static float PID_D { get; private set; } // derivative
95 public static float PID_P { get; private set; } // proportional 95 public static float PID_P { get; private set; } // proportional
96 96
97 // Various constants that come from that other virtual world that shall not be named 97 // Various constants that come from that other virtual world that shall not be named.
98 public const float MinGravityZ = -1f; 98 public const float MinGravityZ = -1f;
99 public const float MaxGravityZ = 28f; 99 public const float MaxGravityZ = 28f;
100 public const float MinFriction = 0f; 100 public const float MinFriction = 0f;
101 public const float MaxFriction = 255f; 101 public const float MaxFriction = 255f;
102 public const float MinDensity = 0f; 102 public const float MinDensity = 0.01f;
103 public const float MaxDensity = 22587f; 103 public const float MaxDensity = 22587f;
104 public const float MinRestitution = 0f; 104 public const float MinRestitution = 0f;
105 public const float MaxRestitution = 1f; 105 public const float MaxRestitution = 1f;
106 public const float MaxAddForceMagnitude = 20000f; 106 public const float MaxAddForceMagnitude = 20f;
107 107
108 // =========================================================================== 108 // ===========================================================================
109 public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); 109 public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val);
@@ -318,13 +318,13 @@ public static class BSParam
318 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, 318 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); },
319 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 319 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
320 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 320 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
321 0f, // set to zero to disable 321 0.3f, // set to zero to disable
322 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, 322 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
323 (s) => { return CcdMotionThreshold; }, 323 (s) => { return CcdMotionThreshold; },
324 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, 324 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); },
325 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), 325 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
326 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 326 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
327 0f, 327 0.2f,
328 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, 328 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
329 (s) => { return CcdSweptSphereRadius; }, 329 (s) => { return CcdSweptSphereRadius; },
330 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, 330 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); },
@@ -465,7 +465,7 @@ public static class BSParam
465 (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, 465 (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; },
466 (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), 466 (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ),
467 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", 467 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
468 ConfigurationParameters.numericFalse, 468 ConfigurationParameters.numericTrue,
469 (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 469 (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
470 (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, 470 (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; },
471 (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), 471 (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ),
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index addab29..9fbfcdc 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -442,7 +442,8 @@ public sealed class BSShapeCollection : IDisposable
442 return ret; 442 return ret;
443 } 443 }
444 444
445 // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'. 445 // Create a mesh, hull or native shape.
446 // Return 'true' if the prim's shape was changed.
446 public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) 447 public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback)
447 { 448 {
448 bool ret = false; 449 bool ret = false;
@@ -472,7 +473,7 @@ public sealed class BSShapeCollection : IDisposable
472 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", 473 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}",
473 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); 474 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type);
474 475
475 // It doesn't look like Bullet scales spheres so make sure the scales are all equal 476 // It doesn't look like Bullet scales native spheres so make sure the scales are all equal
476 if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) 477 if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1)
477 && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) 478 && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)
478 { 479 {
@@ -484,9 +485,9 @@ public sealed class BSShapeCollection : IDisposable
484 { 485 {
485 ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, 486 ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE,
486 FixedShapeKey.KEY_SPHERE, shapeCallback); 487 FixedShapeKey.KEY_SPHERE, shapeCallback);
487 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}",
488 prim.LocalID, forceRebuild, prim.PhysShape);
489 } 488 }
489 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},rebuilt={2},shape={3}",
490 prim.LocalID, forceRebuild, ret, prim.PhysShape);
490 } 491 }
491 if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) 492 if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)
492 { 493 {
@@ -498,9 +499,9 @@ public sealed class BSShapeCollection : IDisposable
498 { 499 {
499 ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, 500 ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX,
500 FixedShapeKey.KEY_BOX, shapeCallback); 501 FixedShapeKey.KEY_BOX, shapeCallback);
501 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}",
502 prim.LocalID, forceRebuild, prim.PhysShape);
503 } 502 }
503 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},rebuilt={2},shape={3}",
504 prim.LocalID, forceRebuild, ret, prim.PhysShape);
504 } 505 }
505 } 506 }
506 507
@@ -513,6 +514,7 @@ public sealed class BSShapeCollection : IDisposable
513 return ret; 514 return ret;
514 } 515 }
515 516
517 // return 'true' if the prim's shape was changed.
516 public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback) 518 public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback)
517 { 519 {
518 520
@@ -872,8 +874,7 @@ public sealed class BSShapeCollection : IDisposable
872 { 874 {
873 prim.LastAssetBuildFailed = true; 875 prim.LastAssetBuildFailed = true;
874 BSPhysObject xprim = prim; 876 BSPhysObject xprim = prim;
875 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lID={1},lastFailed={2}", 877 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed);
876 LogHeader, prim.LocalID, prim.LastAssetBuildFailed);
877 Util.FireAndForget(delegate 878 Util.FireAndForget(delegate
878 { 879 {
879 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; 880 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
@@ -882,19 +883,34 @@ public sealed class BSShapeCollection : IDisposable
882 BSPhysObject yprim = xprim; // probably not necessary, but, just in case. 883 BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
883 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) 884 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
884 { 885 {
885 if (!yprim.BaseShape.SculptEntry) 886 bool assetFound = false; // DEBUG DEBUG
886 return; 887 string mismatchIDs = String.Empty; // DEBUG DEBUG
887 if (yprim.BaseShape.SculptTexture.ToString() != asset.ID) 888 if (yprim.BaseShape.SculptEntry)
888 return; 889 {
889 890 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
890 yprim.BaseShape.SculptData = asset.Data; 891 {
891 // This will cause the prim to see that the filler shape is not the right 892 yprim.BaseShape.SculptData = asset.Data;
892 // one and try again to build the object. 893 // This will cause the prim to see that the filler shape is not the right
893 // No race condition with the normal shape setting since the rebuild is at taint time. 894 // one and try again to build the object.
894 yprim.ForceBodyShapeRebuild(false); 895 // No race condition with the normal shape setting since the rebuild is at taint time.
896 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
897 assetFound = true;
898 }
899 else
900 {
901 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
902 }
903 }
904 DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
905 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
895 906
896 }); 907 });
897 } 908 }
909 else
910 {
911 PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
912 LogHeader, PhysicsScene.Name);
913 }
898 }); 914 });
899 } 915 }
900 else 916 else
@@ -906,9 +922,9 @@ public sealed class BSShapeCollection : IDisposable
906 } 922 }
907 } 923 }
908 924
909 // While we figure out the real problem, stick in a simple box for the object. 925 // While we wait for the mesh defining asset to be loaded, stick in a simple box for the object.
910 BulletShape fillinShape = 926 BulletShape fillinShape = BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
911 BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); 927 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,boxTempShape", prim.LocalID);
912 928
913 return fillinShape; 929 return fillinShape;
914 } 930 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 59cbab9..d4545f7 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,7 +1,14 @@
1CURRENT PRIORITIES 1CURRENT PRIORITIES
2================================================= 2=================================================
3Mantis 6040 script http://opensimulator.org/mantis/view.php?id=6040
4 Msg Kayaker on OSGrid when working
5Teravus llMoveToTarget script debug
6 Mixing of hover, buoyancy/gravity, moveToTarget, into one force
7Boats floating at proper level
3Nebadon vehicles turning funny in arena 8Nebadon vehicles turning funny in arena
4limitMotorUp calibration (more down?) 9limitMotorUp calibration (more down?)
10llRotLookAt
11llLookAt
5Vehicle angular vertical attraction 12Vehicle angular vertical attraction
6Vehicle angular deflection 13Vehicle angular deflection
7 Preferred orientation angular correction fix 14 Preferred orientation angular correction fix
@@ -9,8 +16,6 @@ vehicle angular banking
9Avatars walking up stairs (HALF DONE) 16Avatars walking up stairs (HALF DONE)
10 Radius of the capsule affects ability to climb edges. 17 Radius of the capsule affects ability to climb edges.
11Vehicle movement on terrain smoothness 18Vehicle movement on terrain smoothness
12Surfboard go wonky when turning
13 Angular motor direction is global coordinates rather than local coordinates?
14Boats float low in the water (DONE) 19Boats float low in the water (DONE)
15Avatar movement 20Avatar movement
16 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) 21 flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
@@ -27,6 +32,10 @@ Add material densities to the material types
27 32
28CRASHES 33CRASHES
29================================================= 34=================================================
35Crazyness during 20130115 office hours was PositionAdjustUnderground for both char and prim
36 m1:logs/20130115.0934/physics-BulletSim-20130115083613.log
37 Creation of Neb's terrain made the terrain "disappear". Everything started to fall
38 and then get restored to be above terrain.
3020121129.1411: editting/moving phys object across region boundries causes crash 3920121129.1411: editting/moving phys object across region boundries causes crash
31 getPos-> btRigidBody::upcast -> getBodyType -> BOOM 40 getPos-> btRigidBody::upcast -> getBodyType -> BOOM
3220121128.1600: mesh object not rezzing (no physics mesh). 4120121128.1600: mesh object not rezzing (no physics mesh).
@@ -111,6 +120,8 @@ Physical and phantom will drop through the terrain
111 120
112LINKSETS 121LINKSETS
113====================================================== 122======================================================
123Editing a child of a linkset causes the child to go phantom
124 Move a child prim once when it is physical and can never move it again without it going phantom
114Offset the center of the linkset to be the geometric center of all the prims 125Offset the center of the linkset to be the geometric center of all the prims
115 Not quite the same as the center-of-gravity 126 Not quite the same as the center-of-gravity
116Linksets should allow collisions to individual children 127Linksets should allow collisions to individual children
@@ -133,6 +144,10 @@ Eliminate collisions between objects in a linkset. (LinksetConstraint)
133 144
134MORE 145MORE
135====================================================== 146======================================================
147Create tests for different interface components
148 Have test objects/scripts measure themselves and turn color if correct/bad
149 Test functions in SL and calibrate correctness there
150 Create auto rezzer and tracker to run through the tests
136Use the HACD convex hull routine in Bullet rather than the C# version. 151Use the HACD convex hull routine in Bullet rather than the C# version.
137Do we need to do convex hulls all the time? Can complex meshes be left meshes? 152Do we need to do convex hulls all the time? Can complex meshes be left meshes?
138 There is some problem with meshes and collisions 153 There is some problem with meshes and collisions
@@ -167,6 +182,7 @@ Enforce physical parameter min/max:
167 Restitution [0, 1] 182 Restitution [0, 1]
168 http://wiki.secondlife.com/wiki/Physics_Material_Settings_test 183 http://wiki.secondlife.com/wiki/Physics_Material_Settings_test
169Avatar attachments have no mass? http://forums-archive.secondlife.com/54/f0/31796/1.html 184Avatar attachments have no mass? http://forums-archive.secondlife.com/54/f0/31796/1.html
185Keep avatar scaling correct. http://pennycow.blogspot.fr/2011/07/matter-of-scale.html
170 186
171INTERNAL IMPROVEMENT/CLEANUP 187INTERNAL IMPROVEMENT/CLEANUP
172================================================= 188=================================================
@@ -287,4 +303,7 @@ Disable activity of passive linkset children. (DONE)
287 Since the linkset is a compound object, the old prims are left lying 303 Since the linkset is a compound object, the old prims are left lying
288 around and need to be phantomized so they don't collide, ... 304 around and need to be phantomized so they don't collide, ...
289Remove HeightmapInfo from terrain specification (DONE) 305Remove HeightmapInfo from terrain specification (DONE)
290 Since C++ code does not need terrain height, this structure et al are not needed. \ No newline at end of file 306 Since C++ code does not need terrain height, this structure et al are not needed.
307Surfboard go wonky when turning (DONE)
308 Angular motor direction is global coordinates rather than local coordinates?
309 (Resolution: made angular motor direction correct coordinate system) \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 2027ca6..d2323f5 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -26,9 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.ScriptEngine.Shared;
32 34
33namespace OpenSim.Region.ScriptEngine.Interfaces 35namespace OpenSim.Region.ScriptEngine.Interfaces
34{ 36{
@@ -38,11 +40,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
38 /// Initialize the API 40 /// Initialize the API
39 /// </summary> 41 /// </summary>
40 /// <remarks> 42 /// <remarks>
41 /// Each API has an identifier, which is used to load the 43 /// Each API has an identifier, which is used to load the proper runtime assembly at load time.
42 /// proper runtime assembly at load time. 44 /// <param name='scriptEngine'>/param>
43 /// <param name='engine'>/param> 45 /// <param name='host'>/param>
44 /// <param name='part'></param> 46 /// <param name='item'>/param>
45 /// <param name='item'></param> 47 /// <param name='coopSleepHandle'>/param>
46 void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); 48 void Initialize(
49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle);
47 } 50 }
48} \ No newline at end of file 51} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 2f5b526..f68612c 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -28,9 +28,11 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Threading;
31using OpenMetaverse; 32using OpenMetaverse;
32using log4net; 33using log4net;
33using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.ScriptEngine.Shared; 36using OpenSim.Region.ScriptEngine.Shared;
35using OpenSim.Region.ScriptEngine.Interfaces; 37using OpenSim.Region.ScriptEngine.Interfaces;
36 38
@@ -105,6 +107,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
105 /// </summary> 107 /// </summary>
106 long MeasurementPeriodExecutionTime { get; } 108 long MeasurementPeriodExecutionTime { get; }
107 109
110 /// <summary>
111 /// Scene part in which this script instance is contained.
112 /// </summary>
113 SceneObjectPart Part { get; }
114
108 IScriptEngine Engine { get; } 115 IScriptEngine Engine { get; }
109 UUID AppDomain { get; set; } 116 UUID AppDomain { get; set; }
110 string PrimName { get; } 117 string PrimName { get; }
@@ -124,6 +131,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
124 131
125 uint LocalID { get; } 132 uint LocalID { get; }
126 UUID AssetID { get; } 133 UUID AssetID { get; }
134
135 /// <summary>
136 /// Inventory item containing the script used.
137 /// </summary>
138 TaskInventoryItem ScriptTask { get; }
139
127 Queue EventQueue { get; } 140 Queue EventQueue { get; }
128 141
129 /// <summary> 142 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ea4e609..d47fd6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -83,10 +83,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
83 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi 83 public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
84 { 84 {
85 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 85 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
86
86 protected IScriptEngine m_ScriptEngine; 87 protected IScriptEngine m_ScriptEngine;
87 protected SceneObjectPart m_host; 88 protected SceneObjectPart m_host;
88 89
89 /// <summary> 90 /// <summary>
91 /// Used for script sleeps when we are using co-operative script termination.
92 /// </summary>
93 /// <remarks>null if co-operative script termination is not active</remarks>
94 EventWaitHandle m_coopSleepHandle;
95
96 /// <summary>
90 /// The item that hosts this script 97 /// The item that hosts this script
91 /// </summary> 98 /// </summary>
92 protected TaskInventoryItem m_item; 99 protected TaskInventoryItem m_item;
@@ -110,24 +117,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
110 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. 117 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
111 protected ISoundModule m_SoundModule = null; 118 protected ISoundModule m_SoundModule = null;
112 119
113 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 120 public void Initialize(
121 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
114 { 122 {
115 m_ScriptEngine = ScriptEngine; 123 m_ScriptEngine = scriptEngine;
116 m_host = host; 124 m_host = host;
117 m_item = item; 125 m_item = item;
126 m_coopSleepHandle = coopSleepHandle;
118 127
119 LoadLimits(); // read script limits from config. 128 LoadConfig();
120 129
121 m_TransferModule = 130 m_TransferModule =
122 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 131 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
123 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 132 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
124 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); 133 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
125 134
126 AsyncCommands = new AsyncCommandManager(ScriptEngine); 135 AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
127 } 136 }
128 137
129 /* load configuration items that affect script, object and run-time behavior. */ 138 /// <summary>
130 private void LoadLimits() 139 /// Load configuration items that affect script, object and run-time behavior. */
140 /// </summary>
141 private void LoadConfig()
131 { 142 {
132 m_ScriptDelayFactor = 143 m_ScriptDelayFactor =
133 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 144 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@@ -141,12 +152,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
141 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 152 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
142 if (m_notecardLineReadCharsMax > 65535) 153 if (m_notecardLineReadCharsMax > 65535)
143 m_notecardLineReadCharsMax = 65535; 154 m_notecardLineReadCharsMax = 65535;
155
144 // load limits for particular subsystems. 156 // load limits for particular subsystems.
145 IConfig SMTPConfig; 157 IConfig SMTPConfig;
146 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { 158 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
147 // there's an smtp config, so load in the snooze time. 159 // there's an smtp config, so load in the snooze time.
148 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); 160 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
149 } 161 }
162
150 // Rezzing an object with a velocity can create recoil. This feature seems to have been 163 // Rezzing an object with a velocity can create recoil. This feature seems to have been
151 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales 164 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
152 // it by this factor. May be zero to turn off recoil all together. 165 // it by this factor. May be zero to turn off recoil all together.
@@ -171,7 +184,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
171 delay = (int)((float)delay * m_ScriptDelayFactor); 184 delay = (int)((float)delay * m_ScriptDelayFactor);
172 if (delay == 0) 185 if (delay == 0)
173 return; 186 return;
174 System.Threading.Thread.Sleep(delay); 187
188 Sleep(delay);
189 }
190
191 protected virtual void Sleep(int delay)
192 {
193 if (m_coopSleepHandle == null)
194 System.Threading.Thread.Sleep(delay);
195 else if (m_coopSleepHandle.WaitOne(delay))
196 throw new ScriptCoopStopException();
175 } 197 }
176 198
177 public Scene World 199 public Scene World
@@ -2910,7 +2932,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2910 { 2932 {
2911// m_log.Info("llSleep snoozing " + sec + "s."); 2933// m_log.Info("llSleep snoozing " + sec + "s.");
2912 m_host.AddScriptLPS(1); 2934 m_host.AddScriptLPS(1);
2913 Thread.Sleep((int)(sec * 1000)); 2935
2936 Sleep((int)(sec * 1000));
2914 } 2937 }
2915 2938
2916 public LSL_Float llGetMass() 2939 public LSL_Float llGetMass()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index ceb4660..a08ccc8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
33using OpenMetaverse; 34using OpenMetaverse;
34using Nini.Config; 35using Nini.Config;
35using OpenSim; 36using OpenSim;
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
61 internal bool m_LSFunctionsEnabled = false; 62 internal bool m_LSFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
63 64
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = scriptEngine;
67 m_host = host; 69 m_host = host;
68 70
69 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) 71 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
@@ -92,10 +94,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
92 get { return m_ScriptEngine.World; } 94 get { return m_ScriptEngine.World; }
93 } 95 }
94 96
95 // 97 /// <summary>
96 //Dumps an error message on the debug console. 98 /// Dumps an error message on the debug console.
97 // 99 /// </summary>
98
99 internal void LSShoutError(string message) 100 internal void LSShoutError(string message)
100 { 101 {
101 if (message.Length > 1023) 102 if (message.Length > 1023)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 8f34833..981499e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using System.Threading;
33using OpenMetaverse; 34using OpenMetaverse;
34using Nini.Config; 35using Nini.Config;
35using OpenSim; 36using OpenSim;
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
61 internal bool m_MODFunctionsEnabled = false; 62 internal bool m_MODFunctionsEnabled = false;
62 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
63 64
64 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
65 { 67 {
66 m_ScriptEngine = ScriptEngine; 68 m_ScriptEngine = scriptEngine;
67 m_host = host; 69 m_host = host;
68 m_item = item; 70 m_item = item;
69 71
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 958a448..25635ff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -142,9 +142,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
142 142
143 protected IUrlModule m_UrlModule = null; 143 protected IUrlModule m_UrlModule = null;
144 144
145 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 145 public void Initialize(
146 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle)
146 { 147 {
147 m_ScriptEngine = ScriptEngine; 148 m_ScriptEngine = scriptEngine;
148 m_host = host; 149 m_host = host;
149 m_item = item; 150 m_item = item;
150 151
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 5a58f73..e02d35e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -81,6 +81,24 @@ namespace OpenSim.Region.ScriptEngine.Shared
81 } 81 }
82 } 82 }
83 83
84 /// <summary>
85 /// Used to signal when the script is stopping in co-operation with the script engine
86 /// (instead of through Thread.Abort()).
87 /// </summary>
88 [Serializable]
89 public class ScriptCoopStopException : Exception
90 {
91 public ScriptCoopStopException()
92 {
93 }
94
95 protected ScriptCoopStopException(
96 SerializationInfo info,
97 StreamingContext context)
98 {
99 }
100 }
101
84 public class DetectParams 102 public class DetectParams
85 { 103 {
86 public const int AGENT = 1; 104 public const int AGENT = 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index f172216..75aea2b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -157,9 +157,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
157 157
158 public UUID AppDomain { get; set; } 158 public UUID AppDomain { get; set; }
159 159
160 /// <summary>
161 /// Scene part in which this script instance is contained.
162 /// </summary>
163 public SceneObjectPart Part { get; private set; } 160 public SceneObjectPart Part { get; private set; }
164 161
165 public string PrimName { get; private set; } 162 public string PrimName { get; private set; }
@@ -203,49 +200,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
203 200
204 public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; 201 public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute;
205 202
203 private bool m_coopTermination;
204
205 private EventWaitHandle m_coopSleepHandle;
206
206 public void ClearQueue() 207 public void ClearQueue()
207 { 208 {
208 m_TimerQueued = false; 209 m_TimerQueued = false;
209 EventQueue.Clear(); 210 EventQueue.Clear();
210 } 211 }
211 212
212 public ScriptInstance(IScriptEngine engine, SceneObjectPart part, 213 public ScriptInstance(
213 UUID itemID, UUID assetID, string assembly, 214 IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item,
214 AppDomain dom, string primName, string scriptName, 215 int startParam, bool postOnRez,
215 int startParam, bool postOnRez, StateSource stateSource, 216 int maxScriptQueue)
216 int maxScriptQueue)
217 { 217 {
218 State = "default"; 218 State = "default";
219 EventQueue = new Queue(32); 219 EventQueue = new Queue(32);
220 220
221 Engine = engine; 221 Engine = engine;
222 Part = part; 222 Part = part;
223 ItemID = itemID; 223 ScriptTask = item;
224 AssetID = assetID; 224
225 PrimName = primName; 225 // This is currently only here to allow regression tests to get away without specifying any inventory
226 ScriptName = scriptName; 226 // item when they are testing script logic that doesn't require an item.
227 m_Assembly = assembly; 227 if (ScriptTask != null)
228 {
229 ScriptName = ScriptTask.Name;
230 ItemID = ScriptTask.ItemID;
231 AssetID = ScriptTask.AssetID;
232 }
233
234 PrimName = part.ParentGroup.Name;
228 StartParam = startParam; 235 StartParam = startParam;
229 m_MaxScriptQueue = maxScriptQueue; 236 m_MaxScriptQueue = maxScriptQueue;
230 m_stateSource = stateSource;
231 m_postOnRez = postOnRez; 237 m_postOnRez = postOnRez;
232 m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; 238 m_AttachedAvatar = Part.ParentGroup.AttachedAvatar;
233 m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; 239 m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID;
234 240
235 lock (Part.TaskInventory) 241 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
236 { 242 {
237 if (Part.TaskInventory.ContainsKey(ItemID)) 243 m_coopTermination = true;
238 { 244 m_coopSleepHandle = new AutoResetEvent(false);
239 ScriptTask = Part.TaskInventory[ItemID];
240 }
241 } 245 }
246 }
247
248 /// <summary>
249 /// Load the script from an assembly into an AppDomain.
250 /// </summary>
251 /// <param name='dom'></param>
252 /// <param name='assembly'></param>
253 /// <param name='stateSource'></param>
254 public void Load(AppDomain dom, string assembly, StateSource stateSource)
255 {
256 m_Assembly = assembly;
257 m_stateSource = stateSource;
242 258
243 ApiManager am = new ApiManager(); 259 ApiManager am = new ApiManager();
244 260
245 foreach (string api in am.GetApis()) 261 foreach (string api in am.GetApis())
246 { 262 {
247 m_Apis[api] = am.CreateApi(api); 263 m_Apis[api] = am.CreateApi(api);
248 m_Apis[api].Initialize(engine, part, ScriptTask); 264 m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle);
249 } 265 }
250 266
251 try 267 try
@@ -279,7 +295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
279 295
280// // m_log.Debug("[Script] Script instance created"); 296// // m_log.Debug("[Script] Script instance created");
281 297
282 part.SetScriptEvents(ItemID, 298 Part.SetScriptEvents(ItemID,
283 (int)m_Script.GetStateEventFlags(State)); 299 (int)m_Script.GetStateEventFlags(State));
284 } 300 }
285 catch (Exception e) 301 catch (Exception e)
@@ -526,9 +542,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
526 } 542 }
527 543
528 // Wait for the current event to complete. 544 // Wait for the current event to complete.
529 if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000))) 545 if (!m_InSelfDelete)
530 { 546 {
531 return true; 547 if (!m_coopTermination)
548 {
549 // If we're not co-operative terminating then try and wait for the event to complete before stopping
550 if (workItem.Wait(new TimeSpan((long)timeout * 100000)))
551 return true;
552 }
553 else
554 {
555 m_log.DebugFormat(
556 "[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}",
557 ScriptName, ItemID, PrimName, ObjectID);
558
559 // This will terminate the event on next handle check by the script.
560 m_coopSleepHandle.Set();
561
562 // For now, we will wait forever since the event should always cleanly terminate once LSL loop
563 // checking is implemented. May want to allow a shorter timeout option later.
564 if (workItem.Wait(TimeSpan.MaxValue))
565 {
566 m_log.DebugFormat(
567 "[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}",
568 ScriptName, ItemID, PrimName, ObjectID);
569
570 return true;
571 }
572 }
532 } 573 }
533 574
534 lock (EventQueue) 575 lock (EventQueue)
@@ -541,6 +582,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
541 582
542 // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then 583 // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then
543 // forcibly abort the work item (this aborts the underlying thread). 584 // forcibly abort the work item (this aborts the underlying thread).
585 // Co-operative termination should never reach this point.
544 if (!m_InSelfDelete) 586 if (!m_InSelfDelete)
545 { 587 {
546 m_log.DebugFormat( 588 m_log.DebugFormat(
@@ -780,7 +822,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
780 m_InEvent = false; 822 m_InEvent = false;
781 m_CurrentEvent = String.Empty; 823 m_CurrentEvent = String.Empty;
782 824
783 if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) 825 if ((!(e is TargetInvocationException)
826 || (!(e.InnerException is SelfDeleteException)
827 && !(e.InnerException is ScriptDeleteException)
828 && !(e.InnerException is ScriptCoopStopException)))
829 && !(e is ThreadAbortException))
784 { 830 {
785 try 831 try
786 { 832 {
@@ -828,6 +874,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
828 m_InSelfDelete = true; 874 m_InSelfDelete = true;
829 Part.Inventory.RemoveInventoryItem(ItemID); 875 Part.Inventory.RemoveInventoryItem(ItemID);
830 } 876 }
877 else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
878 {
879 m_log.DebugFormat(
880 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
881 PrimName, ScriptName, data.EventName, State);
882 }
831 } 883 }
832 } 884 }
833 } 885 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
new file mode 100644
index 0000000..8c3e9e0
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
@@ -0,0 +1,157 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Scripting.WorldComm;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.ScriptEngine.XEngine;
39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock;
41
42namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
43{
44 /// <summary>
45 /// Test that co-operative script thread termination is working correctly.
46 /// </summary>
47 [TestFixture]
48 public class CoopTerminationTests : OpenSimTestCase
49 {
50 private TestScene m_scene;
51 private OpenSim.Region.ScriptEngine.XEngine.XEngine m_xEngine;
52
53 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
54 private AutoResetEvent m_stoppedEvent = new AutoResetEvent(false);
55
56 private OSChatMessage m_osChatMessageReceived;
57
58 [TestFixtureSetUp]
59 public void Init()
60 {
61 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
62// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
63 m_xEngine = new OpenSim.Region.ScriptEngine.XEngine.XEngine();
64
65 IniConfigSource configSource = new IniConfigSource();
66
67 IConfig startupConfig = configSource.AddConfig("Startup");
68 startupConfig.Set("DefaultScriptEngine", "XEngine");
69
70 IConfig xEngineConfig = configSource.AddConfig("XEngine");
71 xEngineConfig.Set("Enabled", "true");
72 xEngineConfig.Set("StartDelay", "0");
73
74 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
75 // to AssemblyResolver.OnAssemblyResolve fails.
76 xEngineConfig.Set("AppDomainLoading", "false");
77
78 xEngineConfig.Set("ScriptStopStrategy", "co-op");
79
80 m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource);
81 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine);
82 m_scene.StartScripts();
83 }
84
85 /// <summary>
86 /// Test co-operative termination on derez of an object containing a script with a long-running event.
87 /// </summary>
88 /// <remarks>
89 /// TODO: Actually compiling the script is incidental to this test. Really want a way to compile test scripts
90 /// within the build itself.
91 /// </remarks>
92 [Test]
93 public void TestStopOnLongSleep()
94 {
95 TestHelpers.InMethod();
96// TestHelpers.EnableLogging();
97
98 UUID userId = TestHelpers.ParseTail(0x1);
99// UUID objectId = TestHelpers.ParseTail(0x100);
100// UUID itemId = TestHelpers.ParseTail(0x3);
101 string itemName = "TestStopOnObjectDerezLongSleep() Item";
102
103 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStopOnObjectDerezLongSleep", 0x100);
104 m_scene.AddNewSceneObject(so, true);
105
106 InventoryItemBase itemTemplate = new InventoryItemBase();
107// itemTemplate.ID = itemId;
108 itemTemplate.Name = itemName;
109 itemTemplate.Folder = so.UUID;
110 itemTemplate.InvType = (int)InventoryType.LSL;
111
112 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
113
114 SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate,
115@"default
116{
117 state_entry()
118 {
119 llSay(0, ""Thin Lizzy"");
120 llSleep(60);
121 }
122}");
123
124 TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
125
126 // Wait for the script to start the event before we try stopping it.
127 m_chatEvent.WaitOne(60000);
128
129 Console.WriteLine("Script started with message [{0}]", m_osChatMessageReceived.Message);
130
131 // FIXME: This is a very poor way of trying to avoid a low-probability race condition where the script
132 // executes llSay() but has not started the sleep before we try to stop it.
133 Thread.Sleep(1000);
134
135 // We need a way of carrying on if StopScript() fail, since it won't return if the script isn't actually
136 // stopped. This kind of multi-threading is far from ideal in a regression test.
137 new Thread(() => { m_xEngine.StopScript(rezzedItem.ItemID); m_stoppedEvent.Set(); }).Start();
138
139 if (!m_stoppedEvent.WaitOne(30000))
140 Assert.Fail("Script did not co-operatively stop.");
141
142 bool running;
143 TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
144 Assert.That(
145 SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
146 Assert.That(running, Is.False);
147 }
148
149 private void OnChatFromWorld(object sender, OSChatMessage oscm)
150 {
151// Console.WriteLine("Got chat [{0}]", oscm.Message);
152
153 m_osChatMessageReceived = oscm;
154 m_chatEvent.Set();
155 }
156 }
157} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index cb7291a..6dd6c17 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared; 42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api; 43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance;
44using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
93 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); 94 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
94 95
95 LSL_Api api = new LSL_Api(); 96 LSL_Api api = new LSL_Api();
96 api.Initialize(m_engine, so1.RootPart, null); 97 api.Initialize(m_engine, so1.RootPart, null, null);
97 98
98 // Create a second object 99 // Create a second object
99 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); 100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
126 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
127 m_scene.AddSceneObject(so1); 128 m_scene.AddSceneObject(so1);
128 LSL_Api api = new LSL_Api(); 129 LSL_Api api = new LSL_Api();
129 api.Initialize(m_engine, so1.RootPart, null); 130 api.Initialize(m_engine, so1.RootPart, null, null);
130 131
131 // Create an object embedded inside the first 132 // Create an object embedded inside the first
132 UUID itemId = TestHelpers.ParseTail(0x20); 133 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -136,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
136 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); 137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
137 m_scene.AddSceneObject(so2); 138 m_scene.AddSceneObject(so2);
138 LSL_Api api2 = new LSL_Api(); 139 LSL_Api api2 = new LSL_Api();
139 api2.Initialize(m_engine, so2.RootPart, null); 140 api2.Initialize(m_engine, so2.RootPart, null, null);
140 141
141 // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** 142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
142 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); 143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index d9b17d7..5b57bbe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared; 42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api; 43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance;
44using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 45using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
45using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
@@ -104,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
104 m_scene.AddSceneObject(grp2); 105 m_scene.AddSceneObject(grp2);
105 106
106 LSL_Api apiGrp1 = new LSL_Api(); 107 LSL_Api apiGrp1 = new LSL_Api();
107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); 108 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
108 109
109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); 110 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
110 111
@@ -131,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 132 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
132 133
133 LSL_Api apiGrp1 = new LSL_Api(); 134 LSL_Api apiGrp1 = new LSL_Api();
134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); 135 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
135 136
136 apiGrp1.llBreakLink(2); 137 apiGrp1.llBreakLink(2);
137 138
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
index 98017d8..60de5cb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -34,6 +34,7 @@ using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using Nini.Config; 35using Nini.Config;
36using OpenSim.Region.ScriptEngine.Shared.Api; 36using OpenSim.Region.ScriptEngine.Shared.Api;
37using OpenSim.Region.ScriptEngine.Shared.Instance;
37using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 38using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
38using OpenMetaverse; 39using OpenMetaverse;
39using OpenSim.Tests.Common.Mock; 40using OpenSim.Tests.Common.Mock;
@@ -67,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
67 engine.AddRegion(scene); 68 engine.AddRegion(scene);
68 69
69 m_lslApi = new LSL_Api(); 70 m_lslApi = new LSL_Api();
70 m_lslApi.Initialize(engine, part, null); 71 m_lslApi.Initialize(engine, part, null, null);
71 } 72 }
72 73
73 [Test] 74 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index c41d1e7..e97ae06 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -33,6 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Region.ScriptEngine.Shared.Api; 35using OpenSim.Region.ScriptEngine.Shared.Api;
36using OpenSim.Region.ScriptEngine.Shared.Instance;
36using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 37using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
37using OpenMetaverse; 38using OpenMetaverse;
38using System; 39using System;
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
66 engine.AddRegion(scene); 67 engine.AddRegion(scene);
67 68
68 m_lslApi = new LSL_Api(); 69 m_lslApi = new LSL_Api();
69 m_lslApi.Initialize(engine, part, null); 70 m_lslApi.Initialize(engine, part, null, null);
70 } 71 }
71 72
72 [Test] 73 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index 1381d2b..c88bad5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared; 42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api; 43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance;
44using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
93 m_scene.AddSceneObject(so); 94 m_scene.AddSceneObject(so);
94 95
95 OSSL_Api osslApi = new OSSL_Api(); 96 OSSL_Api osslApi = new OSSL_Api();
96 osslApi.Initialize(m_engine, part, null); 97 osslApi.Initialize(m_engine, part, null, null);
97 98
98 string notecardName = "appearanceNc"; 99 string notecardName = "appearanceNc";
99 100
@@ -134,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
134 m_scene.AddSceneObject(so); 135 m_scene.AddSceneObject(so);
135 136
136 OSSL_Api osslApi = new OSSL_Api(); 137 OSSL_Api osslApi = new OSSL_Api();
137 osslApi.Initialize(m_engine, part, null); 138 osslApi.Initialize(m_engine, part, null, null);
138 139
139 string notecardName = "appearanceNc"; 140 string notecardName = "appearanceNc";
140 141
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index 5ed1f3d..b2803a1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -41,6 +41,7 @@ using OpenSim.Region.CoreModules.Framework.InventoryAccess;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared; 42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api; 43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance;
44using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
@@ -98,9 +99,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 99 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 100 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
100 101
101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); 102 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
102 OSSL_Api osslApi = new OSSL_Api(); 103 OSSL_Api osslApi = new OSSL_Api();
103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); 104 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
104 105
105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); 106// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
106 107
@@ -144,9 +145,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 145 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 146 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
146 147
147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); 148 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
148 OSSL_Api osslApi = new OSSL_Api(); 149 OSSL_Api osslApi = new OSSL_Api();
149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); 150 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
150 151
151 // Create an object embedded inside the first 152 // Create an object embedded inside the first
152 TaskInventoryHelpers.AddNotecard( 153 TaskInventoryHelpers.AddNotecard(
@@ -192,12 +193,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 193 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 194 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
194 195
195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); 196 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
196 OSSL_Api osslApi = new OSSL_Api(); 197 OSSL_Api osslApi = new OSSL_Api();
197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); 198 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
198 199
199 // Create an object embedded inside the first 200 // Create an object embedded inside the first
200 TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); 201 TaskInventoryHelpers.AddSceneObject(
202 m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
201 203
202 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); 204 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);
203 205
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index d6c82f1..1f8a6e5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.OptionalModules.World.NPC;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.ScriptEngine.Shared; 43using OpenSim.Region.ScriptEngine.Shared;
44using OpenSim.Region.ScriptEngine.Shared.Api; 44using OpenSim.Region.ScriptEngine.Shared.Api;
45using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 46using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
46using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 48using OpenSim.Tests.Common;
@@ -99,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
99 m_scene.AddSceneObject(so); 100 m_scene.AddSceneObject(so);
100 101
101 OSSL_Api osslApi = new OSSL_Api(); 102 OSSL_Api osslApi = new OSSL_Api();
102 osslApi.Initialize(m_engine, part, null); 103 osslApi.Initialize(m_engine, part, null, null);
103 104
104 string notecardName = "appearanceNc"; 105 string notecardName = "appearanceNc";
105 osslApi.osOwnerSaveAppearance(notecardName); 106 osslApi.osOwnerSaveAppearance(notecardName);
@@ -125,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
125 m_scene.AddSceneObject(so); 126 m_scene.AddSceneObject(so);
126 127
127 OSSL_Api osslApi = new OSSL_Api(); 128 OSSL_Api osslApi = new OSSL_Api();
128 osslApi.Initialize(m_engine, so.RootPart, null); 129 osslApi.Initialize(m_engine, so.RootPart, null, null);
129 130
130 bool gotExpectedException = false; 131 bool gotExpectedException = false;
131 try 132 try
@@ -160,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
160 m_scene.AddSceneObject(so); 161 m_scene.AddSceneObject(so);
161 162
162 OSSL_Api osslApi = new OSSL_Api(); 163 OSSL_Api osslApi = new OSSL_Api();
163 osslApi.Initialize(m_engine, part, null); 164 osslApi.Initialize(m_engine, part, null, null);
164 165
165 string notecardName = "appearanceNc"; 166 string notecardName = "appearanceNc";
166 osslApi.osOwnerSaveAppearance(notecardName); 167 osslApi.osOwnerSaveAppearance(notecardName);
@@ -194,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
194 m_scene.AddSceneObject(so); 195 m_scene.AddSceneObject(so);
195 196
196 OSSL_Api osslApi = new OSSL_Api(); 197 OSSL_Api osslApi = new OSSL_Api();
197 osslApi.Initialize(m_engine, part, null); 198 osslApi.Initialize(m_engine, part, null, null);
198 199
199 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
200 201
@@ -232,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
232 m_scene.AddSceneObject(so); 233 m_scene.AddSceneObject(so);
233 234
234 OSSL_Api osslApi = new OSSL_Api(); 235 OSSL_Api osslApi = new OSSL_Api();
235 osslApi.Initialize(m_engine, part, null); 236 osslApi.Initialize(m_engine, part, null, null);
236 237
237 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
238 239
@@ -284,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
284 m_scene.AddSceneObject(otherSo); 285 m_scene.AddSceneObject(otherSo);
285 286
286 OSSL_Api osslApi = new OSSL_Api(); 287 OSSL_Api osslApi = new OSSL_Api();
287 osslApi.Initialize(m_engine, part, null); 288 osslApi.Initialize(m_engine, part, null, null);
288 289
289 OSSL_Api otherOsslApi = new OSSL_Api(); 290 OSSL_Api otherOsslApi = new OSSL_Api();
290 otherOsslApi.Initialize(m_engine, otherPart, null); 291 otherOsslApi.Initialize(m_engine, otherPart, null, null);
291 292
292 string notecardName = "appearanceNc"; 293 string notecardName = "appearanceNc";
293 osslApi.osOwnerSaveAppearance(notecardName); 294 osslApi.osOwnerSaveAppearance(notecardName);
@@ -331,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
331 m_scene.AddSceneObject(so); 332 m_scene.AddSceneObject(so);
332 333
333 OSSL_Api osslApi = new OSSL_Api(); 334 OSSL_Api osslApi = new OSSL_Api();
334 osslApi.Initialize(m_engine, part, null); 335 osslApi.Initialize(m_engine, part, null, null);
335 336
336 string notecardName = "appearanceNc"; 337 string notecardName = "appearanceNc";
337 osslApi.osOwnerSaveAppearance(notecardName); 338 osslApi.osOwnerSaveAppearance(notecardName);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 8c3bb5b..a17a018 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1284,11 +1284,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1284 m_DomainScripts[appDomain].Add(itemID); 1284 m_DomainScripts[appDomain].Add(itemID);
1285 1285
1286 instance = new ScriptInstance(this, part, 1286 instance = new ScriptInstance(this, part,
1287 itemID, assetID, assembly, 1287 item,
1288 m_AppDomains[appDomain], 1288 startParam, postOnRez,
1289 part.ParentGroup.RootPart.Name, 1289 m_MaxScriptQueue);
1290 item.Name, startParam, postOnRez, 1290
1291 stateSource, m_MaxScriptQueue); 1291 instance.Load(m_AppDomains[appDomain], assembly, stateSource);
1292 1292
1293// if (DebugLevel >= 1) 1293// if (DebugLevel >= 1)
1294// m_log.DebugFormat( 1294// m_log.DebugFormat(
@@ -1716,9 +1716,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1716 IScriptInstance instance = GetInstance(itemID); 1716 IScriptInstance instance = GetInstance(itemID);
1717 1717
1718 if (instance != null) 1718 if (instance != null)
1719 {
1719 instance.Stop(m_WaitForEventCompletionOnScriptStop); 1720 instance.Stop(m_WaitForEventCompletionOnScriptStop);
1721 }
1720 else 1722 else
1723 {
1724// m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name);
1721 m_runFlags.AddOrUpdate(itemID, false, 240); 1725 m_runFlags.AddOrUpdate(itemID, false, 240);
1726 }
1722 } 1727 }
1723 1728
1724 public DetectParams GetDetectParams(UUID itemID, int idx) 1729 public DetectParams GetDetectParams(UUID itemID, int idx)
diff --git a/TESTING.txt b/TESTING.txt
index 08a0698..a7346ff 100644
--- a/TESTING.txt
+++ b/TESTING.txt
@@ -1,4 +1,4 @@
1=== The Quick Guide to OpenSim Unit Testing === 1===== The Quick Guide to OpenSim Unit Testing ===
2 2
3== Running Tests == 3== Running Tests ==
4 4
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 74bae01..45c3d40 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -929,18 +929,10 @@
929 929
930 MaxObjectMass = 10000.01 930 MaxObjectMass = 10000.01
931 931
932 ; Dynamic parameters
933 LinearDamping = 0.0
934 AngularDamping = 0.0
935 DeactivationTime = 0.2
936 CollisionMargin = 0.04 932 CollisionMargin = 0.04
937 933
938 ; Linkset constraint parameters 934 ; Linkset constraint parameters
939 LinkImplementation = 1 ; 0=constraint, 1=compound 935 LinkImplementation = 1 ; 0=constraint, 1=compound
940 LinkConstraintUseFrameOffset = False
941 LinkConstraintEnableTransMotor = True
942 LinkConstraintTransMotorMaxVel = 5.0
943 LinkConstraintTransMotorMaxForce = 0.1
944 936
945 ; Whether to mesh sculpties 937 ; Whether to mesh sculpties
946 MeshSculptedPrim = true 938 MeshSculptedPrim = true
diff --git a/prebuild.xml b/prebuild.xml
index 4c18aa8..abf8f36 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2417,7 +2417,9 @@
2417 <Reference name="log4net" path="../../../../../bin/"/> 2417 <Reference name="log4net" path="../../../../../bin/"/>
2418 2418
2419 <Files> 2419 <Files>
2420 <Match pattern="*.cs" recurse="true"/> 2420 <Match pattern="*.cs" recurse="true">
2421 <Exclude name="Tests" pattern="Tests"/>
2422 </Match>
2421 </Files> 2423 </Files>
2422 </Project> 2424 </Project>
2423 2425
@@ -3285,6 +3287,7 @@
3285 <Reference name="OpenSim.Region.ScriptEngine.Shared"/> 3287 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
3286 <Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/> 3288 <Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
3287 <Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/> 3289 <Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
3290 <Reference name="OpenSim.Region.ScriptEngine.Shared.Instance"/>
3288 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/> 3291 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/>
3289 <Reference name="OpenSim.Services.Interfaces"/> 3292 <Reference name="OpenSim.Services.Interfaces"/>
3290 <Reference name="OpenSim.Tests.Common"/> 3293 <Reference name="OpenSim.Tests.Common"/>
@@ -3308,6 +3311,7 @@
3308 <!-- SADLY the way this works means you need to keep adding these paths --> 3311 <!-- SADLY the way this works means you need to keep adding these paths -->
3309 <Match path="Shared/Tests" pattern="*.cs" recurse="true"/> 3312 <Match path="Shared/Tests" pattern="*.cs" recurse="true"/>
3310 <Match path="Shared/CodeTools/Tests" pattern="*.cs" recurse="true"/> 3313 <Match path="Shared/CodeTools/Tests" pattern="*.cs" recurse="true"/>
3314 <Match path="Shared/Instance/Tests" pattern="*.cs" recurse="true"/>
3311 <Match path="XEngine/Tests" pattern="*.cs" recurse="true"/> 3315 <Match path="XEngine/Tests" pattern="*.cs" recurse="true"/>
3312 </Files> 3316 </Files>
3313 </Project> 3317 </Project>