diff options
author | Mic Bowman | 2011-08-26 15:23:46 -0700 |
---|---|---|
committer | Mic Bowman | 2011-08-26 15:23:46 -0700 |
commit | 23f10f1d22d5ecf542119e39503230994c521bf0 (patch) | |
tree | 2498e8cccf2ed398052dfa53e9a1faf6e998d039 | |
parent | Merge branch 'master' into bulletsim (diff) | |
parent | refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff) | |
download | opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.zip opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.gz opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.bz2 opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.xz |
Merge branch 'master' into bulletsim
Diffstat (limited to '')
37 files changed, 1017 insertions, 580 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b73a87d..2fe8b46 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -113,6 +113,7 @@ what it is today. | |||
113 | * mpallari | 113 | * mpallari |
114 | * MrMonkE | 114 | * MrMonkE |
115 | * Nebadon Izumi (Michael Cerquoni - http://OSgrid.org) | 115 | * Nebadon Izumi (Michael Cerquoni - http://OSgrid.org) |
116 | * Neil Canham | ||
116 | * nornalbion | 117 | * nornalbion |
117 | * Omar Vera Ustariz (IBM) | 118 | * Omar Vera Ustariz (IBM) |
118 | * openlifegrid.com | 119 | * openlifegrid.com |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index cb1117a..af9b62f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -56,7 +56,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
56 | private volatile int NotSocketErrors = 0; | 56 | private volatile int NotSocketErrors = 0; |
57 | public volatile bool HTTPDRunning = false; | 57 | public volatile bool HTTPDRunning = false; |
58 | 58 | ||
59 | protected Thread m_workerThread; | ||
60 | // protected HttpListener m_httpListener; | 59 | // protected HttpListener m_httpListener; |
61 | protected CoolHTTPListener m_httpListener2; | 60 | protected CoolHTTPListener m_httpListener2; |
62 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); | 61 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); |
@@ -66,7 +65,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
66 | protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); | 65 | protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); |
67 | protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); | 66 | protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); |
68 | protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); | 67 | protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); |
69 | |||
70 | protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = | 68 | protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = |
71 | new Dictionary<string, PollServiceEventArgs>(); | 69 | new Dictionary<string, PollServiceEventArgs>(); |
72 | 70 | ||
@@ -155,7 +153,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
155 | 153 | ||
156 | public List<string> GetStreamHandlerKeys() | 154 | public List<string> GetStreamHandlerKeys() |
157 | { | 155 | { |
158 | return new List<string>(m_streamHandlers.Keys); | 156 | lock (m_streamHandlers) |
157 | return new List<string>(m_streamHandlers.Keys); | ||
159 | } | 158 | } |
160 | 159 | ||
161 | private static string GetHandlerKey(string httpMethod, string path) | 160 | private static string GetHandlerKey(string httpMethod, string path) |
@@ -196,7 +195,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
196 | 195 | ||
197 | public List<string> GetXmlRpcHandlerKeys() | 196 | public List<string> GetXmlRpcHandlerKeys() |
198 | { | 197 | { |
199 | return new List<string>(m_rpcHandlers.Keys); | 198 | lock (m_rpcHandlers) |
199 | return new List<string>(m_rpcHandlers.Keys); | ||
200 | } | 200 | } |
201 | 201 | ||
202 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) | 202 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) |
@@ -218,10 +218,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
218 | 218 | ||
219 | public List<string> GetHTTPHandlerKeys() | 219 | public List<string> GetHTTPHandlerKeys() |
220 | { | 220 | { |
221 | return new List<string>(m_HTTPHandlers.Keys); | 221 | lock (m_HTTPHandlers) |
222 | return new List<string>(m_HTTPHandlers.Keys); | ||
222 | } | 223 | } |
223 | 224 | ||
224 | |||
225 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) | 225 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) |
226 | { | 226 | { |
227 | bool pollHandlerResult = false; | 227 | bool pollHandlerResult = false; |
@@ -242,10 +242,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
242 | 242 | ||
243 | public List<string> GetPollServiceHandlerKeys() | 243 | public List<string> GetPollServiceHandlerKeys() |
244 | { | 244 | { |
245 | return new List<string>(m_pollHandlers.Keys); | 245 | lock (m_pollHandlers) |
246 | return new List<string>(m_pollHandlers.Keys); | ||
246 | } | 247 | } |
247 | 248 | ||
248 | |||
249 | // Note that the agent string is provided simply to differentiate | 249 | // Note that the agent string is provided simply to differentiate |
250 | // the handlers - it is NOT required to be an actual agent header | 250 | // the handlers - it is NOT required to be an actual agent header |
251 | // value. | 251 | // value. |
@@ -266,7 +266,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
266 | 266 | ||
267 | public List<string> GetAgentHandlerKeys() | 267 | public List<string> GetAgentHandlerKeys() |
268 | { | 268 | { |
269 | return new List<string>(m_agentHandlers.Keys); | 269 | lock (m_agentHandlers) |
270 | return new List<string>(m_agentHandlers.Keys); | ||
270 | } | 271 | } |
271 | 272 | ||
272 | public bool AddLLSDHandler(string path, LLSDMethod handler) | 273 | public bool AddLLSDHandler(string path, LLSDMethod handler) |
@@ -284,7 +285,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
284 | 285 | ||
285 | public List<string> GetLLSDHandlerKeys() | 286 | public List<string> GetLLSDHandlerKeys() |
286 | { | 287 | { |
287 | return new List<string>(m_llsdHandlers.Keys); | 288 | lock (m_llsdHandlers) |
289 | return new List<string>(m_llsdHandlers.Keys); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) | 292 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) |
@@ -404,14 +406,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
404 | string requestMethod = request.HttpMethod; | 406 | string requestMethod = request.HttpMethod; |
405 | string uriString = request.RawUrl; | 407 | string uriString = request.RawUrl; |
406 | 408 | ||
407 | string reqnum = "unknown"; | 409 | // string reqnum = "unknown"; |
408 | int tickstart = Environment.TickCount; | 410 | int tickstart = Environment.TickCount; |
409 | 411 | ||
410 | try | 412 | try |
411 | { | 413 | { |
412 | // OpenSim.Framework.WebUtil.OSHeaderRequestID | 414 | // OpenSim.Framework.WebUtil.OSHeaderRequestID |
413 | if (request.Headers["opensim-request-id"] != null) | 415 | // if (request.Headers["opensim-request-id"] != null) |
414 | reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]); | 416 | // reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]); |
415 | //m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl); | 417 | //m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl); |
416 | 418 | ||
417 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); | 419 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); |
@@ -746,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
746 | private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) | 748 | private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) |
747 | { | 749 | { |
748 | agentHandler = null; | 750 | agentHandler = null; |
749 | try | 751 | |
752 | lock (m_agentHandlers) | ||
750 | { | 753 | { |
751 | foreach (IHttpAgentHandler handler in m_agentHandlers.Values) | 754 | foreach (IHttpAgentHandler handler in m_agentHandlers.Values) |
752 | { | 755 | { |
@@ -757,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
757 | } | 760 | } |
758 | } | 761 | } |
759 | } | 762 | } |
760 | catch(KeyNotFoundException) | ||
761 | { | ||
762 | } | ||
763 | 763 | ||
764 | return false; | 764 | return false; |
765 | } | 765 | } |
@@ -803,9 +803,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
803 | 803 | ||
804 | XmlRpcMethod method; | 804 | XmlRpcMethod method; |
805 | bool methodWasFound; | 805 | bool methodWasFound; |
806 | bool keepAlive = false; | ||
806 | lock (m_rpcHandlers) | 807 | lock (m_rpcHandlers) |
807 | { | 808 | { |
808 | methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); | 809 | methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); |
810 | if (methodWasFound) | ||
811 | keepAlive = m_rpcHandlersKeepAlive[methodName]; | ||
809 | } | 812 | } |
810 | 813 | ||
811 | if (methodWasFound) | 814 | if (methodWasFound) |
@@ -824,7 +827,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
824 | } | 827 | } |
825 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] | 828 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] |
826 | 829 | ||
827 | |||
828 | try | 830 | try |
829 | { | 831 | { |
830 | xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); | 832 | xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); |
@@ -846,7 +848,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
846 | } | 848 | } |
847 | 849 | ||
848 | // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here | 850 | // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here |
849 | response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; | 851 | response.KeepAlive = keepAlive; |
850 | } | 852 | } |
851 | else | 853 | else |
852 | { | 854 | { |
@@ -1106,7 +1108,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1106 | /// <returns>true if we have one, false if not</returns> | 1108 | /// <returns>true if we have one, false if not</returns> |
1107 | private bool DoWeHaveALLSDHandler(string path) | 1109 | private bool DoWeHaveALLSDHandler(string path) |
1108 | { | 1110 | { |
1109 | |||
1110 | string[] pathbase = path.Split('/'); | 1111 | string[] pathbase = path.Split('/'); |
1111 | string searchquery = "/"; | 1112 | string searchquery = "/"; |
1112 | 1113 | ||
@@ -1122,14 +1123,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1122 | 1123 | ||
1123 | string bestMatch = null; | 1124 | string bestMatch = null; |
1124 | 1125 | ||
1125 | foreach (string pattern in m_llsdHandlers.Keys) | 1126 | lock (m_llsdHandlers) |
1126 | { | 1127 | { |
1127 | 1128 | foreach (string pattern in m_llsdHandlers.Keys) | |
1128 | if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) | ||
1129 | { | 1129 | { |
1130 | 1130 | if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) | |
1131 | bestMatch = pattern; | 1131 | bestMatch = pattern; |
1132 | |||
1133 | } | 1132 | } |
1134 | } | 1133 | } |
1135 | 1134 | ||
@@ -1142,12 +1141,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1142 | 1141 | ||
1143 | if (String.IsNullOrEmpty(bestMatch)) | 1142 | if (String.IsNullOrEmpty(bestMatch)) |
1144 | { | 1143 | { |
1145 | |||
1146 | return false; | 1144 | return false; |
1147 | } | 1145 | } |
1148 | else | 1146 | else |
1149 | { | 1147 | { |
1150 | |||
1151 | return true; | 1148 | return true; |
1152 | } | 1149 | } |
1153 | } | 1150 | } |
@@ -1232,29 +1229,32 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1232 | 1229 | ||
1233 | string bestMatch = null; | 1230 | string bestMatch = null; |
1234 | 1231 | ||
1235 | foreach (string pattern in m_llsdHandlers.Keys) | 1232 | lock (m_llsdHandlers) |
1236 | { | 1233 | { |
1237 | if (searchquery.ToLower().StartsWith(pattern.ToLower())) | 1234 | foreach (string pattern in m_llsdHandlers.Keys) |
1238 | { | 1235 | { |
1239 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) | 1236 | if (searchquery.ToLower().StartsWith(pattern.ToLower())) |
1240 | { | 1237 | { |
1241 | // You have to specifically register for '/' and to get it, you must specificaly request it | 1238 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) |
1242 | // | 1239 | { |
1243 | if (pattern == "/" && searchquery == "/" || pattern != "/") | 1240 | // You have to specifically register for '/' and to get it, you must specificaly request it |
1244 | bestMatch = pattern; | 1241 | // |
1242 | if (pattern == "/" && searchquery == "/" || pattern != "/") | ||
1243 | bestMatch = pattern; | ||
1244 | } | ||
1245 | } | 1245 | } |
1246 | } | 1246 | } |
1247 | } | 1247 | |
1248 | 1248 | if (String.IsNullOrEmpty(bestMatch)) | |
1249 | if (String.IsNullOrEmpty(bestMatch)) | 1249 | { |
1250 | { | 1250 | llsdHandler = null; |
1251 | llsdHandler = null; | 1251 | return false; |
1252 | return false; | 1252 | } |
1253 | } | 1253 | else |
1254 | else | 1254 | { |
1255 | { | 1255 | llsdHandler = m_llsdHandlers[bestMatch]; |
1256 | llsdHandler = m_llsdHandlers[bestMatch]; | 1256 | return true; |
1257 | return true; | 1257 | } |
1258 | } | 1258 | } |
1259 | } | 1259 | } |
1260 | 1260 | ||
@@ -1793,7 +1793,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1793 | 1793 | ||
1794 | //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); | 1794 | //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); |
1795 | 1795 | ||
1796 | lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); | 1796 | lock (m_streamHandlers) |
1797 | m_streamHandlers.Remove(handlerKey); | ||
1797 | } | 1798 | } |
1798 | 1799 | ||
1799 | public void RemoveHTTPHandler(string httpMethod, string path) | 1800 | public void RemoveHTTPHandler(string httpMethod, string path) |
@@ -1825,17 +1826,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1825 | 1826 | ||
1826 | public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) | 1827 | public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) |
1827 | { | 1828 | { |
1828 | try | 1829 | lock (m_agentHandlers) |
1829 | { | 1830 | { |
1830 | if (handler == m_agentHandlers[agent]) | 1831 | IHttpAgentHandler foundHandler; |
1832 | |||
1833 | if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) | ||
1831 | { | 1834 | { |
1832 | m_agentHandlers.Remove(agent); | 1835 | m_agentHandlers.Remove(agent); |
1833 | return true; | 1836 | return true; |
1834 | } | 1837 | } |
1835 | } | 1838 | } |
1836 | catch(KeyNotFoundException) | ||
1837 | { | ||
1838 | } | ||
1839 | 1839 | ||
1840 | return false; | 1840 | return false; |
1841 | } | 1841 | } |
@@ -1853,18 +1853,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1853 | 1853 | ||
1854 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) | 1854 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) |
1855 | { | 1855 | { |
1856 | try | 1856 | lock (m_llsdHandlers) |
1857 | { | 1857 | { |
1858 | if (handler == m_llsdHandlers[path]) | 1858 | LLSDMethod foundHandler; |
1859 | |||
1860 | if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler) | ||
1859 | { | 1861 | { |
1860 | m_llsdHandlers.Remove(path); | 1862 | m_llsdHandlers.Remove(path); |
1861 | return true; | 1863 | return true; |
1862 | } | 1864 | } |
1863 | } | 1865 | } |
1864 | catch (KeyNotFoundException) | ||
1865 | { | ||
1866 | // This is an exception to prevent crashing because of invalid code | ||
1867 | } | ||
1868 | 1866 | ||
1869 | return false; | 1867 | return false; |
1870 | } | 1868 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 9f78948..1dd8938 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -43,21 +43,29 @@ using Caps = OpenSim.Framework.Capabilities.Caps; | |||
43 | namespace OpenSim.Region.ClientStack.Linden | 43 | namespace OpenSim.Region.ClientStack.Linden |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// SimulatorFeatures capability. This is required for uploading Mesh. | 46 | /// SimulatorFeatures capability. |
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// This is required for uploading Mesh. | ||
47 | /// Since is accepts an open-ended response, we also send more information | 50 | /// Since is accepts an open-ended response, we also send more information |
48 | /// for viewers that care to interpret it. | 51 | /// for viewers that care to interpret it. |
49 | /// | 52 | /// |
50 | /// NOTE: Part of this code was adapted from the Aurora project, specifically | 53 | /// NOTE: Part of this code was adapted from the Aurora project, specifically |
51 | /// the normal part of the response in the capability handler. | 54 | /// the normal part of the response in the capability handler. |
52 | /// </summary> | 55 | /// </remarks> |
53 | /// | ||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 56 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
55 | public class SimulatorFeaturesModule : ISharedRegionModule | 57 | public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule |
56 | { | 58 | { |
57 | private static readonly ILog m_log = | 59 | // private static readonly ILog m_log = |
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
61 | |||
59 | private Scene m_scene; | 62 | private Scene m_scene; |
60 | 63 | ||
64 | /// <summary> | ||
65 | /// Simulator features | ||
66 | /// </summary> | ||
67 | private OSDMap m_features = new OSDMap(); | ||
68 | |||
61 | private string m_MapImageServerURL = string.Empty; | 69 | private string m_MapImageServerURL = string.Empty; |
62 | private string m_SearchURL = string.Empty; | 70 | private string m_SearchURL = string.Empty; |
63 | 71 | ||
@@ -66,18 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
66 | public void Initialise(IConfigSource source) | 74 | public void Initialise(IConfigSource source) |
67 | { | 75 | { |
68 | IConfig config = source.Configs["SimulatorFeatures"]; | 76 | IConfig config = source.Configs["SimulatorFeatures"]; |
69 | if (config == null) | 77 | if (config != null) |
70 | return; | ||
71 | |||
72 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); | ||
73 | if (m_MapImageServerURL != string.Empty) | ||
74 | { | 78 | { |
75 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | 79 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); |
76 | if (!m_MapImageServerURL.EndsWith("/")) | 80 | if (m_MapImageServerURL != string.Empty) |
77 | m_MapImageServerURL = m_MapImageServerURL + "/"; | 81 | { |
82 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
83 | if (!m_MapImageServerURL.EndsWith("/")) | ||
84 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
85 | } | ||
86 | |||
87 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | ||
78 | } | 88 | } |
79 | 89 | ||
80 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | 90 | AddDefaultFeatures(); |
81 | } | 91 | } |
82 | 92 | ||
83 | public void AddRegion(Scene s) | 93 | public void AddRegion(Scene s) |
@@ -110,43 +120,83 @@ namespace OpenSim.Region.ClientStack.Linden | |||
110 | 120 | ||
111 | #endregion | 121 | #endregion |
112 | 122 | ||
123 | /// <summary> | ||
124 | /// Add default features | ||
125 | /// </summary> | ||
126 | /// <remarks> | ||
127 | /// TODO: These should be added from other modules rather than hardcoded. | ||
128 | /// </remarks> | ||
129 | private void AddDefaultFeatures() | ||
130 | { | ||
131 | lock (m_features) | ||
132 | { | ||
133 | m_features["MeshRezEnabled"] = true; | ||
134 | m_features["MeshUploadEnabled"] = true; | ||
135 | m_features["MeshXferEnabled"] = true; | ||
136 | m_features["PhysicsMaterialsEnabled"] = true; | ||
137 | |||
138 | OSDMap typesMap = new OSDMap(); | ||
139 | typesMap["convex"] = true; | ||
140 | typesMap["none"] = true; | ||
141 | typesMap["prim"] = true; | ||
142 | m_features["PhysicsShapeTypes"] = typesMap; | ||
143 | |||
144 | // Extra information for viewers that want to use it | ||
145 | OSDMap gridServicesMap = new OSDMap(); | ||
146 | if (m_MapImageServerURL != string.Empty) | ||
147 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | ||
148 | if (m_SearchURL != string.Empty) | ||
149 | gridServicesMap["search"] = m_SearchURL; | ||
150 | m_features["GridServices"] = gridServicesMap; | ||
151 | } | ||
152 | } | ||
153 | |||
113 | public void RegisterCaps(UUID agentID, Caps caps) | 154 | public void RegisterCaps(UUID agentID, Caps caps) |
114 | { | 155 | { |
115 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures); | 156 | IRequestHandler reqHandler |
157 | = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest); | ||
158 | |||
116 | caps.RegisterHandler("SimulatorFeatures", reqHandler); | 159 | caps.RegisterHandler("SimulatorFeatures", reqHandler); |
117 | } | 160 | } |
118 | 161 | ||
119 | private Hashtable SimulatorFeatures(Hashtable mDhttpMethod) | 162 | public void AddFeature(string name, OSD value) |
120 | { | 163 | { |
121 | m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | 164 | lock (m_features) |
122 | OSDMap data = new OSDMap(); | 165 | m_features[name] = value; |
123 | data["MeshRezEnabled"] = true; | 166 | } |
124 | data["MeshUploadEnabled"] = true; | 167 | |
125 | data["MeshXferEnabled"] = true; | 168 | public bool RemoveFeature(string name) |
126 | data["PhysicsMaterialsEnabled"] = true; | 169 | { |
127 | 170 | lock (m_features) | |
128 | OSDMap typesMap = new OSDMap(); | 171 | return m_features.Remove(name); |
129 | typesMap["convex"] = true; | 172 | } |
130 | typesMap["none"] = true; | 173 | |
131 | typesMap["prim"] = true; | 174 | public bool TryGetFeature(string name, out OSD value) |
132 | data["PhysicsShapeTypes"] = typesMap; | 175 | { |
133 | 176 | lock (m_features) | |
134 | // Extra information for viewers that want to use it | 177 | return m_features.TryGetValue(name, out value); |
135 | OSDMap gridServicesMap = new OSDMap(); | 178 | } |
136 | if (m_MapImageServerURL != string.Empty) | 179 | |
137 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | 180 | public OSDMap GetFeatures() |
138 | if (m_SearchURL != string.Empty) | 181 | { |
139 | gridServicesMap["search"] = m_SearchURL; | 182 | lock (m_features) |
140 | data["GridServices"] = gridServicesMap; | 183 | return new OSDMap(m_features); |
184 | } | ||
185 | |||
186 | private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod) | ||
187 | { | ||
188 | // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | ||
141 | 189 | ||
142 | //Send back data | 190 | //Send back data |
143 | Hashtable responsedata = new Hashtable(); | 191 | Hashtable responsedata = new Hashtable(); |
144 | responsedata["int_response_code"] = 200; | 192 | responsedata["int_response_code"] = 200; |
145 | responsedata["content_type"] = "text/plain"; | 193 | responsedata["content_type"] = "text/plain"; |
146 | responsedata["keepalive"] = false; | 194 | responsedata["keepalive"] = false; |
147 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); | 195 | |
196 | lock (m_features) | ||
197 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features); | ||
198 | |||
148 | return responsedata; | 199 | return responsedata; |
149 | } | 200 | } |
150 | |||
151 | } | 201 | } |
152 | } | 202 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 97a1be6..3e1cb02 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -46,7 +46,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | protected Scene m_scene = null; | 49 | private Scene m_scene = null; |
50 | private IDialogModule m_dialogModule; | ||
50 | 51 | ||
51 | public string Name { get { return "Attachments Module"; } } | 52 | public string Name { get { return "Attachments Module"; } } |
52 | public Type ReplaceableInterface { get { return null; } } | 53 | public Type ReplaceableInterface { get { return null; } } |
@@ -56,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
56 | public void AddRegion(Scene scene) | 57 | public void AddRegion(Scene scene) |
57 | { | 58 | { |
58 | m_scene = scene; | 59 | m_scene = scene; |
60 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
59 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 61 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
60 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 62 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
61 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | 63 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI |
@@ -80,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
80 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; | 82 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; |
81 | client.OnObjectAttach += AttachObject; | 83 | client.OnObjectAttach += AttachObject; |
82 | client.OnObjectDetach += DetachObject; | 84 | client.OnObjectDetach += DetachObject; |
83 | client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; | 85 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; |
84 | } | 86 | } |
85 | 87 | ||
86 | public void UnsubscribeFromClientEvents(IClientAPI client) | 88 | public void UnsubscribeFromClientEvents(IClientAPI client) |
@@ -89,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
89 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; | 91 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; |
90 | client.OnObjectAttach -= AttachObject; | 92 | client.OnObjectAttach -= AttachObject; |
91 | client.OnObjectDetach -= DetachObject; | 93 | client.OnObjectDetach -= DetachObject; |
92 | client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; | 94 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; |
93 | } | 95 | } |
94 | 96 | ||
95 | /// <summary> | 97 | /// <summary> |
@@ -101,10 +103,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
101 | /// <param name="silent"></param> | 103 | /// <param name="silent"></param> |
102 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 104 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
103 | { | 105 | { |
104 | // m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | 106 | // m_log.DebugFormat( |
107 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", | ||
108 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); | ||
105 | 109 | ||
106 | try | 110 | try |
107 | { | 111 | { |
112 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
113 | |||
114 | if (sp == null) | ||
115 | { | ||
116 | m_log.ErrorFormat( | ||
117 | "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId); | ||
118 | return; | ||
119 | } | ||
120 | |||
108 | // If we can't take it, we can't attach it! | 121 | // If we can't take it, we can't attach it! |
109 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); | 122 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); |
110 | if (part == null) | 123 | if (part == null) |
@@ -123,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
123 | AttachmentPt &= 0x7f; | 136 | AttachmentPt &= 0x7f; |
124 | 137 | ||
125 | // Calls attach with a Zero position | 138 | // Calls attach with a Zero position |
126 | if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false)) | 139 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) |
127 | { | 140 | { |
128 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | 141 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
129 | 142 | ||
@@ -136,12 +149,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
136 | } | 149 | } |
137 | catch (Exception e) | 150 | catch (Exception e) |
138 | { | 151 | { |
139 | m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e); | 152 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace); |
140 | } | 153 | } |
141 | } | 154 | } |
142 | 155 | ||
143 | public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) | 156 | public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) |
144 | { | 157 | { |
158 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
159 | |||
160 | if (sp == null) | ||
161 | { | ||
162 | m_log.ErrorFormat( | ||
163 | "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId); | ||
164 | return false; | ||
165 | } | ||
166 | |||
167 | return AttachObject(sp, group, AttachmentPt, silent); | ||
168 | } | ||
169 | |||
170 | private bool AttachObject(ScenePresence sp, SceneObjectGroup group, uint AttachmentPt, bool silent) | ||
171 | { | ||
172 | // m_log.DebugFormat( | ||
173 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", | ||
174 | // group.Name, group.LocalId, sp.Name, AttachmentPt, silent); | ||
175 | |||
176 | if (sp.GetAttachments(AttachmentPt).Contains(group)) | ||
177 | { | ||
178 | // m_log.WarnFormat( | ||
179 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | ||
180 | // group.Name, group.LocalId, sp.Name, AttachmentPt); | ||
181 | |||
182 | return false; | ||
183 | } | ||
184 | |||
145 | Vector3 attachPos = group.AbsolutePosition; | 185 | Vector3 attachPos = group.AbsolutePosition; |
146 | 186 | ||
147 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 187 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
@@ -175,32 +215,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
175 | group.AbsolutePosition = attachPos; | 215 | group.AbsolutePosition = attachPos; |
176 | 216 | ||
177 | // Remove any previous attachments | 217 | // Remove any previous attachments |
178 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
179 | UUID itemID = UUID.Zero; | 218 | UUID itemID = UUID.Zero; |
180 | if (sp != null) | 219 | foreach (SceneObjectGroup grp in sp.Attachments) |
181 | { | 220 | { |
182 | foreach (SceneObjectGroup grp in sp.Attachments) | 221 | if (grp.GetAttachmentPoint() == (byte)AttachmentPt) |
183 | { | 222 | { |
184 | if (grp.GetAttachmentPoint() == (byte)AttachmentPt) | 223 | itemID = grp.GetFromItemID(); |
185 | { | 224 | break; |
186 | itemID = grp.GetFromItemID(); | ||
187 | break; | ||
188 | } | ||
189 | } | 225 | } |
190 | if (itemID != UUID.Zero) | ||
191 | DetachSingleAttachmentToInv(itemID, remoteClient); | ||
192 | } | 226 | } |
193 | 227 | ||
194 | if (group.GetFromItemID() == UUID.Zero) | 228 | if (itemID != UUID.Zero) |
195 | { | 229 | DetachSingleAttachmentToInv(itemID, sp); |
196 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | itemID = group.GetFromItemID(); | ||
201 | } | ||
202 | 230 | ||
203 | ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group); | 231 | itemID = group.GetFromItemID(); |
232 | if (itemID == UUID.Zero) | ||
233 | itemID = AddSceneObjectAsAttachment(sp.ControllingClient, group).ID; | ||
234 | |||
235 | ShowAttachInUserInventory(sp, AttachmentPt, itemID, group); | ||
204 | 236 | ||
205 | AttachToAgent(sp, group, AttachmentPt, attachPos, silent); | 237 | AttachToAgent(sp, group, AttachmentPt, attachPos, silent); |
206 | 238 | ||
@@ -229,19 +261,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
229 | // m_log.DebugFormat( | 261 | // m_log.DebugFormat( |
230 | // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 262 | // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", |
231 | // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | 263 | // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); |
264 | |||
265 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
266 | |||
267 | if (sp == null) | ||
268 | { | ||
269 | m_log.ErrorFormat( | ||
270 | "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", | ||
271 | remoteClient.Name, remoteClient.AgentId); | ||
272 | return UUID.Zero; | ||
273 | } | ||
232 | 274 | ||
233 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 275 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
234 | // be removed when that functionality is implemented in opensim | 276 | // be removed when that functionality is implemented in opensim |
235 | AttachmentPt &= 0x7f; | 277 | AttachmentPt &= 0x7f; |
236 | 278 | ||
237 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 279 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, AttachmentPt); |
238 | 280 | ||
239 | if (updateInventoryStatus) | 281 | if (updateInventoryStatus) |
240 | { | 282 | { |
241 | if (att == null) | 283 | if (att == null) |
242 | ShowDetachInUserInventory(itemID, remoteClient); | 284 | DetachSingleAttachmentToInv(itemID, sp.ControllingClient); |
243 | else | 285 | else |
244 | ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt); | 286 | ShowAttachInUserInventory(att, sp, itemID, AttachmentPt); |
245 | } | 287 | } |
246 | 288 | ||
247 | if (null == att) | 289 | if (null == att) |
@@ -250,15 +292,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
250 | return att.UUID; | 292 | return att.UUID; |
251 | } | 293 | } |
252 | 294 | ||
253 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 295 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
254 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 296 | ScenePresence sp, UUID itemID, uint AttachmentPt) |
255 | { | 297 | { |
256 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 298 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
257 | if (invAccess != null) | 299 | if (invAccess != null) |
258 | { | 300 | { |
259 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | 301 | SceneObjectGroup objatt = invAccess.RezObject(sp.ControllingClient, |
260 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 302 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
261 | false, false, remoteClient.AgentId, true); | 303 | false, false, sp.UUID, true); |
262 | 304 | ||
263 | // m_log.DebugFormat( | 305 | // m_log.DebugFormat( |
264 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | 306 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", |
@@ -277,11 +319,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
277 | // This will throw if the attachment fails | 319 | // This will throw if the attachment fails |
278 | try | 320 | try |
279 | { | 321 | { |
280 | AttachObject(remoteClient, objatt, AttachmentPt, false); | 322 | AttachObject(sp, objatt, AttachmentPt, false); |
281 | } | 323 | } |
282 | catch | 324 | catch (Exception e) |
283 | { | 325 | { |
326 | m_log.ErrorFormat( | ||
327 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | ||
328 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | ||
329 | |||
284 | // Make sure the object doesn't stick around and bail | 330 | // Make sure the object doesn't stick around and bail |
331 | sp.RemoveAttachment(objatt); | ||
285 | m_scene.DeleteSceneObject(objatt, false); | 332 | m_scene.DeleteSceneObject(objatt, false); |
286 | return null; | 333 | return null; |
287 | } | 334 | } |
@@ -295,13 +342,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
295 | objatt.ResumeScripts(); | 342 | objatt.ResumeScripts(); |
296 | 343 | ||
297 | // Do this last so that event listeners have access to all the effects of the attachment | 344 | // Do this last so that event listeners have access to all the effects of the attachment |
298 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 345 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); |
299 | } | 346 | } |
300 | else | 347 | else |
301 | { | 348 | { |
302 | m_log.WarnFormat( | 349 | m_log.WarnFormat( |
303 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 350 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", |
304 | itemID, remoteClient.Name, AttachmentPt); | 351 | itemID, sp.Name, AttachmentPt); |
305 | } | 352 | } |
306 | 353 | ||
307 | return objatt; | 354 | return objatt; |
@@ -314,12 +361,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
314 | /// Update the user inventory to the attachment of an item | 361 | /// Update the user inventory to the attachment of an item |
315 | /// </summary> | 362 | /// </summary> |
316 | /// <param name="att"></param> | 363 | /// <param name="att"></param> |
317 | /// <param name="remoteClient"></param> | 364 | /// <param name="sp"></param> |
318 | /// <param name="itemID"></param> | 365 | /// <param name="itemID"></param> |
319 | /// <param name="AttachmentPt"></param> | 366 | /// <param name="AttachmentPt"></param> |
320 | /// <returns></returns> | 367 | /// <returns></returns> |
321 | protected UUID ShowAttachInUserInventory( | 368 | private UUID ShowAttachInUserInventory( |
322 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 369 | SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt) |
323 | { | 370 | { |
324 | // m_log.DebugFormat( | 371 | // m_log.DebugFormat( |
325 | // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | 372 | // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", |
@@ -328,16 +375,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
328 | if (!att.IsDeleted) | 375 | if (!att.IsDeleted) |
329 | AttachmentPt = att.RootPart.AttachmentPoint; | 376 | AttachmentPt = att.RootPart.AttachmentPoint; |
330 | 377 | ||
331 | ScenePresence presence; | 378 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
332 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 379 | item = m_scene.InventoryService.GetItem(item); |
333 | { | ||
334 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
335 | item = m_scene.InventoryService.GetItem(item); | ||
336 | 380 | ||
337 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 381 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
338 | if (changed && m_scene.AvatarFactory != null) | 382 | if (changed && m_scene.AvatarFactory != null) |
339 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 383 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
340 | } | ||
341 | 384 | ||
342 | return att.UUID; | 385 | return att.UUID; |
343 | } | 386 | } |
@@ -345,12 +388,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
345 | /// <summary> | 388 | /// <summary> |
346 | /// Update the user inventory to reflect an attachment | 389 | /// Update the user inventory to reflect an attachment |
347 | /// </summary> | 390 | /// </summary> |
348 | /// <param name="remoteClient"></param> | 391 | /// <param name="sp"></param> |
349 | /// <param name="AttachmentPt"></param> | 392 | /// <param name="AttachmentPt"></param> |
350 | /// <param name="itemID"></param> | 393 | /// <param name="itemID"></param> |
351 | /// <param name="att"></param> | 394 | /// <param name="att"></param> |
352 | protected void ShowAttachInUserInventory( | 395 | private void ShowAttachInUserInventory( |
353 | IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | 396 | ScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) |
354 | { | 397 | { |
355 | // m_log.DebugFormat( | 398 | // m_log.DebugFormat( |
356 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | 399 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", |
@@ -374,16 +417,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
374 | return; | 417 | return; |
375 | } | 418 | } |
376 | 419 | ||
377 | ScenePresence presence; | 420 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
378 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 421 | item = m_scene.InventoryService.GetItem(item); |
379 | { | 422 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
380 | // XXYY!! | 423 | if (changed && m_scene.AvatarFactory != null) |
381 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 424 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
382 | item = m_scene.InventoryService.GetItem(item); | ||
383 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | ||
384 | if (changed && m_scene.AvatarFactory != null) | ||
385 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | ||
386 | } | ||
387 | } | 425 | } |
388 | 426 | ||
389 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) | 427 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) |
@@ -391,12 +429,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
391 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); | 429 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); |
392 | if (group != null) | 430 | if (group != null) |
393 | { | 431 | { |
394 | //group.DetachToGround(); | 432 | DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient); |
395 | ShowDetachInUserInventory(group.GetFromItemID(), remoteClient); | ||
396 | } | 433 | } |
397 | } | 434 | } |
398 | 435 | ||
399 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | 436 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) |
400 | { | 437 | { |
401 | ScenePresence presence; | 438 | ScenePresence presence; |
402 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 439 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
@@ -407,34 +444,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
407 | bool changed = presence.Appearance.DetachAttachment(itemID); | 444 | bool changed = presence.Appearance.DetachAttachment(itemID); |
408 | if (changed && m_scene.AvatarFactory != null) | 445 | if (changed && m_scene.AvatarFactory != null) |
409 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 446 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
410 | } | ||
411 | 447 | ||
412 | DetachSingleAttachmentToInv(itemID, remoteClient); | 448 | DetachSingleAttachmentToInv(itemID, presence); |
449 | } | ||
413 | } | 450 | } |
414 | 451 | ||
415 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) | 452 | public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient) |
416 | { | 453 | { |
417 | SceneObjectPart part = m_scene.GetSceneObjectPart(itemID); | 454 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID); |
418 | if (part == null || part.ParentGroup == null) | 455 | |
456 | if (so == null) | ||
419 | return; | 457 | return; |
420 | 458 | ||
421 | if (part.ParentGroup.RootPart.AttachedAvatar != remoteClient.AgentId) | 459 | if (so.AttachedAvatar != remoteClient.AgentId) |
422 | return; | 460 | return; |
423 | 461 | ||
424 | UUID inventoryID = part.ParentGroup.GetFromItemID(); | 462 | UUID inventoryID = so.GetFromItemID(); |
425 | 463 | ||
426 | ScenePresence presence; | 464 | ScenePresence presence; |
427 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 465 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
428 | { | 466 | { |
429 | if (!m_scene.Permissions.CanRezObject( | 467 | if (!m_scene.Permissions.CanRezObject( |
430 | part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) | 468 | so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) |
431 | return; | 469 | return; |
432 | 470 | ||
433 | bool changed = presence.Appearance.DetachAttachment(itemID); | 471 | bool changed = presence.Appearance.DetachAttachment(sceneObjectID); |
434 | if (changed && m_scene.AvatarFactory != null) | 472 | if (changed && m_scene.AvatarFactory != null) |
435 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 473 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
436 | 474 | ||
437 | part.ParentGroup.DetachToGround(); | 475 | presence.RemoveAttachment(so); |
476 | DetachSceneObjectToGround(so, presence); | ||
438 | 477 | ||
439 | List<UUID> uuids = new List<UUID>(); | 478 | List<UUID> uuids = new List<UUID>(); |
440 | uuids.Add(inventoryID); | 479 | uuids.Add(inventoryID); |
@@ -442,12 +481,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
442 | remoteClient.SendRemoveInventoryItem(inventoryID); | 481 | remoteClient.SendRemoveInventoryItem(inventoryID); |
443 | } | 482 | } |
444 | 483 | ||
445 | m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero); | 484 | m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero); |
485 | } | ||
486 | |||
487 | /// <summary> | ||
488 | /// Detach the given scene objet to the ground. | ||
489 | /// </summary> | ||
490 | /// <remarks> | ||
491 | /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc. | ||
492 | /// </remarks> | ||
493 | /// <param name="so">The scene object to detach.</param> | ||
494 | /// <param name="sp">The scene presence from which the scene object is being detached.</param> | ||
495 | private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp) | ||
496 | { | ||
497 | SceneObjectPart rootPart = so.RootPart; | ||
498 | |||
499 | rootPart.FromItemID = UUID.Zero; | ||
500 | so.AbsolutePosition = sp.AbsolutePosition; | ||
501 | so.AttachedAvatar = UUID.Zero; | ||
502 | rootPart.SetParentLocalId(0); | ||
503 | so.ClearPartAttachmentData(); | ||
504 | rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim); | ||
505 | so.HasGroupChanged = true; | ||
506 | rootPart.Rezzed = DateTime.Now; | ||
507 | rootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
508 | so.AttachToBackup(); | ||
509 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
510 | rootPart.ScheduleFullUpdate(); | ||
511 | rootPart.ClearUndoState(); | ||
446 | } | 512 | } |
447 | 513 | ||
448 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 514 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
449 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | 515 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? |
450 | protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | 516 | private void DetachSingleAttachmentToInv(UUID itemID, ScenePresence sp) |
451 | { | 517 | { |
452 | if (itemID == UUID.Zero) // If this happened, someone made a mistake.... | 518 | if (itemID == UUID.Zero) // If this happened, someone made a mistake.... |
453 | return; | 519 | return; |
@@ -465,17 +531,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
465 | if (group.GetFromItemID() == itemID) | 531 | if (group.GetFromItemID() == itemID) |
466 | { | 532 | { |
467 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 533 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
468 | group.DetachToInventoryPrep(); | 534 | sp.RemoveAttachment(group); |
469 | // m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 535 | |
470 | 536 | // Prepare sog for storage | |
471 | // If an item contains scripts, it's always changed. | 537 | group.AttachedAvatar = UUID.Zero; |
472 | // This ensures script state is saved on detach | 538 | |
473 | foreach (SceneObjectPart p in group.Parts) | 539 | group.ForEachPart( |
474 | if (p.Inventory.ContainsScripts()) | 540 | delegate(SceneObjectPart part) |
475 | group.HasGroupChanged = true; | 541 | { |
476 | 542 | // If there are any scripts, | |
477 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); | 543 | // then always trigger a new object and state persistence in UpdateKnownItem() |
544 | if (part.Inventory.ContainsScripts()) | ||
545 | group.HasGroupChanged = true; | ||
546 | } | ||
547 | ); | ||
548 | |||
549 | group.RootPart.SetParentLocalId(0); | ||
550 | group.RootPart.IsAttachment = false; | ||
551 | group.AbsolutePosition = group.RootPart.AttachedPos; | ||
552 | |||
553 | UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); | ||
478 | m_scene.DeleteSceneObject(group, false); | 554 | m_scene.DeleteSceneObject(group, false); |
555 | |||
479 | return; | 556 | return; |
480 | } | 557 | } |
481 | } | 558 | } |
@@ -515,7 +592,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
515 | { | 592 | { |
516 | if (!grp.HasGroupChanged) | 593 | if (!grp.HasGroupChanged) |
517 | { | 594 | { |
518 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); | 595 | m_log.DebugFormat( |
596 | "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", | ||
597 | grp.UUID, grp.GetAttachmentPoint()); | ||
598 | |||
519 | return; | 599 | return; |
520 | } | 600 | } |
521 | 601 | ||
@@ -524,6 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
524 | grp.UUID, grp.GetAttachmentPoint()); | 604 | grp.UUID, grp.GetAttachmentPoint()); |
525 | 605 | ||
526 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 606 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
607 | |||
527 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 608 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
528 | item = m_scene.InventoryService.GetItem(item); | 609 | item = m_scene.InventoryService.GetItem(item); |
529 | 610 | ||
@@ -575,12 +656,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
575 | m_scene.DeleteFromStorage(so.UUID); | 656 | m_scene.DeleteFromStorage(so.UUID); |
576 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 657 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
577 | 658 | ||
578 | so.RootPart.AttachedAvatar = avatar.UUID; | 659 | so.AttachedAvatar = avatar.UUID; |
579 | |||
580 | //Anakin Lohner bug #3839 | ||
581 | SceneObjectPart[] parts = so.Parts; | ||
582 | for (int i = 0; i < parts.Length; i++) | ||
583 | parts[i].AttachedAvatar = avatar.UUID; | ||
584 | 660 | ||
585 | if (so.RootPart.PhysActor != null) | 661 | if (so.RootPart.PhysActor != null) |
586 | { | 662 | { |
@@ -616,5 +692,97 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
616 | // it get cleaned up | 692 | // it get cleaned up |
617 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 693 | so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
618 | } | 694 | } |
695 | |||
696 | /// <summary> | ||
697 | /// Add a scene object that was previously free in the scene as an attachment to an avatar. | ||
698 | /// </summary> | ||
699 | /// <param name="remoteClient"></param> | ||
700 | /// <param name="grp"></param> | ||
701 | /// <returns>The user inventory item created that holds the attachment.</returns> | ||
702 | private InventoryItemBase AddSceneObjectAsAttachment(IClientAPI remoteClient, SceneObjectGroup grp) | ||
703 | { | ||
704 | // m_log.DebugFormat("[SCENE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId); | ||
705 | |||
706 | Vector3 inventoryStoredPosition = new Vector3 | ||
707 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
708 | ? Constants.RegionSize - 6 | ||
709 | : grp.AbsolutePosition.X) | ||
710 | , | ||
711 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) | ||
712 | ? Constants.RegionSize - 6 | ||
713 | : grp.AbsolutePosition.Y, | ||
714 | grp.AbsolutePosition.Z); | ||
715 | |||
716 | Vector3 originalPosition = grp.AbsolutePosition; | ||
717 | |||
718 | grp.AbsolutePosition = inventoryStoredPosition; | ||
719 | |||
720 | // If we're being called from a script, then trying to serialize that same script's state will not complete | ||
721 | // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if | ||
722 | // the client/server crashes rather than logging out normally, the attachment's scripts will resume | ||
723 | // without state on relog. Arguably, this is what we want anyway. | ||
724 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); | ||
725 | |||
726 | grp.AbsolutePosition = originalPosition; | ||
727 | |||
728 | AssetBase asset = m_scene.CreateAsset( | ||
729 | grp.GetPartName(grp.LocalId), | ||
730 | grp.GetPartDescription(grp.LocalId), | ||
731 | (sbyte)AssetType.Object, | ||
732 | Utils.StringToBytes(sceneObjectXml), | ||
733 | remoteClient.AgentId); | ||
734 | |||
735 | m_scene.AssetService.Store(asset); | ||
736 | |||
737 | InventoryItemBase item = new InventoryItemBase(); | ||
738 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
739 | item.CreatorData = grp.RootPart.CreatorData; | ||
740 | item.Owner = remoteClient.AgentId; | ||
741 | item.ID = UUID.Random(); | ||
742 | item.AssetID = asset.FullID; | ||
743 | item.Description = asset.Description; | ||
744 | item.Name = asset.Name; | ||
745 | item.AssetType = asset.Type; | ||
746 | item.InvType = (int)InventoryType.Object; | ||
747 | |||
748 | InventoryFolderBase folder = m_scene.InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
749 | if (folder != null) | ||
750 | item.Folder = folder.ID; | ||
751 | else // oopsies | ||
752 | item.Folder = UUID.Zero; | ||
753 | |||
754 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions()) | ||
755 | { | ||
756 | item.BasePermissions = grp.RootPart.NextOwnerMask; | ||
757 | item.CurrentPermissions = grp.RootPart.NextOwnerMask; | ||
758 | item.NextPermissions = grp.RootPart.NextOwnerMask; | ||
759 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
760 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
761 | } | ||
762 | else | ||
763 | { | ||
764 | item.BasePermissions = grp.RootPart.BaseMask; | ||
765 | item.CurrentPermissions = grp.RootPart.OwnerMask; | ||
766 | item.NextPermissions = grp.RootPart.NextOwnerMask; | ||
767 | item.EveryOnePermissions = grp.RootPart.EveryoneMask; | ||
768 | item.GroupPermissions = grp.RootPart.GroupMask; | ||
769 | } | ||
770 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
771 | |||
772 | // sets itemID so client can show item as 'attached' in inventory | ||
773 | grp.SetFromItemID(item.ID); | ||
774 | |||
775 | if (m_scene.AddInventoryItem(item)) | ||
776 | { | ||
777 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
778 | } | ||
779 | else | ||
780 | { | ||
781 | if (m_dialogModule != null) | ||
782 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
783 | } | ||
784 | |||
785 | return item; | ||
786 | } | ||
619 | } | 787 | } |
620 | } | 788 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 5bac4c6..b7d21fd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -54,11 +54,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
54 | [TestFixture] | 54 | [TestFixture] |
55 | public class AttachmentsModuleTests | 55 | public class AttachmentsModuleTests |
56 | { | 56 | { |
57 | public Scene scene; | 57 | private Scene scene; |
58 | public UUID agent1; | 58 | private AttachmentsModule m_attMod; |
59 | public static Random random; | 59 | private ScenePresence m_presence; |
60 | public AgentCircuitData acd1; | ||
61 | public SceneObjectGroup sog1, sog2; | ||
62 | 60 | ||
63 | [SetUp] | 61 | [SetUp] |
64 | public void Init() | 62 | public void Init() |
@@ -71,12 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
71 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 69 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
72 | 70 | ||
73 | scene = SceneHelpers.SetupScene(); | 71 | scene = SceneHelpers.SetupScene(); |
74 | SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); | 72 | m_attMod = new AttachmentsModule(); |
75 | 73 | SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); | |
76 | agent1 = UUID.Random(); | ||
77 | random = new Random(); | ||
78 | sog1 = NewSOG(UUID.Random(), scene, agent1); | ||
79 | sog2 = NewSOG(UUID.Random(), scene, agent1); | ||
80 | } | 74 | } |
81 | 75 | ||
82 | [TearDown] | 76 | [TearDown] |
@@ -86,31 +80,139 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
86 | // threads. Possibly, later tests should be rewritten not to worry about such things. | 80 | // threads. Possibly, later tests should be rewritten not to worry about such things. |
87 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | 81 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; |
88 | } | 82 | } |
89 | 83 | ||
84 | /// <summary> | ||
85 | /// Add the standard presence for a test. | ||
86 | /// </summary> | ||
87 | private void AddPresence() | ||
88 | { | ||
89 | UUID userId = TestHelpers.ParseTail(0x1); | ||
90 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | ||
91 | m_presence = SceneHelpers.AddScenePresence(scene, userId); | ||
92 | } | ||
93 | |||
90 | [Test] | 94 | [Test] |
91 | public void TestAddAttachments() | 95 | public void TestAddAttachmentFromGround() |
92 | { | 96 | { |
93 | TestHelpers.InMethod(); | 97 | TestHelpers.InMethod(); |
98 | // log4net.Config.XmlConfigurator.Configure(); | ||
94 | 99 | ||
95 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); | 100 | AddPresence(); |
96 | presence.AddAttachment(sog1); | 101 | string attName = "att"; |
97 | presence.AddAttachment(sog2); | ||
98 | 102 | ||
99 | Assert.That(presence.HasAttachments(), Is.True); | 103 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; |
100 | Assert.That(presence.ValidateAttachments(), Is.True); | 104 | |
105 | m_attMod.AttachObject(m_presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false); | ||
106 | |||
107 | // Check status on scene presence | ||
108 | Assert.That(m_presence.HasAttachments(), Is.True); | ||
109 | List<SceneObjectGroup> attachments = m_presence.Attachments; | ||
110 | Assert.That(attachments.Count, Is.EqualTo(1)); | ||
111 | SceneObjectGroup attSo = attachments[0]; | ||
112 | Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
113 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
114 | Assert.That(attSo.IsAttachment); | ||
115 | Assert.That(attSo.UsesPhysics, Is.False); | ||
116 | Assert.That(attSo.IsTemporary, Is.False); | ||
117 | |||
118 | // Check item status | ||
119 | Assert.That(m_presence.Appearance.GetAttachpoint( | ||
120 | attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); | ||
101 | } | 121 | } |
102 | 122 | ||
103 | [Test] | 123 | [Test] |
104 | public void TestRemoveAttachments() | 124 | public void TestAddAttachmentFromInventory() |
105 | { | 125 | { |
106 | TestHelpers.InMethod(); | 126 | TestHelpers.InMethod(); |
127 | // log4net.Config.XmlConfigurator.Configure(); | ||
128 | |||
129 | AddPresence(); | ||
107 | 130 | ||
108 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); | 131 | UUID attItemId = TestHelpers.ParseTail(0x2); |
109 | presence.AddAttachment(sog1); | 132 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
110 | presence.AddAttachment(sog2); | 133 | string attName = "att"; |
111 | presence.RemoveAttachment(sog1); | 134 | |
112 | presence.RemoveAttachment(sog2); | 135 | InventoryItemBase attItem |
113 | Assert.That(presence.HasAttachments(), Is.False); | 136 | = UserInventoryHelpers.CreateInventoryItem( |
137 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
138 | |||
139 | m_attMod.RezSingleAttachmentFromInventory( | ||
140 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | ||
141 | |||
142 | // Check status on scene presence | ||
143 | Assert.That(m_presence.HasAttachments(), Is.True); | ||
144 | List<SceneObjectGroup> attachments = m_presence.Attachments; | ||
145 | Assert.That(attachments.Count, Is.EqualTo(1)); | ||
146 | SceneObjectGroup attSo = attachments[0]; | ||
147 | Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
148 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
149 | Assert.That(attSo.IsAttachment); | ||
150 | Assert.That(attSo.UsesPhysics, Is.False); | ||
151 | Assert.That(attSo.IsTemporary, Is.False); | ||
152 | |||
153 | // Check item status | ||
154 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); | ||
155 | } | ||
156 | |||
157 | [Test] | ||
158 | public void TestDetachAttachmentToScene() | ||
159 | { | ||
160 | TestHelpers.InMethod(); | ||
161 | // log4net.Config.XmlConfigurator.Configure(); | ||
162 | |||
163 | AddPresence(); | ||
164 | |||
165 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
166 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
167 | string attName = "att"; | ||
168 | |||
169 | InventoryItemBase attItem | ||
170 | = UserInventoryHelpers.CreateInventoryItem( | ||
171 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
172 | |||
173 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( | ||
174 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | ||
175 | m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient); | ||
176 | |||
177 | // Check status on scene presence | ||
178 | Assert.That(m_presence.HasAttachments(), Is.False); | ||
179 | List<SceneObjectGroup> attachments = m_presence.Attachments; | ||
180 | Assert.That(attachments.Count, Is.EqualTo(0)); | ||
181 | |||
182 | // Check item status | ||
183 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null); | ||
184 | |||
185 | // Check object in scene | ||
186 | Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); | ||
187 | } | ||
188 | |||
189 | [Test] | ||
190 | public void TestDetachAttachmentToInventory() | ||
191 | { | ||
192 | TestHelpers.InMethod(); | ||
193 | // log4net.Config.XmlConfigurator.Configure(); | ||
194 | |||
195 | AddPresence(); | ||
196 | |||
197 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
198 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
199 | string attName = "att"; | ||
200 | |||
201 | InventoryItemBase attItem | ||
202 | = UserInventoryHelpers.CreateInventoryItem( | ||
203 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
204 | |||
205 | m_attMod.RezSingleAttachmentFromInventory( | ||
206 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | ||
207 | m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient); | ||
208 | |||
209 | // Check status on scene presence | ||
210 | Assert.That(m_presence.HasAttachments(), Is.False); | ||
211 | List<SceneObjectGroup> attachments = m_presence.Attachments; | ||
212 | Assert.That(attachments.Count, Is.EqualTo(0)); | ||
213 | |||
214 | // Check item status | ||
215 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0)); | ||
114 | } | 216 | } |
115 | 217 | ||
116 | [Test] | 218 | [Test] |
@@ -138,7 +240,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
138 | List<SceneObjectGroup> attachments = presence.Attachments; | 240 | List<SceneObjectGroup> attachments = presence.Attachments; |
139 | 241 | ||
140 | Assert.That(attachments.Count, Is.EqualTo(1)); | 242 | Assert.That(attachments.Count, Is.EqualTo(1)); |
141 | Assert.That(attachments[0].Name, Is.EqualTo(attName)); | 243 | SceneObjectGroup attSo = attachments[0]; |
244 | Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
245 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
246 | Assert.That(attSo.IsAttachment); | ||
247 | Assert.That(attSo.UsesPhysics, Is.False); | ||
248 | Assert.That(attSo.IsTemporary, Is.False); | ||
142 | } | 249 | } |
143 | 250 | ||
144 | // I'm commenting this test because scene setup NEEDS InventoryService to | 251 | // I'm commenting this test because scene setup NEEDS InventoryService to |
@@ -162,39 +269,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
162 | // //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | 269 | // //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); |
163 | // Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | 270 | // Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); |
164 | // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 271 | // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); |
165 | // } | 272 | // } |
166 | |||
167 | private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) | ||
168 | { | ||
169 | SceneObjectPart sop = new SceneObjectPart(); | ||
170 | sop.Name = RandomName(); | ||
171 | sop.Description = RandomName(); | ||
172 | sop.Text = RandomName(); | ||
173 | sop.SitName = RandomName(); | ||
174 | sop.TouchName = RandomName(); | ||
175 | sop.UUID = uuid; | ||
176 | sop.Shape = PrimitiveBaseShape.Default; | ||
177 | sop.Shape.State = 1; | ||
178 | sop.OwnerID = agent; | ||
179 | |||
180 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
181 | sog.SetScene(scene); | ||
182 | |||
183 | return sog; | ||
184 | } | ||
185 | |||
186 | private static string RandomName() | ||
187 | { | ||
188 | StringBuilder name = new StringBuilder(); | ||
189 | int size = random.Next(5,12); | ||
190 | char ch; | ||
191 | for (int i = 0; i < size; i++) | ||
192 | { | ||
193 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
194 | name.Append(ch); | ||
195 | } | ||
196 | |||
197 | return name.ToString(); | ||
198 | } | ||
199 | } | 273 | } |
200 | } \ No newline at end of file | 274 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e3d4969..b4f69e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -278,7 +278,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
278 | else | 278 | else |
279 | { | 279 | { |
280 | if (m_TransferModule != null) | 280 | if (m_TransferModule != null) |
281 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | 281 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { |
282 | // Send BulkUpdateInventory | ||
283 | IInventoryService invService = scene.InventoryService; | ||
284 | UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip | ||
285 | |||
286 | InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); | ||
287 | folder = invService.GetFolder(folder); | ||
288 | |||
289 | ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID)); | ||
290 | |||
291 | fromUser.ControllingClient.SendBulkUpdateInventory(folder); | ||
292 | }); | ||
282 | } | 293 | } |
283 | } | 294 | } |
284 | else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | 295 | else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index d647e71..22352f5 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -282,6 +282,90 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | ||
286 | /// Delivers the message to. | ||
287 | /// </summary> | ||
288 | /// <param name='target'> | ||
289 | /// Target. | ||
290 | /// </param> | ||
291 | /// <param name='channel'> | ||
292 | /// Channel. | ||
293 | /// </param> | ||
294 | /// <param name='name'> | ||
295 | /// Name. | ||
296 | /// </param> | ||
297 | /// <param name='id'> | ||
298 | /// Identifier. | ||
299 | /// </param> | ||
300 | /// <param name='msg'> | ||
301 | /// Message. | ||
302 | /// </param> | ||
303 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) | ||
304 | { | ||
305 | error = null; | ||
306 | // Is id an avatar? | ||
307 | ScenePresence sp = m_scene.GetScenePresence(target); | ||
308 | |||
309 | if (sp != null) | ||
310 | { | ||
311 | // Send message to avatar | ||
312 | if (channel == 0) | ||
313 | { | ||
314 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false); | ||
315 | } | ||
316 | |||
317 | List<SceneObjectGroup> attachments = sp.Attachments; | ||
318 | // Nothing left to do | ||
319 | if (attachments == null) | ||
320 | return true; | ||
321 | |||
322 | // Get uuid of attachments | ||
323 | List<UUID> targets = new List<UUID>(); | ||
324 | foreach ( SceneObjectGroup sog in attachments ) | ||
325 | { | ||
326 | targets.Add(sog.UUID); | ||
327 | } | ||
328 | // Need to check each attachment | ||
329 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | ||
330 | { | ||
331 | if (li.GetHostID().Equals(id)) | ||
332 | continue; | ||
333 | |||
334 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | ||
335 | continue; | ||
336 | |||
337 | if ( targets.Contains(li.GetHostID())) | ||
338 | QueueMessage(new ListenerInfo(li, name, id, msg)); | ||
339 | } | ||
340 | return true; | ||
341 | } | ||
342 | |||
343 | // Need to toss an error here | ||
344 | if (channel == 0) | ||
345 | { | ||
346 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
347 | return false; | ||
348 | } | ||
349 | |||
350 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | ||
351 | { | ||
352 | // Dont process if this message is from yourself! | ||
353 | if (li.GetHostID().Equals(id)) | ||
354 | continue; | ||
355 | |||
356 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | ||
357 | if (sPart == null) | ||
358 | continue; | ||
359 | |||
360 | if ( li.GetHostID().Equals(target)) | ||
361 | { | ||
362 | QueueMessage(new ListenerInfo(li, name, id, msg)); | ||
363 | break; | ||
364 | } | ||
365 | } | ||
366 | return true; | ||
367 | } | ||
368 | |||
285 | protected void QueueMessage(ListenerInfo li) | 369 | protected void QueueMessage(ListenerInfo li) |
286 | { | 370 | { |
287 | lock (m_pending.SyncRoot) | 371 | lock (m_pending.SyncRoot) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs index b570155..e5af1f4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs | |||
@@ -48,7 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage | |||
48 | private static bool m_Enabled = false; | 48 | private static bool m_Enabled = false; |
49 | 49 | ||
50 | private IConfigSource m_Config; | 50 | private IConfigSource m_Config; |
51 | bool m_Registered = false; | ||
52 | 51 | ||
53 | #region IRegionModule interface | 52 | #region IRegionModule interface |
54 | 53 | ||
@@ -64,9 +63,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage | |||
64 | m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled"); | 63 | m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled"); |
65 | new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService"); | 64 | new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService"); |
66 | } | 65 | } |
67 | |||
68 | } | 66 | } |
69 | |||
70 | } | 67 | } |
71 | 68 | ||
72 | public void PostInitialise() | 69 | public void PostInitialise() |
@@ -106,6 +103,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage | |||
106 | } | 103 | } |
107 | 104 | ||
108 | #endregion | 105 | #endregion |
109 | |||
110 | } | 106 | } |
111 | } | 107 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 5fa27b8..003324f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs | |||
@@ -125,7 +125,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
125 | 125 | ||
126 | bool isAuthorized = true; | 126 | bool isAuthorized = true; |
127 | message = String.Empty; | 127 | message = String.Empty; |
128 | string mail = String.Empty; | ||
129 | 128 | ||
130 | // get the scene this call is being made for | 129 | // get the scene this call is being made for |
131 | Scene scene = null; | 130 | Scene scene = null; |
@@ -144,9 +143,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
144 | { | 143 | { |
145 | UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID)); | 144 | UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID)); |
146 | 145 | ||
147 | if (account != null) | ||
148 | mail = account.Email; | ||
149 | |||
150 | isAuthorized | 146 | isAuthorized |
151 | = IsAuthorizedForRegion( | 147 | = IsAuthorizedForRegion( |
152 | userID, firstName, lastName, account.Email, scene.RegionInfo.RegionName, regionID, out message); | 148 | userID, firstName, lastName, account.Email, scene.RegionInfo.RegionName, regionID, out message); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 0c57618..65e39c0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
280 | { | 280 | { |
281 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); | 281 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); |
282 | 282 | ||
283 | UUID requestedItemId = item.ID; | 283 | // UUID requestedItemId = item.ID; |
284 | 284 | ||
285 | item = m_InventoryService.GetItem(item); | 285 | item = m_InventoryService.GetItem(item); |
286 | 286 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index e224670..6d3ace9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -61,7 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
61 | private bool m_enabled = false; | 61 | private bool m_enabled = false; |
62 | private IMapImageService m_MapService; | 62 | private IMapImageService m_MapService; |
63 | 63 | ||
64 | private string m_serverUrl = String.Empty; | ||
65 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 64 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
66 | 65 | ||
67 | private int m_refreshtime = 0; | 66 | private int m_refreshtime = 0; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index 59a407f..e2e383f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
39 | { | 39 | { |
40 | public class PresenceDetector | 40 | public class PresenceDetector |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | private IPresenceService m_PresenceService; | 44 | private IPresenceService m_PresenceService; |
45 | private Scene m_aScene; | 45 | private Scene m_aScene; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 7554e12..2117827 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -743,7 +743,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
743 | // Corner case. If an autoreturn happens during sim startup | 743 | // Corner case. If an autoreturn happens during sim startup |
744 | // we will come here with the list uninitialized | 744 | // we will come here with the list uninitialized |
745 | // | 745 | // |
746 | int landId = m_landIDList[x, y]; | 746 | // int landId = m_landIDList[x, y]; |
747 | 747 | ||
748 | // if (landId == 0) | 748 | // if (landId == 0) |
749 | // m_log.DebugFormat( | 749 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index dca842a..efede5c 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
51 | 51 | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | private Scene m_Scene; | 56 | private Scene m_Scene; |
57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | 57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 710230a..857079c 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -435,7 +435,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
435 | List<ILandObject> parcels = landChannel.AllParcels(); | 435 | List<ILandObject> parcels = landChannel.AllParcels(); |
436 | 436 | ||
437 | // Local Map Item Request | 437 | // Local Map Item Request |
438 | int tc = Environment.TickCount; | ||
439 | List<mapItemReply> mapitems = new List<mapItemReply>(); | 438 | List<mapItemReply> mapitems = new List<mapItemReply>(); |
440 | mapItemReply mapitem = new mapItemReply(); | 439 | mapItemReply mapitem = new mapItemReply(); |
441 | if ((parcels != null) && (parcels.Count >= 1)) | 440 | if ((parcels != null) && (parcels.Count >= 1)) |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 4cb3df2..86f5a0f 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -47,13 +47,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
47 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); | 47 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Attach an object to an avatar. | 50 | /// Attach an object to an avatar |
51 | /// </summary> | 51 | /// </summary> |
52 | /// <param name="controllingClient"></param> | 52 | /// <param name="remoteClient"></param> |
53 | /// <param name="localID"></param> | 53 | /// <param name="grp"></param> |
54 | /// <param name="attachPoint"></param> | 54 | /// <param name="AttachmentPt"></param> |
55 | /// <param name="rot"></param> | ||
56 | /// <param name="attachPos"></param> | ||
57 | /// <param name="silent"></param> | 55 | /// <param name="silent"></param> |
58 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 56 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
59 | bool AttachObject( | 57 | bool AttachObject( |
@@ -107,16 +105,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
107 | /// <summary> | 105 | /// <summary> |
108 | /// Detach the given item to the ground. | 106 | /// Detach the given item to the ground. |
109 | /// </summary> | 107 | /// </summary> |
110 | /// <param name="itemID"></param> | 108 | /// <param name="sceneObjectID"></param> |
111 | /// <param name="remoteClient"></param> | 109 | /// <param name="remoteClient"></param> |
112 | void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient); | 110 | void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient); |
113 | 111 | ||
114 | /// <summary> | 112 | /// <summary> |
115 | /// Update the user inventory to show a detach. | 113 | /// Detach the given item so that it remains in the user's inventory. |
116 | /// </summary> | 114 | /// </summary> |
117 | /// <param name="itemID">/param> | 115 | /// <param name="itemID">/param> |
118 | /// <param name="remoteClient"></param> | 116 | /// <param name="remoteClient"></param> |
119 | void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); | 117 | void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient); |
120 | 118 | ||
121 | /// <summary> | 119 | /// <summary> |
122 | /// Update the position of an attachment. | 120 | /// Update the position of an attachment. |
@@ -128,18 +126,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
128 | /// <summary> | 126 | /// <summary> |
129 | /// Update the user inventory with a changed attachment | 127 | /// Update the user inventory with a changed attachment |
130 | /// </summary> | 128 | /// </summary> |
131 | /// <param name="remoteClient"> | 129 | /// <param name="remoteClient"></param> |
132 | /// A <see cref="IClientAPI"/> | 130 | /// <param name="grp"></param> |
133 | /// </param> | 131 | /// <param name="itemID"></param> |
134 | /// <param name="grp"> | 132 | /// <param name="agentID"></param> |
135 | /// A <see cref="SceneObjectGroup"/> | ||
136 | /// </param> | ||
137 | /// <param name="itemID"> | ||
138 | /// A <see cref="UUID"/> | ||
139 | /// </param> | ||
140 | /// <param name="agentID"> | ||
141 | /// A <see cref="UUID"/> | ||
142 | /// </param> | ||
143 | void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); | 133 | void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); |
144 | } | 134 | } |
145 | } | 135 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs new file mode 100644 index 0000000..8cef14e --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs | |||
@@ -0,0 +1,43 @@ | |||
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 | |||
28 | using System; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures capability. | ||
35 | /// </summary> | ||
36 | public interface ISimulatorFeaturesModule | ||
37 | { | ||
38 | void AddFeature(string name, OSD value); | ||
39 | bool RemoveFeature(string name); | ||
40 | bool TryGetFeature(string name, out OSD value); | ||
41 | OSDMap GetFeatures(); | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 8da99a0..dafbf30 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -81,6 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); | 81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Delivers the message to a specified object in the region. | ||
85 | /// </summary> | ||
86 | /// <param name='target'> | ||
87 | /// Target. | ||
88 | /// </param> | ||
89 | /// <param name='channel'> | ||
90 | /// Channel. | ||
91 | /// </param> | ||
92 | /// <param name='name'> | ||
93 | /// Name. | ||
94 | /// </param> | ||
95 | /// <param name='id'> | ||
96 | /// Identifier. | ||
97 | /// </param> | ||
98 | /// <param name='msg'> | ||
99 | /// Message. | ||
100 | /// </param> | ||
101 | bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error); | ||
102 | |||
103 | /// <summary> | ||
84 | /// Are there any listen events ready to be dispatched? | 104 | /// Are there any listen events ready to be dispatched? |
85 | /// </summary> | 105 | /// </summary> |
86 | /// <returns>boolean indication</returns> | 106 | /// <returns>boolean indication</returns> |
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index 6fd38e5..213431a 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs | |||
@@ -66,12 +66,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Signals whether this entity was in a scene but has since been removed from it. | 67 | /// Signals whether this entity was in a scene but has since been removed from it. |
68 | /// </summary> | 68 | /// </summary> |
69 | public bool IsDeleted | 69 | public bool IsDeleted { get; protected internal set; } |
70 | { | ||
71 | get { return m_isDeleted; } | ||
72 | set { m_isDeleted = value; } | ||
73 | } | ||
74 | protected bool m_isDeleted; | ||
75 | 70 | ||
76 | protected Vector3 m_pos; | 71 | protected Vector3 m_pos; |
77 | 72 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 4595a29..2a76755 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -116,14 +116,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | return priority; | 116 | return priority; |
117 | } | 117 | } |
118 | 118 | ||
119 | |||
120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) | 119 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) |
121 | { | 120 | { |
122 | // And anything attached to this avatar gets top priority as well | 121 | // And anything attached to this avatar gets top priority as well |
123 | if (entity is SceneObjectPart) | 122 | if (entity is SceneObjectPart) |
124 | { | 123 | { |
125 | SceneObjectPart sop = (SceneObjectPart)entity; | 124 | SceneObjectPart sop = (SceneObjectPart)entity; |
126 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 125 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
127 | return 1; | 126 | return 1; |
128 | } | 127 | } |
129 | 128 | ||
@@ -136,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | if (entity is SceneObjectPart) | 135 | if (entity is SceneObjectPart) |
137 | { | 136 | { |
138 | SceneObjectPart sop = (SceneObjectPart)entity; | 137 | SceneObjectPart sop = (SceneObjectPart)entity; |
139 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 138 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
140 | return 1; | 139 | return 1; |
141 | } | 140 | } |
142 | 141 | ||
@@ -149,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | if (entity is SceneObjectPart) | 148 | if (entity is SceneObjectPart) |
150 | { | 149 | { |
151 | SceneObjectPart sop = (SceneObjectPart)entity; | 150 | SceneObjectPart sop = (SceneObjectPart)entity; |
152 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 151 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
153 | return 1; | 152 | return 1; |
154 | } | 153 | } |
155 | 154 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index afc1a4f..9358e7b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1871,86 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1871 | } | 1871 | } |
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) | ||
1875 | { | ||
1876 | itemID = UUID.Zero; | ||
1877 | if (grp != null) | ||
1878 | { | ||
1879 | Vector3 inventoryStoredPosition = new Vector3 | ||
1880 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1881 | ? 250 | ||
1882 | : grp.AbsolutePosition.X) | ||
1883 | , | ||
1884 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1885 | ? 250 | ||
1886 | : grp.AbsolutePosition.X, | ||
1887 | grp.AbsolutePosition.Z); | ||
1888 | |||
1889 | Vector3 originalPosition = grp.AbsolutePosition; | ||
1890 | |||
1891 | grp.AbsolutePosition = inventoryStoredPosition; | ||
1892 | |||
1893 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | ||
1894 | |||
1895 | grp.AbsolutePosition = originalPosition; | ||
1896 | |||
1897 | AssetBase asset = CreateAsset( | ||
1898 | grp.GetPartName(grp.LocalId), | ||
1899 | grp.GetPartDescription(grp.LocalId), | ||
1900 | (sbyte)AssetType.Object, | ||
1901 | Utils.StringToBytes(sceneObjectXml), | ||
1902 | remoteClient.AgentId); | ||
1903 | AssetService.Store(asset); | ||
1904 | |||
1905 | InventoryItemBase item = new InventoryItemBase(); | ||
1906 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
1907 | item.CreatorData = grp.RootPart.CreatorData; | ||
1908 | item.Owner = remoteClient.AgentId; | ||
1909 | item.ID = UUID.Random(); | ||
1910 | item.AssetID = asset.FullID; | ||
1911 | item.Description = asset.Description; | ||
1912 | item.Name = asset.Name; | ||
1913 | item.AssetType = asset.Type; | ||
1914 | item.InvType = (int)InventoryType.Object; | ||
1915 | |||
1916 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); | ||
1917 | if (folder != null) | ||
1918 | item.Folder = folder.ID; | ||
1919 | else // oopsies | ||
1920 | item.Folder = UUID.Zero; | ||
1921 | |||
1922 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
1923 | { | ||
1924 | item.BasePermissions = grp.RootPart.NextOwnerMask; | ||
1925 | item.CurrentPermissions = grp.RootPart.NextOwnerMask; | ||
1926 | item.NextPermissions = grp.RootPart.NextOwnerMask; | ||
1927 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | ||
1928 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | ||
1929 | } | ||
1930 | else | ||
1931 | { | ||
1932 | item.BasePermissions = grp.RootPart.BaseMask; | ||
1933 | item.CurrentPermissions = grp.RootPart.OwnerMask; | ||
1934 | item.NextPermissions = grp.RootPart.NextOwnerMask; | ||
1935 | item.EveryOnePermissions = grp.RootPart.EveryoneMask; | ||
1936 | item.GroupPermissions = grp.RootPart.GroupMask; | ||
1937 | } | ||
1938 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
1939 | |||
1940 | // sets itemID so client can show item as 'attached' in inventory | ||
1941 | grp.SetFromItemID(item.ID); | ||
1942 | |||
1943 | if (AddInventoryItem(item)) | ||
1944 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
1945 | else | ||
1946 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
1947 | |||
1948 | itemID = item.ID; | ||
1949 | return item.AssetID; | ||
1950 | } | ||
1951 | return UUID.Zero; | ||
1952 | } | ||
1953 | |||
1954 | /// <summary> | 1874 | /// <summary> |
1955 | /// Event Handler Rez an object into a scene | 1875 | /// Event Handler Rez an object into a scene |
1956 | /// Calls the non-void event handler | 1876 | /// Calls the non-void event handler |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fe96152..fada688 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -147,15 +147,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | return false; | 147 | return false; |
148 | } | 148 | } |
149 | 149 | ||
150 | /// <value> | 150 | /// <summary> |
151 | /// Is this scene object acting as an attachment? | 151 | /// Is this scene object acting as an attachment? |
152 | /// | 152 | /// </summary> |
153 | /// <remarks> | ||
153 | /// We return false if the group has already been deleted. | 154 | /// We return false if the group has already been deleted. |
154 | /// | 155 | /// |
155 | /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I | 156 | /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I |
156 | /// presume either all or no parts in a linkset can be part of an attachment (in which | 157 | /// presume either all or no parts in a linkset can be part of an attachment (in which |
157 | /// case the value would get proprogated down into all the descendent parts). | 158 | /// case the value would get proprogated down into all the descendent parts). |
158 | /// </value> | 159 | /// </remarks> |
159 | public bool IsAttachment | 160 | public bool IsAttachment |
160 | { | 161 | { |
161 | get | 162 | get |
@@ -167,6 +168,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | } | 168 | } |
168 | } | 169 | } |
169 | 170 | ||
171 | /// <summary> | ||
172 | /// The avatar to which this scene object is attached. | ||
173 | /// </summary> | ||
174 | /// <remarks> | ||
175 | /// If we're not attached to an avatar then this is UUID.Zero | ||
176 | /// </remarks> | ||
177 | public UUID AttachedAvatar { get; set; } | ||
178 | |||
179 | /// <summary> | ||
180 | /// Is this scene object phantom? | ||
181 | /// </summary> | ||
182 | /// <remarks> | ||
183 | /// Updating must currently take place through UpdatePrimFlags() | ||
184 | /// </remarks> | ||
185 | public bool IsPhantom | ||
186 | { | ||
187 | get { return (RootPart.Flags & PrimFlags.Phantom) != 0; } | ||
188 | } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Does this scene object use physics? | ||
192 | /// </summary> | ||
193 | /// <remarks> | ||
194 | /// Updating must currently take place through UpdatePrimFlags() | ||
195 | /// </remarks> | ||
196 | public bool UsesPhysics | ||
197 | { | ||
198 | get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } | ||
199 | } | ||
200 | |||
201 | /// <summary> | ||
202 | /// Is this scene object temporary? | ||
203 | /// </summary> | ||
204 | /// <remarks> | ||
205 | /// Updating must currently take place through UpdatePrimFlags() | ||
206 | /// </remarks> | ||
207 | public bool IsTemporary | ||
208 | { | ||
209 | get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } | ||
210 | } | ||
211 | |||
212 | public bool IsVolumeDetect | ||
213 | { | ||
214 | get { return RootPart.VolumeDetectActive; } | ||
215 | } | ||
216 | |||
170 | public float scriptScore; | 217 | public float scriptScore; |
171 | 218 | ||
172 | private Vector3 lastPhysGroupPos; | 219 | private Vector3 lastPhysGroupPos; |
@@ -940,68 +987,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
940 | return m_rootPart.Shape.State; | 987 | return m_rootPart.Shape.State; |
941 | } | 988 | } |
942 | 989 | ||
943 | public void ClearPartAttachmentData() | 990 | public void SetAttachmentPoint(byte point) |
944 | { | ||
945 | SetAttachmentPoint((Byte)0); | ||
946 | } | ||
947 | |||
948 | public void DetachToGround() | ||
949 | { | 991 | { |
950 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); | ||
951 | if (avatar == null) | ||
952 | return; | ||
953 | |||
954 | avatar.RemoveAttachment(this); | ||
955 | |||
956 | Vector3 detachedpos = new Vector3(127f,127f,127f); | ||
957 | if (avatar == null) | ||
958 | return; | ||
959 | |||
960 | detachedpos = avatar.AbsolutePosition; | ||
961 | RootPart.FromItemID = UUID.Zero; | ||
962 | |||
963 | AbsolutePosition = detachedpos; | ||
964 | m_rootPart.AttachedAvatar = UUID.Zero; | ||
965 | |||
966 | SceneObjectPart[] parts = m_parts.GetArray(); | 992 | SceneObjectPart[] parts = m_parts.GetArray(); |
967 | for (int i = 0; i < parts.Length; i++) | 993 | for (int i = 0; i < parts.Length; i++) |
968 | parts[i].AttachedAvatar = UUID.Zero; | 994 | parts[i].SetAttachmentPoint(point); |
969 | |||
970 | m_rootPart.SetParentLocalId(0); | ||
971 | SetAttachmentPoint((byte)0); | ||
972 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); | ||
973 | HasGroupChanged = true; | ||
974 | RootPart.Rezzed = DateTime.Now; | ||
975 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
976 | AttachToBackup(); | ||
977 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
978 | m_rootPart.ScheduleFullUpdate(); | ||
979 | m_rootPart.ClearUndoState(); | ||
980 | } | 995 | } |
981 | 996 | ||
982 | public void DetachToInventoryPrep() | 997 | public void ClearPartAttachmentData() |
983 | { | 998 | { |
984 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); | 999 | SetAttachmentPoint((Byte)0); |
985 | //Vector3 detachedpos = new Vector3(127f, 127f, 127f); | ||
986 | if (avatar != null) | ||
987 | { | ||
988 | //detachedpos = avatar.AbsolutePosition; | ||
989 | avatar.RemoveAttachment(this); | ||
990 | } | ||
991 | |||
992 | m_rootPart.AttachedAvatar = UUID.Zero; | ||
993 | |||
994 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
995 | for (int i = 0; i < parts.Length; i++) | ||
996 | parts[i].AttachedAvatar = UUID.Zero; | ||
997 | |||
998 | m_rootPart.SetParentLocalId(0); | ||
999 | //m_rootPart.SetAttachmentPoint((byte)0); | ||
1000 | m_rootPart.IsAttachment = false; | ||
1001 | AbsolutePosition = m_rootPart.AttachedPos; | ||
1002 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); | ||
1003 | //AttachToBackup(); | ||
1004 | //m_rootPart.ScheduleFullUpdate(); | ||
1005 | } | 1000 | } |
1006 | 1001 | ||
1007 | /// <summary> | 1002 | /// <summary> |
@@ -1510,36 +1505,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1510 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); | 1505 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); |
1511 | } | 1506 | } |
1512 | 1507 | ||
1513 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 1508 | public void ScriptSetPhysicsStatus(bool usePhysics) |
1514 | { | 1509 | { |
1515 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | 1510 | UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); |
1516 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1517 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1518 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); | ||
1519 | } | 1511 | } |
1520 | 1512 | ||
1521 | public void ScriptSetTemporaryStatus(bool TemporaryStatus) | 1513 | public void ScriptSetTemporaryStatus(bool makeTemporary) |
1522 | { | 1514 | { |
1523 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1515 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); |
1524 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1525 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1526 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, TemporaryStatus, IsPhantom, IsVolumeDetect); | ||
1527 | } | 1516 | } |
1528 | 1517 | ||
1529 | public void ScriptSetPhantomStatus(bool PhantomStatus) | 1518 | public void ScriptSetPhantomStatus(bool makePhantom) |
1530 | { | 1519 | { |
1531 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1520 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); |
1532 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | ||
1533 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1534 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus, IsVolumeDetect); | ||
1535 | } | 1521 | } |
1536 | 1522 | ||
1537 | public void ScriptSetVolumeDetect(bool VDStatus) | 1523 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) |
1538 | { | 1524 | { |
1539 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1525 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); |
1540 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | ||
1541 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1542 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, VDStatus); | ||
1543 | 1526 | ||
1544 | /* | 1527 | /* |
1545 | ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore | 1528 | ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore |
@@ -1565,7 +1548,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1565 | { | 1548 | { |
1566 | if (IsAttachment) | 1549 | if (IsAttachment) |
1567 | { | 1550 | { |
1568 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | 1551 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1569 | if (avatar != null) | 1552 | if (avatar != null) |
1570 | { | 1553 | { |
1571 | avatar.PushForce(impulse); | 1554 | avatar.PushForce(impulse); |
@@ -1647,7 +1630,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1647 | { | 1630 | { |
1648 | if (IsAttachment) | 1631 | if (IsAttachment) |
1649 | { | 1632 | { |
1650 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | 1633 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1651 | if (avatar != null) | 1634 | if (avatar != null) |
1652 | { | 1635 | { |
1653 | avatar.MoveToTarget(target, false); | 1636 | avatar.MoveToTarget(target, false); |
@@ -1806,7 +1789,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1806 | // an object has been deleted from a scene before update was processed. | 1789 | // an object has been deleted from a scene before update was processed. |
1807 | // A more fundamental overhaul of the update mechanism is required to eliminate all | 1790 | // A more fundamental overhaul of the update mechanism is required to eliminate all |
1808 | // the race conditions. | 1791 | // the race conditions. |
1809 | if (m_isDeleted) | 1792 | if (IsDeleted) |
1810 | return; | 1793 | return; |
1811 | 1794 | ||
1812 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) | 1795 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) |
@@ -2116,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2116 | } | 2099 | } |
2117 | 2100 | ||
2118 | m_scene.UnlinkSceneObject(objectGroup, true); | 2101 | m_scene.UnlinkSceneObject(objectGroup, true); |
2119 | objectGroup.m_isDeleted = true; | 2102 | objectGroup.IsDeleted = true; |
2120 | 2103 | ||
2121 | objectGroup.m_parts.Clear(); | 2104 | objectGroup.m_parts.Clear(); |
2122 | 2105 | ||
@@ -3347,19 +3330,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3347 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 3330 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |
3348 | } | 3331 | } |
3349 | 3332 | ||
3350 | public void SetAttachmentPoint(byte point) | ||
3351 | { | ||
3352 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
3353 | for (int i = 0; i < parts.Length; i++) | ||
3354 | parts[i].SetAttachmentPoint(point); | ||
3355 | } | ||
3356 | |||
3357 | #region ISceneObject | 3333 | #region ISceneObject |
3358 | 3334 | ||
3359 | public virtual ISceneObject CloneForNewScene() | 3335 | public virtual ISceneObject CloneForNewScene() |
3360 | { | 3336 | { |
3361 | SceneObjectGroup sog = Copy(false); | 3337 | SceneObjectGroup sog = Copy(false); |
3362 | sog.m_isDeleted = false; | 3338 | sog.IsDeleted = false; |
3363 | return sog; | 3339 | return sog; |
3364 | } | 3340 | } |
3365 | 3341 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a0e87d0..e510611 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -221,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
221 | public scriptEvents AggregateScriptEvents; | 221 | public scriptEvents AggregateScriptEvents; |
222 | 222 | ||
223 | 223 | ||
224 | public UUID AttachedAvatar; | ||
225 | |||
226 | |||
227 | public Vector3 AttachedPos; | 224 | public Vector3 AttachedPos; |
228 | 225 | ||
229 | 226 | ||
@@ -728,7 +725,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
728 | 725 | ||
729 | if (IsAttachment) | 726 | if (IsAttachment) |
730 | { | 727 | { |
731 | ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); | 728 | ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); |
732 | if (sp != null) | 729 | if (sp != null) |
733 | return sp.AbsolutePosition; | 730 | return sp.AbsolutePosition; |
734 | } | 731 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 719f2da..fc89473 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3509,12 +3509,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3509 | public void RemoveAttachment(SceneObjectGroup gobj) | 3509 | public void RemoveAttachment(SceneObjectGroup gobj) |
3510 | { | 3510 | { |
3511 | lock (m_attachments) | 3511 | lock (m_attachments) |
3512 | { | 3512 | m_attachments.Remove(gobj); |
3513 | if (m_attachments.Contains(gobj)) | ||
3514 | { | ||
3515 | m_attachments.Remove(gobj); | ||
3516 | } | ||
3517 | } | ||
3518 | } | 3513 | } |
3519 | 3514 | ||
3520 | public bool ValidateAttachments() | 3515 | public bool ValidateAttachments() |
@@ -3525,12 +3520,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3525 | foreach (SceneObjectGroup gobj in m_attachments) | 3520 | foreach (SceneObjectGroup gobj in m_attachments) |
3526 | { | 3521 | { |
3527 | if (gobj == null) | 3522 | if (gobj == null) |
3523 | { | ||
3524 | m_log.WarnFormat( | ||
3525 | "[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null", Name); | ||
3528 | return false; | 3526 | return false; |
3527 | } | ||
3529 | 3528 | ||
3530 | if (gobj.IsDeleted) | 3529 | if (gobj.IsDeleted) |
3530 | { | ||
3531 | m_log.WarnFormat( | ||
3532 | "[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted", | ||
3533 | gobj.Name, gobj.UUID, Name); | ||
3531 | return false; | 3534 | return false; |
3535 | } | ||
3532 | } | 3536 | } |
3533 | } | 3537 | } |
3538 | |||
3534 | return true; | 3539 | return true; |
3535 | } | 3540 | } |
3536 | 3541 | ||
@@ -3804,9 +3809,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3804 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); | 3809 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); |
3805 | foreach (AvatarAttachment attach in attachments) | 3810 | foreach (AvatarAttachment attach in attachments) |
3806 | { | 3811 | { |
3807 | if (m_isDeleted) | ||
3808 | return; | ||
3809 | |||
3810 | int p = attach.AttachPoint; | 3812 | int p = attach.AttachPoint; |
3811 | UUID itemID = attach.ItemID; | 3813 | UUID itemID = attach.ItemID; |
3812 | 3814 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 8fb9fad..a60ee9b 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -127,26 +127,36 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
127 | /// <returns></returns> | 127 | /// <returns></returns> |
128 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) | 128 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) |
129 | { | 129 | { |
130 | return ToOriginalXmlFormat(sceneObject, true); | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Serialize a scene object to the original xml format | ||
135 | /// </summary> | ||
136 | /// <param name="sceneObject"></param> | ||
137 | /// <param name="doScriptStates">Control whether script states are also serialized.</para> | ||
138 | /// <returns></returns> | ||
139 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates) | ||
140 | { | ||
130 | using (StringWriter sw = new StringWriter()) | 141 | using (StringWriter sw = new StringWriter()) |
131 | { | 142 | { |
132 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 143 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
133 | { | 144 | { |
134 | ToOriginalXmlFormat(sceneObject, writer); | 145 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates); |
135 | } | 146 | } |
136 | 147 | ||
137 | return sw.ToString(); | 148 | return sw.ToString(); |
138 | } | 149 | } |
139 | } | 150 | } |
140 | |||
141 | 151 | ||
142 | /// <summary> | 152 | /// <summary> |
143 | /// Serialize a scene object to the original xml format | 153 | /// Serialize a scene object to the original xml format |
144 | /// </summary> | 154 | /// </summary> |
145 | /// <param name="sceneObject"></param> | 155 | /// <param name="sceneObject"></param> |
146 | /// <returns></returns> | 156 | /// <returns></returns> |
147 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) | 157 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates) |
148 | { | 158 | { |
149 | ToOriginalXmlFormat(sceneObject, writer, false); | 159 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); |
150 | } | 160 | } |
151 | 161 | ||
152 | /// <summary> | 162 | /// <summary> |
@@ -156,10 +166,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
156 | /// <param name="writer"></param> | 166 | /// <param name="writer"></param> |
157 | /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> | 167 | /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> |
158 | /// <returns></returns> | 168 | /// <returns></returns> |
159 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement) | 169 | public static void ToOriginalXmlFormat( |
170 | SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement) | ||
160 | { | 171 | { |
161 | //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); | 172 | // m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name); |
162 | //int time = System.Environment.TickCount; | 173 | // int time = System.Environment.TickCount; |
163 | 174 | ||
164 | if (!noRootElement) | 175 | if (!noRootElement) |
165 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 176 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
@@ -182,12 +193,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
182 | } | 193 | } |
183 | 194 | ||
184 | writer.WriteEndElement(); // OtherParts | 195 | writer.WriteEndElement(); // OtherParts |
185 | sceneObject.SaveScriptedState(writer); | 196 | |
197 | if (doScriptStates) | ||
198 | sceneObject.SaveScriptedState(writer); | ||
186 | 199 | ||
187 | if (!noRootElement) | 200 | if (!noRootElement) |
188 | writer.WriteEndElement(); // SceneObjectGroup | 201 | writer.WriteEndElement(); // SceneObjectGroup |
189 | 202 | ||
190 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | 203 | // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); |
191 | } | 204 | } |
192 | 205 | ||
193 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) | 206 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 8b7871b..0cc0fe7 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -58,7 +58,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
58 | /// </summary> | 58 | /// </summary> |
59 | public interface IScriptInstance | 59 | public interface IScriptInstance |
60 | { | 60 | { |
61 | /// <summary> | ||
62 | /// Is this script currently running? | ||
63 | /// </summary> | ||
61 | bool Running { get; set; } | 64 | bool Running { get; set; } |
65 | |||
62 | bool ShuttingDown { get; set; } | 66 | bool ShuttingDown { get; set; } |
63 | string State { get; set; } | 67 | string State { get; set; } |
64 | IScriptEngine Engine { get; } | 68 | IScriptEngine Engine { get; } |
@@ -78,7 +82,14 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
78 | 82 | ||
79 | void Init(); | 83 | void Init(); |
80 | void Start(); | 84 | void Start(); |
85 | |||
86 | /// <summary> | ||
87 | /// Stop the script. | ||
88 | /// </summary> | ||
89 | /// <param name="timeout"></param> | ||
90 | /// <returns>true if the script was successfully stopped, false otherwise</returns> | ||
81 | bool Stop(int timeout); | 91 | bool Stop(int timeout); |
92 | |||
82 | void SetState(string state); | 93 | void SetState(string state); |
83 | 94 | ||
84 | void PostEvent(EventParams data); | 95 | void PostEvent(EventParams data); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c84afee..81f1f38 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -843,6 +843,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
843 | wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); | 843 | wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); |
844 | } | 844 | } |
845 | 845 | ||
846 | public void llRegionSayTo(string target, int channel, string msg) | ||
847 | { | ||
848 | string error = String.Empty; | ||
849 | |||
850 | if (msg.Length > 1023) | ||
851 | msg = msg.Substring(0, 1023); | ||
852 | |||
853 | m_host.AddScriptLPS(1); | ||
854 | |||
855 | UUID TargetID; | ||
856 | UUID.TryParse(target, out TargetID); | ||
857 | |||
858 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
859 | if (wComm != null) | ||
860 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) | ||
861 | LSLError(error); | ||
862 | } | ||
863 | |||
846 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 864 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |
847 | { | 865 | { |
848 | m_host.AddScriptLPS(1); | 866 | m_host.AddScriptLPS(1); |
@@ -1601,9 +1619,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1601 | tex.FaceTextures[i].RGBA = texcolor; | 1619 | tex.FaceTextures[i].RGBA = texcolor; |
1602 | } | 1620 | } |
1603 | } | 1621 | } |
1604 | texcolor = tex.DefaultTexture.RGBA; | 1622 | |
1605 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); | 1623 | // In some cases, the default texture can be null, eg when every face |
1606 | tex.DefaultTexture.RGBA = texcolor; | 1624 | // has a unique texture |
1625 | if (tex.DefaultTexture != null) | ||
1626 | { | ||
1627 | texcolor = tex.DefaultTexture.RGBA; | ||
1628 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); | ||
1629 | tex.DefaultTexture.RGBA = texcolor; | ||
1630 | } | ||
1631 | |||
1607 | part.UpdateTexture(tex); | 1632 | part.UpdateTexture(tex); |
1608 | return; | 1633 | return; |
1609 | } | 1634 | } |
@@ -2074,7 +2099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2074 | { | 2099 | { |
2075 | if (part.ParentGroup.RootPart.AttachmentPoint != 0) | 2100 | if (part.ParentGroup.RootPart.AttachmentPoint != 0) |
2076 | { | 2101 | { |
2077 | ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); | 2102 | ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); |
2078 | if (avatar != null) | 2103 | if (avatar != null) |
2079 | { | 2104 | { |
2080 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 2105 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
@@ -2218,7 +2243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2218 | 2243 | ||
2219 | if (m_host.IsAttachment) | 2244 | if (m_host.IsAttachment) |
2220 | { | 2245 | { |
2221 | ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar); | 2246 | ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); |
2222 | vel = avatar.Velocity; | 2247 | vel = avatar.Velocity; |
2223 | } | 2248 | } |
2224 | else | 2249 | else |
@@ -2939,8 +2964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2939 | { | 2964 | { |
2940 | m_host.AddScriptLPS(1); | 2965 | m_host.AddScriptLPS(1); |
2941 | 2966 | ||
2942 | if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) | 2967 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) |
2943 | return; | 2968 | // return; |
2944 | 2969 | ||
2945 | TaskInventoryItem item; | 2970 | TaskInventoryItem item; |
2946 | 2971 | ||
@@ -3006,7 +3031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3006 | 3031 | ||
3007 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3032 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3008 | if (attachmentsModule != null) | 3033 | if (attachmentsModule != null) |
3009 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | 3034 | attachmentsModule.DetachSingleAttachmentToInv(itemID, presence.ControllingClient); |
3010 | } | 3035 | } |
3011 | 3036 | ||
3012 | public void llTakeCamera(string avatar) | 3037 | public void llTakeCamera(string avatar) |
@@ -3363,7 +3388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3363 | 3388 | ||
3364 | m_host.AddScriptLPS(1); | 3389 | m_host.AddScriptLPS(1); |
3365 | 3390 | ||
3366 | if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.RootPart.AttachedAvatar) | 3391 | if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) |
3367 | { | 3392 | { |
3368 | // When attached, certain permissions are implicit if requested from owner | 3393 | // When attached, certain permissions are implicit if requested from owner |
3369 | int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | | 3394 | int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | |
@@ -3909,7 +3934,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3909 | GridInstantMessage msg = new GridInstantMessage(World, | 3934 | GridInstantMessage msg = new GridInstantMessage(World, |
3910 | m_host.UUID, m_host.Name+", an object owned by "+ | 3935 | m_host.UUID, m_host.Name+", an object owned by "+ |
3911 | resolveName(m_host.OwnerID)+",", destId, | 3936 | resolveName(m_host.OwnerID)+",", destId, |
3912 | (byte)InstantMessageDialog.InventoryOffered, | 3937 | (byte)InstantMessageDialog.TaskInventoryOffered, |
3913 | false, objName+"\n"+m_host.Name+" is located at "+ | 3938 | false, objName+"\n"+m_host.Name+" is located at "+ |
3914 | World.RegionInfo.RegionName+" "+ | 3939 | World.RegionInfo.RegionName+" "+ |
3915 | m_host.AbsolutePosition.ToString(), | 3940 | m_host.AbsolutePosition.ToString(), |
@@ -6583,7 +6608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6583 | return Util.SHA1Hash(src).ToLower(); | 6608 | return Util.SHA1Hash(src).ToLower(); |
6584 | } | 6609 | } |
6585 | 6610 | ||
6586 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) | 6611 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) |
6587 | { | 6612 | { |
6588 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 6613 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
6589 | 6614 | ||
@@ -6594,7 +6619,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6594 | { | 6619 | { |
6595 | holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; | 6620 | holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; |
6596 | } | 6621 | } |
6597 | shapeBlock.ProfileCurve = (byte)holeshape; | 6622 | shapeBlock.PathCurve = pathcurve; |
6623 | shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape. | ||
6624 | shapeBlock.ProfileCurve += profileshape; // Add in the profile shape. | ||
6598 | if (cut.x < 0f) | 6625 | if (cut.x < 0f) |
6599 | { | 6626 | { |
6600 | cut.x = 0f; | 6627 | cut.x = 0f; |
@@ -6626,9 +6653,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6626 | { | 6653 | { |
6627 | hollow = 0f; | 6654 | hollow = 0f; |
6628 | } | 6655 | } |
6629 | if (hollow > 0.95) | 6656 | // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a |
6657 | // Box or Tube) and the hole shape is a square, hollow is limited to | ||
6658 | // a max of 70%. The viewer performs its own check on this value but | ||
6659 | // we need to do it here also so llGetPrimitiveParams can have access | ||
6660 | // to the correct value. | ||
6661 | if (profileshape != (byte)ProfileCurve.Square && | ||
6662 | holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE) | ||
6630 | { | 6663 | { |
6631 | hollow = 0.95f; | 6664 | if (hollow > 0.70f) |
6665 | { | ||
6666 | hollow = 0.70f; | ||
6667 | } | ||
6668 | } | ||
6669 | // Otherwise, hollow is limited to 95%. | ||
6670 | else | ||
6671 | { | ||
6672 | if (hollow > 0.95f) | ||
6673 | { | ||
6674 | hollow = 0.95f; | ||
6675 | } | ||
6632 | } | 6676 | } |
6633 | shapeBlock.ProfileHollow = (ushort)(50000 * hollow); | 6677 | shapeBlock.ProfileHollow = (ushort)(50000 * hollow); |
6634 | if (twist.x < -1.0f) | 6678 | if (twist.x < -1.0f) |
@@ -6652,20 +6696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6652 | 6696 | ||
6653 | shapeBlock.ObjectLocalID = part.LocalId; | 6697 | shapeBlock.ObjectLocalID = part.LocalId; |
6654 | 6698 | ||
6655 | // retain pathcurve | ||
6656 | shapeBlock.PathCurve = part.Shape.PathCurve; | ||
6657 | |||
6658 | part.Shape.SculptEntry = false; | 6699 | part.Shape.SculptEntry = false; |
6659 | return shapeBlock; | 6700 | return shapeBlock; |
6660 | } | 6701 | } |
6661 | 6702 | ||
6662 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) | 6703 | // Prim type box, cylinder and prism. |
6704 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve) | ||
6663 | { | 6705 | { |
6664 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6706 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6665 | 6707 | ||
6666 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6708 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); |
6667 | |||
6668 | shapeBlock.ProfileCurve += fudge; | ||
6669 | 6709 | ||
6670 | if (taper_b.x < 0f) | 6710 | if (taper_b.x < 0f) |
6671 | { | 6711 | { |
@@ -6708,18 +6748,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6708 | part.UpdateShape(shapeBlock); | 6748 | part.UpdateShape(shapeBlock); |
6709 | } | 6749 | } |
6710 | 6750 | ||
6711 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) | 6751 | // Prim type sphere. |
6752 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve) | ||
6712 | { | 6753 | { |
6713 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6754 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6714 | 6755 | ||
6715 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6756 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); |
6716 | 6757 | ||
6717 | // profile/path swapped for a sphere | 6758 | // profile/path swapped for a sphere |
6718 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 6759 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
6719 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; | 6760 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; |
6720 | 6761 | ||
6721 | shapeBlock.ProfileCurve += fudge; | ||
6722 | |||
6723 | shapeBlock.PathScaleX = 100; | 6762 | shapeBlock.PathScaleX = 100; |
6724 | shapeBlock.PathScaleY = 100; | 6763 | shapeBlock.PathScaleY = 100; |
6725 | 6764 | ||
@@ -6750,13 +6789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6750 | part.UpdateShape(shapeBlock); | 6789 | part.UpdateShape(shapeBlock); |
6751 | } | 6790 | } |
6752 | 6791 | ||
6753 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) | 6792 | // Prim type torus, tube and ring. |
6793 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve) | ||
6754 | { | 6794 | { |
6755 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6795 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6756 | 6796 | ||
6757 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6797 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); |
6758 | |||
6759 | shapeBlock.ProfileCurve += fudge; | ||
6760 | 6798 | ||
6761 | // profile/path swapped for a torrus, tube, ring | 6799 | // profile/path swapped for a torrus, tube, ring |
6762 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 6800 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
@@ -6876,7 +6914,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6876 | part.UpdateShape(shapeBlock); | 6914 | part.UpdateShape(shapeBlock); |
6877 | } | 6915 | } |
6878 | 6916 | ||
6879 | protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) | 6917 | // Prim type sculpt. |
6918 | protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve) | ||
6880 | { | 6919 | { |
6881 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 6920 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
6882 | UUID sculptId; | 6921 | UUID sculptId; |
@@ -6889,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6889 | if (sculptId == UUID.Zero) | 6928 | if (sculptId == UUID.Zero) |
6890 | return; | 6929 | return; |
6891 | 6930 | ||
6931 | shapeBlock.PathCurve = pathcurve; | ||
6892 | shapeBlock.ObjectLocalID = part.LocalId; | 6932 | shapeBlock.ObjectLocalID = part.LocalId; |
6893 | shapeBlock.PathScaleX = 100; | 6933 | shapeBlock.PathScaleX = 100; |
6894 | shapeBlock.PathScaleY = 150; | 6934 | shapeBlock.PathScaleY = 150; |
@@ -6902,9 +6942,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6902 | type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; | 6942 | type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; |
6903 | } | 6943 | } |
6904 | 6944 | ||
6905 | // retain pathcurve | ||
6906 | shapeBlock.PathCurve = part.Shape.PathCurve; | ||
6907 | |||
6908 | part.Shape.SetSculptProperties((byte)type, sculptId); | 6945 | part.Shape.SetSculptProperties((byte)type, sculptId); |
6909 | part.Shape.SculptEntry = true; | 6946 | part.Shape.SculptEntry = true; |
6910 | part.UpdateShape(shapeBlock); | 6947 | part.UpdateShape(shapeBlock); |
@@ -7028,8 +7065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7028 | taper_b = rules.GetVector3Item(idx++); | 7065 | taper_b = rules.GetVector3Item(idx++); |
7029 | topshear = rules.GetVector3Item(idx++); | 7066 | topshear = rules.GetVector3Item(idx++); |
7030 | 7067 | ||
7031 | part.Shape.PathCurve = (byte)Extrusion.Straight; | 7068 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7032 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); | 7069 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); |
7033 | break; | 7070 | break; |
7034 | 7071 | ||
7035 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 7072 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
@@ -7042,9 +7079,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7042 | twist = rules.GetVector3Item(idx++); | 7079 | twist = rules.GetVector3Item(idx++); |
7043 | taper_b = rules.GetVector3Item(idx++); | 7080 | taper_b = rules.GetVector3Item(idx++); |
7044 | topshear = rules.GetVector3Item(idx++); | 7081 | topshear = rules.GetVector3Item(idx++); |
7045 | part.Shape.ProfileShape = ProfileShape.Circle; | 7082 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7046 | part.Shape.PathCurve = (byte)Extrusion.Straight; | 7083 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); |
7047 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0); | ||
7048 | break; | 7084 | break; |
7049 | 7085 | ||
7050 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 7086 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
@@ -7057,8 +7093,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7057 | twist = rules.GetVector3Item(idx++); | 7093 | twist = rules.GetVector3Item(idx++); |
7058 | taper_b = rules.GetVector3Item(idx++); | 7094 | taper_b = rules.GetVector3Item(idx++); |
7059 | topshear = rules.GetVector3Item(idx++); | 7095 | topshear = rules.GetVector3Item(idx++); |
7060 | part.Shape.PathCurve = (byte)Extrusion.Straight; | 7096 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7061 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); | 7097 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); |
7062 | break; | 7098 | break; |
7063 | 7099 | ||
7064 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 7100 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: |
@@ -7070,8 +7106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7070 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7106 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7071 | twist = rules.GetVector3Item(idx++); | 7107 | twist = rules.GetVector3Item(idx++); |
7072 | taper_b = rules.GetVector3Item(idx++); // dimple | 7108 | taper_b = rules.GetVector3Item(idx++); // dimple |
7073 | part.Shape.PathCurve = (byte)Extrusion.Curve1; | 7109 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, |
7074 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); | 7110 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); |
7075 | break; | 7111 | break; |
7076 | 7112 | ||
7077 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 7113 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: |
@@ -7089,9 +7125,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7089 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7125 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7090 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7126 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7091 | skew = (float)rules.GetLSLFloatItem(idx++); | 7127 | skew = (float)rules.GetLSLFloatItem(idx++); |
7092 | part.Shape.PathCurve = (byte)Extrusion.Curve1; | ||
7093 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7128 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7094 | revolutions, radiusoffset, skew, 0); | 7129 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); |
7095 | break; | 7130 | break; |
7096 | 7131 | ||
7097 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 7132 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
@@ -7109,9 +7144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7109 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7144 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7110 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7145 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7111 | skew = (float)rules.GetLSLFloatItem(idx++); | 7146 | skew = (float)rules.GetLSLFloatItem(idx++); |
7112 | part.Shape.PathCurve = (byte)Extrusion.Curve1; | ||
7113 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7147 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7114 | revolutions, radiusoffset, skew, 1); | 7148 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); |
7115 | break; | 7149 | break; |
7116 | 7150 | ||
7117 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 7151 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
@@ -7129,9 +7163,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7129 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7163 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7130 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7164 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7131 | skew = (float)rules.GetLSLFloatItem(idx++); | 7165 | skew = (float)rules.GetLSLFloatItem(idx++); |
7132 | part.Shape.PathCurve = (byte)Extrusion.Curve1; | ||
7133 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7166 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7134 | revolutions, radiusoffset, skew, 3); | 7167 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); |
7135 | break; | 7168 | break; |
7136 | 7169 | ||
7137 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 7170 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
@@ -7140,8 +7173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7140 | 7173 | ||
7141 | string map = rules.Data[idx++].ToString(); | 7174 | string map = rules.Data[idx++].ToString(); |
7142 | face = (int)rules.GetLSLIntegerItem(idx++); // type | 7175 | face = (int)rules.GetLSLIntegerItem(idx++); // type |
7143 | part.Shape.PathCurve = (byte)Extrusion.Curve1; | 7176 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); |
7144 | SetPrimitiveShapeParams(part, map, face); | ||
7145 | break; | 7177 | break; |
7146 | } | 7178 | } |
7147 | 7179 | ||
@@ -7428,7 +7460,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7428 | Quaternion q; | 7460 | Quaternion q; |
7429 | if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) | 7461 | if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) |
7430 | { | 7462 | { |
7431 | ScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar); | 7463 | ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); |
7432 | if (avatar != null) | 7464 | if (avatar != null) |
7433 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 7465 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
7434 | q = avatar.CameraRotation; // Mouselook | 7466 | q = avatar.CameraRotation; // Mouselook |
@@ -10486,12 +10518,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10486 | NotImplemented("llGetUsedMemory"); | 10518 | NotImplemented("llGetUsedMemory"); |
10487 | } | 10519 | } |
10488 | 10520 | ||
10489 | public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg) | ||
10490 | { | ||
10491 | m_host.AddScriptLPS(1); | ||
10492 | NotImplemented("llRegionSayTo"); | ||
10493 | } | ||
10494 | |||
10495 | public void llScriptProfiler(LSL_Integer flags) | 10521 | public void llScriptProfiler(LSL_Integer flags) |
10496 | { | 10522 | { |
10497 | m_host.AddScriptLPS(1); | 10523 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index e53a61a..bf74760 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
308 | // In attachments, the sensor cone always orients with the | 308 | // In attachments, the sensor cone always orients with the |
309 | // avatar rotation. This may include a nonzero elevation if | 309 | // avatar rotation. This may include a nonzero elevation if |
310 | // in mouselook. | 310 | // in mouselook. |
311 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); | 311 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
312 | q = avatar.Rotation; | 312 | q = avatar.Rotation; |
313 | } | 313 | } |
314 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 314 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
@@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
428 | // In attachments, the sensor cone always orients with the | 428 | // In attachments, the sensor cone always orients with the |
429 | // avatar rotation. This may include a nonzero elevation if | 429 | // avatar rotation. This may include a nonzero elevation if |
430 | // in mouselook. | 430 | // in mouselook. |
431 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); | 431 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
432 | q = avatar.Rotation; | 432 | q = avatar.Rotation; |
433 | } | 433 | } |
434 | 434 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 27f9c84..4d7d60d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -271,6 +271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
271 | void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); | 271 | void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); |
272 | void llRefreshPrimURL(); | 272 | void llRefreshPrimURL(); |
273 | void llRegionSay(int channelID, string text); | 273 | void llRegionSay(int channelID, string text); |
274 | void llRegionSayTo(string target, int channelID, string text); | ||
274 | void llReleaseCamera(string avatar); | 275 | void llReleaseCamera(string avatar); |
275 | void llReleaseControls(); | 276 | void llReleaseControls(); |
276 | void llReleaseURL(string url); | 277 | void llReleaseURL(string url); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 303d75e..96e46fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1199,6 +1199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1199 | m_LSL_Functions.llRegionSay(channelID, text); | 1199 | m_LSL_Functions.llRegionSay(channelID, text); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | public void llRegionSayTo(string key, int channelID, string text) | ||
1203 | { | ||
1204 | m_LSL_Functions.llRegionSayTo(key, channelID, text); | ||
1205 | } | ||
1206 | |||
1202 | public void llReleaseCamera(string avatar) | 1207 | public void llReleaseCamera(string avatar) |
1203 | { | 1208 | { |
1204 | m_LSL_Functions.llReleaseCamera(avatar); | 1209 | m_LSL_Functions.llReleaseCamera(avatar); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 783791f..ef9b2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
233 | m_MaxScriptQueue = maxScriptQueue; | 233 | m_MaxScriptQueue = maxScriptQueue; |
234 | m_stateSource = stateSource; | 234 | m_stateSource = stateSource; |
235 | m_postOnRez = postOnRez; | 235 | m_postOnRez = postOnRez; |
236 | m_AttachedAvatar = part.AttachedAvatar; | 236 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; |
237 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; | 237 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; |
238 | 238 | ||
239 | if (part != null) | 239 | if (part != null) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 623c82d..8cd1e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
182 | Vector3.Zero) { Name = obj1Name, UUID = objUuid }; | 182 | Vector3.Zero) { Name = obj1Name, UUID = objUuid }; |
183 | Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); | 183 | Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); |
184 | 184 | ||
185 | // Note that prim hollow check is passed with the other prim params in order to allow the | ||
186 | // specification of a different check value from the prim param. A cylinder, prism, sphere, | ||
187 | // torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below | ||
188 | // specifies a value of 95% and checks to see if 70% was properly returned. | ||
189 | |||
185 | // Test a sphere. | 190 | // Test a sphere. |
186 | CheckllSetPrimitiveParams( | 191 | CheckllSetPrimitiveParams( |
187 | "test 1", // Prim test identification string | 192 | "test 1", // Prim test identification string |
@@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
191 | new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut | 196 | new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut |
192 | 0.80d, // Prim hollow | 197 | 0.80d, // Prim hollow |
193 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist | 198 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist |
194 | new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple | 199 | new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple |
200 | 0.80d); // Prim hollow check | ||
195 | 201 | ||
196 | // Test a prism. | 202 | // Test a prism. |
197 | CheckllSetPrimitiveParams( | 203 | CheckllSetPrimitiveParams( |
@@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
203 | 0.90d, // Prim hollow | 209 | 0.90d, // Prim hollow |
204 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist | 210 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist |
205 | new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper | 211 | new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper |
206 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear | 212 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear |
213 | 0.90d); // Prim hollow check | ||
207 | 214 | ||
208 | // Test a box. | 215 | // Test a box. |
209 | CheckllSetPrimitiveParams( | 216 | CheckllSetPrimitiveParams( |
@@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
212 | ScriptBaseClass.PRIM_TYPE_BOX, // Prim type | 219 | ScriptBaseClass.PRIM_TYPE_BOX, // Prim type |
213 | ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type | 220 | ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type |
214 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut | 221 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut |
215 | 0.90d, // Prim hollow | 222 | 0.95d, // Prim hollow |
216 | new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist | 223 | new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist |
217 | new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper | 224 | new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper |
218 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear | 225 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear |
226 | 0.95d); // Prim hollow check | ||
219 | 227 | ||
220 | // Test a tube. | 228 | // Test a tube. |
221 | CheckllSetPrimitiveParams( | 229 | CheckllSetPrimitiveParams( |
@@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
232 | new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper | 240 | new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper |
233 | 1.0d, // Prim revolutions | 241 | 1.0d, // Prim revolutions |
234 | 1.0d, // Prim radius | 242 | 1.0d, // Prim radius |
235 | 0.0d); // Prim skew | 243 | 0.0d, // Prim skew |
244 | 0.00d); // Prim hollow check | ||
245 | |||
246 | // Test a prism. | ||
247 | CheckllSetPrimitiveParams( | ||
248 | "test 5", // Prim test identification string | ||
249 | new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size | ||
250 | ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type | ||
251 | ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type | ||
252 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut | ||
253 | 0.95d, // Prim hollow | ||
254 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist | ||
255 | new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper | ||
256 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear | ||
257 | 0.70d); // Prim hollow check | ||
258 | |||
259 | // Test a sculpted prim. | ||
260 | CheckllSetPrimitiveParams( | ||
261 | "test 6", // Prim test identification string | ||
262 | new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size | ||
263 | ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type | ||
264 | "be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map | ||
265 | ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type | ||
236 | } | 266 | } |
237 | 267 | ||
238 | // Set prim params for a box, cylinder or prism and check results. | 268 | // Set prim params for a box, cylinder or prism and check results. |
239 | public void CheckllSetPrimitiveParams(string primTest, | 269 | public void CheckllSetPrimitiveParams(string primTest, |
240 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 270 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
241 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) | 271 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, |
272 | double primHollowCheck) | ||
242 | { | 273 | { |
243 | // Set the prim params. | 274 | // Set the prim params. |
244 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 275 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
256 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), | 287 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), |
257 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); | 288 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); |
258 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); | 289 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); |
259 | Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, | 290 | Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, |
260 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); | 291 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); |
261 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); | 292 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); |
262 | CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); | 293 | CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); |
@@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
266 | // Set prim params for a sphere and check results. | 297 | // Set prim params for a sphere and check results. |
267 | public void CheckllSetPrimitiveParams(string primTest, | 298 | public void CheckllSetPrimitiveParams(string primTest, |
268 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 299 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
269 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) | 300 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck) |
270 | { | 301 | { |
271 | // Set the prim params. | 302 | // Set the prim params. |
272 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 303 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
284 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), | 315 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), |
285 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); | 316 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); |
286 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); | 317 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); |
287 | Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, | 318 | Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, |
288 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); | 319 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); |
289 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); | 320 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); |
290 | CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); | 321 | CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); |
@@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
295 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 326 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
296 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, | 327 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, |
297 | LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, | 328 | LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, |
298 | double primRev, double primRadius, double primSkew) | 329 | double primRev, double primRadius, double primSkew, double primHollowCheck) |
299 | { | 330 | { |
300 | // Set the prim params. | 331 | // Set the prim params. |
301 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 332 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
314 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), | 345 | Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), |
315 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); | 346 | "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); |
316 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); | 347 | CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); |
317 | Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, | 348 | Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, |
318 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); | 349 | "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); |
319 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); | 350 | CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); |
320 | CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); | 351 | CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); |
@@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
329 | "TestllSetPrimitiveParams " + primTest + " prim skew fail"); | 360 | "TestllSetPrimitiveParams " + primTest + " prim skew fail"); |
330 | } | 361 | } |
331 | 362 | ||
363 | // Set prim params for a sculpted prim and check results. | ||
364 | public void CheckllSetPrimitiveParams(string primTest, | ||
365 | LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType) | ||
366 | { | ||
367 | // Set the prim params. | ||
368 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | ||
369 | ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType)); | ||
370 | |||
371 | // Get params for prim to validate settings. | ||
372 | LSL_Types.list primParams = | ||
373 | m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); | ||
374 | |||
375 | // Validate settings. | ||
376 | CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); | ||
377 | Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), | ||
378 | "TestllSetPrimitiveParams " + primTest + " prim type check fail"); | ||
379 | Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2), | ||
380 | "TestllSetPrimitiveParams " + primTest + " prim map check fail"); | ||
381 | Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3), | ||
382 | "TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail"); | ||
383 | } | ||
384 | |||
332 | public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) | 385 | public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) |
333 | { | 386 | { |
334 | // Check each vector component against expected result. | 387 | // Check each vector component against expected result. |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index d253c6a..c443669 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1294,9 +1294,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1294 | 1294 | ||
1295 | public string GetXMLState(UUID itemID) | 1295 | public string GetXMLState(UUID itemID) |
1296 | { | 1296 | { |
1297 | // m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID); | ||
1298 | |||
1297 | IScriptInstance instance = GetInstance(itemID); | 1299 | IScriptInstance instance = GetInstance(itemID); |
1298 | if (instance == null) | 1300 | if (instance == null) |
1301 | { | ||
1302 | // m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID); | ||
1299 | return ""; | 1303 | return ""; |
1304 | } | ||
1305 | |||
1300 | string xml = instance.GetXMLState(); | 1306 | string xml = instance.GetXMLState(); |
1301 | 1307 | ||
1302 | XmlDocument sdoc = new XmlDocument(); | 1308 | XmlDocument sdoc = new XmlDocument(); |
@@ -1437,6 +1443,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1437 | mapData.InnerText = map; | 1443 | mapData.InnerText = map; |
1438 | 1444 | ||
1439 | stateData.AppendChild(mapData); | 1445 | stateData.AppendChild(mapData); |
1446 | |||
1447 | // m_log.DebugFormat("[XEngine]: Got XML state for {0}", itemID); | ||
1448 | |||
1440 | return doc.InnerXml; | 1449 | return doc.InnerXml; |
1441 | } | 1450 | } |
1442 | 1451 | ||
diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 3590e12..2c6cebd 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs | |||
@@ -42,15 +42,13 @@ namespace OpenSim.Services.AuthenticationService | |||
42 | public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService | 42 | public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private IConfigSource m_config; | ||
47 | private Dictionary<string, IAuthenticationService> m_svcChecks | 46 | private Dictionary<string, IAuthenticationService> m_svcChecks |
48 | = new Dictionary<string, IAuthenticationService>(); | 47 | = new Dictionary<string, IAuthenticationService>(); |
49 | 48 | ||
50 | public WebkeyOrPasswordAuthenticationService(IConfigSource config) | 49 | public WebkeyOrPasswordAuthenticationService(IConfigSource config) |
51 | : base(config) | 50 | : base(config) |
52 | { | 51 | { |
53 | this.m_config = config; | ||
54 | m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config); | 52 | m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config); |
55 | m_svcChecks["password"] = new PasswordAuthenticationService(config); | 53 | m_svcChecks["password"] = new PasswordAuthenticationService(config); |
56 | } | 54 | } |
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index b760abd..910ba02 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -203,6 +203,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
203 | UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" | 203 | UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" |
204 | FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" | 204 | FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" |
205 | 205 | ||
206 | ;; Ask co-operative viewers to use a different currency name | ||
206 | ;Currency = "" | 207 | ;Currency = "" |
207 | 208 | ||
208 | WelcomeMessage = "Welcome, Avatar!" | 209 | WelcomeMessage = "Welcome, Avatar!" |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index a36d255..f7781ab 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -188,6 +188,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
188 | LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" | 188 | LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" |
189 | FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" | 189 | FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" |
190 | 190 | ||
191 | ;; Ask co-operative viewers to use a different currency name | ||
191 | ;Currency = "" | 192 | ;Currency = "" |
192 | 193 | ||
193 | WelcomeMessage = "Welcome, Avatar!" | 194 | WelcomeMessage = "Welcome, Avatar!" |
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 431dce1..c057887 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example | |||
@@ -97,25 +97,26 @@ | |||
97 | SRV_FriendsServerURI = "http://127.0.0.1:9000" | 97 | SRV_FriendsServerURI = "http://127.0.0.1:9000" |
98 | SRV_IMServerURI = "http://127.0.0.1:9000" | 98 | SRV_IMServerURI = "http://127.0.0.1:9000" |
99 | 99 | ||
100 | ;; For Viewer 2 | 100 | ;; For Viewer 2 |
101 | MapTileURL = "http://127.0.0.1:9000/" | 101 | MapTileURL = "http://127.0.0.1:9000/" |
102 | 102 | ||
103 | ;; Ask co-operative viewers to use a different currency name | ||
103 | ;Currency = "" | 104 | ;Currency = "" |
104 | 105 | ||
105 | ;; Regular expressions for controlling which client versions are accepted/denied. | 106 | ;; Regular expressions for controlling which client versions are accepted/denied. |
106 | ;; An empty string means nothing is checked. | 107 | ;; An empty string means nothing is checked. |
107 | ;; | 108 | ;; |
108 | ;; Example 1: allow only these 3 types of clients (any version of them) | 109 | ;; Example 1: allow only these 3 types of clients (any version of them) |
109 | ;; AllowedClients = "Imprudence|Hippo|Second Life" | 110 | ;; AllowedClients = "Imprudence|Hippo|Second Life" |
110 | ;; | 111 | ;; |
111 | ;; Example 2: allow all clients except these | 112 | ;; Example 2: allow all clients except these |
112 | ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" | 113 | ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" |
113 | ;; | 114 | ;; |
114 | ;; Note that these are regular expressions, so every character counts. | 115 | ;; Note that these are regular expressions, so every character counts. |
115 | ;; Also note that this is very weak security and should not be trusted as a reliable means | 116 | ;; Also note that this is very weak security and should not be trusted as a reliable means |
116 | ;; for keeping bad clients out; modified clients can fake their identifiers. | 117 | ;; for keeping bad clients out; modified clients can fake their identifiers. |
117 | ;; | 118 | ;; |
118 | ;; | 119 | ;; |
119 | ;AllowedClients = "" | 120 | ;AllowedClients = "" |
120 | ;DeniedClients = "" | 121 | ;DeniedClients = "" |
121 | 122 | ||