aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs3
-rw-r--r--OpenSim/Data/SQLite/SQLiteAuthenticationData.cs3
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs3
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs3
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs3
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs3
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Framework/Util.cs68
-rw-r--r--OpenSim/Framework/Watchdog.cs72
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs3
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs3
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs14
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs58
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs349
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs76
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs341
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs177
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs140
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs24
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs3
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs10
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs3
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
46 files changed, 519 insertions, 1170 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index bb23fc1..d0e24c3 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -81,6 +81,9 @@ namespace OpenSim.Data.SQLite
81 /// <param name="dbconnect">connect string</param> 81 /// <param name="dbconnect">connect string</param>
82 override public void Initialise(string dbconnect) 82 override public void Initialise(string dbconnect)
83 { 83 {
84 if (Util.IsWindows())
85 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
86
84 if (dbconnect == string.Empty) 87 if (dbconnect == string.Empty)
85 { 88 {
86 dbconnect = "URI=file:Asset.db,version=3"; 89 dbconnect = "URI=file:Asset.db,version=3";
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
index f51aa28..5120453 100644
--- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
@@ -65,6 +65,9 @@ namespace OpenSim.Data.SQLite
65 65
66 if (!m_initialized) 66 if (!m_initialized)
67 { 67 {
68 if (Util.IsWindows())
69 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
70
68 m_Connection = new SqliteConnection(connectionString); 71 m_Connection = new SqliteConnection(connectionString);
69 m_Connection.Open(); 72 m_Connection.Open();
70 73
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 8db9262..c042ba2 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -69,6 +69,9 @@ namespace OpenSim.Data.SQLite
69 69
70 public void Initialise(string connectionString) 70 public void Initialise(string connectionString)
71 { 71 {
72 if (Util.IsWindows())
73 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
74
72 m_connectionString = connectionString; 75 m_connectionString = connectionString;
73 76
74 m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString); 77 m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 4992bcc..1594717 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Data.SQLite
48 48
49 protected SQLiteFramework(string connectionString) 49 protected SQLiteFramework(string connectionString)
50 { 50 {
51 if (Util.IsWindows())
52 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
51 } 53 }
52 54
53 ////////////////////////////////////////////////////////////// 55 //////////////////////////////////////////////////////////////
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 7dc07ec..ccbd154 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -77,6 +77,9 @@ namespace OpenSim.Data.SQLite
77 { 77 {
78 m_Initialized = true; 78 m_Initialized = true;
79 79
80 if (Util.IsWindows())
81 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
82
80 if (dbconnect == string.Empty) 83 if (dbconnect == string.Empty)
81 { 84 {
82 dbconnect = "URI=file:inventoryStore.db,version=3"; 85 dbconnect = "URI=file:inventoryStore.db,version=3";
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 6295113..186a586 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -110,6 +110,9 @@ namespace OpenSim.Data.SQLite
110 { 110 {
111 try 111 try
112 { 112 {
113 if (Util.IsWindows())
114 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
115
113 m_connectionString = connectionString; 116 m_connectionString = connectionString;
114 117
115 ds = new DataSet("Region"); 118 ds = new DataSet("Region");
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index 16f9046..1f36986 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -52,6 +52,9 @@ namespace OpenSim.Data.SQLite
52 52
53 public SQLiteXInventoryData(string conn, string realm) 53 public SQLiteXInventoryData(string conn, string realm)
54 { 54 {
55 if (Util.IsWindows())
56 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
57
55 m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>( 58 m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
56 conn, "inventoryfolders", "XInventoryStore"); 59 conn, "inventoryfolders", "XInventoryStore");
57 m_Items = new SqliteItemHandler( 60 m_Items = new SqliteItemHandler(
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 545e76c..6a3135e 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
247 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; 247 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
248 248
249 StringBuilder sb = new StringBuilder(); 249 StringBuilder sb = new StringBuilder();
250 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); 250 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
251 251
252 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); 252 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
253 253
@@ -308,7 +308,9 @@ namespace OpenSim.Framework.Servers
308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and 308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
309 // the clr version number doesn't match the project version number under Mono. 309 // the clr version number doesn't match the project version number under Mono.
310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); 310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
311 m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine); 311 m_log.InfoFormat(
312 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
313 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
312 314
313 StartupSpecific(); 315 StartupSpecific();
314 316
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 2206feb..0062d4e 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
65 String.Format("PollServiceWorkerThread{0}", i), 65 String.Format("PollServiceWorkerThread{0}", i),
66 ThreadPriority.Normal, 66 ThreadPriority.Normal,
67 false, 67 false,
68 true,
68 int.MaxValue); 69 int.MaxValue);
69 } 70 }
70 71
@@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
73 "PollServiceWatcherThread", 74 "PollServiceWatcherThread",
74 ThreadPriority.Normal, 75 ThreadPriority.Normal,
75 false, 76 false,
77 true,
76 1000 * 60 * 10); 78 1000 * 60 * 10);
77 } 79 }
78 80
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 4b0b13c..efa4a7b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -35,7 +35,8 @@ using System.IO;
35using System.IO.Compression; 35using System.IO.Compression;
36using System.Net; 36using System.Net;
37using System.Net.Sockets; 37using System.Net.Sockets;
38using System.Reflection; 38using System.Reflection;
39using System.Runtime.InteropServices;
39using System.Runtime.Serialization; 40using System.Runtime.Serialization;
40using System.Runtime.Serialization.Formatters.Binary; 41using System.Runtime.Serialization.Formatters.Binary;
41using System.Security.Cryptography; 42using System.Security.Cryptography;
@@ -375,6 +376,50 @@ namespace OpenSim.Framework
375 } 376 }
376 377
377 return sb.ToString(); 378 return sb.ToString();
379 }
380
381 /// <summary>
382 /// Is the platform Windows?
383 /// </summary>
384 /// <returns>true if so, false otherwise</returns>
385 public static bool IsWindows()
386 {
387 PlatformID platformId = Environment.OSVersion.Platform;
388
389 return (platformId == PlatformID.Win32NT
390 || platformId == PlatformID.Win32S
391 || platformId == PlatformID.Win32Windows
392 || platformId == PlatformID.WinCE);
393 }
394
395 public static bool LoadArchSpecificWindowsDll(string libraryName)
396 {
397 // We do this so that OpenSimulator on Windows loads the correct native library depending on whether
398 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
399 // will find it already loaded later on.
400 //
401 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
402 // controlled in config files.
403 string nativeLibraryPath;
404
405 if (Util.Is64BitProcess())
406 nativeLibraryPath = "lib64/" + libraryName;
407 else
408 nativeLibraryPath = "lib32/" + libraryName;
409
410 m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath);
411
412 if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
413 {
414 m_log.ErrorFormat(
415 "[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath);
416
417 return false;
418 }
419 else
420 {
421 return true;
422 }
378 } 423 }
379 424
380 public static bool IsEnvironmentSupported(ref string reason) 425 public static bool IsEnvironmentSupported(ref string reason)
@@ -1457,6 +1502,27 @@ namespace OpenSim.Framework
1457 } 1502 }
1458 1503
1459 return data; 1504 return data;
1505 }
1506
1507 /// <summary>
1508 /// Used to trigger an early library load on Windows systems.
1509 /// </summary>
1510 /// <remarks>
1511 /// Required to get 32-bit and 64-bit processes to automatically use the
1512 /// appropriate native library.
1513 /// </remarks>
1514 /// <param name="dllToLoad"></param>
1515 /// <returns></returns>
1516 [DllImport("kernel32.dll")]
1517 public static extern IntPtr LoadLibrary(string dllToLoad);
1518
1519 /// <summary>
1520 /// Determine whether the current process is 64 bit
1521 /// </summary>
1522 /// <returns>true if so, false if not</returns>
1523 public static bool Is64BitProcess()
1524 {
1525 return IntPtr.Size == 8;
1460 } 1526 }
1461 1527
1462 #region FireAndForget Threading Pattern 1528 #region FireAndForget Threading Pattern
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs
index 2dd6ebe..e93e50e 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Watchdog.cs
@@ -72,6 +72,11 @@ namespace OpenSim.Framework
72 /// </summary> 72 /// </summary>
73 public bool IsTimedOut { get; set; } 73 public bool IsTimedOut { get; set; }
74 74
75 /// <summary>
76 /// Will this thread trigger the alarm function if it has timed out?
77 /// </summary>
78 public bool AlarmIfTimeout { get; set; }
79
75 public ThreadWatchdogInfo(Thread thread, int timeout) 80 public ThreadWatchdogInfo(Thread thread, int timeout)
76 { 81 {
77 Thread = thread; 82 Thread = thread;
@@ -112,12 +117,13 @@ namespace OpenSim.Framework
112 /// <param name="start">The method that will be executed in a new thread</param> 117 /// <param name="start">The method that will be executed in a new thread</param>
113 /// <param name="name">A name to give to the new thread</param> 118 /// <param name="name">A name to give to the new thread</param>
114 /// <param name="priority">Priority to run the thread at</param> 119 /// <param name="priority">Priority to run the thread at</param>
115 /// <param name="isBackground">True to run this thread as a background 120 /// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
116 /// thread, otherwise false</param> 121 /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
117 /// <returns>The newly created Thread object</returns> 122 /// <returns>The newly created Thread object</returns>
118 public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) 123 public static Thread StartThread(
124 ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
119 { 125 {
120 return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); 126 return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
121 } 127 }
122 128
123 /// <summary> 129 /// <summary>
@@ -128,21 +134,21 @@ namespace OpenSim.Framework
128 /// <param name="priority">Priority to run the thread at</param> 134 /// <param name="priority">Priority to run the thread at</param>
129 /// <param name="isBackground">True to run this thread as a background 135 /// <param name="isBackground">True to run this thread as a background
130 /// thread, otherwise false</param> 136 /// thread, otherwise false</param>
131 /// <param name="timeout"> 137 /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
132 /// Number of milliseconds to wait until we issue a warning about timeout. 138 /// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
133 /// </para>
134 /// <returns>The newly created Thread object</returns> 139 /// <returns>The newly created Thread object</returns>
135 public static Thread StartThread( 140 public static Thread StartThread(
136 ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) 141 ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
137 { 142 {
138 Thread thread = new Thread(start); 143 Thread thread = new Thread(start);
139 thread.Name = name; 144 thread.Name = name;
140 thread.Priority = priority; 145 thread.Priority = priority;
141 thread.IsBackground = isBackground; 146 thread.IsBackground = isBackground;
142 147
143 ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); 148 ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
144 149
145 m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); 150 m_log.DebugFormat(
151 "[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
146 152
147 lock (m_threads) 153 lock (m_threads)
148 m_threads.Add(twi.Thread.ManagedThreadId, twi); 154 m_threads.Add(twi.Thread.ManagedThreadId, twi);
@@ -224,19 +230,39 @@ namespace OpenSim.Framework
224 /// Get currently watched threads for diagnostic purposes 230 /// Get currently watched threads for diagnostic purposes
225 /// </summary> 231 /// </summary>
226 /// <returns></returns> 232 /// <returns></returns>
227 public static ThreadWatchdogInfo[] GetThreads() 233 public static ThreadWatchdogInfo[] GetThreadsInfo()
228 { 234 {
229 lock (m_threads) 235 lock (m_threads)
230 return m_threads.Values.ToArray(); 236 return m_threads.Values.ToArray();
231 } 237 }
232 238
239 /// <summary>
240 /// Return the current thread's watchdog info.
241 /// </summary>
242 /// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
243 public static ThreadWatchdogInfo GetCurrentThreadInfo()
244 {
245 lock (m_threads)
246 {
247 if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
248 return m_threads[Thread.CurrentThread.ManagedThreadId];
249 }
250
251 return null;
252 }
253
254 /// <summary>
255 /// Check watched threads. Fire alarm if appropriate.
256 /// </summary>
257 /// <param name="sender"></param>
258 /// <param name="e"></param>
233 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) 259 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
234 { 260 {
235 WatchdogTimeout callback = OnWatchdogTimeout; 261 WatchdogTimeout callback = OnWatchdogTimeout;
236 262
237 if (callback != null) 263 if (callback != null)
238 { 264 {
239 ThreadWatchdogInfo timedOut = null; 265 List<ThreadWatchdogInfo> callbackInfos = null;
240 266
241 lock (m_threads) 267 lock (m_threads)
242 { 268 {
@@ -246,21 +272,31 @@ namespace OpenSim.Framework
246 { 272 {
247 if (threadInfo.Thread.ThreadState == ThreadState.Stopped) 273 if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
248 { 274 {
249 timedOut = threadInfo;
250 RemoveThread(threadInfo.Thread.ManagedThreadId); 275 RemoveThread(threadInfo.Thread.ManagedThreadId);
251 break; 276
277 if (callbackInfos == null)
278 callbackInfos = new List<ThreadWatchdogInfo>();
279
280 callbackInfos.Add(threadInfo);
252 } 281 }
253 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 282 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
254 { 283 {
255 threadInfo.IsTimedOut = true; 284 threadInfo.IsTimedOut = true;
256 timedOut = threadInfo; 285
257 break; 286 if (threadInfo.AlarmIfTimeout)
287 {
288 if (callbackInfos == null)
289 callbackInfos = new List<ThreadWatchdogInfo>();
290
291 callbackInfos.Add(threadInfo);
292 }
258 } 293 }
259 } 294 }
260 } 295 }
261 296
262 if (timedOut != null) 297 if (callbackInfos != null)
263 callback(timedOut.Thread, timedOut.LastTick); 298 foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
299 callback(callbackInfo.Thread, callbackInfo.LastTick);
264 } 300 }
265 301
266 m_watchdogTimer.Start(); 302 m_watchdogTimer.Start();
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 1e22fcc..fb6b11e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
244 base.Start(m_recvBufferSize, m_asyncPacketHandling); 244 base.Start(m_recvBufferSize, m_asyncPacketHandling);
245 245
246 // Start the packet processing threads 246 // Start the packet processing threads
247 Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 247 Watchdog.StartThread(
248 Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 248 IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
249 Watchdog.StartThread(
250 OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
251
249 m_elapsedMSSinceLastStatReport = Environment.TickCount; 252 m_elapsedMSSinceLastStatReport = Environment.TickCount;
250 } 253 }
251 254
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index c7f4c20..b0cee03 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -496,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
496 SetAppearanceAssets(sp.UUID, sp.Appearance); 496 SetAppearanceAssets(sp.UUID, sp.Appearance);
497 497
498 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); 498 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
499
500 // Trigger this here because it's the final step in the set/queue/save process for appearance setting.
501 // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes).
502 m_scene.EventManager.TriggerAvatarAppearanceChanged(sp);
499 } 503 }
500 504
501 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 505 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 8f047ea..f6e4dbf 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1704,14 +1704,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1704 1704
1705 // Offset the positions for the new region across the border 1705 // Offset the positions for the new region across the border
1706 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 1706 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1707 grp.RootPart.GroupPosition = pos;
1708 1707
1709 // If we fail to cross the border, then reset the position of the scene object on that border. 1708 // If we fail to cross the border, then reset the position of the scene object on that border.
1710 uint x = 0, y = 0; 1709 uint x = 0, y = 0;
1711 Utils.LongToUInts(newRegionHandle, out x, out y); 1710 Utils.LongToUInts(newRegionHandle, out x, out y);
1712 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1711 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1713 1712
1714 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 1713 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
1715 { 1714 {
1716 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); 1715 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
1717 1716
@@ -1741,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1741 /// true if the crossing itself was successful, false on failure 1740 /// true if the crossing itself was successful, false on failure
1742 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 1741 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
1743 /// </returns> 1742 /// </returns>
1744 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent) 1743 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent)
1745 { 1744 {
1746 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 1745 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
1747 1746
@@ -1766,7 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1766 //if (m_interregionCommsOut != null) 1765 //if (m_interregionCommsOut != null)
1767 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 1766 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
1768 if (m_aScene.SimulationService != null) 1767 if (m_aScene.SimulationService != null)
1769 successYN = m_aScene.SimulationService.CreateObject(destination, grp, true); 1768 successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
1770 1769
1771 if (successYN) 1770 if (successYN)
1772 { 1771 {
@@ -1825,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1825 gobj.IsAttachment = false; 1824 gobj.IsAttachment = false;
1826 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 1825 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1827 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); 1826 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1828 CrossPrimGroupIntoNewRegion(destination, gobj, silent); 1827 CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
1829 } 1828 }
1830 } 1829 }
1831 1830
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index f367739..a6e2548 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
1210 if (homeScene.TryGetScenePresence(avatarId,out avatar)) 1210 if (homeScene.TryGetScenePresence(avatarId,out avatar))
1211 { 1211 {
1212 KillAUser ku = new KillAUser(avatar,mod); 1212 KillAUser ku = new KillAUser(avatar,mod);
1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); 1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
1214 } 1214 }
1215 } 1215 }
1216 1216
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index a17c6ae..85e7e94 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
315 * Object-related communications 315 * Object-related communications
316 */ 316 */
317 317
318 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 318 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
319 { 319 {
320 if (destination == null) 320 if (destination == null)
321 return false; 321 return false;
@@ -330,12 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
330 // We need to make a local copy of the object 330 // We need to make a local copy of the object
331 ISceneObject sogClone = sog.CloneForNewScene(); 331 ISceneObject sogClone = sog.CloneForNewScene();
332 sogClone.SetState(sog.GetStateSnapshot(), s); 332 sogClone.SetState(sog.GetStateSnapshot(), s);
333 return s.IncomingCreateObject(sogClone); 333 return s.IncomingCreateObject(newPosition, sogClone);
334 } 334 }
335 else 335 else
336 { 336 {
337 // Use the object as it came through the wire 337 // Use the object as it came through the wire
338 return s.IncomingCreateObject(sog); 338 return s.IncomingCreateObject(newPosition, sog);
339 } 339 }
340 } 340 }
341 } 341 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f8cea71..eaf9506 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -282,13 +282,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
282 * Object-related communications 282 * Object-related communications
283 */ 283 */
284 284
285 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 285 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
286 { 286 {
287 if (destination == null) 287 if (destination == null)
288 return false; 288 return false;
289 289
290 // Try local first 290 // Try local first
291 if (m_localBackend.CreateObject(destination, sog, isLocalCall)) 291 if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
292 { 292 {
293 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); 293 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
294 return true; 294 return true;
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
296 296
297 // else do the remote thing 297 // else do the remote thing
298 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 298 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
299 return m_remoteConnector.CreateObject(destination, sog, isLocalCall); 299 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
300 300
301 return false; 301 return false;
302 } 302 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 1c503aa..f6d4b40 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land
94 94
95 // caches ExtendedLandData 95 // caches ExtendedLandData
96 private Cache parcelInfoCache; 96 private Cache parcelInfoCache;
97 private Dictionary<UUID, Vector3> forcedPosition = 97
98 new Dictionary<UUID, Vector3>(); 98 /// <summary>
99 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
100 /// </summary>
101 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
99 102
100 #region INonSharedRegionModule Members 103 #region INonSharedRegionModule Members
101 104
@@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land
224 //When the avatar walks into a ban line on the ground, it prevents getting stuck 227 //When the avatar walks into a ban line on the ground, it prevents getting stuck
225 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 228 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
226 229
227
228 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines 230 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
229 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) 231 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
230 { 232 {
231 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); 233// m_log.DebugFormat(
234// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
235// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
236
232 forcedPosition.Remove(remoteClient.AgentId); 237 forcedPosition.Remove(remoteClient.AgentId);
233 } 238 }
234 //if we are far away, teleport 239 //if we are far away, teleport
235 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) 240 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
236 { 241 {
237 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); 242 Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
238 clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); 243// m_log.DebugFormat(
244// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
245// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
246
247 m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
248 forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
249
239 forcedPosition.Remove(remoteClient.AgentId); 250 forcedPosition.Remove(remoteClient.AgentId);
240 } 251 }
241 else 252 else
242 { 253 {
254// m_log.DebugFormat(
255// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
256// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
257
243 //Forces them toward the forced position we want if they aren't there yet 258 //Forces them toward the forced position we want if they aren't there yet
244 agentData.UseClientAgentPosition = true; 259 agentData.UseClientAgentPosition = true;
245 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; 260 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f3c6a30..7023984 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -677,18 +677,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
677 bool permission = false; 677 bool permission = false;
678 bool locked = false; 678 bool locked = false;
679 679
680 if (!m_scene.Entities.ContainsKey(objId)) 680 SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
681 {
682 return false;
683 }
684 681
685 // If it's not an object, we cant edit it. 682 if (part == null)
686 if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
687 {
688 return false; 683 return false;
689 }
690 684
691 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; 685 SceneObjectGroup group = part.ParentGroup;
692 686
693 UUID objectOwner = group.OwnerID; 687 UUID objectOwner = group.OwnerID;
694 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); 688 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
@@ -977,16 +971,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
977 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 971 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
978 if (m_bypassPermissions) return m_bypassPermissionsValue; 972 if (m_bypassPermissions) return m_bypassPermissionsValue;
979 973
980 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
981
982 // If we selected a sub-prim to edit, the objectID won't represent the object, but only a part.
983 // We have to check the permissions of the group, though.
984 if (part.ParentID != 0)
985 {
986 objectID = part.ParentUUID;
987 part = m_scene.GetSceneObjectPart(objectID);
988 }
989
990 return GenericObjectPermission(editorID, objectID, false); 974 return GenericObjectPermission(editorID, objectID, false);
991 } 975 }
992 976
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index b315d2c..74b047b 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
351 process, 351 process,
352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), 352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
353 ThreadPriority.BelowNormal, 353 ThreadPriority.BelowNormal,
354 true,
354 true); 355 true);
355 } 356 }
356 357
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index d31d380..569c235 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -173,6 +173,9 @@ namespace OpenSim.Region.Framework.Scenes
173 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); 173 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
174 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; 174 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
175 175
176 public delegate void AvatarAppearanceChange(ScenePresence avatar);
177 public event AvatarAppearanceChange OnAvatarAppearanceChange;
178
176 public event Action<ScenePresence> OnSignificantClientMovement; 179 public event Action<ScenePresence> OnSignificantClientMovement;
177 180
178 public delegate void IncomingInstantMessage(GridInstantMessage message); 181 public delegate void IncomingInstantMessage(GridInstantMessage message);
@@ -184,10 +187,62 @@ namespace OpenSim.Region.Framework.Scenes
184 187
185 public event ClientClosed OnClientClosed; 188 public event ClientClosed OnClientClosed;
186 189
190 // Fired when a script is created
191 // The indication that a new script exists in this region.
192 public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
193 public event NewScript OnNewScript;
194 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
195 {
196 NewScript handlerNewScript = OnNewScript;
197 if (handlerNewScript != null)
198 {
199 foreach (NewScript d in handlerNewScript.GetInvocationList())
200 {
201 try
202 {
203 d(clientID, part, itemID);
204 }
205 catch (Exception e)
206 {
207 m_log.ErrorFormat(
208 "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
209 e.Message, e.StackTrace);
210 }
211 }
212 }
213 }
214
215 //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
216 // An indication that the script has changed.
217 public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
218 public event UpdateScript OnUpdateScript;
219 public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
220 {
221 UpdateScript handlerUpdateScript = OnUpdateScript;
222 if (handlerUpdateScript != null)
223 {
224 foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
225 {
226 try
227 {
228 d(clientId, itemId, primId, isScriptRunning, newAssetID);
229 }
230 catch (Exception e)
231 {
232 m_log.ErrorFormat(
233 "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
234 e.Message, e.StackTrace);
235 }
236 }
237 }
238 }
239
187 /// <summary> 240 /// <summary>
188 /// This is fired when a scene object property that a script might be interested in (such as color, scale or 241 /// ScriptChangedEvent is fired when a scene object property that a script might be interested
189 /// inventory) changes. Only enough information is sent for the LSL changed event 242 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
190 /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) 243 /// This is not an indication that the script has changed (see OnUpdateScript for that).
244 /// This event is sent to a script to tell it that some property changed on
245 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
191 /// </summary> 246 /// </summary>
192 public event ScriptChangedEvent OnScriptChangedEvent; 247 public event ScriptChangedEvent OnScriptChangedEvent;
193 public delegate void ScriptChangedEvent(uint localID, uint change); 248 public delegate void ScriptChangedEvent(uint localID, uint change);
@@ -1238,6 +1293,27 @@ namespace OpenSim.Region.Framework.Scenes
1238 } 1293 }
1239 } 1294 }
1240 1295
1296 public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
1297 {
1298 AvatarAppearanceChange handler = OnAvatarAppearanceChange;
1299 if (handler != null)
1300 {
1301 foreach (AvatarAppearanceChange d in handler.GetInvocationList())
1302 {
1303 try
1304 {
1305 d(avatar);
1306 }
1307 catch (Exception e)
1308 {
1309 m_log.ErrorFormat(
1310 "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
1311 e.Message, e.StackTrace);
1312 }
1313 }
1314 }
1315 }
1316
1241 public void TriggerIncomingInstantMessage(GridInstantMessage message) 1317 public void TriggerIncomingInstantMessage(GridInstantMessage message)
1242 { 1318 {
1243 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; 1319 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9d9729e..23f39a8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -283,6 +283,10 @@ namespace OpenSim.Region.Framework.Scenes
283 { 283 {
284 remoteClient.SendAgentAlertMessage("Script saved", false); 284 remoteClient.SendAgentAlertMessage("Script saved", false);
285 } 285 }
286
287 // Tell anyone managing scripts that a script has been reloaded/changed
288 EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
289
286 part.ParentGroup.ResumeScripts(); 290 part.ParentGroup.ResumeScripts();
287 return errors; 291 return errors;
288 } 292 }
@@ -1151,8 +1155,7 @@ namespace OpenSim.Region.Framework.Scenes
1151 return; 1155 return;
1152 } 1156 }
1153 1157
1154 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); 1158 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1155 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1156 { 1159 {
1157 // If the item to be moved is no copy, we need to be able to 1160 // If the item to be moved is no copy, we need to be able to
1158 // edit the prim. 1161 // edit the prim.
@@ -1624,9 +1627,13 @@ namespace OpenSim.Region.Framework.Scenes
1624 // have state in inventory 1627 // have state in inventory
1625 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); 1628 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
1626 1629
1630 // tell anyone watching that there is a new script in town
1631 EventManager.TriggerNewScript(agentID, part, copyID);
1632
1627 // m_log.InfoFormat("[PRIMINVENTORY]: " + 1633 // m_log.InfoFormat("[PRIMINVENTORY]: " +
1628 // "Rezzed script {0} into prim local ID {1} for user {2}", 1634 // "Rezzed script {0} into prim local ID {1} for user {2}",
1629 // item.inventoryName, localID, remoteClient.Name); 1635 // item.inventoryName, localID, remoteClient.Name);
1636
1630 part.ParentGroup.ResumeScripts(); 1637 part.ParentGroup.ResumeScripts();
1631 1638
1632 return part; 1639 return part;
@@ -1707,6 +1714,10 @@ namespace OpenSim.Region.Framework.Scenes
1707 1714
1708 part.Inventory.AddInventoryItem(taskItem, false); 1715 part.Inventory.AddInventoryItem(taskItem, false);
1709 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1716 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
1717
1718 // tell anyone managing scripts that a new script exists
1719 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
1720
1710 part.ParentGroup.ResumeScripts(); 1721 part.ParentGroup.ResumeScripts();
1711 1722
1712 return part; 1723 return part;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d2a8ad0..9bca654 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -864,16 +864,16 @@ namespace OpenSim.Region.Framework.Scenes
864 try 864 try
865 { 865 {
866 ForEachRootScenePresence(delegate(ScenePresence agent) 866 ForEachRootScenePresence(delegate(ScenePresence agent)
867 { 867 {
868 //agent.ControllingClient.new 868 //agent.ControllingClient.new
869 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 869 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
870 870
871 List<ulong> old = new List<ulong>(); 871 List<ulong> old = new List<ulong>();
872 old.Add(otherRegion.RegionHandle); 872 old.Add(otherRegion.RegionHandle);
873 agent.DropOldNeighbours(old); 873 agent.DropOldNeighbours(old);
874 if (m_teleportModule != null) 874 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
875 m_teleportModule.EnableChildAgent(agent, otherRegion); 875 m_teleportModule.EnableChildAgent(agent, otherRegion);
876 }); 876 });
877 } 877 }
878 catch (NullReferenceException) 878 catch (NullReferenceException)
879 { 879 {
@@ -881,7 +881,6 @@ namespace OpenSim.Region.Framework.Scenes
881 // This shouldn't happen too often anymore. 881 // This shouldn't happen too often anymore.
882 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception"); 882 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
883 } 883 }
884
885 } 884 }
886 else 885 else
887 { 886 {
@@ -1009,10 +1008,10 @@ namespace OpenSim.Region.Framework.Scenes
1009 try 1008 try
1010 { 1009 {
1011 ForEachRootScenePresence(delegate(ScenePresence agent) 1010 ForEachRootScenePresence(delegate(ScenePresence agent)
1012 { 1011 {
1013 if (m_teleportModule != null) 1012 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
1014 m_teleportModule.EnableChildAgent(agent, r); 1013 m_teleportModule.EnableChildAgent(agent, r);
1015 }); 1014 });
1016 } 1015 }
1017 catch (NullReferenceException) 1016 catch (NullReferenceException)
1018 { 1017 {
@@ -1141,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes
1141 1140
1142 HeartbeatThread 1141 HeartbeatThread
1143 = Watchdog.StartThread( 1142 = Watchdog.StartThread(
1144 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); 1143 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1145 } 1144 }
1146 1145
1147 /// <summary> 1146 /// <summary>
@@ -1179,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes
1179 try 1178 try
1180 { 1179 {
1181 m_eventManager.TriggerOnRegionStarted(this); 1180 m_eventManager.TriggerOnRegionStarted(this);
1181
1182 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1183 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1184 // alarms for scenes with many objects.
1185 Update();
1186 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1187
1182 while (!shuttingdown) 1188 while (!shuttingdown)
1183 Update(); 1189 Update();
1184 1190
@@ -1207,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
1207 1213
1208 ++Frame; 1214 ++Frame;
1209 1215
1210// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1216// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1211 1217
1212 try 1218 try
1213 { 1219 {
@@ -1362,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes
1362 { 1368 {
1363 throw; 1369 throw;
1364 } 1370 }
1365 catch (AccessViolationException e)
1366 {
1367 m_log.ErrorFormat(
1368 "[REGION]: Failed on region {0} with exception {1}{2}",
1369 RegionInfo.RegionName, e.Message, e.StackTrace);
1370 }
1371 //catch (NullReferenceException e)
1372 //{
1373 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1374 //}
1375 catch (InvalidOperationException e)
1376 {
1377 m_log.ErrorFormat(
1378 "[REGION]: Failed on region {0} with exception {1}{2}",
1379 RegionInfo.RegionName, e.Message, e.StackTrace);
1380 }
1381 catch (Exception e) 1371 catch (Exception e)
1382 { 1372 {
1383 m_log.ErrorFormat( 1373 m_log.ErrorFormat(
1384 "[REGION]: Failed on region {0} with exception {1}{2}", 1374 "[SCENE]: Failed on region {0} with exception {1}{2}",
1385 RegionInfo.RegionName, e.Message, e.StackTrace); 1375 RegionInfo.RegionName, e.Message, e.StackTrace);
1386 } 1376 }
1387 1377
@@ -1419,7 +1409,6 @@ namespace OpenSim.Region.Framework.Scenes
1419 entry.checkAtTargets(); 1409 entry.checkAtTargets();
1420 } 1410 }
1421 1411
1422
1423 /// <summary> 1412 /// <summary>
1424 /// Send out simstats data to all clients 1413 /// Send out simstats data to all clients
1425 /// </summary> 1414 /// </summary>
@@ -2318,7 +2307,7 @@ namespace OpenSim.Region.Framework.Scenes
2318 /// </summary> 2307 /// </summary>
2319 /// <param name="sog"></param> 2308 /// <param name="sog"></param>
2320 /// <returns></returns> 2309 /// <returns></returns>
2321 public bool IncomingCreateObject(ISceneObject sog) 2310 public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
2322 { 2311 {
2323 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition, 2312 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2324 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment); 2313 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
@@ -2334,6 +2323,9 @@ namespace OpenSim.Region.Framework.Scenes
2334 return false; 2323 return false;
2335 } 2324 }
2336 2325
2326 if (newPosition != Vector3.Zero)
2327 newObject.RootPart.GroupPosition = newPosition;
2328
2337 if (!AddSceneObject(newObject)) 2329 if (!AddSceneObject(newObject))
2338 { 2330 {
2339 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2331 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
@@ -4258,10 +4250,7 @@ namespace OpenSim.Region.Framework.Scenes
4258 /// <param name="action"></param> 4250 /// <param name="action"></param>
4259 public void ForEachRootScenePresence(Action<ScenePresence> action) 4251 public void ForEachRootScenePresence(Action<ScenePresence> action)
4260 { 4252 {
4261 if (m_sceneGraph != null) 4253 m_sceneGraph.ForEachAvatar(action);
4262 {
4263 m_sceneGraph.ForEachAvatar(action);
4264 }
4265 } 4254 }
4266 4255
4267 /// <summary> 4256 /// <summary>
@@ -4270,10 +4259,7 @@ namespace OpenSim.Region.Framework.Scenes
4270 /// <param name="action"></param> 4259 /// <param name="action"></param>
4271 public void ForEachScenePresence(Action<ScenePresence> action) 4260 public void ForEachScenePresence(Action<ScenePresence> action)
4272 { 4261 {
4273 if (m_sceneGraph != null) 4262 m_sceneGraph.ForEachScenePresence(action);
4274 {
4275 m_sceneGraph.ForEachScenePresence(action);
4276 }
4277 } 4263 }
4278 4264
4279 /// <summary> 4265 /// <summary>
@@ -4703,7 +4689,10 @@ namespace OpenSim.Region.Framework.Scenes
4703 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4689 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4704 if (nearestPoint != null) 4690 if (nearestPoint != null)
4705 { 4691 {
4706 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 4692// m_log.DebugFormat(
4693// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}",
4694// avatar.Name, nearestPoint, nearestParcel.LandData.Name);
4695
4707 return nearestPoint.Value; 4696 return nearestPoint.Value;
4708 } 4697 }
4709 4698
@@ -4713,12 +4702,16 @@ namespace OpenSim.Region.Framework.Scenes
4713 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 4702 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
4714 if (nearestPoint != null) 4703 if (nearestPoint != null)
4715 { 4704 {
4716 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 4705// m_log.DebugFormat(
4706// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint);
4707
4717 return nearestPoint.Value; 4708 return nearestPoint.Value;
4718 } 4709 }
4719 4710
4720 //Ultimate backup if we have no idea where they are 4711 //Ultimate backup if we have no idea where they are
4721 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 4712// m_log.DebugFormat(
4713// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition);
4714
4722 return avatar.lastKnownAllowedPosition; 4715 return avatar.lastKnownAllowedPosition;
4723 } 4716 }
4724 4717
@@ -5124,7 +5117,7 @@ namespace OpenSim.Region.Framework.Scenes
5124// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); 5117// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
5125 5118
5126 Vector3 agent_control_v3 = new Vector3(); 5119 Vector3 agent_control_v3 = new Vector3();
5127 presence.HandleMoveToTargetUpdate(ref agent_control_v3); 5120 presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
5128 presence.AddNewMovement(agent_control_v3); 5121 presence.AddNewMovement(agent_control_v3);
5129 } 5122 }
5130 } 5123 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 19c9745..b5007cd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -156,8 +156,9 @@ namespace OpenSim.Region.Framework.Scenes
156 // that the region position is cached or performance will degrade 156 // that the region position is cached or performance will degrade
157 Utils.LongToUInts(regionHandle, out x, out y); 157 Utils.LongToUInts(regionHandle, out x, out y);
158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
159 bool v = true; 159
160 if (! simulatorList.Contains(dest.ServerURI)) 160// bool v = true;
161 if (!simulatorList.Contains(dest.ServerURI))
161 { 162 {
162 // we havent seen this simulator before, add it to the list 163 // we havent seen this simulator before, add it to the list
163 // and send it an update 164 // and send it an update
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e66678a..66fb493 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1592,7 +1592,7 @@ namespace OpenSim.Region.Framework.Scenes
1592 1592
1593 if (group != null) 1593 if (group != null)
1594 { 1594 {
1595 if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) 1595 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1596 { 1596 {
1597 group.UpdateExtraParam(primLocalID, type, inUse, data); 1597 group.UpdateExtraParam(primLocalID, type, inUse, data);
1598 } 1598 }
@@ -1609,7 +1609,7 @@ namespace OpenSim.Region.Framework.Scenes
1609 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1609 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1610 if (group != null) 1610 if (group != null)
1611 { 1611 {
1612 if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) 1612 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1613 { 1613 {
1614 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); 1614 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
1615 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; 1615 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index daf711c..40c8d06 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
1048 } 1048 }
1049 1049
1050 /// <summary> 1050 /// <summary>
1051 /// 1051 /// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
1052 /// </summary> 1052 /// </summary>
1053 /// <param name="pos"></param> 1053 /// <param name="pos"></param>
1054 public void Teleport(Vector3 pos) 1054 public void Teleport(Vector3 pos)
@@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes
1522 } 1522 }
1523 else if (bAllowUpdateMoveToPosition) 1523 else if (bAllowUpdateMoveToPosition)
1524 { 1524 {
1525 if (HandleMoveToTargetUpdate(ref agent_control_v3)) 1525 // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a
1526 // certain position. It's only check for tolerance on returning to that position is 0.2
1527 // rather than 1, at which point it removes its force target.
1528 if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3))
1526 update_movementflag = true; 1529 update_movementflag = true;
1527 } 1530 }
1528 } 1531 }
@@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
1584 /// </remarks> 1587 /// </remarks>
1585 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> 1588 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1586 /// <returns>True if movement has been updated in some way. False otherwise.</returns> 1589 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1587 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) 1590 public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3)
1588 { 1591 {
1589// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); 1592// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1590 1593
@@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
1601// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); 1604// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
1602 1605
1603 // Check the error term of the current position in relation to the target position 1606 // Check the error term of the current position in relation to the target position
1604 if (distanceToTarget <= 1) 1607 if (distanceToTarget <= tolerance)
1605 { 1608 {
1606 // We are close enough to the target 1609 // We are close enough to the target
1607 AbsolutePosition = MoveToPositionTarget; 1610 AbsolutePosition = MoveToPositionTarget;
@@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes
1777// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); 1780// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
1778 1781
1779 Vector3 agent_control_v3 = new Vector3(); 1782 Vector3 agent_control_v3 = new Vector3();
1780 HandleMoveToTargetUpdate(ref agent_control_v3); 1783 HandleMoveToTargetUpdate(1, ref agent_control_v3);
1781 AddNewMovement(agent_control_v3); 1784 AddNewMovement(agent_control_v3);
1782 } 1785 }
1783 1786
@@ -3223,7 +3226,7 @@ namespace OpenSim.Region.Framework.Scenes
3223 ((SceneObjectGroup)so).LocalId = 0; 3226 ((SceneObjectGroup)so).LocalId = 0;
3224 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); 3227 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
3225 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene); 3228 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3226 m_scene.IncomingCreateObject(so); 3229 m_scene.IncomingCreateObject(Vector3.Zero, so);
3227 } 3230 }
3228 } 3231 }
3229 } 3232 }
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index c928af7..d3c96e2 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
70 m_client = client; 70 m_client = client;
71 m_scene = scene; 71 m_scene = scene;
72 72
73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); 73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
74 } 74 }
75 75
76 private void SendServerCommand(string command) 76 private void SendServerCommand(string command)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index eb39026..a7c5020 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
57 57
58 m_listener.Start(50); 58 m_listener.Start(50);
59 59
60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); 60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
61 m_baseScene = baseScene; 61 m_baseScene = baseScene;
62 } 62 }
63 63
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
index 61be56d..0730824 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
@@ -51,6 +51,9 @@ public class BSPlugin : IPhysicsPlugin
51 { 51 {
52 if (_mScene == null) 52 if (_mScene == null)
53 { 53 {
54 if (Util.IsWindows())
55 Util.LoadArchSpecificWindowsDll("BulletSim.dll");
56
54 _mScene = new BSScene(sceneIdentifier); 57 _mScene = new BSScene(sceneIdentifier);
55 } 58 }
56 return (_mScene); 59 return (_mScene);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 3763696..8587a2b 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -30,7 +30,8 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using log4net; 33using log4net;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Region.Physics.Manager 36namespace OpenSim.Region.Physics.Manager
36{ 37{
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 75364b7..97890ee 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
1474 /// </summary> 1474 /// </summary>
1475 private void changeadd() 1475 private void changeadd()
1476 { 1476 {
1477// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
1478
1477 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 1479 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
1478 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); 1480 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
1479 1481
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 716161a..478dd95 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
46 /// </summary> 46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin 47 public class OdePlugin : IPhysicsPlugin
48 { 48 {
49 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private OdeScene m_scene; 51 private OdeScene m_scene;
52 52
@@ -59,13 +59,23 @@ namespace OpenSim.Region.Physics.OdePlugin
59 { 59 {
60 if (m_scene == null) 60 if (m_scene == null)
61 { 61 {
62 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
63 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
64 // will find it already loaded later on.
65 //
66 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
67 // controlled in Ode.NET.dll.config
68 if (Util.IsWindows())
69 Util.LoadArchSpecificWindowsDll("ode.dll");
70
62 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to 71 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
63 // http://opensimulator.org/mantis/view.php?id=2750). 72 // http://opensimulator.org/mantis/view.php?id=2750).
64 d.InitODE(); 73 d.InitODE();
65 74
66 m_scene = new OdeScene(sceneIdentifier); 75 m_scene = new OdeScene(sceneIdentifier);
67 } 76 }
68 return (m_scene); 77
78 return m_scene;
69 } 79 }
70 80
71 public string GetName() 81 public string GetName()
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
deleted file mode 100644
index fa5e66a..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// Information about this assembly is defined by the following
32// attributes.
33//
34// change them to the information which is associated with the assembly
35// you compile.
36
37[assembly : AssemblyTitle("RealPhysXplugin")]
38[assembly : AssemblyDescription("")]
39[assembly : AssemblyConfiguration("")]
40[assembly : AssemblyCompany("http://opensimulator.org")]
41[assembly : AssemblyProduct("RealPhysXplugin")]
42[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
43[assembly : AssemblyTrademark("")]
44[assembly : AssemblyCulture("")]
45
46// This sets the default COM visibility of types in the assembly to invisible.
47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
48
49[assembly : ComVisible(false)]
50
51// The assembly version has following format :
52//
53// Major.Minor.Build.Revision
54//
55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default):
57
58[assembly : AssemblyVersion("0.6.5.*")]
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs
deleted file mode 100644
index 9216a9e..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs
+++ /dev/null
@@ -1,349 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXCharacter : PhysicsActor
42 {
43 private Vector3 _position;
44 private Vector3 _velocity;
45 private Vector3 m_rotationalVelocity = Vector3.Zero;
46 private Vector3 _acceleration;
47 private NxCharacter _character;
48 private bool flying;
49 private bool iscolliding = false;
50 private float gravityAccel;
51
52 public PhysXCharacter(NxCharacter character)
53 {
54 _character = character;
55 }
56
57 public override int PhysicsActorType
58 {
59 get { return (int) ActorTypes.Agent; }
60 set { return; }
61 }
62
63 public override bool SetAlwaysRun
64 {
65 get { return false; }
66 set { return; }
67 }
68
69 public override uint LocalID
70 {
71 set { return; }
72 }
73
74 public override bool Grabbed
75 {
76 set { return; }
77 }
78
79 public override bool Selected
80 {
81 set { return; }
82 }
83
84 public override float Buoyancy
85 {
86 get { return 0f; }
87 set { return; }
88 }
89
90 public override bool FloatOnWater
91 {
92 set { return; }
93 }
94
95 public override bool IsPhysical
96 {
97 get { return false; }
98 set { return; }
99 }
100
101 public override bool ThrottleUpdates
102 {
103 get { return false; }
104 set { return; }
105 }
106
107 public override bool Flying
108 {
109 get { return flying; }
110 set { flying = value; }
111 }
112
113 public override bool IsColliding
114 {
115 get { return iscolliding; }
116 set { iscolliding = value; }
117 }
118
119 public override bool CollidingGround
120 {
121 get { return false; }
122 set { return; }
123 }
124
125 public override bool CollidingObj
126 {
127 get { return false; }
128 set { return; }
129 }
130
131 public override Vector3 RotationalVelocity
132 {
133 get { return m_rotationalVelocity; }
134 set { m_rotationalVelocity = value; }
135 }
136
137 public override bool Stopped
138 {
139 get { return false; }
140 }
141
142 public override Vector3 Position
143 {
144 get { return _position; }
145 set
146 {
147 _position = value;
148 Vec3 ps = new Vec3();
149 ps.X = value.X;
150 ps.Y = value.Y;
151 ps.Z = value.Z;
152 _character.Position = ps;
153 }
154 }
155
156 public override Vector3 Size
157 {
158 get { return Vector3.Zero; }
159 set { }
160 }
161
162 public override float Mass
163 {
164 get { return 0f; }
165 }
166
167 public override Vector3 Force
168 {
169 get { return Vector3.Zero; }
170 set { return; }
171 }
172
173 public override int VehicleType
174 {
175 get { return 0; }
176 set { return; }
177 }
178
179 public override void VehicleFloatParam(int param, float value)
180 {
181 }
182
183 public override void VehicleVectorParam(int param, Vector3 value)
184 {
185 }
186
187 public override void VehicleRotationParam(int param, Quaternion rotation)
188 {
189 }
190
191 public override void VehicleFlags(int param, bool remove)
192 {
193 }
194
195 public override void SetVolumeDetect(int param)
196 {
197 }
198
199 public override Vector3 CenterOfMass
200 {
201 get { return Vector3.Zero; }
202 }
203
204 public override Vector3 GeometricCenter
205 {
206 get { return Vector3.Zero; }
207 }
208
209 public override Vector3 Velocity
210 {
211 get { return _velocity; }
212 set { _velocity = value; }
213 }
214
215 public override float CollisionScore
216 {
217 get { return 0f; }
218 set { }
219 }
220
221 public override bool Kinematic
222 {
223 get { return false; }
224 set { }
225 }
226
227 public override Quaternion Orientation
228 {
229 get { return Quaternion.Identity; }
230 set { }
231 }
232
233 public override Vector3 Acceleration
234 {
235 get { return _acceleration; }
236 set { _acceleration = value; }
237 }
238
239 public override void AddForce(Vector3 force, bool pushforce)
240 {
241 }
242
243 public override Vector3 Torque
244 {
245 get { return Vector3.Zero; }
246 set { return; }
247 }
248
249 public override void AddAngularForce(Vector3 force, bool pushforce)
250 {
251 }
252
253 public override void link(PhysicsActor obj)
254 {
255 }
256
257 public override void delink()
258 {
259 }
260
261 public override void LockAngularMotion(Vector3 axis)
262 {
263 }
264
265 public override void SetMomentum(Vector3 momentum)
266 {
267 }
268
269 public void Move(float timeStep)
270 {
271 Vec3 vec = new Vec3();
272 vec.X = _velocity.X*timeStep;
273 vec.Y = _velocity.Y*timeStep;
274 if (flying)
275 {
276 vec.Z = (_velocity.Z)*timeStep;
277 }
278 else
279 {
280 gravityAccel += -9.8f;
281 vec.Z = (gravityAccel + _velocity.Z)*timeStep;
282 }
283 int res = _character.Move(vec);
284 if (res == 1)
285 {
286 gravityAccel = 0;
287 }
288 }
289
290 public override PrimitiveBaseShape Shape
291 {
292 set { return; }
293 }
294
295 public void UpdatePosition()
296 {
297 Vec3 vec = _character.Position;
298 _position.X = vec.X;
299 _position.Y = vec.Y;
300 _position.Z = vec.Z;
301 }
302
303 public override void CrossingFailure()
304 {
305 }
306
307 public override Vector3 PIDTarget { set { return; } }
308 public override bool PIDActive { set { return; } }
309 public override float PIDTau { set { return; } }
310
311 public override float PIDHoverHeight { set { return; } }
312 public override bool PIDHoverActive { set { return; } }
313 public override PIDHoverType PIDHoverType { set { return; } }
314 public override float PIDHoverTau { set { return; } }
315
316 public override Quaternion APIDTarget
317 {
318 set { return; }
319 }
320
321 public override bool APIDActive
322 {
323 set { return; }
324 }
325
326 public override float APIDStrength
327 {
328 set { return; }
329 }
330
331 public override float APIDDamping
332 {
333 set { return; }
334 }
335
336 public override void SubscribeEvents(int ms)
337 {
338
339 }
340 public override void UnSubscribeEvents()
341 {
342
343 }
344 public override bool SubscribedEvents()
345 {
346 return false;
347 }
348 }
349}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
deleted file mode 100644
index ca7a4f8..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 /// <summary>
42 /// Will be the PhysX plugin but for now will be a very basic physics engine
43 /// </summary>
44 public class PhysXPlugin : IPhysicsPlugin
45 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private PhysXScene _mScene;
48
49 public PhysXPlugin()
50 {
51 }
52
53 public bool Init()
54 {
55 return true;
56 }
57
58 public PhysicsScene GetScene(string sceneIdentifier)
59 {
60 if (_mScene == null)
61 {
62 _mScene = new PhysXScene(sceneIdentifier);
63 }
64 return (_mScene);
65 }
66
67 public string GetName()
68 {
69 return ("RealPhysX");
70 }
71
72 public void Dispose()
73 {
74 }
75 }
76}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs
deleted file mode 100644
index 42bd119..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs
+++ /dev/null
@@ -1,341 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXPrim : PhysicsActor
42 {
43 private Vector3 _velocity;
44 private Vector3 _acceleration;
45 private Vector3 m_rotationalVelocity;
46 private NxActor _prim;
47
48 public PhysXPrim(NxActor prim)
49 {
50 _velocity = Vector3.Zero;
51 _acceleration = Vector3.Zero;
52 _prim = prim;
53 }
54
55 public override int PhysicsActorType
56 {
57 get { return (int) ActorTypes.Prim; }
58 set { return; }
59 }
60
61 public override bool IsPhysical
62 {
63 get { return false; }
64 set { return; }
65 }
66
67 public override bool SetAlwaysRun
68 {
69 get { return false; }
70 set { return; }
71 }
72
73 public override uint LocalID
74 {
75 set { return; }
76 }
77
78 public override bool Grabbed
79 {
80 set { return; }
81 }
82
83 public override bool Selected
84 {
85 set { return; }
86 }
87
88 public override float Buoyancy
89 {
90 get { return 0f; }
91 set { return; }
92 }
93
94 public override bool FloatOnWater
95 {
96 set { return; }
97 }
98
99 public override bool ThrottleUpdates
100 {
101 get { return false; }
102 set { return; }
103 }
104
105 public override Vector3 RotationalVelocity
106 {
107 get { return m_rotationalVelocity; }
108 set { m_rotationalVelocity = value; }
109 }
110
111 public override bool Flying
112 {
113 get { return false; //no flying prims for you
114 }
115 set { }
116 }
117
118 public override bool IsColliding
119 {
120 get { return false; }
121 set { }
122 }
123
124 public override bool CollidingGround
125 {
126 get { return false; }
127 set { return; }
128 }
129
130 public override bool CollidingObj
131 {
132 get { return false; }
133 set { return; }
134 }
135
136 public override bool Stopped
137 {
138 get { return false; }
139 }
140
141 public override Vector3 Position
142 {
143 get
144 {
145 Vector3 pos = Vector3.Zero;
146 Vec3 vec = _prim.Position;
147 pos.X = vec.X;
148 pos.Y = vec.Y;
149 pos.Z = vec.Z;
150 return pos;
151 }
152 set
153 {
154 Vector3 vec = value;
155 Vec3 pos = new Vec3();
156 pos.X = vec.X;
157 pos.Y = vec.Y;
158 pos.Z = vec.Z;
159 _prim.Position = pos;
160 }
161 }
162
163 public override PrimitiveBaseShape Shape
164 {
165 set { return; }
166 }
167
168 public override Vector3 Velocity
169 {
170 get { return _velocity; }
171 set { _velocity = value; }
172 }
173
174 public override Vector3 Torque
175 {
176 get { return Vector3.Zero; }
177 set { return; }
178 }
179
180 public override float CollisionScore
181 {
182 get { return 0f; }
183 set { }
184 }
185
186 public override bool Kinematic
187 {
188 get { return _prim.Kinematic; }
189 set { _prim.Kinematic = value; }
190 }
191
192 public override Quaternion Orientation
193 {
194 get
195 {
196 Quaternion res;
197 PhysXWrapper.Quaternion quat = _prim.GetOrientation();
198 res.W = quat.W;
199 res.X = quat.X;
200 res.Y = quat.Y;
201 res.Z = quat.Z;
202 return res;
203 }
204 set { }
205 }
206
207 public override Vector3 Acceleration
208 {
209 get { return _acceleration; }
210 set { _acceleration = value; }
211 }
212
213 public override void AddForce(Vector3 force, bool pushforce)
214 {
215 }
216
217 public override void AddAngularForce(Vector3 force, bool pushforce)
218 {
219 }
220
221 public override void SetMomentum(Vector3 momentum)
222 {
223 }
224
225 public override Vector3 Size
226 {
227 get { return Vector3.Zero; }
228 set { }
229 }
230
231 public override void link(PhysicsActor obj)
232 {
233 }
234
235 public override void delink()
236 {
237 }
238
239 public override void LockAngularMotion(Vector3 axis)
240 {
241
242 }
243
244 public override float Mass
245 {
246 get { return 0f; }
247 }
248
249 public override Vector3 Force
250 {
251 get { return Vector3.Zero; }
252 set { return; }
253 }
254
255 public override int VehicleType
256 {
257 get { return 0; }
258 set { return; }
259 }
260
261 public override void VehicleFloatParam(int param, float value)
262 {
263
264 }
265
266 public override void VehicleVectorParam(int param, Vector3 value)
267 {
268
269 }
270
271 public override void VehicleRotationParam(int param, Quaternion rotation)
272 {
273
274 }
275
276 public override void VehicleFlags(int param, bool remove) { }
277
278 public override void SetVolumeDetect(int param)
279 {
280
281 }
282
283 public override Vector3 CenterOfMass
284 {
285 get { return Vector3.Zero; }
286 }
287
288 public override Vector3 GeometricCenter
289 {
290 get { return Vector3.Zero; }
291 }
292
293 public override void CrossingFailure()
294 {
295 }
296
297 public override Vector3 PIDTarget { set { return; } }
298 public override bool PIDActive { set { return; } }
299 public override float PIDTau { set { return; } }
300
301 public override float PIDHoverHeight { set { return; } }
302 public override bool PIDHoverActive { set { return; } }
303 public override PIDHoverType PIDHoverType { set { return; } }
304 public override float PIDHoverTau { set { return; } }
305
306 public override Quaternion APIDTarget
307 {
308 set { return; }
309 }
310
311 public override bool APIDActive
312 {
313 set { return; }
314 }
315
316 public override float APIDStrength
317 {
318 set { return; }
319 }
320
321 public override float APIDDamping
322 {
323 set { return; }
324 }
325
326
327
328 public override void SubscribeEvents(int ms)
329 {
330
331 }
332 public override void UnSubscribeEvents()
333 {
334
335 }
336 public override bool SubscribedEvents()
337 {
338 return false;
339 }
340 }
341}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs
deleted file mode 100644
index beb3404..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXScene : PhysicsScene
42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
45 private List<PhysXPrim> _prims = new List<PhysXPrim>();
46 private float[] _heightMap = null;
47 private NxPhysicsSDK mySdk;
48 private NxScene scene;
49
50 // protected internal string sceneIdentifier;
51 public PhysXScene(string _sceneIdentifier)
52 {
53 //sceneIdentifier = _sceneIdentifier;
54
55 mySdk = NxPhysicsSDK.CreateSDK();
56 m_log.Info("Sdk created - now creating scene");
57 scene = mySdk.CreateScene();
58 }
59
60 public override void Initialise(IMesher meshmerizer, IConfigSource config)
61 {
62 // Does nothing right now
63 }
64 public override void Dispose()
65 {
66
67 }
68
69 public override void SetWaterLevel(float baseheight)
70 {
71
72 }
73
74 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
75 {
76 Vec3 pos = new Vec3();
77 pos.X = position.X;
78 pos.Y = position.Y;
79 pos.Z = position.Z;
80 PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
81 act.Flying = isFlying;
82 act.Position = position;
83 _characters.Add(act);
84 return act;
85 }
86
87 public override void RemovePrim(PhysicsActor prim)
88 {
89 }
90
91 public override void RemoveAvatar(PhysicsActor actor)
92 {
93 }
94
95 private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
96 {
97 Vec3 pos = new Vec3();
98 pos.X = position.X;
99 pos.Y = position.Y;
100 pos.Z = position.Z;
101 Vec3 siz = new Vec3();
102 siz.X = size.X;
103 siz.Y = size.Y;
104 siz.Z = size.Z;
105 PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
106 _prims.Add(act);
107 return act;
108 }
109
110 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
111 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
112 {
113 return AddPrim(position, size, rotation);
114 }
115
116 public override void AddPhysicsActorTaint(PhysicsActor prim)
117 {
118 }
119
120 public override float Simulate(float timeStep)
121 {
122 float fps = 0f;
123 try
124 {
125 foreach (PhysXCharacter actor in _characters)
126 {
127 actor.Move(timeStep);
128 }
129 scene.Simulate(timeStep);
130 scene.FetchResults();
131 scene.UpdateControllers();
132
133 foreach (PhysXCharacter actor in _characters)
134 {
135 actor.UpdatePosition();
136 }
137 }
138 catch (Exception e)
139 {
140 m_log.Error(e.Message);
141 }
142 return fps;
143 }
144
145 public override void GetResults()
146 {
147 }
148
149 public override bool IsThreaded
150 {
151 // for now we won't be multithreaded
152 get { return (false); }
153 }
154
155 public override void SetTerrain(float[] heightMap)
156 {
157 if (_heightMap != null)
158 {
159 m_log.Debug("PhysX - deleting old terrain");
160 scene.DeleteTerrain();
161 }
162 _heightMap = heightMap;
163 scene.AddTerrain(heightMap);
164 }
165
166 public override void DeleteTerrain()
167 {
168 scene.DeleteTerrain();
169 }
170
171 public override Dictionary<uint, float> GetTopColliders()
172 {
173 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
174 return returncolliders;
175 }
176 }
177}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index ee32755..14edde4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
137 if (cmdHandlerThread == null) 137 if (cmdHandlerThread == null)
138 { 138 {
139 // Start the thread that will be doing the work 139 // Start the thread that will be doing the work
140 cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); 140 cmdHandlerThread
141 = Watchdog.StartThread(
142 CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
141 } 143 }
142 } 144 }
143 145
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0bdd84a..525c3c3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3845,7 +3845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3845 // Single prim 3845 // Single prim
3846 if (m_host.LinkNum == 0) 3846 if (m_host.LinkNum == 0)
3847 { 3847 {
3848 if (linknum == 0) 3848 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT)
3849 return m_host.Name; 3849 return m_host.Name;
3850 else 3850 else
3851 return UUID.Zero.ToString(); 3851 return UUID.Zero.ToString();
@@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6376 } 6376 }
6377 } 6377 }
6378 6378
6379 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) 6379 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
6380 { 6380 {
6381 m_host.AddScriptLPS(1);
6382 // LSL quaternions can normalize to 0, normal Quaternions can't. 6381 // LSL quaternions can normalize to 0, normal Quaternions can't.
6383 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6382 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6384 rot.z = 1; // ZERO_ROTATION = 0,0,0,1 6383 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6385 6384
6386 m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6385 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
6387 m_host.SitTargetOrientation = Rot2Quaternion(rot); 6386 part.SitTargetOrientation = Rot2Quaternion(rot);
6388 m_host.ParentGroup.HasGroupChanged = true; 6387 part.ParentGroup.HasGroupChanged = true;
6388 }
6389
6390 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
6391 {
6392 m_host.AddScriptLPS(1);
6393 SitTarget(m_host, offset, rot);
6394 }
6395
6396 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
6397 {
6398 m_host.AddScriptLPS(1);
6399 if (link == ScriptBaseClass.LINK_ROOT)
6400 SitTarget(m_host.ParentGroup.RootPart, offset, rot);
6401 else if (link == ScriptBaseClass.LINK_THIS)
6402 SitTarget(m_host, offset, rot);
6403 else
6404 {
6405 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
6406 if (null != part)
6407 {
6408 SitTarget(part, offset, rot);
6409 }
6410 }
6389 } 6411 }
6390 6412
6391 public LSL_String llAvatarOnSitTarget() 6413 public LSL_String llAvatarOnSitTarget()
@@ -8151,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8151 { 8173 {
8152 m_host.AddScriptLPS(1); 8174 m_host.AddScriptLPS(1);
8153 ScriptSleep(1000); 8175 ScriptSleep(1000);
8176 return GetPrimMediaParams(m_host, face, rules);
8177 }
8154 8178
8179 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8180 {
8181 m_host.AddScriptLPS(1);
8182 ScriptSleep(1000);
8183 if (link == ScriptBaseClass.LINK_ROOT)
8184 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8185 else if (link == ScriptBaseClass.LINK_THIS)
8186 return GetPrimMediaParams(m_host, face, rules);
8187 else
8188 {
8189 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8190 if (null != part)
8191 return GetPrimMediaParams(part, face, rules);
8192 }
8193
8194 return new LSL_List();
8195 }
8196
8197 private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
8198 {
8155 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 8199 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
8156 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 8200 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
8157 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8201 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8158 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8202 if (face < 0 || face > part.GetNumberOfSides() - 1)
8159 return new LSL_List(); 8203 return new LSL_List();
8160 8204
8161 return GetPrimMediaParams(face, rules);
8162 }
8163
8164 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8165 {
8166 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8205 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8167 if (null == module) 8206 if (null == module)
8168 throw new Exception("Media on a prim functions not available"); 8207 return new LSL_List();
8169 8208
8170 MediaEntry me = module.GetMediaEntry(m_host, face); 8209 MediaEntry me = module.GetMediaEntry(part, face);
8171 8210
8172 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8211 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8173 if (null == me) 8212 if (null == me)
@@ -8249,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8249 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8288 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8250 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8289 res.Add(new LSL_Integer((int)me.ControlPermissions));
8251 break; 8290 break;
8291
8292 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8252 } 8293 }
8253 } 8294 }
8254 8295
8255 return res; 8296 return res;
8256 } 8297 }
8257 8298
8258 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8299 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
8259 { 8300 {
8260 m_host.AddScriptLPS(1); 8301 m_host.AddScriptLPS(1);
8261 ScriptSleep(1000); 8302 ScriptSleep(1000);
8303 return SetPrimMediaParams(m_host, face, rules);
8304 }
8262 8305
8263 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid 8306 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8264 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8307 {
8265 // Don't perform the media check directly 8308 m_host.AddScriptLPS(1);
8266 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8309 ScriptSleep(1000);
8267 return ScriptBaseClass.LSL_STATUS_OK; 8310 if (link == ScriptBaseClass.LINK_ROOT)
8311 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8312 else if (link == ScriptBaseClass.LINK_THIS)
8313 return SetPrimMediaParams(m_host, face, rules);
8314 else
8315 {
8316 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8317 if (null != part)
8318 return SetPrimMediaParams(part, face, rules);
8319 }
8268 8320
8269 return SetPrimMediaParams(face, rules); 8321 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8270 } 8322 }
8271 8323
8272 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8324 private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
8273 { 8325 {
8326 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
8327 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8328 // Don't perform the media check directly
8329 if (face < 0 || face > part.GetNumberOfSides() - 1)
8330 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8331
8274 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8332 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8275 if (null == module) 8333 if (null == module)
8276 throw new Exception("Media on a prim functions not available"); 8334 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8277 8335
8278 MediaEntry me = module.GetMediaEntry(m_host, face); 8336 MediaEntry me = module.GetMediaEntry(part, face);
8279 if (null == me) 8337 if (null == me)
8280 me = new MediaEntry(); 8338 me = new MediaEntry();
8281 8339
@@ -8354,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8354 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8412 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8355 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8413 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8356 break; 8414 break;
8415
8416 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8357 } 8417 }
8358 } 8418 }
8359 8419
8360 module.SetMediaEntry(m_host, face, me); 8420 module.SetMediaEntry(part, face, me);
8361 8421
8362 return ScriptBaseClass.LSL_STATUS_OK; 8422 return ScriptBaseClass.LSL_STATUS_OK;
8363 } 8423 }
@@ -8366,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8366 { 8426 {
8367 m_host.AddScriptLPS(1); 8427 m_host.AddScriptLPS(1);
8368 ScriptSleep(1000); 8428 ScriptSleep(1000);
8429 return ClearPrimMedia(m_host, face);
8430 }
8369 8431
8432 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
8433 {
8434 m_host.AddScriptLPS(1);
8435 ScriptSleep(1000);
8436 if (link == ScriptBaseClass.LINK_ROOT)
8437 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
8438 else if (link == ScriptBaseClass.LINK_THIS)
8439 return ClearPrimMedia(m_host, face);
8440 else
8441 {
8442 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8443 if (null != part)
8444 return ClearPrimMedia(part, face);
8445 }
8446
8447 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8448 }
8449
8450 private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
8451 {
8370 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid 8452 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
8371 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8453 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
8372 // FIXME: Don't perform the media check directly 8454 // FIXME: Don't perform the media check directly
8373 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8455 if (face < 0 || face > part.GetNumberOfSides() - 1)
8374 return ScriptBaseClass.LSL_STATUS_OK; 8456 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8375 8457
8376 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8458 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8377 if (null == module) 8459 if (null == module)
8378 throw new Exception("Media on a prim functions not available"); 8460 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8379 8461
8380 module.ClearMediaEntry(m_host, face); 8462 module.ClearMediaEntry(part, face);
8381 8463
8382 return ScriptBaseClass.LSL_STATUS_OK; 8464 return ScriptBaseClass.LSL_STATUS_OK;
8383 } 8465 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c55e2ae..ff1f5fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 2740 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
2741 m_host.AddScriptLPS(1); 2741 m_host.AddScriptLPS(1);
2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 2742 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
2743 avatar.SpeedModifier = (float)SpeedModifier; 2743
2744 if (avatar != null)
2745 avatar.SpeedModifier = (float)SpeedModifier;
2744 } 2746 }
2745 2747
2746 public void osKickAvatar(string FirstName,string SurName,string alert) 2748 public void osKickAvatar(string FirstName,string SurName,string alert)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 6106a65..0f53bc3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); 64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
65 LSL_Integer llCeil(double f); 65 LSL_Integer llCeil(double f);
66 void llClearCameraParams(); 66 void llClearCameraParams();
67 LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
67 LSL_Integer llClearPrimMedia(LSL_Integer face); 68 LSL_Integer llClearPrimMedia(LSL_Integer face);
68 void llCloseRemoteDataChannel(string channel); 69 void llCloseRemoteDataChannel(string channel);
69 LSL_Float llCloud(LSL_Vector offset); 70 LSL_Float llCloud(LSL_Vector offset);
@@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
139 LSL_String llGetLinkName(int linknum); 140 LSL_String llGetLinkName(int linknum);
140 LSL_Integer llGetLinkNumber(); 141 LSL_Integer llGetLinkNumber();
141 LSL_Integer llGetLinkNumberOfSides(int link); 142 LSL_Integer llGetLinkNumberOfSides(int link);
142 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); 143 LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
144 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
143 LSL_Integer llGetListEntryType(LSL_List src, int index); 145 LSL_Integer llGetListEntryType(LSL_List src, int index);
144 LSL_Integer llGetListLength(LSL_List src); 146 LSL_Integer llGetListLength(LSL_List src);
145 LSL_Vector llGetLocalPos(); 147 LSL_Vector llGetLocalPos();
@@ -218,6 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
218 LSL_String llGetDisplayName(string id); 220 LSL_String llGetDisplayName(string id);
219 LSL_String llRequestDisplayName(string id); 221 LSL_String llRequestDisplayName(string id);
220 void llLinkParticleSystem(int linknum, LSL_List rules); 222 void llLinkParticleSystem(int linknum, LSL_List rules);
223 void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
221 LSL_String llList2CSV(LSL_List src); 224 LSL_String llList2CSV(LSL_List src);
222 LSL_Float llList2Float(LSL_List src, int index); 225 LSL_Float llList2Float(LSL_List src, int index);
223 LSL_Integer llList2Integer(LSL_List src, int index); 226 LSL_Integer llList2Integer(LSL_List src, int index);
@@ -334,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
334 void llSetInventoryPermMask(string item, int mask, int value); 337 void llSetInventoryPermMask(string item, int mask, int value);
335 void llSetLinkAlpha(int linknumber, double alpha, int face); 338 void llSetLinkAlpha(int linknumber, double alpha, int face);
336 void llSetLinkColor(int linknumber, LSL_Vector color, int face); 339 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
340 LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
337 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); 341 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
338 void llSetLinkTexture(int linknumber, string texture, int face); 342 void llSetLinkTexture(int linknumber, string texture, int face);
339 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); 343 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
@@ -344,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
344 void llSetParcelMusicURL(string url); 348 void llSetParcelMusicURL(string url);
345 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 349 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
346 void llSetPos(LSL_Vector pos); 350 void llSetPos(LSL_Vector pos);
347 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); 351 LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
348 void llSetPrimitiveParams(LSL_List rules); 352 void llSetPrimitiveParams(LSL_List rules);
349 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 353 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
350 void llSetPrimURL(string url); 354 void llSetPrimURL(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 83550a5..f8e3c36 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1688 m_LSL_Functions.llSitTarget(offset, rot); 1688 m_LSL_Functions.llSitTarget(offset, rot);
1689 } 1689 }
1690 1690
1691 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
1692 {
1693 m_LSL_Functions.llLinkSitTarget(link, offset, rot);
1694 }
1695
1691 public void llSleep(double sec) 1696 public void llSleep(double sec)
1692 { 1697 {
1693 m_LSL_Functions.llSleep(sec); 1698 m_LSL_Functions.llSleep(sec);
@@ -1882,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1882 { 1887 {
1883 return m_LSL_Functions.llGetPrimMediaParams(face, rules); 1888 return m_LSL_Functions.llGetPrimMediaParams(face, rules);
1884 } 1889 }
1885 1890
1891 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1892 {
1893 return m_LSL_Functions.llGetLinkMedia(link, face, rules);
1894 }
1895
1886 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 1896 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
1887 { 1897 {
1888 return m_LSL_Functions.llSetPrimMediaParams(face, rules); 1898 return m_LSL_Functions.llSetPrimMediaParams(face, rules);
1889 } 1899 }
1890 1900
1901 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1902 {
1903 return m_LSL_Functions.llSetLinkMedia(link, face, rules);
1904 }
1905
1891 public LSL_Integer llClearPrimMedia(LSL_Integer face) 1906 public LSL_Integer llClearPrimMedia(LSL_Integer face)
1892 { 1907 {
1893 return m_LSL_Functions.llClearPrimMedia(face); 1908 return m_LSL_Functions.llClearPrimMedia(face);
1894 } 1909 }
1895 1910
1911 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
1912 {
1913 return m_LSL_Functions.llClearLinkMedia(link, face);
1914 }
1915
1896 public void print(string str) 1916 public void print(string str)
1897 { 1917 {
1898 m_LSL_Functions.print(str); 1918 m_LSL_Functions.print(str);
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index f627e37..ad272f7 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
83 { 83 {
84 if (m_scenes.Count == 0) 84 if (m_scenes.Count == 0)
85 { 85 {
86 if (Util.IsWindows())
87 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
88
86 //IConfig startupConfig = config.Configs["Startup"]; 89 //IConfig startupConfig = config.Configs["Startup"];
87 90
88 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); 91 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index 984b843..f0d8f69 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -136,6 +136,8 @@ namespace OpenSim.Server.Handlers.Simulation
136 int x = 0, y = 0; 136 int x = 0, y = 0;
137 UUID uuid = UUID.Zero; 137 UUID uuid = UUID.Zero;
138 string regionname = string.Empty; 138 string regionname = string.Empty;
139 Vector3 newPosition = Vector3.Zero;
140
139 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 141 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
140 Int32.TryParse(args["destination_x"].AsString(), out x); 142 Int32.TryParse(args["destination_x"].AsString(), out x);
141 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 143 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
@@ -144,6 +146,8 @@ namespace OpenSim.Server.Handlers.Simulation
144 UUID.TryParse(args["destination_uuid"].AsString(), out uuid); 146 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
145 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 147 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
146 regionname = args["destination_name"].ToString(); 148 regionname = args["destination_name"].ToString();
149 if (args.ContainsKey("new_position") && args["new_position"] != null)
150 Vector3.TryParse(args["new_position"], out newPosition);
147 151
148 GridRegion destination = new GridRegion(); 152 GridRegion destination = new GridRegion();
149 destination.RegionID = uuid; 153 destination.RegionID = uuid;
@@ -199,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation
199 try 203 try
200 { 204 {
201 // This is the meaning of POST object 205 // This is the meaning of POST object
202 result = CreateObject(destination, sog); 206 result = CreateObject(destination, newPosition, sog);
203 } 207 }
204 catch (Exception e) 208 catch (Exception e)
205 { 209 {
@@ -211,9 +215,9 @@ namespace OpenSim.Server.Handlers.Simulation
211 } 215 }
212 216
213 // subclasses can override this 217 // subclasses can override this
214 protected virtual bool CreateObject(GridRegion destination, ISceneObject sog) 218 protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog)
215 { 219 {
216 return m_SimulationService.CreateObject(destination, sog, false); 220 return m_SimulationService.CreateObject(destination, newPosition, sog, false);
217 } 221 }
218 222
219 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) 223 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 65f01b3..cb003d1 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -408,7 +408,7 @@ namespace OpenSim.Services.Connectors.Simulation
408 /// <summary> 408 /// <summary>
409 /// 409 ///
410 /// </summary> 410 /// </summary>
411 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 411 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
412 { 412 {
413 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start"); 413 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");
414 414
@@ -421,6 +421,7 @@ namespace OpenSim.Services.Connectors.Simulation
421 args["sog"] = OSD.FromString(sog.ToXml2()); 421 args["sog"] = OSD.FromString(sog.ToXml2());
422 args["extra"] = OSD.FromString(sog.ExtraToXmlString()); 422 args["extra"] = OSD.FromString(sog.ExtraToXmlString());
423 args["modified"] = OSD.FromBoolean(sog.HasGroupChanged); 423 args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
424 args["new_position"] = newPosition.ToString();
424 425
425 string state = sog.GetStateSnapshot(); 426 string state = sog.GetStateSnapshot();
426 if (state.Length > 0) 427 if (state.Length > 0)
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 5f9ce6d..36fd6fc 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Services.Interfaces
98 /// <param name="sog"></param> 98 /// <param name="sog"></param>
99 /// <param name="isLocalCall"></param> 99 /// <param name="isLocalCall"></param>
100 /// <returns></returns> 100 /// <returns></returns>
101 bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall); 101 bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall);
102 102
103 /// <summary> 103 /// <summary>
104 /// Create an object from the user's inventory in the destination region. 104 /// Create an object from the user's inventory in the destination region.