diff options
Diffstat (limited to 'OpenSim/Region')
42 files changed, 2334 insertions, 2090 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 414b9bf..87ded7b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -220,7 +220,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
220 | PollServiceMeshEventArgs args; | 220 | PollServiceMeshEventArgs args; |
221 | if (m_pollservices.TryGetValue(user, out args)) | 221 | if (m_pollservices.TryGetValue(user, out args)) |
222 | { | 222 | { |
223 | args.UpdateThrottle(imagethrottle, p); | 223 | args.UpdateThrottle(imagethrottle); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
@@ -238,14 +238,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
238 | base(null, uri, null, null, null, null, pId, int.MaxValue) | 238 | base(null, uri, null, null, null, null, pId, int.MaxValue) |
239 | { | 239 | { |
240 | m_scene = scene; | 240 | m_scene = scene; |
241 | m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); | 241 | m_throttler = new MeshCapsDataThrottler(100000); |
242 | // x is request id, y is userid | 242 | // x is request id, y is userid |
243 | HasEvents = (x, y) => | 243 | HasEvents = (x, y) => |
244 | { | 244 | { |
245 | lock (responses) | 245 | lock (responses) |
246 | { | 246 | { |
247 | bool ret = m_throttler.hasEvents(x, responses); | 247 | bool ret = m_throttler.hasEvents(x, responses); |
248 | m_throttler.ProcessTime(); | ||
249 | return ret; | 248 | return ret; |
250 | 249 | ||
251 | } | 250 | } |
@@ -271,8 +270,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
271 | } | 270 | } |
272 | finally | 271 | finally |
273 | { | 272 | { |
274 | m_throttler.ProcessTime(); | ||
275 | responses.Remove(x); | 273 | responses.Remove(x); |
274 | m_throttler.PassTime(); | ||
276 | } | 275 | } |
277 | } | 276 | } |
278 | }; | 277 | }; |
@@ -285,6 +284,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
285 | reqinfo.request = y; | 284 | reqinfo.request = y; |
286 | 285 | ||
287 | m_queue.Enqueue(reqinfo); | 286 | m_queue.Enqueue(reqinfo); |
287 | m_throttler.PassTime(); | ||
288 | }; | 288 | }; |
289 | 289 | ||
290 | // this should never happen except possible on shutdown | 290 | // this should never happen except possible on shutdown |
@@ -364,12 +364,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
364 | }; | 364 | }; |
365 | 365 | ||
366 | } | 366 | } |
367 | m_throttler.ProcessTime(); | 367 | m_throttler.PassTime(); |
368 | } | 368 | } |
369 | 369 | ||
370 | internal void UpdateThrottle(int pimagethrottle, ScenePresence p) | 370 | internal void UpdateThrottle(int pthrottle) |
371 | { | 371 | { |
372 | m_throttler.UpdateThrottle(pimagethrottle, p); | 372 | int tmp = 2 * pthrottle; |
373 | if(tmp < 10000) | ||
374 | tmp = 10000; | ||
375 | m_throttler.ThrottleBytes = tmp; | ||
373 | } | 376 | } |
374 | } | 377 | } |
375 | 378 | ||
@@ -423,24 +426,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
423 | 426 | ||
424 | internal sealed class MeshCapsDataThrottler | 427 | internal sealed class MeshCapsDataThrottler |
425 | { | 428 | { |
429 | private double lastTimeElapsed = 0; | ||
430 | private double BytesSent = 0; | ||
426 | 431 | ||
427 | private volatile int currenttime = 0; | 432 | public MeshCapsDataThrottler(int pBytes) |
428 | private volatile int lastTimeElapsed = 0; | ||
429 | private volatile int BytesSent = 0; | ||
430 | private int CapSetThrottle = 0; | ||
431 | private readonly Scene m_scene; | ||
432 | private ThrottleOutPacketType Throttle; | ||
433 | private readonly UUID User; | ||
434 | |||
435 | public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) | ||
436 | { | 433 | { |
434 | if(pBytes < 10000) | ||
435 | pBytes = 10000; | ||
437 | ThrottleBytes = pBytes; | 436 | ThrottleBytes = pBytes; |
438 | if(ThrottleBytes < 10000) | 437 | lastTimeElapsed = Util.GetTimeStampMS(); |
439 | ThrottleBytes = 10000; | ||
440 | lastTimeElapsed = Util.EnvironmentTickCount(); | ||
441 | Throttle = ThrottleOutPacketType.Asset; | ||
442 | m_scene = pScene; | ||
443 | User = puser; | ||
444 | } | 438 | } |
445 | 439 | ||
446 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) | 440 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) |
@@ -470,46 +464,22 @@ namespace OpenSim.Region.ClientStack.Linden | |||
470 | return haskey; | 464 | return haskey; |
471 | } | 465 | } |
472 | 466 | ||
473 | public void ProcessTime() | 467 | public void PassTime() |
474 | { | 468 | { |
475 | PassTime(); | 469 | double currenttime = Util.GetTimeStampMS(); |
476 | } | 470 | double timeElapsed = currenttime - lastTimeElapsed; |
477 | 471 | if(timeElapsed < 50.0) | |
478 | private void PassTime() | 472 | return; |
473 | int add = (int)(ThrottleBytes * timeElapsed * 0.001); | ||
474 | if (add >= 1000) | ||
479 | { | 475 | { |
480 | currenttime = Util.EnvironmentTickCount(); | ||
481 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | ||
482 | if (timeElapsed >= 100) | ||
483 | { | ||
484 | lastTimeElapsed = currenttime; | 476 | lastTimeElapsed = currenttime; |
485 | BytesSent -= (ThrottleBytes * timeElapsed / 1000); | 477 | BytesSent -= add; |
486 | if (BytesSent < 0) BytesSent = 0; | 478 | if (BytesSent < 0) BytesSent = 0; |
487 | } | 479 | } |
488 | } | 480 | } |
489 | 481 | ||
490 | private void AlterThrottle(int setting, ScenePresence p) | 482 | public int ThrottleBytes; |
491 | { | ||
492 | p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting); | ||
493 | } | 483 | } |
494 | |||
495 | public int ThrottleBytes | ||
496 | { | ||
497 | get { return CapSetThrottle; } | ||
498 | set | ||
499 | { | ||
500 | if (value > 10000) | ||
501 | CapSetThrottle = value; | ||
502 | else | ||
503 | CapSetThrottle = 10000; | ||
504 | } | 484 | } |
505 | } | ||
506 | |||
507 | internal void UpdateThrottle(int pimagethrottle, ScenePresence p) | ||
508 | { | ||
509 | // Client set throttle ! | ||
510 | CapSetThrottle = 2 * pimagethrottle; | ||
511 | ProcessTime(); | ||
512 | } | ||
513 | } | ||
514 | } | ||
515 | } | 485 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 1a31157..d77cf0c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
221 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); | 221 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); |
222 | 222 | ||
223 | private Scene m_scene; | 223 | private Scene m_scene; |
224 | private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); | 224 | private CapsDataThrottler m_throttler = new CapsDataThrottler(100000); |
225 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : | 225 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : |
226 | base(null, "", null, null, null, null, pId, int.MaxValue) | 226 | base(null, "", null, null, null, null, pId, int.MaxValue) |
227 | { | 227 | { |
@@ -232,7 +232,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
232 | lock (responses) | 232 | lock (responses) |
233 | { | 233 | { |
234 | bool ret = m_throttler.hasEvents(x, responses); | 234 | bool ret = m_throttler.hasEvents(x, responses); |
235 | m_throttler.ProcessTime(); | ||
236 | return ret; | 235 | return ret; |
237 | 236 | ||
238 | } | 237 | } |
@@ -258,6 +257,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
258 | finally | 257 | finally |
259 | { | 258 | { |
260 | responses.Remove(x); | 259 | responses.Remove(x); |
260 | m_throttler.PassTime(); | ||
261 | } | 261 | } |
262 | } | 262 | } |
263 | }; | 263 | }; |
@@ -282,6 +282,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | m_queue.Enqueue(reqinfo); | 284 | m_queue.Enqueue(reqinfo); |
285 | m_throttler.PassTime(); | ||
285 | }; | 286 | }; |
286 | 287 | ||
287 | // this should never happen except possible on shutdown | 288 | // this should never happen except possible on shutdown |
@@ -381,14 +382,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
381 | response = response | 382 | response = response |
382 | }; | 383 | }; |
383 | } | 384 | } |
384 | m_throttler.ProcessTime(); | 385 | m_throttler.PassTime(); |
385 | } | 386 | } |
386 | 387 | ||
387 | internal void UpdateThrottle(int pimagethrottle) | 388 | internal void UpdateThrottle(int pimagethrottle) |
388 | { | 389 | { |
389 | m_throttler.ThrottleBytes = 2 * pimagethrottle; | 390 | int tmp = 2 * pimagethrottle; |
390 | if(m_throttler.ThrottleBytes < 10000) | 391 | if(tmp < 10000) |
391 | m_throttler.ThrottleBytes = 10000; | 392 | tmp = 10000; |
393 | m_throttler.ThrottleBytes = tmp; | ||
392 | } | 394 | } |
393 | } | 395 | } |
394 | 396 | ||
@@ -456,15 +458,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
456 | 458 | ||
457 | internal sealed class CapsDataThrottler | 459 | internal sealed class CapsDataThrottler |
458 | { | 460 | { |
459 | private volatile int currenttime = 0; | 461 | private double lastTimeElapsed = 0; |
460 | private volatile int lastTimeElapsed = 0; | ||
461 | private volatile int BytesSent = 0; | 462 | private volatile int BytesSent = 0; |
462 | public CapsDataThrottler(int pBytes, int max, int min) | 463 | public CapsDataThrottler(int pBytes) |
463 | { | 464 | { |
465 | if(pBytes < 10000) | ||
466 | pBytes = 10000; | ||
464 | ThrottleBytes = pBytes; | 467 | ThrottleBytes = pBytes; |
465 | if(ThrottleBytes < 10000) | 468 | lastTimeElapsed = Util.GetTimeStampMS(); |
466 | ThrottleBytes = 10000; | ||
467 | lastTimeElapsed = Util.EnvironmentTickCount(); | ||
468 | } | 469 | } |
469 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) | 470 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) |
470 | { | 471 | { |
@@ -497,20 +498,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
497 | return haskey; | 498 | return haskey; |
498 | } | 499 | } |
499 | 500 | ||
500 | public void ProcessTime() | 501 | public void PassTime() |
501 | { | 502 | { |
502 | PassTime(); | 503 | double currenttime = Util.GetTimeStampMS(); |
503 | } | 504 | double timeElapsed = currenttime - lastTimeElapsed; |
504 | 505 | if(timeElapsed < 50.0) | |
505 | private void PassTime() | 506 | return; |
507 | int add = (int)(ThrottleBytes * timeElapsed * 0.001); | ||
508 | if (add >= 1000) | ||
506 | { | 509 | { |
507 | currenttime = Util.EnvironmentTickCount(); | ||
508 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | ||
509 | //processTimeBasedActions(responses); | ||
510 | if (timeElapsed >= 100) | ||
511 | { | ||
512 | lastTimeElapsed = currenttime; | 510 | lastTimeElapsed = currenttime; |
513 | BytesSent -= (ThrottleBytes * timeElapsed / 1000); | 511 | BytesSent -= add; |
514 | if (BytesSent < 0) BytesSent = 0; | 512 | if (BytesSent < 0) BytesSent = 0; |
515 | } | 513 | } |
516 | } | 514 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 01c1fb9..861b79e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4137,6 +4137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4137 | Vector3 mypos = Vector3.Zero; | 4137 | Vector3 mypos = Vector3.Zero; |
4138 | ScenePresence mysp = (ScenePresence)SceneAgent; | 4138 | ScenePresence mysp = (ScenePresence)SceneAgent; |
4139 | 4139 | ||
4140 | bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; | ||
4140 | // we should have a presence | 4141 | // we should have a presence |
4141 | if(mysp == null) | 4142 | if(mysp == null) |
4142 | return; | 4143 | return; |
@@ -4151,8 +4152,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4151 | while (maxUpdatesBytes > 0) | 4152 | while (maxUpdatesBytes > 0) |
4152 | { | 4153 | { |
4153 | lock (m_entityUpdates.SyncRoot) | 4154 | lock (m_entityUpdates.SyncRoot) |
4154 | if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) | 4155 | { |
4155 | break; | 4156 | if(orderedDequeue) |
4157 | { | ||
4158 | if (!m_entityUpdates.TryOrderedDequeue(out update, out timeinqueue)) | ||
4159 | break; | ||
4160 | } | ||
4161 | else | ||
4162 | { | ||
4163 | if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) | ||
4164 | break; | ||
4165 | } | ||
4166 | } | ||
4156 | 4167 | ||
4157 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | 4168 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; |
4158 | 4169 | ||
@@ -4850,6 +4861,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4850 | // OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = | 4861 | // OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = |
4851 | // new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); | 4862 | // new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); |
4852 | 4863 | ||
4864 | bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; | ||
4853 | 4865 | ||
4854 | EntityUpdate iupdate; | 4866 | EntityUpdate iupdate; |
4855 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 4867 | Int32 timeinqueue; // this is just debugging code & can be dropped later |
@@ -4857,8 +4869,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4857 | while (maxUpdateBytes > 0) | 4869 | while (maxUpdateBytes > 0) |
4858 | { | 4870 | { |
4859 | lock (m_entityProps.SyncRoot) | 4871 | lock (m_entityProps.SyncRoot) |
4860 | if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue)) | 4872 | { |
4861 | break; | 4873 | if(orderedDequeue) |
4874 | { | ||
4875 | if (!m_entityProps.TryOrderedDequeue(out iupdate, out timeinqueue)) | ||
4876 | break; | ||
4877 | } | ||
4878 | else | ||
4879 | { | ||
4880 | if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue)) | ||
4881 | break; | ||
4882 | } | ||
4883 | } | ||
4862 | 4884 | ||
4863 | ObjectPropertyUpdate update = (ObjectPropertyUpdate)iupdate; | 4885 | ObjectPropertyUpdate update = (ObjectPropertyUpdate)iupdate; |
4864 | if (update.SendFamilyProps) | 4886 | if (update.SendFamilyProps) |
@@ -5526,6 +5548,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5526 | #endregion | 5548 | #endregion |
5527 | 5549 | ||
5528 | #region Helper Methods | 5550 | #region Helper Methods |
5551 | private void ClampVectorForUint(ref Vector3 v, float max) | ||
5552 | { | ||
5553 | float a,b; | ||
5554 | |||
5555 | a = Math.Abs(v.X); | ||
5556 | b = Math.Abs(v.Y); | ||
5557 | if(b > a) | ||
5558 | a = b; | ||
5559 | b= Math.Abs(v.Z); | ||
5560 | if(b > a) | ||
5561 | a = b; | ||
5562 | |||
5563 | if (a > max) | ||
5564 | { | ||
5565 | a = max / a; | ||
5566 | v.X *= a; | ||
5567 | v.Y *= a; | ||
5568 | v.Z *= a; | ||
5569 | } | ||
5570 | } | ||
5529 | 5571 | ||
5530 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) | 5572 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) |
5531 | { | 5573 | { |
@@ -5616,11 +5658,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5616 | pos += 12; | 5658 | pos += 12; |
5617 | 5659 | ||
5618 | // Velocity | 5660 | // Velocity |
5661 | ClampVectorForUint(ref velocity, 128f); | ||
5619 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.X, -128.0f, 128.0f), data, pos); pos += 2; | 5662 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.X, -128.0f, 128.0f), data, pos); pos += 2; |
5620 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Y, -128.0f, 128.0f), data, pos); pos += 2; | 5663 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Y, -128.0f, 128.0f), data, pos); pos += 2; |
5621 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Z, -128.0f, 128.0f), data, pos); pos += 2; | 5664 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Z, -128.0f, 128.0f), data, pos); pos += 2; |
5622 | 5665 | ||
5623 | // Acceleration | 5666 | // Acceleration |
5667 | ClampVectorForUint(ref acceleration, 64f); | ||
5624 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.X, -64.0f, 64.0f), data, pos); pos += 2; | 5668 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.X, -64.0f, 64.0f), data, pos); pos += 2; |
5625 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Y, -64.0f, 64.0f), data, pos); pos += 2; | 5669 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Y, -64.0f, 64.0f), data, pos); pos += 2; |
5626 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Z, -64.0f, 64.0f), data, pos); pos += 2; | 5670 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Z, -64.0f, 64.0f), data, pos); pos += 2; |
@@ -5632,6 +5676,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5632 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.W, -1.0f, 1.0f), data, pos); pos += 2; | 5676 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.W, -1.0f, 1.0f), data, pos); pos += 2; |
5633 | 5677 | ||
5634 | // Angular Velocity | 5678 | // Angular Velocity |
5679 | ClampVectorForUint(ref angularVelocity, 64f); | ||
5635 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.X, -64.0f, 64.0f), data, pos); pos += 2; | 5680 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.X, -64.0f, 64.0f), data, pos); pos += 2; |
5636 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; | 5681 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; |
5637 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; | 5682 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; |
@@ -5753,7 +5798,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5753 | //update.JointPivot = Vector3.Zero; | 5798 | //update.JointPivot = Vector3.Zero; |
5754 | //update.JointType = 0; | 5799 | //update.JointType = 0; |
5755 | update.Material = part.Material; | 5800 | update.Material = part.Material; |
5756 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim | ||
5757 | /* | 5801 | /* |
5758 | if (data.ParentGroup.IsAttachment) | 5802 | if (data.ParentGroup.IsAttachment) |
5759 | { | 5803 | { |
@@ -5832,8 +5876,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5832 | update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes; | 5876 | update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes; |
5833 | update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes; | 5877 | update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes; |
5834 | update.Scale = part.Shape.Scale; | 5878 | update.Scale = part.Shape.Scale; |
5835 | update.Text = Util.StringToBytes256(part.Text); | 5879 | update.Text = Util.StringToBytes(part.Text, 255); |
5836 | update.MediaURL = Util.StringToBytes256(part.MediaUrl); | 5880 | update.MediaURL = Util.StringToBytes(part.MediaUrl, 255); |
5837 | 5881 | ||
5838 | #region PrimFlags | 5882 | #region PrimFlags |
5839 | 5883 | ||
@@ -6234,20 +6278,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6234 | /// <param name='x'></param> | 6278 | /// <param name='x'></param> |
6235 | private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) | 6279 | private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) |
6236 | { | 6280 | { |
6237 | float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); | 6281 | if(Math.Abs(x.CameraCenter.X - m_thisAgentUpdateArgs.CameraCenter.X) > VDELTA || |
6238 | if((vdelta > VDELTA)) | 6282 | Math.Abs(x.CameraCenter.Y - m_thisAgentUpdateArgs.CameraCenter.Y) > VDELTA || |
6239 | return true; | 6283 | Math.Abs(x.CameraCenter.Z - m_thisAgentUpdateArgs.CameraCenter.Z) > VDELTA || |
6240 | 6284 | ||
6241 | vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); | 6285 | Math.Abs(x.CameraAtAxis.X - m_thisAgentUpdateArgs.CameraAtAxis.X) > VDELTA || |
6242 | if((vdelta > VDELTA)) | 6286 | Math.Abs(x.CameraAtAxis.Y - m_thisAgentUpdateArgs.CameraAtAxis.Y) > VDELTA || |
6243 | return true; | 6287 | // Math.Abs(x.CameraAtAxis.Z - m_thisAgentUpdateArgs.CameraAtAxis.Z) > VDELTA || |
6244 | 6288 | ||
6245 | vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); | 6289 | Math.Abs(x.CameraLeftAxis.X - m_thisAgentUpdateArgs.CameraLeftAxis.X) > VDELTA || |
6246 | if((vdelta > VDELTA)) | 6290 | Math.Abs(x.CameraLeftAxis.Y - m_thisAgentUpdateArgs.CameraLeftAxis.Y) > VDELTA || |
6247 | return true; | 6291 | // Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA || |
6248 | 6292 | ||
6249 | vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); | 6293 | Math.Abs(x.CameraUpAxis.X - m_thisAgentUpdateArgs.CameraUpAxis.X) > VDELTA || |
6250 | if((vdelta > VDELTA)) | 6294 | Math.Abs(x.CameraUpAxis.Y - m_thisAgentUpdateArgs.CameraUpAxis.Y) > VDELTA |
6295 | // Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA || | ||
6296 | ) | ||
6251 | return true; | 6297 | return true; |
6252 | 6298 | ||
6253 | return false; | 6299 | return false; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index f002ad7..ad46107 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -218,10 +218,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
218 | 218 | ||
219 | // Count inventory items (different to asset count) | 219 | // Count inventory items (different to asset count) |
220 | CountItems++; | 220 | CountItems++; |
221 | 221 | ||
222 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset | 222 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset |
223 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) | 223 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) |
224 | { | ||
225 | int curErrorCntr = m_assetGatherer.ErrorCount; | ||
226 | int possible = m_assetGatherer.possibleNotAssetCount; | ||
224 | m_assetGatherer.AddForInspection(inventoryItem.AssetID); | 227 | m_assetGatherer.AddForInspection(inventoryItem.AssetID); |
228 | m_assetGatherer.GatherAll(); | ||
229 | curErrorCntr = m_assetGatherer.ErrorCount - curErrorCntr; | ||
230 | possible = m_assetGatherer.possibleNotAssetCount - possible; | ||
231 | |||
232 | if(curErrorCntr > 0 || possible > 0) | ||
233 | { | ||
234 | string spath; | ||
235 | int indx = path.IndexOf("__"); | ||
236 | if(indx > 0) | ||
237 | spath = path.Substring(0,indx); | ||
238 | else | ||
239 | spath = path; | ||
240 | |||
241 | if(curErrorCntr > 0) | ||
242 | { | ||
243 | m_log.ErrorFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references to missing or damaged assets", | ||
244 | inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, curErrorCntr); | ||
245 | if(possible > 0) | ||
246 | m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item also contains {0} references that may be to missing or damaged assets or not a problem", possible); | ||
247 | } | ||
248 | else if(possible > 0) | ||
249 | { | ||
250 | m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references that may be to missing or damaged assets or not a problem", inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, possible); | ||
251 | } | ||
252 | } | ||
253 | } | ||
225 | } | 254 | } |
226 | 255 | ||
227 | /// <summary> | 256 | /// <summary> |
@@ -381,6 +410,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
381 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 410 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
382 | Exception e = new InventoryArchiverException(errorMessage); | 411 | Exception e = new InventoryArchiverException(errorMessage); |
383 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0); | 412 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0); |
413 | if(m_saveStream != null && m_saveStream.CanWrite) | ||
414 | m_saveStream.Close(); | ||
384 | throw e; | 415 | throw e; |
385 | } | 416 | } |
386 | 417 | ||
@@ -420,17 +451,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
420 | { | 451 | { |
421 | m_assetGatherer.GatherAll(); | 452 | m_assetGatherer.GatherAll(); |
422 | 453 | ||
454 | int errors = m_assetGatherer.FailedUUIDs.Count; | ||
455 | |||
423 | m_log.DebugFormat( | 456 | m_log.DebugFormat( |
424 | "[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count); | 457 | "[INVENTORY ARCHIVER]: The items to save reference {0} possible assets", m_assetGatherer.GatheredUuids.Count + errors); |
458 | if(errors > 0) | ||
459 | m_log.DebugFormat("[INVENTORY ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors); | ||
425 | 460 | ||
426 | AssetsRequest ar | 461 | AssetsRequest ar = new AssetsRequest( |
427 | = new AssetsRequest( | ||
428 | new AssetsArchiver(m_archiveWriter), | 462 | new AssetsArchiver(m_archiveWriter), |
429 | m_assetGatherer.GatheredUuids, m_scene.AssetService, | 463 | m_assetGatherer.GatheredUuids, m_assetGatherer.FailedUUIDs.Count, |
464 | m_scene.AssetService, | ||
430 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 465 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, |
431 | options, ReceivedAllAssets); | 466 | options, ReceivedAllAssets); |
432 | 467 | ar.Execute(); | |
433 | WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name)); | ||
434 | } | 468 | } |
435 | else | 469 | else |
436 | { | 470 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index be59eb5..06aec7b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
218 | // { | 218 | // { |
219 | try | 219 | try |
220 | { | 220 | { |
221 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); | 221 | InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream); |
222 | iarReq.Execute(options, UserAccountService); | ||
222 | } | 223 | } |
223 | catch (EntryPointNotFoundException e) | 224 | catch (EntryPointNotFoundException e) |
224 | { | 225 | { |
@@ -261,7 +262,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
261 | // { | 262 | // { |
262 | try | 263 | try |
263 | { | 264 | { |
264 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); | 265 | InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath); |
266 | iarReq.Execute(options, UserAccountService); | ||
265 | } | 267 | } |
266 | catch (EntryPointNotFoundException e) | 268 | catch (EntryPointNotFoundException e) |
267 | { | 269 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 3f3245c..f1409bb 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
412 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 412 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); |
413 | Dictionary<UUID, Quaternion> originalRotations = new Dictionary<UUID, Quaternion>(); | 413 | Dictionary<UUID, Quaternion> originalRotations = new Dictionary<UUID, Quaternion>(); |
414 | // this possible is not needed if keyframes are saved | 414 | // this possible is not needed if keyframes are saved |
415 | Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>(); | 415 | // Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>(); |
416 | 416 | ||
417 | foreach (SceneObjectGroup objectGroup in objlist) | 417 | foreach (SceneObjectGroup objectGroup in objlist) |
418 | { | 418 | { |
@@ -423,8 +423,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
423 | objectGroup.RootPart.SetForce(Vector3.Zero); | 423 | objectGroup.RootPart.SetForce(Vector3.Zero); |
424 | objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); | 424 | objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); |
425 | 425 | ||
426 | originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; | 426 | // originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; |
427 | objectGroup.RootPart.KeyframeMotion = null; | 427 | // objectGroup.RootPart.KeyframeMotion = null; |
428 | 428 | ||
429 | Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition; | 429 | Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition; |
430 | originalPositions[objectGroup.UUID] = inventoryStoredPosition; | 430 | originalPositions[objectGroup.UUID] = inventoryStoredPosition; |
@@ -476,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
476 | { | 476 | { |
477 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | 477 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; |
478 | objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID]; | 478 | objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID]; |
479 | objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; | 479 | // objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; |
480 | if (objectGroup.RootPart.KeyframeMotion != null) | 480 | if (objectGroup.RootPart.KeyframeMotion != null) |
481 | objectGroup.RootPart.KeyframeMotion.Resume(); | 481 | objectGroup.RootPart.KeyframeMotion.Resume(); |
482 | } | 482 | } |
@@ -989,11 +989,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
989 | // one full update during the attachment | 989 | // one full update during the attachment |
990 | // process causes some clients to fail to display the | 990 | // process causes some clients to fail to display the |
991 | // attachment properly. | 991 | // attachment properly. |
992 | m_Scene.AddNewSceneObject(group, true, false); | ||
993 | 992 | ||
994 | if (!attachment) | 993 | if (!attachment) |
995 | { | 994 | { |
996 | group.AbsolutePosition = pos + veclist[i]; | 995 | group.AbsolutePosition = pos + veclist[i]; |
996 | m_Scene.AddNewSceneObject(group, true, false); | ||
997 | 997 | ||
998 | // Fire on_rez | 998 | // Fire on_rez |
999 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 999 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); |
@@ -1001,6 +1001,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1001 | 1001 | ||
1002 | group.ScheduleGroupForFullUpdate(); | 1002 | group.ScheduleGroupForFullUpdate(); |
1003 | } | 1003 | } |
1004 | else | ||
1005 | m_Scene.AddNewSceneObject(group, true, false); | ||
1006 | |||
1004 | 1007 | ||
1005 | // m_log.DebugFormat( | 1008 | // m_log.DebugFormat( |
1006 | // "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 1009 | // "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index c369d87..090cb7d 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -135,17 +135,13 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
135 | m_reuseableDynamicTextures.Store( | 135 | m_reuseableDynamicTextures.Store( |
136 | GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID); | 136 | GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID); |
137 | } | 137 | } |
138 | updater.newTextureID = newTextureID; | ||
138 | } | 139 | } |
139 | } | ||
140 | 140 | ||
141 | if (updater.UpdateTimer == 0) | ||
142 | { | ||
143 | lock (Updaters) | 141 | lock (Updaters) |
144 | { | 142 | { |
145 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 143 | if (Updaters.ContainsKey(updater.UpdaterID)) |
146 | { | ||
147 | Updaters.Remove(updater.UpdaterID); | 144 | Updaters.Remove(updater.UpdaterID); |
148 | } | ||
149 | } | 145 | } |
150 | } | 146 | } |
151 | } | 147 | } |
@@ -172,21 +168,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
172 | } | 168 | } |
173 | 169 | ||
174 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, | 170 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, |
175 | string extraParams, int updateTimer) | 171 | string extraParams) |
176 | { | 172 | { |
177 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); | 173 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, false, 255); |
178 | } | 174 | } |
179 | 175 | ||
180 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, | 176 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, |
181 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | 177 | string extraParams, bool SetBlending, byte AlphaValue) |
182 | { | 178 | { |
183 | return AddDynamicTextureURL(simID, primID, contentType, url, | 179 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, SetBlending, |
184 | extraParams, updateTimer, SetBlending, | 180 | (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); |
185 | (int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); | ||
186 | } | 181 | } |
187 | 182 | ||
188 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, | 183 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, |
189 | string extraParams, int updateTimer, bool SetBlending, | 184 | string extraParams, bool SetBlending, |
190 | int disp, byte AlphaValue, int face) | 185 | int disp, byte AlphaValue, int face) |
191 | { | 186 | { |
192 | if (RenderPlugins.ContainsKey(contentType)) | 187 | if (RenderPlugins.ContainsKey(contentType)) |
@@ -196,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
196 | updater.PrimID = primID; | 191 | updater.PrimID = primID; |
197 | updater.ContentType = contentType; | 192 | updater.ContentType = contentType; |
198 | updater.Url = url; | 193 | updater.Url = url; |
199 | updater.UpdateTimer = updateTimer; | ||
200 | updater.UpdaterID = UUID.Random(); | 194 | updater.UpdaterID = UUID.Random(); |
201 | updater.Params = extraParams; | 195 | updater.Params = extraParams; |
202 | updater.BlendWithOldTexture = SetBlending; | 196 | updater.BlendWithOldTexture = SetBlending; |
@@ -213,26 +207,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
213 | } | 207 | } |
214 | 208 | ||
215 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 209 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
216 | return updater.UpdaterID; | 210 | return updater.newTextureID; |
217 | } | 211 | } |
218 | return UUID.Zero; | 212 | return UUID.Zero; |
219 | } | 213 | } |
220 | 214 | ||
221 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, | 215 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, |
222 | string extraParams, int updateTimer) | 216 | string extraParams) |
223 | { | 217 | { |
224 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); | 218 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, false, |
219 | (DISP_TEMP|DISP_EXPIRE), 255, ALL_SIDES); | ||
225 | } | 220 | } |
226 | 221 | ||
227 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, | 222 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, |
228 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | 223 | string extraParams, bool SetBlending, byte AlphaValue) |
229 | { | 224 | { |
230 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending, | 225 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, SetBlending, |
231 | (int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); | 226 | (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); |
232 | } | 227 | } |
233 | 228 | ||
234 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, | 229 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, |
235 | string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) | 230 | string extraParams, bool SetBlending, int disp, byte AlphaValue, int face) |
236 | { | 231 | { |
237 | if (!RenderPlugins.ContainsKey(contentType)) | 232 | if (!RenderPlugins.ContainsKey(contentType)) |
238 | return UUID.Zero; | 233 | return UUID.Zero; |
@@ -258,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
258 | updater.PrimID = primID; | 253 | updater.PrimID = primID; |
259 | updater.ContentType = contentType; | 254 | updater.ContentType = contentType; |
260 | updater.BodyData = data; | 255 | updater.BodyData = data; |
261 | updater.UpdateTimer = updateTimer; | ||
262 | updater.UpdaterID = UUID.Random(); | 256 | updater.UpdaterID = UUID.Random(); |
263 | updater.Params = extraParams; | 257 | updater.Params = extraParams; |
264 | updater.BlendWithOldTexture = SetBlending; | 258 | updater.BlendWithOldTexture = SetBlending; |
@@ -314,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
314 | updater.UpdatePart(part, (UUID)objReusableTextureUUID); | 308 | updater.UpdatePart(part, (UUID)objReusableTextureUUID); |
315 | } | 309 | } |
316 | 310 | ||
317 | return updater.UpdaterID; | 311 | return updater.newTextureID; |
318 | } | 312 | } |
319 | 313 | ||
320 | private string GenerateReusableTextureKey(string data, string extraParams) | 314 | private string GenerateReusableTextureKey(string data, string extraParams) |
@@ -404,17 +398,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
404 | public byte FrontAlpha = 255; | 398 | public byte FrontAlpha = 255; |
405 | public string Params; | 399 | public string Params; |
406 | public UUID PrimID; | 400 | public UUID PrimID; |
407 | public bool SetNewFrontAlpha = false; | ||
408 | public UUID SimUUID; | 401 | public UUID SimUUID; |
409 | public UUID UpdaterID; | 402 | public UUID UpdaterID; |
410 | public int UpdateTimer; | ||
411 | public int Face; | 403 | public int Face; |
412 | public int Disp; | 404 | public int Disp; |
413 | public string Url; | 405 | public string Url; |
406 | public UUID newTextureID; | ||
414 | 407 | ||
415 | public DynamicTextureUpdater() | 408 | public DynamicTextureUpdater() |
416 | { | 409 | { |
417 | UpdateTimer = 0; | ||
418 | BodyData = null; | 410 | BodyData = null; |
419 | } | 411 | } |
420 | 412 | ||
@@ -436,16 +428,23 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
436 | // FIXME: Need to return the appropriate ID if only a single face is replaced. | 428 | // FIXME: Need to return the appropriate ID if only a single face is replaced. |
437 | oldID = tmptex.DefaultTexture.TextureID; | 429 | oldID = tmptex.DefaultTexture.TextureID; |
438 | 430 | ||
431 | // not using parts number of faces because that fails on old meshs | ||
439 | if (Face == ALL_SIDES) | 432 | if (Face == ALL_SIDES) |
440 | { | 433 | { |
441 | oldID = tmptex.DefaultTexture.TextureID; | 434 | oldID = tmptex.DefaultTexture.TextureID; |
442 | tmptex.DefaultTexture.TextureID = textureID; | 435 | tmptex.DefaultTexture.TextureID = textureID; |
436 | for(int i = 0; i < tmptex.FaceTextures.Length; i++) | ||
437 | { | ||
438 | if(tmptex.FaceTextures[i] != null) | ||
439 | tmptex.FaceTextures[i].TextureID = textureID; | ||
440 | } | ||
443 | } | 441 | } |
444 | else | 442 | else |
445 | { | 443 | { |
446 | try | 444 | try |
447 | { | 445 | { |
448 | Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face); | 446 | Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face); |
447 | oldID = texface.TextureID; | ||
449 | texface.TextureID = textureID; | 448 | texface.TextureID = textureID; |
450 | tmptex.FaceTextures[Face] = texface; | 449 | tmptex.FaceTextures[Face] = texface; |
451 | } | 450 | } |
@@ -455,10 +454,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
455 | } | 454 | } |
456 | } | 455 | } |
457 | 456 | ||
458 | // I'm pretty sure we always want to force this to true | ||
459 | // I'm pretty sure noone whats to set fullbright true if it wasn't true before. | ||
460 | // tmptex.DefaultTexture.Fullbright = true; | ||
461 | |||
462 | part.UpdateTextureEntry(tmptex.GetBytes()); | 457 | part.UpdateTextureEntry(tmptex.GetBytes()); |
463 | } | 458 | } |
464 | 459 | ||
@@ -491,13 +486,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
491 | 486 | ||
492 | if (BlendWithOldTexture) | 487 | if (BlendWithOldTexture) |
493 | { | 488 | { |
494 | Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture; | 489 | Primitive.TextureEntryFace curFace; |
495 | if (defaultFace != null) | 490 | if(Face == ALL_SIDES) |
491 | curFace = part.Shape.Textures.DefaultTexture; | ||
492 | else | ||
493 | { | ||
494 | try | ||
495 | { | ||
496 | curFace = part.Shape.Textures.GetFace((uint)Face); | ||
497 | } | ||
498 | catch | ||
499 | { | ||
500 | curFace = null; | ||
501 | } | ||
502 | } | ||
503 | if (curFace != null) | ||
496 | { | 504 | { |
497 | oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString()); | 505 | oldAsset = scene.AssetService.Get(curFace.TextureID.ToString()); |
498 | 506 | ||
499 | if (oldAsset != null) | 507 | if (oldAsset != null) |
500 | assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); | 508 | assetData = BlendTextures(data, oldAsset.Data, FrontAlpha); |
501 | } | 509 | } |
502 | } | 510 | } |
503 | 511 | ||
@@ -548,7 +556,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
548 | return asset.FullID; | 556 | return asset.FullID; |
549 | } | 557 | } |
550 | 558 | ||
551 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) | 559 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, byte newAlpha) |
552 | { | 560 | { |
553 | ManagedImage managedImage; | 561 | ManagedImage managedImage; |
554 | Image image; | 562 | Image image; |
@@ -568,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
568 | Bitmap image2 = new Bitmap(image); | 576 | Bitmap image2 = new Bitmap(image); |
569 | image.Dispose(); | 577 | image.Dispose(); |
570 | 578 | ||
571 | if (setNewAlpha) | 579 | if (newAlpha < 255) |
572 | SetAlpha(ref image1, newAlpha); | 580 | SetAlpha(ref image1, newAlpha); |
573 | 581 | ||
574 | using(Bitmap joint = MergeBitMaps(image1, image2)) | 582 | using(Bitmap joint = MergeBitMaps(image1, image2)) |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index b499b19..d342163 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -379,9 +379,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
379 | if (ThreadPool == null) | 379 | if (ThreadPool == null) |
380 | { | 380 | { |
381 | STPStartInfo startInfo = new STPStartInfo(); | 381 | STPStartInfo startInfo = new STPStartInfo(); |
382 | startInfo.IdleTimeout = 20000; | 382 | startInfo.IdleTimeout = 2000; |
383 | startInfo.MaxWorkerThreads = maxThreads; | 383 | startInfo.MaxWorkerThreads = maxThreads; |
384 | startInfo.MinWorkerThreads = 1; | 384 | startInfo.MinWorkerThreads = 0; |
385 | startInfo.ThreadPriority = ThreadPriority.BelowNormal; | 385 | startInfo.ThreadPriority = ThreadPriority.BelowNormal; |
386 | startInfo.StartSuspended = true; | 386 | startInfo.StartSuspended = true; |
387 | startInfo.ThreadPoolName = "ScriptsHttpReq"; | 387 | startInfo.ThreadPoolName = "ScriptsHttpReq"; |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index ed255bf..325f7f9 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | |||
@@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
77 | so.UUID, | 77 | so.UUID, |
78 | m_vrm.GetContentType(), | 78 | m_vrm.GetContentType(), |
79 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | 79 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", |
80 | "", | 80 | ""); |
81 | 0); | ||
82 | 81 | ||
83 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 82 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
84 | } | 83 | } |
@@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
98 | so.UUID, | 97 | so.UUID, |
99 | m_vrm.GetContentType(), | 98 | m_vrm.GetContentType(), |
100 | dtText, | 99 | dtText, |
101 | "", | 100 | ""); |
102 | 0); | ||
103 | 101 | ||
104 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 102 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
105 | 103 | ||
@@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
108 | so.UUID, | 106 | so.UUID, |
109 | m_vrm.GetContentType(), | 107 | m_vrm.GetContentType(), |
110 | dtText, | 108 | dtText, |
111 | "", | 109 | ""); |
112 | 0); | ||
113 | 110 | ||
114 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 111 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
115 | } | 112 | } |
@@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
129 | so.UUID, | 126 | so.UUID, |
130 | m_vrm.GetContentType(), | 127 | m_vrm.GetContentType(), |
131 | dtText, | 128 | dtText, |
132 | "", | 129 | ""); |
133 | 0); | ||
134 | 130 | ||
135 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 131 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
136 | 132 | ||
@@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
139 | so.UUID, | 135 | so.UUID, |
140 | m_vrm.GetContentType(), | 136 | m_vrm.GetContentType(), |
141 | dtText, | 137 | dtText, |
142 | "alpha:250", | 138 | "alpha:250"); |
143 | 0); | ||
144 | 139 | ||
145 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 140 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
146 | } | 141 | } |
@@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
161 | so.UUID, | 156 | so.UUID, |
162 | m_vrm.GetContentType(), | 157 | m_vrm.GetContentType(), |
163 | dtText, | 158 | dtText, |
164 | "", | 159 | ""); |
165 | 0); | ||
166 | 160 | ||
167 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 161 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
168 | 162 | ||
@@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
171 | so.UUID, | 165 | so.UUID, |
172 | m_vrm.GetContentType(), | 166 | m_vrm.GetContentType(), |
173 | dtText, | 167 | dtText, |
174 | "", | 168 | ""); |
175 | 0); | ||
176 | 169 | ||
177 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 170 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
178 | } | 171 | } |
@@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
191 | so.UUID, | 184 | so.UUID, |
192 | m_vrm.GetContentType(), | 185 | m_vrm.GetContentType(), |
193 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | 186 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", |
194 | "", | 187 | ""); |
195 | 0); | ||
196 | 188 | ||
197 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 189 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
198 | } | 190 | } |
@@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
213 | so.UUID, | 205 | so.UUID, |
214 | m_vrm.GetContentType(), | 206 | m_vrm.GetContentType(), |
215 | dtText, | 207 | dtText, |
216 | "", | 208 | ""); |
217 | 0); | ||
218 | 209 | ||
219 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 210 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
220 | 211 | ||
@@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
223 | so.UUID, | 214 | so.UUID, |
224 | m_vrm.GetContentType(), | 215 | m_vrm.GetContentType(), |
225 | dtText, | 216 | dtText, |
226 | "", | 217 | ""); |
227 | 0); | ||
228 | 218 | ||
229 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 219 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
230 | } | 220 | } |
@@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
253 | so.UUID, | 243 | so.UUID, |
254 | m_vrm.GetContentType(), | 244 | m_vrm.GetContentType(), |
255 | dtText, | 245 | dtText, |
256 | "1024", | 246 | "1024"); |
257 | 0); | ||
258 | 247 | ||
259 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 248 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
260 | 249 | ||
@@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
263 | so.UUID, | 252 | so.UUID, |
264 | m_vrm.GetContentType(), | 253 | m_vrm.GetContentType(), |
265 | dtText, | 254 | dtText, |
266 | "1024", | 255 | "1024"); |
267 | 0); | ||
268 | 256 | ||
269 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 257 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
270 | } | 258 | } |
@@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
284 | so.UUID, | 272 | so.UUID, |
285 | m_vrm.GetContentType(), | 273 | m_vrm.GetContentType(), |
286 | dtText, | 274 | dtText, |
287 | "", | 275 | ""); |
288 | 0); | ||
289 | 276 | ||
290 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 277 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
291 | 278 | ||
@@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
294 | so.UUID, | 281 | so.UUID, |
295 | m_vrm.GetContentType(), | 282 | m_vrm.GetContentType(), |
296 | dtText, | 283 | dtText, |
297 | "alpha:250", | 284 | "alpha:250"); |
298 | 0); | ||
299 | 285 | ||
300 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 286 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
301 | } | 287 | } |
@@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
316 | so.UUID, | 302 | so.UUID, |
317 | m_vrm.GetContentType(), | 303 | m_vrm.GetContentType(), |
318 | dtText, | 304 | dtText, |
319 | "", | 305 | ""); |
320 | 0); | ||
321 | 306 | ||
322 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 307 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
323 | 308 | ||
@@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
326 | so.UUID, | 311 | so.UUID, |
327 | m_vrm.GetContentType(), | 312 | m_vrm.GetContentType(), |
328 | dtText, | 313 | dtText, |
329 | "", | 314 | ""); |
330 | 0); | ||
331 | 315 | ||
332 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 316 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
333 | } | 317 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index f12286d..8a26ab7 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -355,30 +355,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
355 | lock (this) | 355 | lock (this) |
356 | { | 356 | { |
357 | if (alpha == 256) | 357 | if (alpha == 256) |
358 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); | ||
359 | else | ||
360 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); | ||
361 | |||
362 | graph = Graphics.FromImage(bitmap); | ||
363 | |||
364 | // this is really just to save people filling the | ||
365 | // background color in their scripts, only do when fully opaque | ||
366 | if (alpha >= 255) | ||
367 | { | 358 | { |
359 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); | ||
360 | graph = Graphics.FromImage(bitmap); | ||
368 | using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) | 361 | using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) |
369 | { | 362 | { |
370 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); | 363 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); |
371 | } | 364 | } |
372 | } | 365 | } |
373 | 366 | else | |
374 | for (int w = 0; w < bitmap.Width; w++) | ||
375 | { | 367 | { |
376 | if (alpha <= 255) | 368 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); |
369 | graph = Graphics.FromImage(bitmap); | ||
370 | Color newbg = Color.FromArgb(alpha,bgColor); | ||
371 | using (SolidBrush bgFillBrush = new SolidBrush(newbg)) | ||
377 | { | 372 | { |
378 | for (int h = 0; h < bitmap.Height; h++) | 373 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); |
379 | { | ||
380 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | ||
381 | } | ||
382 | } | 374 | } |
383 | } | 375 | } |
384 | 376 | ||
@@ -519,8 +511,32 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
519 | 511 | ||
520 | // m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine); | 512 | // m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine); |
521 | 513 | ||
514 | if (nextLine.StartsWith("ResetTransf")) | ||
515 | { | ||
516 | graph.ResetTransform(); | ||
517 | } | ||
518 | else if (nextLine.StartsWith("TransTransf")) | ||
519 | { | ||
520 | float x = 0; | ||
521 | float y = 0; | ||
522 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
523 | graph.TranslateTransform(x, y); | ||
524 | } | ||
525 | else if (nextLine.StartsWith("ScaleTransf")) | ||
526 | { | ||
527 | float x = 0; | ||
528 | float y = 0; | ||
529 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
530 | graph.ScaleTransform(x, y); | ||
531 | } | ||
532 | else if (nextLine.StartsWith("RotTransf")) | ||
533 | { | ||
534 | float x = 0; | ||
535 | GetParams(partsDelimiter, ref nextLine, 9, ref x); | ||
536 | graph.RotateTransform(x); | ||
537 | } | ||
522 | //replace with switch, or even better, do some proper parsing | 538 | //replace with switch, or even better, do some proper parsing |
523 | if (nextLine.StartsWith("MoveTo")) | 539 | else if (nextLine.StartsWith("MoveTo")) |
524 | { | 540 | { |
525 | float x = 0; | 541 | float x = 0; |
526 | float y = 0; | 542 | float y = 0; |
@@ -625,6 +641,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
625 | startPoint.X += endPoint.X; | 641 | startPoint.X += endPoint.X; |
626 | startPoint.Y += endPoint.Y; | 642 | startPoint.Y += endPoint.Y; |
627 | } | 643 | } |
644 | else if (nextLine.StartsWith("FillEllipse")) | ||
645 | { | ||
646 | float x = 0; | ||
647 | float y = 0; | ||
648 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
649 | endPoint.X = (int)x; | ||
650 | endPoint.Y = (int)y; | ||
651 | graph.FillEllipse(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
652 | startPoint.X += endPoint.X; | ||
653 | startPoint.Y += endPoint.Y; | ||
654 | } | ||
628 | else if (nextLine.StartsWith("FontSize")) | 655 | else if (nextLine.StartsWith("FontSize")) |
629 | { | 656 | { |
630 | nextLine = nextLine.Remove(0, 8); | 657 | nextLine = nextLine.Remove(0, 8); |
@@ -790,6 +817,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
790 | } | 817 | } |
791 | } | 818 | } |
792 | 819 | ||
820 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x) | ||
821 | { | ||
822 | line = line.Remove(0, startLength); | ||
823 | string[] parts = line.Split(partsDelimiter); | ||
824 | if (parts.Length > 0) | ||
825 | { | ||
826 | string xVal = parts[0].Trim(); | ||
827 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | ||
828 | } | ||
829 | } | ||
830 | |||
793 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) | 831 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) |
794 | { | 832 | { |
795 | line = line.Remove(0, startLength); | 833 | line = line.Remove(0, startLength); |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index f68c5f8..6028eef 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
658 | public void Process() | 658 | public void Process() |
659 | { | 659 | { |
660 | _finished = false; | 660 | _finished = false; |
661 | httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue); | 661 | httpThread = WorkManager.StartThread(SendRequest, "XMLRPCreqThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue); |
662 | } | 662 | } |
663 | 663 | ||
664 | /* | 664 | /* |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 8dabcee..11c53d7 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -181,11 +181,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
181 | // Archive the regions | 181 | // Archive the regions |
182 | 182 | ||
183 | Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>(); | 183 | Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>(); |
184 | HashSet<UUID> failedIDs = new HashSet<UUID>(); | ||
185 | HashSet<UUID> uncertainAssetsUUIDs = new HashSet<UUID>(); | ||
184 | 186 | ||
185 | scenesGroup.ForEachScene(delegate(Scene scene) | 187 | scenesGroup.ForEachScene(delegate(Scene scene) |
186 | { | 188 | { |
187 | string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : ""; | 189 | string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : ""; |
188 | ArchiveOneRegion(scene, regionDir, assetUuids); | 190 | ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs); |
189 | }); | 191 | }); |
190 | 192 | ||
191 | // Archive the assets | 193 | // Archive the assets |
@@ -193,23 +195,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
193 | if (SaveAssets) | 195 | if (SaveAssets) |
194 | { | 196 | { |
195 | m_log.DebugFormat("[ARCHIVER]: Saving {0} assets", assetUuids.Count); | 197 | m_log.DebugFormat("[ARCHIVER]: Saving {0} assets", assetUuids.Count); |
196 | 198 | ||
197 | // Asynchronously request all the assets required to perform this archive operation | 199 | AssetsRequest ar = new AssetsRequest( |
198 | AssetsRequest ar | ||
199 | = new AssetsRequest( | ||
200 | new AssetsArchiver(m_archiveWriter), assetUuids, | 200 | new AssetsArchiver(m_archiveWriter), assetUuids, |
201 | failedIDs.Count, | ||
201 | m_rootScene.AssetService, m_rootScene.UserAccountService, | 202 | m_rootScene.AssetService, m_rootScene.UserAccountService, |
202 | m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); | 203 | m_rootScene.RegionInfo.ScopeID, options, null); |
203 | 204 | ar.Execute(); | |
204 | WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request"); | 205 | assetUuids = null; |
205 | |||
206 | // CloseArchive() will be called from ReceivedAllAssets() | ||
207 | } | 206 | } |
208 | else | 207 | else |
209 | { | 208 | { |
210 | m_log.DebugFormat("[ARCHIVER]: Not saving assets since --noassets was specified"); | 209 | m_log.DebugFormat("[ARCHIVER]: Not saving assets since --noassets was specified"); |
211 | CloseArchive(string.Empty); | 210 | // CloseArchive(string.Empty); |
212 | } | 211 | } |
212 | CloseArchive(string.Empty); | ||
213 | } | 213 | } |
214 | catch (Exception e) | 214 | catch (Exception e) |
215 | { | 215 | { |
@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids) | 221 | private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids, |
222 | HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs) | ||
222 | { | 223 | { |
223 | m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name); | 224 | m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name); |
224 | 225 | ||
@@ -237,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
237 | { | 238 | { |
238 | SceneObjectGroup sceneObject = (SceneObjectGroup)entity; | 239 | SceneObjectGroup sceneObject = (SceneObjectGroup)entity; |
239 | 240 | ||
240 | if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) | 241 | if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit) |
241 | { | 242 | { |
242 | if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule)) | 243 | if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule)) |
243 | { | 244 | { |
@@ -254,17 +255,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
254 | 255 | ||
255 | if (SaveAssets) | 256 | if (SaveAssets) |
256 | { | 257 | { |
257 | UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids); | 258 | UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids, failedIDs, uncertainAssetsUUIDs); |
258 | int prevAssets = assetUuids.Count; | 259 | int prevAssets = assetUuids.Count; |
259 | 260 | ||
260 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 261 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
262 | { | ||
263 | int curErrorCntr = assetGatherer.ErrorCount; | ||
264 | int possible = assetGatherer.possibleNotAssetCount; | ||
261 | assetGatherer.AddForInspection(sceneObject); | 265 | assetGatherer.AddForInspection(sceneObject); |
266 | assetGatherer.GatherAll(); | ||
267 | curErrorCntr = assetGatherer.ErrorCount - curErrorCntr; | ||
268 | possible = assetGatherer.possibleNotAssetCount - possible; | ||
269 | if(curErrorCntr > 0) | ||
270 | { | ||
271 | m_log.ErrorFormat("[ARCHIVER]: object {0} '{1}', at {2}, contains {3} references to missing or damaged assets", | ||
272 | sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), curErrorCntr); | ||
273 | if(possible > 0) | ||
274 | m_log.WarnFormat("[ARCHIVER Warning]: object also contains {0} references that may be to missing or damaged assets or not a problem", possible); | ||
275 | } | ||
276 | else if(possible > 0) | ||
277 | { | ||
278 | m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains {3} references that may be to missing or damaged assets or not a problem", | ||
279 | sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), possible); | ||
280 | } | ||
281 | } | ||
262 | 282 | ||
263 | assetGatherer.GatherAll(); | 283 | assetGatherer.GatherAll(); |
264 | 284 | ||
285 | int errors = assetGatherer.FailedUUIDs.Count; | ||
265 | m_log.DebugFormat( | 286 | m_log.DebugFormat( |
266 | "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", | 287 | "[ARCHIVER]: {0} region scene objects to save reference {1} possible assets", |
267 | sceneObjects.Count, assetUuids.Count - prevAssets); | 288 | sceneObjects.Count, assetUuids.Count - prevAssets + errors); |
289 | if(errors > 0) | ||
290 | m_log.DebugFormat("[ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors); | ||
268 | } | 291 | } |
269 | 292 | ||
270 | if (numObjectsSkippedPermissions > 0) | 293 | if (numObjectsSkippedPermissions > 0) |
@@ -572,7 +595,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
572 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 595 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
573 | { | 596 | { |
574 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); | 597 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); |
575 | 598 | if(sceneObject.IsDeleted || sceneObject.inTransit) | |
599 | continue; | ||
576 | string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options); | 600 | string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options); |
577 | string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject)); | 601 | string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject)); |
578 | m_archiveWriter.WriteFile(objectPath, serializedObject); | 602 | m_archiveWriter.WriteFile(objectPath, serializedObject); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs index efacae3..3092fe0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
46 | /// <value> | 46 | /// <value> |
47 | /// Post a message to the log every x assets as a progress bar | 47 | /// Post a message to the log every x assets as a progress bar |
48 | /// </value> | 48 | /// </value> |
49 | protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 50; | 49 | protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 100; |
50 | 50 | ||
51 | /// <value> | 51 | /// <value> |
52 | /// Keep a count of the number of assets written so that we can provide status updates | 52 | /// Keep a count of the number of assets written so that we can provide status updates |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index d380da8..91f4dc3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -62,27 +62,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
62 | }; | 62 | }; |
63 | 63 | ||
64 | /// <value> | 64 | /// <value> |
65 | /// Timeout threshold if we still need assets or missing asset notifications but have stopped receiving them | ||
66 | /// from the asset service | ||
67 | /// </value> | ||
68 | protected const int TIMEOUT = 60 * 1000; | ||
69 | |||
70 | /// <value> | ||
71 | /// If a timeout does occur, limit the amount of UUID information put to the console. | ||
72 | /// </value> | ||
73 | protected const int MAX_UUID_DISPLAY_ON_TIMEOUT = 3; | ||
74 | |||
75 | protected System.Timers.Timer m_requestCallbackTimer; | ||
76 | |||
77 | /// <value> | ||
78 | /// State of this request | ||
79 | /// </value> | ||
80 | private RequestState m_requestState = RequestState.Initial; | ||
81 | |||
82 | /// <value> | ||
83 | /// uuids to request | 65 | /// uuids to request |
84 | /// </value> | 66 | /// </value> |
85 | protected IDictionary<UUID, sbyte> m_uuids; | 67 | protected IDictionary<UUID, sbyte> m_uuids; |
68 | private int m_previousErrorsCount; | ||
86 | 69 | ||
87 | /// <value> | 70 | /// <value> |
88 | /// Callback used when all the assets requested have been received. | 71 | /// Callback used when all the assets requested have been received. |
@@ -104,6 +87,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | /// </value> | 87 | /// </value> |
105 | private int m_repliesRequired; | 88 | private int m_repliesRequired; |
106 | 89 | ||
90 | private System.Timers.Timer m_timeOutTimer; | ||
91 | private bool m_timeout; | ||
92 | |||
107 | /// <value> | 93 | /// <value> |
108 | /// Asset service used to request the assets | 94 | /// Asset service used to request the assets |
109 | /// </value> | 95 | /// </value> |
@@ -117,205 +103,98 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
117 | 103 | ||
118 | protected internal AssetsRequest( | 104 | protected internal AssetsRequest( |
119 | AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids, | 105 | AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids, |
106 | int previousErrorsCount, | ||
120 | IAssetService assetService, IUserAccountService userService, | 107 | IAssetService assetService, IUserAccountService userService, |
121 | UUID scope, Dictionary<string, object> options, | 108 | UUID scope, Dictionary<string, object> options, |
122 | AssetsRequestCallback assetsRequestCallback) | 109 | AssetsRequestCallback assetsRequestCallback) |
123 | { | 110 | { |
124 | m_assetsArchiver = assetsArchiver; | 111 | m_assetsArchiver = assetsArchiver; |
125 | m_uuids = uuids; | 112 | m_uuids = uuids; |
113 | m_previousErrorsCount = previousErrorsCount; | ||
126 | m_assetsRequestCallback = assetsRequestCallback; | 114 | m_assetsRequestCallback = assetsRequestCallback; |
127 | m_assetService = assetService; | 115 | m_assetService = assetService; |
128 | m_userAccountService = userService; | 116 | m_userAccountService = userService; |
129 | m_scopeID = scope; | 117 | m_scopeID = scope; |
130 | m_options = options; | 118 | m_options = options; |
131 | m_repliesRequired = uuids.Count; | 119 | m_repliesRequired = uuids.Count; |
132 | |||
133 | // FIXME: This is a really poor way of handling the timeout since it will always leave the original requesting thread | ||
134 | // hanging. Need to restructure so an original request thread waits for a ManualResetEvent on asset received | ||
135 | // so we can properly abort that thread. Or request all assets synchronously, though that would be a more | ||
136 | // radical change | ||
137 | m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); | ||
138 | m_requestCallbackTimer.AutoReset = false; | ||
139 | m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); | ||
140 | } | 120 | } |
141 | 121 | ||
142 | protected internal void Execute() | 122 | protected internal void Execute() |
143 | { | 123 | { |
144 | m_requestState = RequestState.Running; | 124 | Culture.SetCurrentCulture(); |
145 | |||
146 | m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired); | ||
147 | |||
148 | // We can stop here if there are no assets to fetch | 125 | // We can stop here if there are no assets to fetch |
149 | if (m_repliesRequired == 0) | 126 | if (m_repliesRequired == 0) |
150 | { | 127 | { |
151 | m_requestState = RequestState.Completed; | ||
152 | PerformAssetsRequestCallback(false); | 128 | PerformAssetsRequestCallback(false); |
153 | return; | 129 | return; |
154 | } | 130 | } |
155 | 131 | ||
156 | m_requestCallbackTimer.Enabled = true; | 132 | m_timeOutTimer = new System.Timers.Timer(60000); |
133 | m_timeOutTimer .AutoReset = false; | ||
134 | m_timeOutTimer.Elapsed += OnTimeout; | ||
135 | m_timeout = false; | ||
157 | 136 | ||
158 | foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids) | 137 | foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids) |
159 | { | 138 | { |
160 | // m_log.DebugFormat("[ARCHIVER]: Requesting asset {0}", kvp.Key); | 139 | string thiskey = kvp.Key.ToString(); |
161 | 140 | try | |
162 | // m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); | ||
163 | AssetBase asset = m_assetService.Get(kvp.Key.ToString()); | ||
164 | PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) | ||
169 | { | ||
170 | bool timedOut = true; | ||
171 | |||
172 | try | ||
173 | { | ||
174 | lock (this) | ||
175 | { | 141 | { |
176 | // Take care of the possibilty that this thread started but was paused just outside the lock before | 142 | m_timeOutTimer.Enabled = true; |
177 | // the final request came in (assuming that such a thing is possible) | 143 | AssetBase asset = m_assetService.Get(thiskey); |
178 | if (m_requestState == RequestState.Completed) | 144 | if(m_timeout) |
145 | break; | ||
146 | |||
147 | m_timeOutTimer.Enabled = false; | ||
148 | |||
149 | if(asset == null) | ||
179 | { | 150 | { |
180 | timedOut = false; | 151 | m_notFoundAssetUuids.Add(new UUID(thiskey)); |
181 | return; | 152 | continue; |
182 | } | 153 | } |
183 | 154 | ||
184 | m_requestState = RequestState.Aborted; | 155 | sbyte assetType = kvp.Value; |
185 | } | 156 | if (asset != null && assetType == (sbyte)AssetType.Unknown) |
186 | 157 | { | |
187 | // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure | 158 | m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", thiskey, SLUtil.AssetTypeFromCode(assetType)); |
188 | // case anyway. | 159 | asset.Type = assetType; |
189 | List<UUID> uuids = new List<UUID>(); | 160 | } |
190 | foreach (UUID uuid in m_uuids.Keys) | ||
191 | { | ||
192 | uuids.Add(uuid); | ||
193 | } | ||
194 | |||
195 | foreach (UUID uuid in m_foundAssetUuids) | ||
196 | { | ||
197 | uuids.Remove(uuid); | ||
198 | } | ||
199 | 161 | ||
200 | foreach (UUID uuid in m_notFoundAssetUuids) | 162 | m_foundAssetUuids.Add(asset.FullID); |
201 | { | 163 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
202 | uuids.Remove(uuid); | ||
203 | } | 164 | } |
204 | 165 | ||
205 | m_log.ErrorFormat( | 166 | catch (Exception e) |
206 | "[ARCHIVER]: Asset service failed to return information about {0} requested assets", uuids.Count); | ||
207 | |||
208 | int i = 0; | ||
209 | foreach (UUID uuid in uuids) | ||
210 | { | 167 | { |
211 | m_log.ErrorFormat("[ARCHIVER]: No information about asset {0} received", uuid); | 168 | m_log.ErrorFormat("[ARCHIVER]: Execute failed with {0}", e); |
212 | |||
213 | if (++i >= MAX_UUID_DISPLAY_ON_TIMEOUT) | ||
214 | break; | ||
215 | } | 169 | } |
216 | |||
217 | if (uuids.Count > MAX_UUID_DISPLAY_ON_TIMEOUT) | ||
218 | m_log.ErrorFormat( | ||
219 | "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); | ||
220 | |||
221 | m_log.Error("[ARCHIVER]: Archive save aborted. PLEASE DO NOT USE THIS ARCHIVE, IT WILL BE INCOMPLETE."); | ||
222 | } | 170 | } |
223 | catch (Exception e) | ||
224 | { | ||
225 | m_log.ErrorFormat("[ARCHIVER]: Timeout handler exception {0}{1}", e.Message, e.StackTrace); | ||
226 | } | ||
227 | finally | ||
228 | { | ||
229 | if (timedOut) | ||
230 | WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback"); | ||
231 | } | ||
232 | } | ||
233 | 171 | ||
234 | protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset) | 172 | m_timeOutTimer.Dispose(); |
235 | { | 173 | int totalerrors = m_notFoundAssetUuids.Count + m_previousErrorsCount; |
236 | // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer | ||
237 | if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown) | ||
238 | { | ||
239 | m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, SLUtil.AssetTypeFromCode((sbyte)assetType)); | ||
240 | fetchedAsset.Type = (sbyte)assetType; | ||
241 | } | ||
242 | 174 | ||
243 | AssetRequestCallback(fetchedAssetID, this, fetchedAsset); | 175 | if(m_timeout) |
244 | } | 176 | m_log.DebugFormat("[ARCHIVER]: Aborted because AssetService request timeout. Successfully added {0} assets", m_foundAssetUuids.Count); |
177 | else if(totalerrors == 0) | ||
178 | m_log.DebugFormat("[ARCHIVER]: Successfully added all {0} assets", m_foundAssetUuids.Count); | ||
179 | else | ||
180 | m_log.DebugFormat("[ARCHIVER]: Successfully added {0} assets ({1} of total possible assets requested were not found, were damaged or were not assets)", | ||
181 | m_foundAssetUuids.Count, totalerrors); | ||
245 | 182 | ||
246 | /// <summary> | 183 | PerformAssetsRequestCallback(m_timeout); |
247 | /// Called back by the asset cache when it has the asset | 184 | } |
248 | /// </summary> | 185 | |
249 | /// <param name="assetID"></param> | 186 | private void OnTimeout(object source, ElapsedEventArgs args) |
250 | /// <param name="asset"></param> | ||
251 | public void AssetRequestCallback(string id, object sender, AssetBase asset) | ||
252 | { | 187 | { |
253 | Culture.SetCurrentCulture(); | 188 | m_timeout = true; |
254 | |||
255 | try | ||
256 | { | ||
257 | lock (this) | ||
258 | { | ||
259 | //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id); | ||
260 | |||
261 | m_requestCallbackTimer.Stop(); | ||
262 | |||
263 | if ((m_requestState == RequestState.Aborted) || (m_requestState == RequestState.Completed)) | ||
264 | { | ||
265 | m_log.WarnFormat( | ||
266 | "[ARCHIVER]: Received information about asset {0} while in state {1}. Ignoring.", | ||
267 | id, m_requestState); | ||
268 | |||
269 | return; | ||
270 | } | ||
271 | |||
272 | if (asset != null) | ||
273 | { | ||
274 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); | ||
275 | m_foundAssetUuids.Add(asset.FullID); | ||
276 | |||
277 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | ||
278 | } | ||
279 | else | ||
280 | { | ||
281 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
282 | m_notFoundAssetUuids.Add(new UUID(id)); | ||
283 | } | ||
284 | |||
285 | if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired) | ||
286 | { | ||
287 | m_requestState = RequestState.Completed; | ||
288 | if(m_notFoundAssetUuids.Count == 0) | ||
289 | m_log.DebugFormat( | ||
290 | "[ARCHIVER]: Successfully added {0} assets", | ||
291 | m_foundAssetUuids.Count); | ||
292 | else | ||
293 | m_log.DebugFormat( | ||
294 | "[ARCHIVER]: Successfully added {0} assets ({1} assets not found but these may be expected invalid references)", | ||
295 | m_foundAssetUuids.Count, m_notFoundAssetUuids.Count); | ||
296 | |||
297 | |||
298 | // We want to stop using the asset cache thread asap | ||
299 | // as we now need to do the work of producing the rest of the archive | ||
300 | WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback"); | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | m_requestCallbackTimer.Start(); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | catch (Exception e) | ||
309 | { | ||
310 | m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); | ||
311 | } | ||
312 | } | 189 | } |
313 | 190 | ||
314 | /// <summary> | 191 | /// <summary> |
315 | /// Perform the callback on the original requester of the assets | 192 | /// Perform the callback on the original requester of the assets |
316 | /// </summary> | 193 | /// </summary> |
317 | protected void PerformAssetsRequestCallback(object o) | 194 | private void PerformAssetsRequestCallback(object o) |
318 | { | 195 | { |
196 | if(m_assetsRequestCallback == null) | ||
197 | return; | ||
319 | Culture.SetCurrentCulture(); | 198 | Culture.SetCurrentCulture(); |
320 | 199 | ||
321 | Boolean timedOut = (Boolean)o; | 200 | Boolean timedOut = (Boolean)o; |
@@ -331,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
331 | } | 210 | } |
332 | } | 211 | } |
333 | 212 | ||
334 | protected AssetBase PostProcess(AssetBase asset) | 213 | private AssetBase PostProcess(AssetBase asset) |
335 | { | 214 | { |
336 | if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) | 215 | if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) |
337 | { | 216 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index b59e2af..5ff063b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -176,6 +176,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | public void SendParcelsOverlay(IClientAPI client) | ||
180 | { | ||
181 | if (m_landManagementModule != null) | ||
182 | { | ||
183 | m_landManagementModule.SendParcelOverlay(client); | ||
184 | } | ||
185 | } | ||
186 | |||
179 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) | 187 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) |
180 | { | 188 | { |
181 | if (m_landManagementModule != null) | 189 | if (m_landManagementModule != null) |
diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs index 441076d..093ea9c 100644 --- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs | |||
@@ -44,14 +44,13 @@ namespace OpenSim.Region.Framework.Interfaces | |||
44 | /// <param name='isReuseable'></param> | 44 | /// <param name='isReuseable'></param> |
45 | void ReturnData(UUID id, IDynamicTexture texture); | 45 | void ReturnData(UUID id, IDynamicTexture texture); |
46 | 46 | ||
47 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams); | ||
47 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, | 48 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, |
48 | int updateTimer); | 49 | bool SetBlending, byte AlphaValue); |
49 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, | 50 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, |
50 | int updateTimer, bool SetBlending, byte AlphaValue); | 51 | bool SetBlending, int disp, byte AlphaValue, int face); |
51 | UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, | 52 | |
52 | int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); | 53 | UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams); |
53 | UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, | ||
54 | int updateTimer); | ||
55 | 54 | ||
56 | /// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the | 55 | /// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the |
57 | /// asset service. | 56 | /// asset service. |
@@ -62,8 +61,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
62 | /// based texture or "image" to create a texture from an image at a particular URL</param> | 61 | /// based texture or "image" to create a texture from an image at a particular URL</param> |
63 | /// <param name="data">The data for the generator</param> | 62 | /// <param name="data">The data for the generator</param> |
64 | /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param> | 63 | /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param> |
65 | /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive | ||
66 | /// the image is updated at the given interval. Not implemented for </param> | ||
67 | /// <param name="SetBlending"> | 64 | /// <param name="SetBlending"> |
68 | /// If true, the newly generated texture is blended with the appropriate existing ones on the prim | 65 | /// If true, the newly generated texture is blended with the appropriate existing ones on the prim |
69 | /// </param> | 66 | /// </param> |
@@ -76,7 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
76 | /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID | 73 | /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID |
77 | /// </returns> | 74 | /// </returns> |
78 | UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, | 75 | UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, |
79 | int updateTimer, bool SetBlending, byte AlphaValue); | 76 | bool SetBlending, byte AlphaValue); |
80 | 77 | ||
81 | /// <summary> | 78 | /// <summary> |
82 | /// Apply a dynamically generated texture to the given prim. | 79 | /// Apply a dynamically generated texture to the given prim. |
@@ -87,8 +84,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
87 | /// based texture or "image" to create a texture from an image at a particular URL</param> | 84 | /// based texture or "image" to create a texture from an image at a particular URL</param> |
88 | /// <param name="data">The data for the generator</param> | 85 | /// <param name="data">The data for the generator</param> |
89 | /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param> | 86 | /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param> |
90 | /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive | ||
91 | /// the image is updated at the given interval. Not implemented for </param> | ||
92 | /// <param name="SetBlending"> | 87 | /// <param name="SetBlending"> |
93 | /// If true, the newly generated texture is blended with the appropriate existing ones on the prim | 88 | /// If true, the newly generated texture is blended with the appropriate existing ones on the prim |
94 | /// </param> | 89 | /// </param> |
@@ -109,9 +104,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
109 | /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture | 104 | /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture |
110 | /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID | 105 | /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID |
111 | /// </returns> | 106 | /// </returns> |
112 | UUID AddDynamicTextureData( | 107 | UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, |
113 | UUID simID, UUID primID, string contentType, string data, string extraParams, | 108 | bool SetBlending, int disp, byte AlphaValue, int face); |
114 | int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); | ||
115 | 109 | ||
116 | void GetDrawStringSize(string contentType, string text, string fontName, int fontSize, | 110 | void GetDrawStringSize(string contentType, string text, string fontName, int fontSize, |
117 | out double xSize, out double ySize); | 111 | out double xSize, out double ySize); |
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index e76fef4..63aafcd 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -116,16 +116,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | 116 | ||
117 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) | 117 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) |
118 | { | 118 | { |
119 | if (part.CollisionSoundType < 0) | ||
120 | return; | ||
121 | |||
119 | if (collidersinfolist.Count == 0 || part == null) | 122 | if (collidersinfolist.Count == 0 || part == null) |
120 | return; | 123 | return; |
121 | 124 | ||
122 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) | 125 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) |
123 | return; | 126 | return; |
124 | 127 | ||
125 | if (part.ParentGroup == null) | 128 | SceneObjectGroup sog = part.ParentGroup; |
129 | if (sog == null || sog.IsDeleted || sog.inTransit) | ||
126 | return; | 130 | return; |
127 | 131 | ||
128 | if (part.CollisionSoundType < 0) | 132 | if(sog.CollisionSoundThrottled(part.CollisionSoundType)) |
129 | return; | 133 | return; |
130 | 134 | ||
131 | float volume = part.CollisionSoundVolume; | 135 | float volume = part.CollisionSoundVolume; |
@@ -189,15 +193,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | continue; | 193 | continue; |
190 | } | 194 | } |
191 | 195 | ||
192 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id); | 196 | SceneObjectPart otherPart = sog.Scene.GetSceneObjectPart(id); |
193 | if (otherPart != null) | 197 | if (otherPart != null) |
194 | { | 198 | { |
195 | if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive) | 199 | SceneObjectGroup othersog = otherPart.ParentGroup; |
200 | if(othersog == null || othersog.IsDeleted || othersog.inTransit) | ||
201 | continue; | ||
202 | |||
203 | int otherType = otherPart.CollisionSoundType; | ||
204 | if (otherType < 0 || otherPart.VolumeDetectActive) | ||
196 | continue; | 205 | continue; |
197 | 206 | ||
198 | if (!HaveSound) | 207 | if (!HaveSound) |
199 | { | 208 | { |
200 | if (otherPart.CollisionSoundType == 1) | 209 | if(othersog.CollisionSoundThrottled(otherType)) |
210 | continue; | ||
211 | |||
212 | if (otherType == 1) | ||
201 | { | 213 | { |
202 | soundID = otherPart.CollisionSound; | 214 | soundID = otherPart.CollisionSound; |
203 | volume = otherPart.CollisionSoundVolume; | 215 | volume = otherPart.CollisionSoundVolume; |
@@ -206,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | } | 218 | } |
207 | else | 219 | else |
208 | { | 220 | { |
209 | if (otherPart.CollisionSoundType == 2) | 221 | if (otherType == 2) |
210 | { | 222 | { |
211 | volume = otherPart.CollisionSoundVolume; | 223 | volume = otherPart.CollisionSoundVolume; |
212 | if (volume == 0.0f) | 224 | if (volume == 0.0f) |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 827f91e..f76f882 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -855,7 +855,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | /// <see cref="Scene.DeleteSceneObject"/>, | 855 | /// <see cref="Scene.DeleteSceneObject"/>, |
856 | /// <see cref="Scene.SelectPrim"/>, | 856 | /// <see cref="Scene.SelectPrim"/>, |
857 | /// <see cref="Scene.DeselectPrim"/>, | 857 | /// <see cref="Scene.DeselectPrim"/>, |
858 | /// <see cref="SceneObjectGroup.UpdatePrimFlags"/>, | 858 | /// <see cref="SceneObjectGroup.UpdateFlags"/>, |
859 | /// <see cref="SceneObjectGroup.AbsolutePosition"/> | 859 | /// <see cref="SceneObjectGroup.AbsolutePosition"/> |
860 | /// </remarks> | 860 | /// </remarks> |
861 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; | 861 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; |
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index d81d8a2..80ee510 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -295,6 +295,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | lock (m_frames) | 295 | lock (m_frames) |
296 | { | 296 | { |
297 | KeyframeTimer.Add(this); | 297 | KeyframeTimer.Add(this); |
298 | m_lasttickMS = Util.GetTimeStampMS(); | ||
298 | m_timerStopped = false; | 299 | m_timerStopped = false; |
299 | } | 300 | } |
300 | } | 301 | } |
@@ -326,8 +327,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | newMotion.m_selected = true; | 327 | newMotion.m_selected = true; |
327 | } | 328 | } |
328 | 329 | ||
329 | newMotion.m_timerStopped = false; | 330 | // newMotion.m_timerStopped = false; |
330 | newMotion.m_running = true; | 331 | // newMotion.m_running = true; |
331 | newMotion.m_isCrossing = false; | 332 | newMotion.m_isCrossing = false; |
332 | newMotion.m_waitingCrossing = false; | 333 | newMotion.m_waitingCrossing = false; |
333 | } | 334 | } |
@@ -483,9 +484,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | 484 | ||
484 | m_group.RootPart.Velocity = Vector3.Zero; | 485 | m_group.RootPart.Velocity = Vector3.Zero; |
485 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 486 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
486 | m_group.SendGroupRootTerseUpdate(); | 487 | // m_group.SendGroupRootTerseUpdate(); |
487 | // m_group.RootPart.ScheduleTerseUpdate(); | 488 | m_group.RootPart.ScheduleTerseUpdate(); |
488 | m_frames.Clear(); | 489 | m_frames.Clear(); |
490 | m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); | ||
489 | } | 491 | } |
490 | 492 | ||
491 | public void Pause() | 493 | public void Pause() |
@@ -496,8 +498,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
496 | m_group.RootPart.Velocity = Vector3.Zero; | 498 | m_group.RootPart.Velocity = Vector3.Zero; |
497 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 499 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
498 | m_skippedUpdates = 1000; | 500 | m_skippedUpdates = 1000; |
499 | m_group.SendGroupRootTerseUpdate(); | 501 | // m_group.SendGroupRootTerseUpdate(); |
500 | // m_group.RootPart.ScheduleTerseUpdate(); | 502 | m_group.RootPart.ScheduleTerseUpdate(); |
503 | m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); | ||
501 | } | 504 | } |
502 | 505 | ||
503 | public void Suspend() | 506 | public void Suspend() |
@@ -644,15 +647,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
644 | 647 | ||
645 | m_group.RootPart.Velocity = Vector3.Zero; | 648 | m_group.RootPart.Velocity = Vector3.Zero; |
646 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 649 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
647 | m_group.SendGroupRootTerseUpdate(); | 650 | // m_group.SendGroupRootTerseUpdate(); |
648 | 651 | m_group.RootPart.ScheduleTerseUpdate(); | |
649 | m_frames.Clear(); | 652 | m_frames.Clear(); |
650 | } | 653 | } |
651 | 654 | ||
652 | Vector3 m_lastPosUpdate; | 655 | [NonSerialized()] Vector3 m_lastPosUpdate; |
653 | Quaternion m_lastRotationUpdate; | 656 | [NonSerialized()] Quaternion m_lastRotationUpdate; |
654 | Vector3 m_currentVel; | 657 | [NonSerialized()] Vector3 m_currentVel; |
655 | int m_skippedUpdates; | 658 | [NonSerialized()] int m_skippedUpdates; |
659 | [NonSerialized()] double m_lasttickMS; | ||
656 | 660 | ||
657 | private void DoOnTimer(double tickDuration) | 661 | private void DoOnTimer(double tickDuration) |
658 | { | 662 | { |
@@ -673,7 +677,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | { | 677 | { |
674 | m_group.RootPart.Velocity = Vector3.Zero; | 678 | m_group.RootPart.Velocity = Vector3.Zero; |
675 | m_skippedUpdates = 1000; | 679 | m_skippedUpdates = 1000; |
676 | m_group.SendGroupRootTerseUpdate(); | 680 | // m_group.SendGroupRootTerseUpdate(); |
681 | m_group.RootPart.ScheduleTerseUpdate(); | ||
677 | } | 682 | } |
678 | return; | 683 | return; |
679 | } | 684 | } |
@@ -696,6 +701,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | return; | 701 | return; |
697 | } | 702 | } |
698 | 703 | ||
704 | double nowMS = Util.GetTimeStampMS(); | ||
705 | |||
699 | if (m_frames.Count == 0) | 706 | if (m_frames.Count == 0) |
700 | { | 707 | { |
701 | lock (m_frames) | 708 | lock (m_frames) |
@@ -716,10 +723,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
716 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); | 723 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); |
717 | 724 | ||
718 | m_currentFrame.TimeMS += (int)tickDuration; | 725 | m_currentFrame.TimeMS += (int)tickDuration; |
726 | m_lasttickMS = nowMS - 50f; | ||
719 | update = true; | 727 | update = true; |
720 | } | 728 | } |
721 | 729 | ||
722 | m_currentFrame.TimeMS -= (int)tickDuration; | 730 | int elapsed = (int)(nowMS - m_lasttickMS); |
731 | if( elapsed > 3 * tickDuration) | ||
732 | elapsed = (int)tickDuration; | ||
733 | |||
734 | m_currentFrame.TimeMS -= elapsed; | ||
735 | m_lasttickMS = nowMS; | ||
723 | 736 | ||
724 | // Do the frame processing | 737 | // Do the frame processing |
725 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; | 738 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; |
@@ -752,7 +765,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
752 | } | 765 | } |
753 | else | 766 | else |
754 | { | 767 | { |
755 | bool lastSteps = remainingSteps < 4; | 768 | // bool lastSteps = remainingSteps < 4; |
769 | |||
756 | Vector3 currentPosition = m_group.AbsolutePosition; | 770 | Vector3 currentPosition = m_group.AbsolutePosition; |
757 | Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; | 771 | Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; |
758 | motionThisFrame /= (float)remainingSteps; | 772 | motionThisFrame /= (float)remainingSteps; |
@@ -766,20 +780,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
766 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); | 780 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); |
767 | step.Normalize(); | 781 | step.Normalize(); |
768 | m_group.RootPart.RotationOffset = step; | 782 | m_group.RootPart.RotationOffset = step; |
783 | /* | ||
769 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f | 784 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f |
770 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f | 785 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f |
771 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) | 786 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) |
772 | update = true; | 787 | update = true; |
788 | */ | ||
773 | } | 789 | } |
774 | 790 | ||
775 | m_group.AbsolutePosition = m_nextPosition; | 791 | m_group.AbsolutePosition = m_nextPosition; |
776 | if(lastSteps) | 792 | // if(lastSteps) |
777 | m_group.RootPart.Velocity = Vector3.Zero; | 793 | // m_group.RootPart.Velocity = Vector3.Zero; |
778 | else | 794 | // else |
779 | m_group.RootPart.Velocity = m_currentVel; | 795 | m_group.RootPart.Velocity = m_currentVel; |
780 | 796 | /* | |
781 | if(!update && ( | 797 | if(!update && ( |
782 | lastSteps || | 798 | // lastSteps || |
783 | m_skippedUpdates * tickDuration > 0.5 || | 799 | m_skippedUpdates * tickDuration > 0.5 || |
784 | Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || | 800 | Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || |
785 | Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || | 801 | Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || |
@@ -790,15 +806,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
790 | } | 806 | } |
791 | else | 807 | else |
792 | m_skippedUpdates++; | 808 | m_skippedUpdates++; |
793 | 809 | */ | |
794 | } | 810 | } |
795 | if(update) | 811 | // if(update) |
796 | { | 812 | // { |
797 | m_lastPosUpdate = m_nextPosition; | 813 | // m_lastPosUpdate = m_nextPosition; |
798 | m_lastRotationUpdate = m_group.GroupRotation; | 814 | // m_lastRotationUpdate = m_group.GroupRotation; |
799 | m_skippedUpdates = 0; | 815 | // m_skippedUpdates = 0; |
800 | m_group.SendGroupRootTerseUpdate(); | 816 | // m_group.SendGroupRootTerseUpdate(); |
801 | } | 817 | m_group.RootPart.ScheduleTerseUpdate(); |
818 | // } | ||
802 | } | 819 | } |
803 | 820 | ||
804 | public Byte[] Serialize() | 821 | public Byte[] Serialize() |
@@ -842,8 +859,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
842 | { | 859 | { |
843 | m_group.RootPart.Velocity = Vector3.Zero; | 860 | m_group.RootPart.Velocity = Vector3.Zero; |
844 | m_skippedUpdates = 1000; | 861 | m_skippedUpdates = 1000; |
845 | m_group.SendGroupRootTerseUpdate(); | 862 | // m_group.SendGroupRootTerseUpdate(); |
846 | // m_group.RootPart.ScheduleTerseUpdate(); | 863 | m_group.RootPart.ScheduleTerseUpdate(); |
847 | } | 864 | } |
848 | } | 865 | } |
849 | 866 | ||
@@ -855,8 +872,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | { | 872 | { |
856 | m_group.RootPart.Velocity = Vector3.Zero; | 873 | m_group.RootPart.Velocity = Vector3.Zero; |
857 | m_skippedUpdates = 1000; | 874 | m_skippedUpdates = 1000; |
858 | m_group.SendGroupRootTerseUpdate(); | 875 | // m_group.SendGroupRootTerseUpdate(); |
859 | // m_group.RootPart.ScheduleTerseUpdate(); | 876 | m_group.RootPart.ScheduleTerseUpdate(); |
860 | 877 | ||
861 | if (m_running) | 878 | if (m_running) |
862 | { | 879 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 8d11331..351eda3 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -425,25 +425,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
425 | 425 | ||
426 | private void XWfloat(string name, float f) | 426 | private void XWfloat(string name, float f) |
427 | { | 427 | { |
428 | writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); | 428 | writer.WriteElementString(name, f.ToString(Culture.FormatProvider)); |
429 | } | 429 | } |
430 | 430 | ||
431 | private void XWVector(string name, Vector3 vec) | 431 | private void XWVector(string name, Vector3 vec) |
432 | { | 432 | { |
433 | writer.WriteStartElement(name); | 433 | writer.WriteStartElement(name); |
434 | writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); | 434 | writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); |
435 | writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); | 435 | writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); |
436 | writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); | 436 | writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); |
437 | writer.WriteEndElement(); | 437 | writer.WriteEndElement(); |
438 | } | 438 | } |
439 | 439 | ||
440 | private void XWQuat(string name, Quaternion quat) | 440 | private void XWQuat(string name, Quaternion quat) |
441 | { | 441 | { |
442 | writer.WriteStartElement(name); | 442 | writer.WriteStartElement(name); |
443 | writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); | 443 | writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); |
444 | writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); | 444 | writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); |
445 | writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); | 445 | writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); |
446 | writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); | 446 | writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); |
447 | writer.WriteEndElement(); | 447 | writer.WriteEndElement(); |
448 | } | 448 | } |
449 | 449 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ebef158..c06b3dd 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1651,10 +1651,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1651 | physicsMS2 = (float)(tmpMS2 - tmpMS); | 1651 | physicsMS2 = (float)(tmpMS2 - tmpMS); |
1652 | tmpMS = tmpMS2; | 1652 | tmpMS = tmpMS2; |
1653 | 1653 | ||
1654 | /* | ||
1654 | // Apply any pending avatar force input to the avatar's velocity | 1655 | // Apply any pending avatar force input to the avatar's velocity |
1655 | if (Frame % m_update_entitymovement == 0) | 1656 | if (Frame % m_update_entitymovement == 0) |
1656 | m_sceneGraph.UpdateScenePresenceMovement(); | 1657 | m_sceneGraph.UpdateScenePresenceMovement(); |
1657 | 1658 | */ | |
1658 | if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations) | 1659 | if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations) |
1659 | { | 1660 | { |
1660 | m_sendingCoarseLocations = true; | 1661 | m_sendingCoarseLocations = true; |
@@ -1942,7 +1943,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1942 | { | 1943 | { |
1943 | if (!m_backingup) | 1944 | if (!m_backingup) |
1944 | { | 1945 | { |
1945 | m_backingup = true; | ||
1946 | WorkManager.RunInThreadPool(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); | 1946 | WorkManager.RunInThreadPool(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); |
1947 | } | 1947 | } |
1948 | } | 1948 | } |
@@ -1971,38 +1971,58 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | { | 1971 | { |
1972 | lock (m_returns) | 1972 | lock (m_returns) |
1973 | { | 1973 | { |
1974 | EventManager.TriggerOnBackup(SimulationDataService, forced); | 1974 | if(m_backingup) |
1975 | { | ||
1976 | m_log.WarnFormat("[Scene] Backup of {0} already running. New call skipped", RegionInfo.RegionName); | ||
1977 | return; | ||
1978 | } | ||
1975 | 1979 | ||
1976 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) | 1980 | m_backingup = true; |
1981 | try | ||
1977 | { | 1982 | { |
1978 | UUID transaction = UUID.Random(); | 1983 | EventManager.TriggerOnBackup(SimulationDataService, forced); |
1979 | 1984 | ||
1980 | GridInstantMessage msg = new GridInstantMessage(); | 1985 | if(m_returns.Count == 0) |
1981 | msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server | 1986 | return; |
1982 | msg.toAgentID = new Guid(ret.Key.ToString()); | ||
1983 | msg.imSessionID = new Guid(transaction.ToString()); | ||
1984 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
1985 | msg.fromAgentName = "Server"; | ||
1986 | msg.dialog = (byte)19; // Object msg | ||
1987 | msg.fromGroup = false; | ||
1988 | msg.offline = (byte)1; | ||
1989 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | ||
1990 | msg.Position = Vector3.Zero; | ||
1991 | msg.RegionID = RegionInfo.RegionID.Guid; | ||
1992 | |||
1993 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | ||
1994 | msg.binaryBucket = Util.StringToBytes256("\0"); | ||
1995 | if (ret.Value.count > 1) | ||
1996 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | ||
1997 | else | ||
1998 | msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | ||
1999 | 1987 | ||
2000 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); | 1988 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); |
2001 | if (tr != null) | 1989 | if (tr == null) |
1990 | return; | ||
1991 | |||
1992 | uint unixtime = (uint)Util.UnixTimeSinceEpoch(); | ||
1993 | uint estateid = RegionInfo.EstateSettings.ParentEstateID; | ||
1994 | Guid regionguid = RegionInfo.RegionID.Guid; | ||
1995 | |||
1996 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) | ||
1997 | { | ||
1998 | GridInstantMessage msg = new GridInstantMessage(); | ||
1999 | msg.fromAgentID = Guid.Empty; // From server | ||
2000 | msg.toAgentID = ret.Key.Guid; | ||
2001 | msg.imSessionID = Guid.NewGuid(); | ||
2002 | msg.timestamp = unixtime; | ||
2003 | msg.fromAgentName = "Server"; | ||
2004 | msg.dialog = 19; // Object msg | ||
2005 | msg.fromGroup = false; | ||
2006 | msg.offline = 1; | ||
2007 | msg.ParentEstateID = estateid; | ||
2008 | msg.Position = Vector3.Zero; | ||
2009 | msg.RegionID = regionguid; | ||
2010 | |||
2011 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | ||
2012 | msg.binaryBucket = new Byte[1] {0}; | ||
2013 | if (ret.Value.count > 1) | ||
2014 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | ||
2015 | else | ||
2016 | msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | ||
2017 | |||
2002 | tr.SendInstantMessage(msg, delegate(bool success) { }); | 2018 | tr.SendInstantMessage(msg, delegate(bool success) { }); |
2019 | } | ||
2020 | m_returns.Clear(); | ||
2021 | } | ||
2022 | finally | ||
2023 | { | ||
2024 | m_backingup = false; | ||
2003 | } | 2025 | } |
2004 | m_returns.Clear(); | ||
2005 | m_backingup = false; | ||
2006 | } | 2026 | } |
2007 | } | 2027 | } |
2008 | 2028 | ||
@@ -4805,16 +4825,34 @@ Label_GroupsDone: | |||
4805 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4825 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4806 | Vector3 lookat, uint teleportFlags) | 4826 | Vector3 lookat, uint teleportFlags) |
4807 | { | 4827 | { |
4808 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); | 4828 | if (EntityTransferModule == null) |
4829 | { | ||
4830 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); | ||
4831 | return; | ||
4832 | } | ||
4833 | |||
4834 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | ||
4835 | if (sp == null || sp.IsDeleted || sp.IsInTransit) | ||
4836 | return; | ||
4809 | 4837 | ||
4810 | if (region == null) | 4838 | ulong regionHandle = 0; |
4839 | if(regionName == RegionInfo.RegionName) | ||
4840 | regionHandle = RegionInfo.RegionHandle; | ||
4841 | else | ||
4842 | { | ||
4843 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); | ||
4844 | if (region != null) | ||
4845 | regionHandle = region.RegionHandle; | ||
4846 | } | ||
4847 | |||
4848 | if(regionHandle == 0) | ||
4811 | { | 4849 | { |
4812 | // can't find the region: Tell viewer and abort | 4850 | // can't find the region: Tell viewer and abort |
4813 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 4851 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
4814 | return; | 4852 | return; |
4815 | } | 4853 | } |
4816 | 4854 | ||
4817 | RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags); | 4855 | EntityTransferModule.Teleport(sp, regionHandle, position, lookat, teleportFlags); |
4818 | } | 4856 | } |
4819 | 4857 | ||
4820 | /// <summary> | 4858 | /// <summary> |
@@ -4828,19 +4866,17 @@ Label_GroupsDone: | |||
4828 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, | 4866 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, |
4829 | Vector3 lookAt, uint teleportFlags) | 4867 | Vector3 lookAt, uint teleportFlags) |
4830 | { | 4868 | { |
4831 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | 4869 | if (EntityTransferModule == null) |
4832 | if (sp != null) | ||
4833 | { | 4870 | { |
4834 | if (EntityTransferModule != null) | 4871 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
4835 | { | 4872 | return; |
4836 | EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | ||
4837 | } | ||
4838 | else | ||
4839 | { | ||
4840 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); | ||
4841 | sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator."); | ||
4842 | } | ||
4843 | } | 4873 | } |
4874 | |||
4875 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | ||
4876 | if (sp == null || sp.IsDeleted || sp.IsInTransit) | ||
4877 | return; | ||
4878 | |||
4879 | EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | ||
4844 | } | 4880 | } |
4845 | 4881 | ||
4846 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 4882 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index ae827f4..61a243d 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1649,7 +1649,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1649 | else // else turn it off | 1649 | else // else turn it off |
1650 | vdtc = false; | 1650 | vdtc = false; |
1651 | 1651 | ||
1652 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc); | 1652 | group.UpdateFlags(UsePhysics, SetTemporary, SetPhantom, vdtc); |
1653 | } | 1653 | } |
1654 | else | 1654 | else |
1655 | { | 1655 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fdfe8ae..6f46a92 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1259,6 +1259,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1259 | set { m_LoopSoundSlavePrims = value; } | 1259 | set { m_LoopSoundSlavePrims = value; } |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | private double m_lastCollisionSoundMS; | ||
1263 | |||
1262 | /// <summary> | 1264 | /// <summary> |
1263 | /// The UUID for the region this object is in. | 1265 | /// The UUID for the region this object is in. |
1264 | /// </summary> | 1266 | /// </summary> |
@@ -1336,7 +1338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1336 | /// </summary> | 1338 | /// </summary> |
1337 | public SceneObjectGroup() | 1339 | public SceneObjectGroup() |
1338 | { | 1340 | { |
1339 | 1341 | m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; | |
1340 | } | 1342 | } |
1341 | 1343 | ||
1342 | /// <summary> | 1344 | /// <summary> |
@@ -2716,35 +2718,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2716 | RootPart.KeyframeMotion.Stop(); | 2718 | RootPart.KeyframeMotion.Stop(); |
2717 | RootPart.KeyframeMotion = null; | 2719 | RootPart.KeyframeMotion = null; |
2718 | } | 2720 | } |
2719 | UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); | 2721 | UpdateFlags(usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); |
2720 | } | 2722 | } |
2721 | 2723 | ||
2722 | public void ScriptSetTemporaryStatus(bool makeTemporary) | 2724 | public void ScriptSetTemporaryStatus(bool makeTemporary) |
2723 | { | 2725 | { |
2724 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); | 2726 | UpdateFlags(UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); |
2725 | } | 2727 | } |
2726 | 2728 | ||
2727 | public void ScriptSetPhantomStatus(bool makePhantom) | 2729 | public void ScriptSetPhantomStatus(bool makePhantom) |
2728 | { | 2730 | { |
2729 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); | 2731 | UpdateFlags(UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); |
2730 | } | 2732 | } |
2731 | 2733 | ||
2732 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) | 2734 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) |
2733 | { | 2735 | { |
2734 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); | 2736 | UpdateFlags(UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); |
2735 | |||
2736 | /* | ||
2737 | ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore | ||
2738 | |||
2739 | if (PhysActor != null) // Should always be the case now | ||
2740 | { | ||
2741 | PhysActor.SetVolumeDetect(param); | ||
2742 | } | ||
2743 | if (param != 0) | ||
2744 | AddFlag(PrimFlags.Phantom); | ||
2745 | |||
2746 | ScheduleFullUpdate(); | ||
2747 | */ | ||
2748 | } | 2737 | } |
2749 | 2738 | ||
2750 | public void applyImpulse(Vector3 impulse) | 2739 | public void applyImpulse(Vector3 impulse) |
@@ -4029,84 +4018,80 @@ namespace OpenSim.Region.Framework.Scenes | |||
4029 | /// <param name="SetTemporary"></param> | 4018 | /// <param name="SetTemporary"></param> |
4030 | /// <param name="SetPhantom"></param> | 4019 | /// <param name="SetPhantom"></param> |
4031 | /// <param name="SetVolumeDetect"></param> | 4020 | /// <param name="SetVolumeDetect"></param> |
4032 | public void UpdatePrimFlags(uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) | 4021 | public void UpdateFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) |
4033 | { | 4022 | { |
4034 | HasGroupChanged = true; | 4023 | if (m_scene == null || IsDeleted) |
4024 | return; | ||
4035 | 4025 | ||
4036 | SceneObjectPart selectionPart = GetPart(localID); | 4026 | HasGroupChanged = true; |
4037 | 4027 | ||
4038 | if (Scene != null) | 4028 | if (SetTemporary) |
4039 | { | 4029 | { |
4040 | if (SetTemporary) | 4030 | DetachFromBackup(); |
4041 | { | 4031 | // Remove from database and parcel prim count |
4042 | DetachFromBackup(); | 4032 | // |
4043 | // Remove from database and parcel prim count | 4033 | m_scene.DeleteFromStorage(UUID); |
4044 | // | ||
4045 | m_scene.DeleteFromStorage(UUID); | ||
4046 | } | ||
4047 | else if (!Backup) | ||
4048 | { | ||
4049 | // Previously been temporary now switching back so make it | ||
4050 | // available for persisting again | ||
4051 | AttachToBackup(); | ||
4052 | } | ||
4053 | |||
4054 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
4055 | } | 4034 | } |
4056 | 4035 | else if (!Backup) | |
4057 | if (selectionPart != null) | ||
4058 | { | 4036 | { |
4059 | SceneObjectPart[] parts = m_parts.GetArray(); | 4037 | // Previously been temporary now switching back so make it |
4038 | // available for persisting again | ||
4039 | AttachToBackup(); | ||
4040 | } | ||
4060 | 4041 | ||
4061 | if (Scene != null && UsePhysics) | ||
4062 | { | ||
4063 | int maxprims = m_scene.m_linksetPhysCapacity; | ||
4064 | bool checkShape = (maxprims > 0 && | ||
4065 | parts.Length > maxprims); | ||
4066 | 4042 | ||
4067 | for (int i = 0; i < parts.Length; i++) | 4043 | SceneObjectPart[] parts = m_parts.GetArray(); |
4068 | { | 4044 | |
4069 | SceneObjectPart part = parts[i]; | 4045 | if (UsePhysics) |
4046 | { | ||
4047 | int maxprims = m_scene.m_linksetPhysCapacity; | ||
4048 | bool checkShape = (maxprims > 0 && | ||
4049 | parts.Length > maxprims); | ||
4070 | 4050 | ||
4071 | if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) | 4051 | for (int i = 0; i < parts.Length; i++) |
4072 | continue; // assuming root type was checked elsewhere | 4052 | { |
4053 | SceneObjectPart part = parts[i]; | ||
4073 | 4054 | ||
4074 | if (checkShape) | 4055 | if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) |
4075 | { | 4056 | continue; // assuming root type was checked elsewhere |
4076 | if (--maxprims < 0) | ||
4077 | { | ||
4078 | UsePhysics = false; | ||
4079 | break; | ||
4080 | } | ||
4081 | } | ||
4082 | 4057 | ||
4083 | if (part.Scale.X > m_scene.m_maxPhys || | 4058 | if (checkShape) |
4084 | part.Scale.Y > m_scene.m_maxPhys || | 4059 | { |
4085 | part.Scale.Z > m_scene.m_maxPhys ) | 4060 | if (--maxprims < 0) |
4086 | { | 4061 | { |
4087 | UsePhysics = false; // Reset physics | 4062 | UsePhysics = false; |
4088 | break; | 4063 | break; |
4089 | } | 4064 | } |
4090 | } | 4065 | } |
4091 | } | ||
4092 | |||
4093 | if (parts.Length > 1) | ||
4094 | { | ||
4095 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
4096 | 4066 | ||
4097 | for (int i = 0; i < parts.Length; i++) | 4067 | if (part.Scale.X > m_scene.m_maxPhys || |
4068 | part.Scale.Y > m_scene.m_maxPhys || | ||
4069 | part.Scale.Z > m_scene.m_maxPhys ) | ||
4098 | { | 4070 | { |
4099 | 4071 | UsePhysics = false; // Reset physics | |
4100 | if (parts[i].UUID != m_rootPart.UUID) | 4072 | break; |
4101 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
4102 | } | 4073 | } |
4074 | } | ||
4075 | } | ||
4076 | |||
4077 | if (parts.Length > 1) | ||
4078 | { | ||
4079 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
4103 | 4080 | ||
4104 | if (m_rootPart.PhysActor != null) | 4081 | for (int i = 0; i < parts.Length; i++) |
4105 | m_rootPart.PhysActor.Building = false; | 4082 | { |
4083 | |||
4084 | if (parts[i].UUID != m_rootPart.UUID) | ||
4085 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
4106 | } | 4086 | } |
4107 | else | 4087 | |
4108 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | 4088 | if (m_rootPart.PhysActor != null) |
4089 | m_rootPart.PhysActor.Building = false; | ||
4109 | } | 4090 | } |
4091 | else | ||
4092 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | ||
4093 | |||
4094 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
4110 | } | 4095 | } |
4111 | 4096 | ||
4112 | public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) | 4097 | public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) |
@@ -5528,7 +5513,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
5528 | } | 5513 | } |
5529 | } | 5514 | } |
5530 | 5515 | ||
5516 | public bool CollisionSoundThrottled(int collisionSoundType) | ||
5517 | { | ||
5518 | double time = m_lastCollisionSoundMS; | ||
5519 | // m_lastCollisionSoundMS = Util.GetTimeStampMS(); | ||
5520 | // time = m_lastCollisionSoundMS - time; | ||
5521 | double now = Util.GetTimeStampMS(); | ||
5522 | time = now - time; | ||
5523 | switch (collisionSoundType) | ||
5524 | { | ||
5525 | case 0: // default sounds | ||
5526 | case 2: // default sounds with volume set by script | ||
5527 | if(time < 300.0) | ||
5528 | return true; | ||
5529 | break; | ||
5530 | case 1: // selected sound | ||
5531 | if(time < 200.0) | ||
5532 | return true; | ||
5533 | break; | ||
5534 | default: | ||
5535 | break; | ||
5536 | } | ||
5537 | m_lastCollisionSoundMS = now; | ||
5538 | return false; | ||
5539 | } | ||
5540 | |||
5531 | #endregion | 5541 | #endregion |
5532 | } | 5542 | } |
5533 | 5543 | ||
5544 | |||
5534 | } | 5545 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c2eac24..f0a3fab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -329,7 +329,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
329 | private byte[] m_TextureAnimation; | 329 | private byte[] m_TextureAnimation; |
330 | private byte m_clickAction; | 330 | private byte m_clickAction; |
331 | private Color m_color = Color.Black; | 331 | private Color m_color = Color.Black; |
332 | private readonly List<uint> m_lastColliders = new List<uint>(); | 332 | private List<uint> m_lastColliders = new List<uint>(); |
333 | private bool m_lastLandCollide; | ||
333 | private int m_linkNum; | 334 | private int m_linkNum; |
334 | 335 | ||
335 | private int m_scriptAccessPin; | 336 | private int m_scriptAccessPin; |
@@ -369,9 +370,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
369 | protected Vector3 m_lastPosition; | 370 | protected Vector3 m_lastPosition; |
370 | protected Quaternion m_lastRotation; | 371 | protected Quaternion m_lastRotation; |
371 | protected Vector3 m_lastVelocity; | 372 | protected Vector3 m_lastVelocity; |
372 | protected Vector3 m_lastAcceleration; | 373 | protected Vector3 m_lastAcceleration; // acceleration is a derived var with high noise |
373 | protected Vector3 m_lastAngularVelocity; | 374 | protected Vector3 m_lastAngularVelocity; |
374 | protected int m_lastUpdateSentTime; | 375 | protected double m_lastUpdateSentTime; |
375 | protected float m_buoyancy = 0.0f; | 376 | protected float m_buoyancy = 0.0f; |
376 | protected Vector3 m_force; | 377 | protected Vector3 m_force; |
377 | protected Vector3 m_torque; | 378 | protected Vector3 m_torque; |
@@ -809,7 +810,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
809 | { | 810 | { |
810 | // If this is a linkset, we don't want the physics engine mucking up our group position here. | 811 | // If this is a linkset, we don't want the physics engine mucking up our group position here. |
811 | PhysicsActor actor = PhysActor; | 812 | PhysicsActor actor = PhysActor; |
812 | if (ParentID == 0) | 813 | if (_parentID == 0) |
813 | { | 814 | { |
814 | if (actor != null) | 815 | if (actor != null) |
815 | m_groupPosition = actor.Position; | 816 | m_groupPosition = actor.Position; |
@@ -838,7 +839,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
838 | try | 839 | try |
839 | { | 840 | { |
840 | // Root prim actually goes at Position | 841 | // Root prim actually goes at Position |
841 | if (ParentID == 0) | 842 | if (_parentID == 0) |
842 | { | 843 | { |
843 | actor.Position = value; | 844 | actor.Position = value; |
844 | } | 845 | } |
@@ -880,7 +881,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
880 | ParentGroup.InvalidBoundsRadius(); | 881 | ParentGroup.InvalidBoundsRadius(); |
881 | 882 | ||
882 | PhysicsActor actor = PhysActor; | 883 | PhysicsActor actor = PhysActor; |
883 | if (ParentID != 0 && actor != null) | 884 | if (_parentID != 0 && actor != null) |
884 | { | 885 | { |
885 | actor.Position = GetWorldPosition(); | 886 | actor.Position = GetWorldPosition(); |
886 | actor.Orientation = GetWorldRotation(); | 887 | actor.Orientation = GetWorldRotation(); |
@@ -940,7 +941,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
940 | PhysicsActor actor = PhysActor; | 941 | PhysicsActor actor = PhysActor; |
941 | // If this is a root of a linkset, the real rotation is what the physics engine thinks. | 942 | // If this is a root of a linkset, the real rotation is what the physics engine thinks. |
942 | // If not a root prim, the offset rotation is computed by SOG and is relative to the root. | 943 | // If not a root prim, the offset rotation is computed by SOG and is relative to the root. |
943 | if (ParentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null) | 944 | if (_parentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null) |
944 | m_rotationOffset = actor.Orientation; | 945 | m_rotationOffset = actor.Orientation; |
945 | 946 | ||
946 | return m_rotationOffset; | 947 | return m_rotationOffset; |
@@ -957,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
957 | try | 958 | try |
958 | { | 959 | { |
959 | // Root prim gets value directly | 960 | // Root prim gets value directly |
960 | if (ParentID == 0) | 961 | if (_parentID == 0) |
961 | { | 962 | { |
962 | actor.Orientation = value; | 963 | actor.Orientation = value; |
963 | //m_log.Info("[PART]: RO1:" + actor.Orientation.ToString()); | 964 | //m_log.Info("[PART]: RO1:" + actor.Orientation.ToString()); |
@@ -1103,8 +1104,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1103 | { | 1104 | { |
1104 | get | 1105 | get |
1105 | { | 1106 | { |
1106 | if (m_text.Length > 255) | 1107 | if (m_text.Length > 256) // yes > 254 |
1107 | return m_text.Substring(0, 254); | 1108 | return m_text.Substring(0, 256); |
1108 | return m_text; | 1109 | return m_text; |
1109 | } | 1110 | } |
1110 | set { m_text = value; } | 1111 | set { m_text = value; } |
@@ -1258,6 +1259,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1258 | { | 1259 | { |
1259 | get | 1260 | get |
1260 | { | 1261 | { |
1262 | if (_parentID == 0) | ||
1263 | return GroupPosition; | ||
1264 | |||
1261 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); | 1265 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1262 | } | 1266 | } |
1263 | } | 1267 | } |
@@ -1379,7 +1383,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | public UUID LastOwnerID | 1383 | public UUID LastOwnerID |
1380 | { | 1384 | { |
1381 | get { return _lastOwnerID; } | 1385 | get { return _lastOwnerID; } |
1382 | set { _lastOwnerID = value; } | 1386 | set { |
1387 | _lastOwnerID = value; } | ||
1383 | } | 1388 | } |
1384 | 1389 | ||
1385 | public UUID RezzerID | 1390 | public UUID RezzerID |
@@ -2422,7 +2427,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2422 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 2427 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; |
2423 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; | 2428 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; |
2424 | 2429 | ||
2425 | if (ParentID != 0 && ParentID != LocalId) | 2430 | if (_parentID != 0 && _parentID != LocalId) |
2426 | { | 2431 | { |
2427 | PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; | 2432 | PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; |
2428 | 2433 | ||
@@ -2788,12 +2793,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2788 | { | 2793 | { |
2789 | ColliderArgs colliderArgs = new ColliderArgs(); | 2794 | ColliderArgs colliderArgs = new ColliderArgs(); |
2790 | List<DetectedObject> colliding = new List<DetectedObject>(); | 2795 | List<DetectedObject> colliding = new List<DetectedObject>(); |
2796 | Scene parentScene = ParentGroup.Scene; | ||
2791 | foreach (uint localId in colliders) | 2797 | foreach (uint localId in colliders) |
2792 | { | 2798 | { |
2793 | if (localId == 0) | 2799 | if (localId == 0) |
2794 | continue; | 2800 | continue; |
2795 | 2801 | ||
2796 | SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); | 2802 | SceneObjectPart obj = parentScene.GetSceneObjectPart(localId); |
2797 | if (obj != null) | 2803 | if (obj != null) |
2798 | { | 2804 | { |
2799 | if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) | 2805 | if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) |
@@ -2801,7 +2807,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2801 | } | 2807 | } |
2802 | else | 2808 | else |
2803 | { | 2809 | { |
2804 | ScenePresence av = ParentGroup.Scene.GetScenePresence(localId); | 2810 | ScenePresence av = parentScene.GetScenePresence(localId); |
2805 | if (av != null && (!av.IsChildAgent)) | 2811 | if (av != null && (!av.IsChildAgent)) |
2806 | { | 2812 | { |
2807 | if (!dest.CollisionFilteredOut(av.UUID, av.Name)) | 2813 | if (!dest.CollisionFilteredOut(av.UUID, av.Name)) |
@@ -2874,10 +2880,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2874 | 2880 | ||
2875 | public void PhysicsCollision(EventArgs e) | 2881 | public void PhysicsCollision(EventArgs e) |
2876 | { | 2882 | { |
2877 | if (ParentGroup.Scene == null || ParentGroup.IsDeleted) | 2883 | if (ParentGroup.Scene == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
2878 | return; | 2884 | return; |
2879 | 2885 | ||
2880 | // this a thread from physics ( heartbeat ) | 2886 | // this a thread from physics ( heartbeat ) |
2887 | bool thisHitLand = false; | ||
2888 | bool startLand = false; | ||
2889 | bool endedLand = false; | ||
2881 | 2890 | ||
2882 | CollisionEventUpdate a = (CollisionEventUpdate)e; | 2891 | CollisionEventUpdate a = (CollisionEventUpdate)e; |
2883 | Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; | 2892 | Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; |
@@ -2887,13 +2896,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2887 | 2896 | ||
2888 | if (collissionswith.Count == 0) | 2897 | if (collissionswith.Count == 0) |
2889 | { | 2898 | { |
2890 | if (m_lastColliders.Count == 0) | 2899 | if (m_lastColliders.Count == 0 && !m_lastLandCollide) |
2891 | return; // nothing to do | 2900 | return; // nothing to do |
2892 | 2901 | ||
2902 | endedLand = m_lastLandCollide; | ||
2903 | m_lastLandCollide = false; | ||
2904 | |||
2893 | foreach (uint localID in m_lastColliders) | 2905 | foreach (uint localID in m_lastColliders) |
2894 | { | 2906 | { |
2895 | endedColliders.Add(localID); | 2907 | endedColliders.Add(localID); |
2896 | } | 2908 | } |
2909 | |||
2897 | m_lastColliders.Clear(); | 2910 | m_lastColliders.Clear(); |
2898 | } | 2911 | } |
2899 | else | 2912 | else |
@@ -2909,19 +2922,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
2909 | 2922 | ||
2910 | foreach (uint id in collissionswith.Keys) | 2923 | foreach (uint id in collissionswith.Keys) |
2911 | { | 2924 | { |
2912 | thisHitColliders.Add(id); | 2925 | if(id == 0) |
2913 | if (!m_lastColliders.Contains(id)) | ||
2914 | { | 2926 | { |
2915 | startedColliders.Add(id); | 2927 | thisHitLand = true; |
2916 | 2928 | if (!m_lastLandCollide) | |
2917 | curcontact = collissionswith[id]; | 2929 | { |
2918 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | 2930 | startLand = true; |
2931 | curcontact = collissionswith[id]; | ||
2932 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | ||
2933 | { | ||
2934 | soundinfo = new CollisionForSoundInfo(); | ||
2935 | soundinfo.colliderID = id; | ||
2936 | soundinfo.position = curcontact.Position; | ||
2937 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
2938 | soundinfolist.Add(soundinfo); | ||
2939 | } | ||
2940 | } | ||
2941 | } | ||
2942 | else | ||
2943 | { | ||
2944 | thisHitColliders.Add(id); | ||
2945 | if (!m_lastColliders.Contains(id)) | ||
2919 | { | 2946 | { |
2920 | soundinfo = new CollisionForSoundInfo(); | 2947 | startedColliders.Add(id); |
2921 | soundinfo.colliderID = id; | 2948 | |
2922 | soundinfo.position = curcontact.Position; | 2949 | curcontact = collissionswith[id]; |
2923 | soundinfo.relativeVel = curcontact.RelativeSpeed; | 2950 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) |
2924 | soundinfolist.Add(soundinfo); | 2951 | { |
2952 | soundinfo = new CollisionForSoundInfo(); | ||
2953 | soundinfo.colliderID = id; | ||
2954 | soundinfo.position = curcontact.Position; | ||
2955 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
2956 | soundinfolist.Add(soundinfo); | ||
2957 | } | ||
2925 | } | 2958 | } |
2926 | } | 2959 | } |
2927 | } | 2960 | } |
@@ -2930,9 +2963,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2930 | { | 2963 | { |
2931 | foreach (uint id in collissionswith.Keys) | 2964 | foreach (uint id in collissionswith.Keys) |
2932 | { | 2965 | { |
2933 | thisHitColliders.Add(id); | 2966 | if(id == 0) |
2934 | if (!m_lastColliders.Contains(id)) | 2967 | { |
2935 | startedColliders.Add(id); | 2968 | thisHitLand = true; |
2969 | if (!m_lastLandCollide) | ||
2970 | startLand = true; | ||
2971 | } | ||
2972 | else | ||
2973 | { | ||
2974 | thisHitColliders.Add(id); | ||
2975 | if (!m_lastColliders.Contains(id)) | ||
2976 | startedColliders.Add(id); | ||
2977 | } | ||
2936 | } | 2978 | } |
2937 | } | 2979 | } |
2938 | 2980 | ||
@@ -2951,22 +2993,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
2951 | foreach (uint localID in endedColliders) | 2993 | foreach (uint localID in endedColliders) |
2952 | m_lastColliders.Remove(localID); | 2994 | m_lastColliders.Remove(localID); |
2953 | 2995 | ||
2996 | if(m_lastLandCollide && !thisHitLand) | ||
2997 | endedLand = true; | ||
2998 | |||
2999 | m_lastLandCollide = thisHitLand; | ||
3000 | |||
2954 | // play sounds. | 3001 | // play sounds. |
2955 | if (soundinfolist.Count > 0) | 3002 | if (soundinfolist.Count > 0) |
2956 | CollisionSounds.PartCollisionSound(this, soundinfolist); | 3003 | CollisionSounds.PartCollisionSound(this, soundinfolist); |
2957 | } | 3004 | } |
3005 | |||
3006 | EventManager eventmanager = ParentGroup.Scene.EventManager; | ||
2958 | 3007 | ||
2959 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 3008 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, eventmanager.TriggerScriptCollidingStart); |
2960 | if (!VolumeDetectActive) | 3009 | if (!VolumeDetectActive) |
2961 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); | 3010 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , eventmanager.TriggerScriptColliding); |
2962 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); | 3011 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , eventmanager.TriggerScriptCollidingEnd); |
2963 | 3012 | ||
2964 | if (startedColliders.Contains(0)) | 3013 | if (!VolumeDetectActive) |
2965 | SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); | 3014 | { |
2966 | if (m_lastColliders.Contains(0)) | 3015 | if (startLand) |
2967 | SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); | 3016 | SendLandCollisionEvent(scriptEvents.land_collision_start, eventmanager.TriggerScriptLandCollidingStart); |
2968 | if (endedColliders.Contains(0)) | 3017 | if (m_lastLandCollide) |
2969 | SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); | 3018 | SendLandCollisionEvent(scriptEvents.land_collision, eventmanager.TriggerScriptLandColliding); |
3019 | if (endedLand) | ||
3020 | SendLandCollisionEvent(scriptEvents.land_collision_end, eventmanager.TriggerScriptLandCollidingEnd); | ||
3021 | } | ||
2970 | } | 3022 | } |
2971 | 3023 | ||
2972 | // The Collision sounds code calls this | 3024 | // The Collision sounds code calls this |
@@ -2985,7 +3037,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2985 | volume = 0; | 3037 | volume = 0; |
2986 | 3038 | ||
2987 | int now = Util.EnvironmentTickCount(); | 3039 | int now = Util.EnvironmentTickCount(); |
2988 | if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) | 3040 | if(Util.EnvironmentTickCountSubtract(now, LastColSoundSentTime) < 200) |
2989 | return; | 3041 | return; |
2990 | 3042 | ||
2991 | LastColSoundSentTime = now; | 3043 | LastColSoundSentTime = now; |
@@ -3026,7 +3078,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3026 | //ParentGroup.RootPart.m_groupPosition = newpos; | 3078 | //ParentGroup.RootPart.m_groupPosition = newpos; |
3027 | } | 3079 | } |
3028 | /* | 3080 | /* |
3029 | if (pa != null && ParentID != 0 && ParentGroup != null) | 3081 | if (pa != null && _parentID != 0 && ParentGroup != null) |
3030 | { | 3082 | { |
3031 | // Special case where a child object is requesting property updates. | 3083 | // Special case where a child object is requesting property updates. |
3032 | // This happens when linksets are modified to use flexible links rather than | 3084 | // This happens when linksets are modified to use flexible links rather than |
@@ -3236,7 +3288,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3236 | 3288 | ||
3237 | /// <summary> | 3289 | /// <summary> |
3238 | /// Schedule a terse update for this prim. Terse updates only send position, | 3290 | /// Schedule a terse update for this prim. Terse updates only send position, |
3239 | /// rotation, velocity and rotational velocity information. | 3291 | /// rotation, velocity and rotational velocity information. WRONG!!!! |
3240 | /// </summary> | 3292 | /// </summary> |
3241 | public void ScheduleTerseUpdate() | 3293 | public void ScheduleTerseUpdate() |
3242 | { | 3294 | { |
@@ -3295,21 +3347,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3295 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); | 3347 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); |
3296 | } | 3348 | } |
3297 | } | 3349 | } |
3298 | |||
3299 | /* this does nothing | ||
3300 | SendFullUpdateToClient(remoteClient, Position) ignores position parameter | ||
3301 | if (IsRoot) | ||
3302 | { | ||
3303 | if (ParentGroup.IsAttachment) | ||
3304 | { | ||
3305 | SendFullUpdateToClient(remoteClient, AttachedPos); | ||
3306 | } | ||
3307 | else | ||
3308 | { | ||
3309 | SendFullUpdateToClient(remoteClient, AbsolutePosition); | ||
3310 | } | ||
3311 | } | ||
3312 | */ | ||
3313 | else | 3350 | else |
3314 | { | 3351 | { |
3315 | SendFullUpdateToClient(remoteClient); | 3352 | SendFullUpdateToClient(remoteClient); |
@@ -3325,12 +3362,12 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3325 | return; | 3362 | return; |
3326 | 3363 | ||
3327 | // Update the "last" values | 3364 | // Update the "last" values |
3328 | m_lastPosition = OffsetPosition; | 3365 | m_lastPosition = AbsolutePosition; |
3329 | m_lastRotation = RotationOffset; | 3366 | m_lastRotation = RotationOffset; |
3330 | m_lastVelocity = Velocity; | 3367 | m_lastVelocity = Velocity; |
3331 | m_lastAcceleration = Acceleration; | 3368 | m_lastAcceleration = Acceleration; |
3332 | m_lastAngularVelocity = AngularVelocity; | 3369 | m_lastAngularVelocity = AngularVelocity; |
3333 | m_lastUpdateSentTime = Environment.TickCount; | 3370 | m_lastUpdateSentTime = Util.GetTimeStampMS(); |
3334 | 3371 | ||
3335 | ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 3372 | ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
3336 | { | 3373 | { |
@@ -3344,12 +3381,12 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3344 | return; | 3381 | return; |
3345 | 3382 | ||
3346 | // Update the "last" values | 3383 | // Update the "last" values |
3347 | m_lastPosition = OffsetPosition; | 3384 | m_lastPosition = AbsolutePosition; |
3348 | m_lastRotation = RotationOffset; | 3385 | m_lastRotation = RotationOffset; |
3349 | m_lastVelocity = Velocity; | 3386 | m_lastVelocity = Velocity; |
3350 | m_lastAcceleration = Acceleration; | 3387 | m_lastAcceleration = Acceleration; |
3351 | m_lastAngularVelocity = AngularVelocity; | 3388 | m_lastAngularVelocity = AngularVelocity; |
3352 | m_lastUpdateSentTime = Environment.TickCount; | 3389 | m_lastUpdateSentTime = Util.GetTimeStampMS(); |
3353 | 3390 | ||
3354 | if (ParentGroup.IsAttachment) | 3391 | if (ParentGroup.IsAttachment) |
3355 | { | 3392 | { |
@@ -3395,40 +3432,129 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3395 | ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); | 3432 | ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); |
3396 | } | 3433 | } |
3397 | 3434 | ||
3435 | |||
3436 | private const float ROTATION_TOLERANCE = 0.01f; | ||
3437 | private const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution | ||
3438 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | ||
3439 | private const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | ||
3440 | |||
3398 | /// <summary> | 3441 | /// <summary> |
3399 | /// Tell all the prims which have had updates scheduled | 3442 | /// Tell all the prims which have had updates scheduled |
3400 | /// </summary> | 3443 | /// </summary> |
3401 | public void SendScheduledUpdates() | 3444 | public void SendScheduledUpdates() |
3402 | { | 3445 | { |
3403 | const float ROTATION_TOLERANCE = 0.01f; | ||
3404 | const float VELOCITY_TOLERANCE = 0.001f; | ||
3405 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | ||
3406 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | ||
3407 | |||
3408 | switch (UpdateFlag) | 3446 | switch (UpdateFlag) |
3409 | { | 3447 | { |
3448 | case UpdateRequired.NONE: | ||
3449 | ClearUpdateSchedule(); | ||
3450 | break; | ||
3451 | |||
3410 | case UpdateRequired.TERSE: | 3452 | case UpdateRequired.TERSE: |
3411 | { | 3453 | |
3412 | ClearUpdateSchedule(); | 3454 | ClearUpdateSchedule(); |
3413 | // Throw away duplicate or insignificant updates | 3455 | bool needupdate = true; |
3414 | if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 3456 | double now = Util.GetTimeStampMS(); |
3415 | !Acceleration.Equals(m_lastAcceleration) || | 3457 | Vector3 curvel = Velocity; |
3416 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 3458 | Vector3 curacc = Acceleration; |
3417 | Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || | 3459 | Vector3 angvel = AngularVelocity; |
3418 | !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || | 3460 | |
3419 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 3461 | while(true) // just to avoid ugly goto |
3420 | Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) | 3462 | { |
3463 | double elapsed = now - m_lastUpdateSentTime; | ||
3464 | if (elapsed > TIME_MS_TOLERANCE) | ||
3465 | break; | ||
3466 | |||
3467 | if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE || | ||
3468 | Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE || | ||
3469 | Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE) | ||
3470 | break; | ||
3471 | |||
3472 | // velocity change is also direction not only norm) | ||
3473 | if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | ||
3474 | Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | ||
3475 | Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE) | ||
3476 | break; | ||
3477 | |||
3478 | float vx = Math.Abs(curvel.X); | ||
3479 | if(vx > 128.0) | ||
3480 | break; | ||
3481 | float vy = Math.Abs(curvel.Y); | ||
3482 | if(vy > 128.0) | ||
3483 | break; | ||
3484 | float vz = Math.Abs(curvel.Z); | ||
3485 | if(vz > 128.0) | ||
3486 | break; | ||
3487 | |||
3488 | if ( | ||
3489 | vx < VELOCITY_TOLERANCE && | ||
3490 | vy < VELOCITY_TOLERANCE && | ||
3491 | vz < VELOCITY_TOLERANCE | ||
3492 | ) | ||
3493 | { | ||
3494 | if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | ||
3495 | break; | ||
3496 | |||
3497 | if (vx < 1e-4 && | ||
3498 | vy < 1e-4 && | ||
3499 | vz < 1e-4 && | ||
3500 | ( | ||
3501 | Math.Abs(m_lastVelocity.X) > 1e-4 || | ||
3502 | Math.Abs(m_lastVelocity.Y) > 1e-4 || | ||
3503 | Math.Abs(m_lastVelocity.Z) > 1e-4 | ||
3504 | )) | ||
3505 | break; | ||
3506 | } | ||
3507 | |||
3508 | if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > VELOCITY_TOLERANCE || | ||
3509 | Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > VELOCITY_TOLERANCE || | ||
3510 | Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > VELOCITY_TOLERANCE) | ||
3511 | break; | ||
3512 | |||
3513 | // viewer interpolators have a limit of 128m/s | ||
3514 | float ax = Math.Abs(angvel.X); | ||
3515 | if(ax > 64.0) | ||
3516 | break; | ||
3517 | float ay = Math.Abs(angvel.Y); | ||
3518 | if(ay > 64.0) | ||
3519 | break; | ||
3520 | float az = Math.Abs(angvel.Z); | ||
3521 | if(az > 64.0) | ||
3522 | break; | ||
3523 | |||
3524 | if ( | ||
3525 | ax < VELOCITY_TOLERANCE && | ||
3526 | ay < VELOCITY_TOLERANCE && | ||
3527 | az < VELOCITY_TOLERANCE && | ||
3528 | !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | ||
3529 | ) | ||
3530 | break; | ||
3531 | |||
3532 | needupdate = false; | ||
3533 | break; | ||
3534 | } | ||
3535 | |||
3536 | if(needupdate) | ||
3421 | { | 3537 | { |
3422 | SendTerseUpdateToAllClientsInternal(); | 3538 | |
3539 | // Update the "last" values | ||
3540 | m_lastPosition = AbsolutePosition; | ||
3541 | m_lastRotation = RotationOffset; | ||
3542 | m_lastVelocity = curvel; | ||
3543 | m_lastAcceleration = curacc; | ||
3544 | m_lastAngularVelocity = angvel; | ||
3545 | m_lastUpdateSentTime = now; | ||
3546 | |||
3547 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) | ||
3548 | { | ||
3549 | SendTerseUpdateToClient(client); | ||
3550 | }); | ||
3423 | } | 3551 | } |
3424 | break; | 3552 | break; |
3425 | } | 3553 | |
3426 | case UpdateRequired.FULL: | 3554 | case UpdateRequired.FULL: |
3427 | { | ||
3428 | ClearUpdateSchedule(); | 3555 | ClearUpdateSchedule(); |
3429 | SendFullUpdateToAllClientsInternal(); | 3556 | SendFullUpdateToAllClientsInternal(); |
3430 | break; | 3557 | break; |
3431 | } | ||
3432 | } | 3558 | } |
3433 | } | 3559 | } |
3434 | 3560 | ||
@@ -3441,13 +3567,15 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3441 | if (ParentGroup == null || ParentGroup.Scene == null) | 3567 | if (ParentGroup == null || ParentGroup.Scene == null) |
3442 | return; | 3568 | return; |
3443 | 3569 | ||
3570 | ClearUpdateSchedule(); | ||
3571 | |||
3444 | // Update the "last" values | 3572 | // Update the "last" values |
3445 | m_lastPosition = OffsetPosition; | 3573 | m_lastPosition = AbsolutePosition; |
3446 | m_lastRotation = RotationOffset; | 3574 | m_lastRotation = RotationOffset; |
3447 | m_lastVelocity = Velocity; | 3575 | m_lastVelocity = Velocity; |
3448 | m_lastAcceleration = Acceleration; | 3576 | m_lastAcceleration = Acceleration; |
3449 | m_lastAngularVelocity = AngularVelocity; | 3577 | m_lastAngularVelocity = AngularVelocity; |
3450 | m_lastUpdateSentTime = Environment.TickCount; | 3578 | m_lastUpdateSentTime = Util.GetTimeStampMS(); |
3451 | 3579 | ||
3452 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) | 3580 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) |
3453 | { | 3581 | { |
@@ -3460,13 +3588,15 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3460 | if (ParentGroup == null || ParentGroup.Scene == null) | 3588 | if (ParentGroup == null || ParentGroup.Scene == null) |
3461 | return; | 3589 | return; |
3462 | 3590 | ||
3591 | ClearUpdateSchedule(); | ||
3592 | |||
3463 | // Update the "last" values | 3593 | // Update the "last" values |
3464 | m_lastPosition = OffsetPosition; | 3594 | m_lastPosition = AbsolutePosition; |
3465 | m_lastRotation = RotationOffset; | 3595 | m_lastRotation = RotationOffset; |
3466 | m_lastVelocity = Velocity; | 3596 | m_lastVelocity = Velocity; |
3467 | m_lastAcceleration = Acceleration; | 3597 | m_lastAcceleration = Acceleration; |
3468 | m_lastAngularVelocity = AngularVelocity; | 3598 | m_lastAngularVelocity = AngularVelocity; |
3469 | m_lastUpdateSentTime = Environment.TickCount; | 3599 | m_lastUpdateSentTime = Util.GetTimeStampMS(); |
3470 | 3600 | ||
3471 | if (ParentGroup.IsAttachment) | 3601 | if (ParentGroup.IsAttachment) |
3472 | { | 3602 | { |
@@ -4783,7 +4913,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4783 | pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 4913 | pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; |
4784 | pa.OnOutOfBounds += PhysicsOutOfBounds; | 4914 | pa.OnOutOfBounds += PhysicsOutOfBounds; |
4785 | 4915 | ||
4786 | if (ParentID != 0 && ParentID != LocalId) | 4916 | if (_parentID != 0 && _parentID != LocalId) |
4787 | { | 4917 | { |
4788 | PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; | 4918 | PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; |
4789 | 4919 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7e3adb9..ba3aaae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -279,8 +279,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | private bool MouseDown = false; | 279 | private bool MouseDown = false; |
280 | public Vector3 lastKnownAllowedPosition; | 280 | public Vector3 lastKnownAllowedPosition; |
281 | public bool sentMessageAboutRestrictedParcelFlyingDown; | 281 | public bool sentMessageAboutRestrictedParcelFlyingDown; |
282 | |||
282 | public Vector4 CollisionPlane = Vector4.UnitW; | 283 | public Vector4 CollisionPlane = Vector4.UnitW; |
283 | 284 | ||
285 | public Vector4 m_lastCollisionPlane = Vector4.UnitW; | ||
286 | private byte m_lastState; | ||
284 | private Vector3 m_lastPosition; | 287 | private Vector3 m_lastPosition; |
285 | private Quaternion m_lastRotation; | 288 | private Quaternion m_lastRotation; |
286 | private Vector3 m_lastVelocity; | 289 | private Vector3 m_lastVelocity; |
@@ -2818,16 +2821,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2818 | CameraAtAxis = agentData.CameraAtAxis; | 2821 | CameraAtAxis = agentData.CameraAtAxis; |
2819 | CameraLeftAxis = agentData.CameraLeftAxis; | 2822 | CameraLeftAxis = agentData.CameraLeftAxis; |
2820 | CameraUpAxis = agentData.CameraUpAxis; | 2823 | CameraUpAxis = agentData.CameraUpAxis; |
2821 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2822 | CameraRotation = camRot; | ||
2823 | |||
2824 | // The Agent's Draw distance setting | ||
2825 | // When we get to the point of re-computing neighbors everytime this | ||
2826 | // changes, then start using the agent's drawdistance rather than the | ||
2827 | // region's draw distance. | ||
2828 | |||
2829 | DrawDistance = agentData.Far; | 2824 | DrawDistance = agentData.Far; |
2830 | 2825 | ||
2826 | CameraAtAxis.Normalize(); | ||
2827 | CameraLeftAxis.Normalize(); | ||
2828 | CameraUpAxis.Normalize(); | ||
2829 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2830 | CameraRotation = camRot; | ||
2831 | 2831 | ||
2832 | // Check if Client has camera in 'follow cam' or 'build' mode. | 2832 | // Check if Client has camera in 'follow cam' or 'build' mode. |
2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | 2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
@@ -3789,29 +3789,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3789 | 3789 | ||
3790 | // Send terse position update if not sitting and position, velocity, or rotation | 3790 | // Send terse position update if not sitting and position, velocity, or rotation |
3791 | // has changed significantly from last sent update | 3791 | // has changed significantly from last sent update |
3792 | if (!IsSatOnObject && ( | ||
3793 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | ||
3794 | || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) | ||
3795 | || !m_pos.ApproxEquals(m_lastPosition, POSITION_LARGETOLERANCE) | ||
3796 | // if velocity is zero and it wasn't zero last time, send the update | ||
3797 | || (Velocity == Vector3.Zero && m_lastVelocity != Vector3.Zero) | ||
3798 | // if position has moved just a little and velocity is very low, send the update | ||
3799 | || (!m_pos.ApproxEquals(m_lastPosition, POSITION_SMALLTOLERANCE) && Velocity.LengthSquared() < LOWVELOCITYSQ ) | ||
3800 | ) ) | ||
3801 | { | ||
3802 | /* | ||
3803 | if (!IsSatOnObject) | 3792 | if (!IsSatOnObject) |
3804 | { | 3793 | { |
3805 | // this does need to be more complex later | 3794 | // this does need to be more complex later |
3806 | Vector3 vel = Velocity; | 3795 | Vector3 vel = Velocity; |
3807 | Vector3 dpos = m_pos - m_lastPosition; | 3796 | Vector3 dpos = m_pos - m_lastPosition; |
3808 | if( Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | 3797 | if( State != m_lastState || |
3798 | Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | ||
3809 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | 3799 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || |
3810 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || | 3800 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || |
3811 | 3801 | ||
3812 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || | 3802 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || |
3813 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || | 3803 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || |
3814 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || | 3804 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || |
3805 | |||
3806 | (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || | ||
3815 | 3807 | ||
3816 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || | 3808 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || |
3817 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || | 3809 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || |
@@ -3821,11 +3813,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3821 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || | 3813 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || |
3822 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) | 3814 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) |
3823 | && vel.LengthSquared() < LOWVELOCITYSQ | 3815 | && vel.LengthSquared() < LOWVELOCITYSQ |
3824 | )) | 3816 | ) || |
3817 | |||
3818 | Math.Abs(CollisionPlane.X - m_lastCollisionPlane.X) > POSITION_SMALLTOLERANCE || | ||
3819 | Math.Abs(CollisionPlane.Y - m_lastCollisionPlane.Y) > POSITION_SMALLTOLERANCE || | ||
3820 | Math.Abs(CollisionPlane.W - m_lastCollisionPlane.W) > POSITION_SMALLTOLERANCE | ||
3821 | ) | ||
3825 | { | 3822 | { |
3826 | */ | ||
3827 | SendTerseUpdateToAllClients(); | 3823 | SendTerseUpdateToAllClients(); |
3828 | // } | 3824 | } |
3829 | } | 3825 | } |
3830 | CheckForSignificantMovement(); | 3826 | CheckForSignificantMovement(); |
3831 | } | 3827 | } |
@@ -3921,11 +3917,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3921 | /// </summary> | 3917 | /// </summary> |
3922 | public void SendTerseUpdateToAllClients() | 3918 | public void SendTerseUpdateToAllClients() |
3923 | { | 3919 | { |
3924 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | 3920 | m_lastState = State; |
3925 | // Update the "last" values | ||
3926 | m_lastPosition = m_pos; | 3921 | m_lastPosition = m_pos; |
3927 | m_lastRotation = m_bodyRot; | 3922 | m_lastRotation = m_bodyRot; |
3928 | m_lastVelocity = Velocity; | 3923 | m_lastVelocity = Velocity; |
3924 | m_lastCollisionPlane = CollisionPlane; | ||
3925 | |||
3926 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | ||
3927 | // Update the "last" values | ||
3929 | TriggerScenePresenceUpdated(); | 3928 | TriggerScenePresenceUpdated(); |
3930 | } | 3929 | } |
3931 | 3930 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 7f7977e..41f3ef4 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -86,9 +86,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
86 | 86 | ||
87 | writer.WriteStartElement("CoalescedObject"); | 87 | writer.WriteStartElement("CoalescedObject"); |
88 | 88 | ||
89 | writer.WriteAttributeString("x", size.X.ToString()); | 89 | writer.WriteAttributeString("x", size.X.ToString(Culture.FormatProvider)); |
90 | writer.WriteAttributeString("y", size.Y.ToString()); | 90 | writer.WriteAttributeString("y", size.Y.ToString(Culture.FormatProvider)); |
91 | writer.WriteAttributeString("z", size.Z.ToString()); | 91 | writer.WriteAttributeString("z", size.Z.ToString(Culture.FormatProvider)); |
92 | 92 | ||
93 | // Embed the offsets into the group XML | 93 | // Embed the offsets into the group XML |
94 | for (int i = 0; i < coaObjects.Count; i++) | 94 | for (int i = 0; i < coaObjects.Count; i++) |
@@ -100,9 +100,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
100 | // i, obj.Name); | 100 | // i, obj.Name); |
101 | 101 | ||
102 | writer.WriteStartElement("SceneObjectGroup"); | 102 | writer.WriteStartElement("SceneObjectGroup"); |
103 | writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); | 103 | writer.WriteAttributeString("offsetx", offsets[i].X.ToString(Culture.FormatProvider)); |
104 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); | 104 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString(Culture.FormatProvider)); |
105 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); | 105 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString(Culture.FormatProvider)); |
106 | 106 | ||
107 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); | 107 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); |
108 | 108 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b012a08..82bbe6f 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -65,7 +65,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
65 | { | 65 | { |
66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | 66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) |
67 | { | 67 | { |
68 | try { | 68 | try |
69 | { | ||
69 | return FromOriginalXmlFormat(reader); | 70 | return FromOriginalXmlFormat(reader); |
70 | } | 71 | } |
71 | catch (Exception e) | 72 | catch (Exception e) |
@@ -109,11 +110,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
109 | } | 110 | } |
110 | } | 111 | } |
111 | while (reader.ReadToNextSibling("Part")); | 112 | while (reader.ReadToNextSibling("Part")); |
113 | reader.ReadEndElement(); | ||
114 | } | ||
115 | |||
116 | if (reader.Name == "KeyframeMotion" && reader.NodeType == XmlNodeType.Element) | ||
117 | { | ||
118 | |||
119 | string innerkeytxt = reader.ReadElementContentAsString(); | ||
120 | sceneObject.RootPart.KeyframeMotion = | ||
121 | KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(innerkeytxt)); | ||
112 | } | 122 | } |
123 | else | ||
124 | sceneObject.RootPart.KeyframeMotion = null; | ||
113 | 125 | ||
114 | // Script state may, or may not, exist. Not having any, is NOT | 126 | // Script state may, or may not, exist. Not having any, is NOT |
115 | // ever a problem. | 127 | // ever a problem. |
116 | sceneObject.LoadScriptState(reader); | 128 | sceneObject.LoadScriptState(reader); |
129 | |||
117 | sceneObject.InvalidateDeepEffectivePerms(); | 130 | sceneObject.InvalidateDeepEffectivePerms(); |
118 | return sceneObject; | 131 | return sceneObject; |
119 | } | 132 | } |
@@ -210,9 +223,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
210 | 223 | ||
211 | writer.WriteEndElement(); // OtherParts | 224 | writer.WriteEndElement(); // OtherParts |
212 | 225 | ||
226 | if (sceneObject.RootPart.KeyframeMotion != null) | ||
227 | { | ||
228 | Byte[] data = sceneObject.RootPart.KeyframeMotion.Serialize(); | ||
229 | |||
230 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | ||
231 | writer.WriteBase64(data, 0, data.Length); | ||
232 | writer.WriteEndElement(); | ||
233 | } | ||
234 | |||
213 | if (doScriptStates) | 235 | if (doScriptStates) |
214 | sceneObject.SaveScriptedState(writer); | 236 | sceneObject.SaveScriptedState(writer); |
215 | 237 | ||
238 | |||
216 | if (!noRootElement) | 239 | if (!noRootElement) |
217 | writer.WriteEndElement(); // SceneObjectGroup | 240 | writer.WriteEndElement(); // SceneObjectGroup |
218 | 241 | ||
@@ -1459,10 +1482,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1459 | writer.WriteElementString("Description", sop.Description); | 1482 | writer.WriteElementString("Description", sop.Description); |
1460 | 1483 | ||
1461 | writer.WriteStartElement("Color"); | 1484 | writer.WriteStartElement("Color"); |
1462 | writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); | 1485 | writer.WriteElementString("R", sop.Color.R.ToString(Culture.FormatProvider)); |
1463 | writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); | 1486 | writer.WriteElementString("G", sop.Color.G.ToString(Culture.FormatProvider)); |
1464 | writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); | 1487 | writer.WriteElementString("B", sop.Color.B.ToString(Culture.FormatProvider)); |
1465 | writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture)); | 1488 | writer.WriteElementString("A", sop.Color.A.ToString(Culture.FormatProvider)); |
1466 | writer.WriteEndElement(); | 1489 | writer.WriteEndElement(); |
1467 | 1490 | ||
1468 | writer.WriteElementString("Text", sop.Text); | 1491 | writer.WriteElementString("Text", sop.Text); |
@@ -1505,7 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1505 | writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); | 1528 | writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); |
1506 | WriteFlags(writer, "Flags", sop.Flags.ToString(), options); | 1529 | WriteFlags(writer, "Flags", sop.Flags.ToString(), options); |
1507 | WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); | 1530 | WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); |
1508 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); | 1531 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString(Culture.FormatProvider)); |
1509 | if (sop.MediaUrl != null) | 1532 | if (sop.MediaUrl != null) |
1510 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1533 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1511 | WriteVector(writer, "AttachedPos", sop.AttachedPos); | 1534 | WriteVector(writer, "AttachedPos", sop.AttachedPos); |
@@ -1525,7 +1548,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1525 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1548 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1526 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1549 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1527 | 1550 | ||
1528 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString()); | 1551 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString(Culture.FormatProvider)); |
1529 | 1552 | ||
1530 | WriteVector(writer, "Force", sop.Force); | 1553 | WriteVector(writer, "Force", sop.Force); |
1531 | WriteVector(writer, "Torque", sop.Torque); | 1554 | WriteVector(writer, "Torque", sop.Torque); |
@@ -1542,22 +1565,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1542 | writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); | 1565 | writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); |
1543 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1566 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1544 | if (sop.Density != 1000.0f) | 1567 | if (sop.Density != 1000.0f) |
1545 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | 1568 | writer.WriteElementString("Density", sop.Density.ToString(Culture.FormatProvider)); |
1546 | if (sop.Friction != 0.6f) | 1569 | if (sop.Friction != 0.6f) |
1547 | writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); | 1570 | writer.WriteElementString("Friction", sop.Friction.ToString(Culture.FormatProvider)); |
1548 | if (sop.Restitution != 0.5f) | 1571 | if (sop.Restitution != 0.5f) |
1549 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | 1572 | writer.WriteElementString("Bounce", sop.Restitution.ToString(Culture.FormatProvider)); |
1550 | if (sop.GravityModifier != 1.0f) | 1573 | if (sop.GravityModifier != 1.0f) |
1551 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | 1574 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString(Culture.FormatProvider)); |
1552 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | 1575 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); |
1553 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | 1576 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); |
1554 | 1577 | ||
1555 | // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim | 1578 | // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim |
1556 | { | 1579 | { |
1557 | WriteUUID(writer, "SoundID", sop.Sound, options); | 1580 | WriteUUID(writer, "SoundID", sop.Sound, options); |
1558 | writer.WriteElementString("SoundGain", sop.SoundGain.ToString().ToLower()); | 1581 | writer.WriteElementString("SoundGain", sop.SoundGain.ToString(Culture.FormatProvider)); |
1559 | writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower()); | 1582 | writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower()); |
1560 | writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower()); | 1583 | writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString(Culture.FormatProvider)); |
1561 | } | 1584 | } |
1562 | writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); | 1585 | writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); |
1563 | 1586 | ||
@@ -1577,19 +1600,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1577 | static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) | 1600 | static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) |
1578 | { | 1601 | { |
1579 | writer.WriteStartElement(name); | 1602 | writer.WriteStartElement(name); |
1580 | writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); | 1603 | writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); |
1581 | writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); | 1604 | writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); |
1582 | writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); | 1605 | writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); |
1583 | writer.WriteEndElement(); | 1606 | writer.WriteEndElement(); |
1584 | } | 1607 | } |
1585 | 1608 | ||
1586 | static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) | 1609 | static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) |
1587 | { | 1610 | { |
1588 | writer.WriteStartElement(name); | 1611 | writer.WriteStartElement(name); |
1589 | writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); | 1612 | writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); |
1590 | writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); | 1613 | writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); |
1591 | writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); | 1614 | writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); |
1592 | writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); | 1615 | writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); |
1593 | writer.WriteEndElement(); | 1616 | writer.WriteEndElement(); |
1594 | } | 1617 | } |
1595 | 1618 | ||
@@ -1731,22 +1754,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1731 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. | 1754 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. |
1732 | 1755 | ||
1733 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); | 1756 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); |
1734 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); | 1757 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString(Culture.FormatProvider)); |
1735 | writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString()); | 1758 | writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString(Culture.FormatProvider)); |
1736 | writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString()); | 1759 | writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString(Culture.FormatProvider)); |
1737 | writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString()); | 1760 | writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString(Culture.FormatProvider)); |
1738 | writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString()); | 1761 | writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString(Culture.FormatProvider)); |
1739 | writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString()); | 1762 | writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString(Culture.FormatProvider)); |
1740 | writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString()); | 1763 | writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString(Culture.FormatProvider)); |
1741 | 1764 | ||
1742 | writer.WriteElementString("LightColorR", shp.LightColorR.ToString()); | 1765 | writer.WriteElementString("LightColorR", shp.LightColorR.ToString(Culture.FormatProvider)); |
1743 | writer.WriteElementString("LightColorG", shp.LightColorG.ToString()); | 1766 | writer.WriteElementString("LightColorG", shp.LightColorG.ToString(Culture.FormatProvider)); |
1744 | writer.WriteElementString("LightColorB", shp.LightColorB.ToString()); | 1767 | writer.WriteElementString("LightColorB", shp.LightColorB.ToString(Culture.FormatProvider)); |
1745 | writer.WriteElementString("LightColorA", shp.LightColorA.ToString()); | 1768 | writer.WriteElementString("LightColorA", shp.LightColorA.ToString(Culture.FormatProvider)); |
1746 | writer.WriteElementString("LightRadius", shp.LightRadius.ToString()); | 1769 | writer.WriteElementString("LightRadius", shp.LightRadius.ToString(Culture.FormatProvider)); |
1747 | writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString()); | 1770 | writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString(Culture.FormatProvider)); |
1748 | writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString()); | 1771 | writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString(Culture.FormatProvider)); |
1749 | writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString()); | 1772 | writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString(Culture.FormatProvider)); |
1750 | 1773 | ||
1751 | writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); | 1774 | writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); |
1752 | writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); | 1775 | writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs index 045fd3c..4ce6a95 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs | |||
@@ -54,8 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
54 | 54 | ||
55 | UUID ownerId = TestHelpers.ParseTail(0x1); | 55 | UUID ownerId = TestHelpers.ParseTail(0x1); |
56 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(3, ownerId, "so1", 0x10); | 56 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(3, ownerId, "so1", 0x10); |
57 | so1.ScriptSetPhysicsStatus(true); | ||
58 | m_scene.AddSceneObject(so1); | 57 | m_scene.AddSceneObject(so1); |
58 | so1.ScriptSetPhysicsStatus(true); | ||
59 | 59 | ||
60 | Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(3)); | 60 | Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(3)); |
61 | Assert.That(m_scene.SceneGraph.GetActiveObjectsCount(), Is.EqualTo(3)); | 61 | Assert.That(m_scene.SceneGraph.GetActiveObjectsCount(), Is.EqualTo(3)); |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 5a9a5a0..80d3f62 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -65,7 +65,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
65 | /// </summary> | 65 | /// </summary> |
66 | /// <value>The gathered uuids.</value> | 66 | /// <value>The gathered uuids.</value> |
67 | public IDictionary<UUID, sbyte> GatheredUuids { get; private set; } | 67 | public IDictionary<UUID, sbyte> GatheredUuids { get; private set; } |
68 | 68 | public HashSet<UUID> FailedUUIDs { get; private set; } | |
69 | public HashSet<UUID> UncertainAssetsUUIDs { get; private set; } | ||
70 | public int possibleNotAssetCount { get; set; } | ||
71 | public int ErrorCount { get; private set; } | ||
69 | /// <summary> | 72 | /// <summary> |
70 | /// Gets the next UUID to inspect. | 73 | /// Gets the next UUID to inspect. |
71 | /// </summary> | 74 | /// </summary> |
@@ -92,7 +95,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | /// <param name="assetService"> | 95 | /// <param name="assetService"> |
93 | /// Asset service. | 96 | /// Asset service. |
94 | /// </param> | 97 | /// </param> |
95 | public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>()) {} | 98 | public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>(), |
99 | new HashSet <UUID>(),new HashSet <UUID>()) {} | ||
100 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) : this(assetService, collector, | ||
101 | new HashSet <UUID>(), new HashSet <UUID>()) {} | ||
96 | 102 | ||
97 | /// <summary> | 103 | /// <summary> |
98 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. | 104 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. |
@@ -101,16 +107,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | /// Asset service. | 107 | /// Asset service. |
102 | /// </param> | 108 | /// </param> |
103 | /// <param name="collector"> | 109 | /// <param name="collector"> |
104 | /// Gathered UUIDs will be collected in this dictinaory. | 110 | /// Gathered UUIDs will be collected in this dictionary. |
105 | /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. | 111 | /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. |
106 | /// </param> | 112 | /// </param> |
107 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) | 113 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector, HashSet <UUID> failedIDs, HashSet <UUID> uncertainAssetsUUIDs) |
108 | { | 114 | { |
109 | m_assetService = assetService; | 115 | m_assetService = assetService; |
110 | GatheredUuids = collector; | 116 | GatheredUuids = collector; |
111 | 117 | ||
112 | // FIXME: Not efficient for searching, can improve. | 118 | // FIXME: Not efficient for searching, can improve. |
113 | m_assetUuidsToInspect = new Queue<UUID>(); | 119 | m_assetUuidsToInspect = new Queue<UUID>(); |
120 | FailedUUIDs = failedIDs; | ||
121 | UncertainAssetsUUIDs = uncertainAssetsUUIDs; | ||
122 | ErrorCount = 0; | ||
123 | possibleNotAssetCount = 0; | ||
114 | } | 124 | } |
115 | 125 | ||
116 | /// <summary> | 126 | /// <summary> |
@@ -120,6 +130,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | /// <param name="uuid">UUID.</param> | 130 | /// <param name="uuid">UUID.</param> |
121 | public bool AddForInspection(UUID uuid) | 131 | public bool AddForInspection(UUID uuid) |
122 | { | 132 | { |
133 | if(uuid == UUID.Zero) | ||
134 | return false; | ||
135 | |||
136 | if(FailedUUIDs.Contains(uuid)) | ||
137 | { | ||
138 | if(UncertainAssetsUUIDs.Contains(uuid)) | ||
139 | possibleNotAssetCount++; | ||
140 | else | ||
141 | ErrorCount++; | ||
142 | return false; | ||
143 | } | ||
144 | if(GatheredUuids.ContainsKey(uuid)) | ||
145 | return false; | ||
123 | if (m_assetUuidsToInspect.Contains(uuid)) | 146 | if (m_assetUuidsToInspect.Contains(uuid)) |
124 | return false; | 147 | return false; |
125 | 148 | ||
@@ -141,7 +164,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | public void AddForInspection(SceneObjectGroup sceneObject) | 164 | public void AddForInspection(SceneObjectGroup sceneObject) |
142 | { | 165 | { |
143 | // m_log.DebugFormat( | 166 | // m_log.DebugFormat( |
144 | // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); | 167 | // "[UUID GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); |
168 | if(sceneObject.IsDeleted) | ||
169 | return; | ||
145 | 170 | ||
146 | SceneObjectPart[] parts = sceneObject.Parts; | 171 | SceneObjectPart[] parts = sceneObject.Parts; |
147 | for (int i = 0; i < parts.Length; i++) | 172 | for (int i = 0; i < parts.Length; i++) |
@@ -149,7 +174,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | SceneObjectPart part = parts[i]; | 174 | SceneObjectPart part = parts[i]; |
150 | 175 | ||
151 | // m_log.DebugFormat( | 176 | // m_log.DebugFormat( |
152 | // "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID); | 177 | // "[UUID GATHERER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID); |
153 | 178 | ||
154 | try | 179 | try |
155 | { | 180 | { |
@@ -207,9 +232,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
207 | // m_log.DebugFormat( | 232 | // m_log.DebugFormat( |
208 | // "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", | 233 | // "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", |
209 | // tii.Name, tii.Type, part.Name, part.UUID); | 234 | // tii.Name, tii.Type, part.Name, part.UUID); |
210 | 235 | AddForInspection(tii.AssetID, (sbyte)tii.Type); | |
211 | if (!GatheredUuids.ContainsKey(tii.AssetID)) | ||
212 | AddForInspection(tii.AssetID, (sbyte)tii.Type); | ||
213 | } | 236 | } |
214 | 237 | ||
215 | // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed | 238 | // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed |
@@ -225,9 +248,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
225 | catch (Exception e) | 248 | catch (Exception e) |
226 | { | 249 | { |
227 | m_log.ErrorFormat("[UUID GATHERER]: Failed to get part - {0}", e); | 250 | m_log.ErrorFormat("[UUID GATHERER]: Failed to get part - {0}", e); |
228 | m_log.DebugFormat( | ||
229 | "[UUID GATHERER]: Texture entry length for prim was {0} (min is 46)", | ||
230 | part.Shape.TextureEntry.Length); | ||
231 | } | 251 | } |
232 | } | 252 | } |
233 | } | 253 | } |
@@ -278,55 +298,112 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> | 298 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> |
279 | private void GetAssetUuids(UUID assetUuid) | 299 | private void GetAssetUuids(UUID assetUuid) |
280 | { | 300 | { |
301 | if(assetUuid == UUID.Zero) | ||
302 | return; | ||
303 | |||
304 | if(FailedUUIDs.Contains(assetUuid)) | ||
305 | { | ||
306 | if(UncertainAssetsUUIDs.Contains(assetUuid)) | ||
307 | possibleNotAssetCount++; | ||
308 | else | ||
309 | ErrorCount++; | ||
310 | return; | ||
311 | } | ||
312 | |||
281 | // avoid infinite loops | 313 | // avoid infinite loops |
282 | if (GatheredUuids.ContainsKey(assetUuid)) | 314 | if (GatheredUuids.ContainsKey(assetUuid)) |
283 | return; | 315 | return; |
284 | 316 | ||
317 | AssetBase assetBase; | ||
285 | try | 318 | try |
286 | { | 319 | { |
287 | AssetBase assetBase = GetAsset(assetUuid); | 320 | assetBase = GetAsset(assetUuid); |
321 | } | ||
322 | catch (Exception e) | ||
323 | { | ||
324 | m_log.ErrorFormat("[UUID GATHERER]: Failed to get asset {0} : {1}", assetUuid, e.Message); | ||
325 | ErrorCount++; | ||
326 | FailedUUIDs.Add(assetUuid); | ||
327 | return; | ||
328 | } | ||
288 | 329 | ||
289 | if (null != assetBase) | 330 | if(assetBase == null) |
290 | { | 331 | { |
291 | sbyte assetType = assetBase.Type; | 332 | // m_log.ErrorFormat("[UUID GATHERER]: asset {0} not found", assetUuid); |
292 | GatheredUuids[assetUuid] = assetType; | 333 | FailedUUIDs.Add(assetUuid); |
334 | if(UncertainAssetsUUIDs.Contains(assetUuid)) | ||
335 | possibleNotAssetCount++; | ||
336 | else | ||
337 | ErrorCount++; | ||
338 | return; | ||
339 | } | ||
293 | 340 | ||
294 | if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType) | 341 | if(UncertainAssetsUUIDs.Contains(assetUuid)) |
295 | { | 342 | UncertainAssetsUUIDs.Remove(assetUuid); |
296 | RecordWearableAssetUuids(assetBase); | 343 | |
297 | } | 344 | sbyte assetType = assetBase.Type; |
298 | else if ((sbyte)AssetType.Gesture == assetType) | 345 | |
299 | { | 346 | if(assetBase.Data == null || assetBase.Data.Length == 0) |
300 | RecordGestureAssetUuids(assetBase); | 347 | { |
301 | } | 348 | // m_log.ErrorFormat("[UUID GATHERER]: asset {0}, type {1} has no data", assetUuid, assetType); |
302 | else if ((sbyte)AssetType.Notecard == assetType) | 349 | ErrorCount++; |
303 | { | 350 | FailedUUIDs.Add(assetUuid); |
304 | RecordTextEmbeddedAssetUuids(assetBase); | 351 | return; |
305 | } | 352 | } |
306 | else if ((sbyte)AssetType.LSLText == assetType) | 353 | |
307 | { | 354 | GatheredUuids[assetUuid] = assetType; |
308 | RecordTextEmbeddedAssetUuids(assetBase); | 355 | try |
309 | } | 356 | { |
310 | else if ((sbyte)OpenSimAssetType.Material == assetType) | 357 | if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType) |
311 | { | 358 | { |
312 | RecordMaterialAssetUuids(assetBase); | 359 | RecordWearableAssetUuids(assetBase); |
313 | } | 360 | } |
314 | else if ((sbyte)AssetType.Object == assetType) | 361 | else if ((sbyte)AssetType.Gesture == assetType) |
315 | { | 362 | { |
316 | RecordSceneObjectAssetUuids(assetBase); | 363 | RecordGestureAssetUuids(assetBase); |
317 | } | 364 | } |
365 | else if ((sbyte)AssetType.Notecard == assetType) | ||
366 | { | ||
367 | RecordTextEmbeddedAssetUuids(assetBase); | ||
368 | } | ||
369 | else if ((sbyte)AssetType.LSLText == assetType) | ||
370 | { | ||
371 | RecordTextEmbeddedAssetUuids(assetBase); | ||
372 | } | ||
373 | else if ((sbyte)OpenSimAssetType.Material == assetType) | ||
374 | { | ||
375 | RecordMaterialAssetUuids(assetBase); | ||
376 | } | ||
377 | else if ((sbyte)AssetType.Object == assetType) | ||
378 | { | ||
379 | RecordSceneObjectAssetUuids(assetBase); | ||
318 | } | 380 | } |
319 | } | 381 | } |
320 | catch (Exception) | 382 | catch (Exception e) |
321 | { | 383 | { |
322 | m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset id {0}", assetUuid); | 384 | m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset with id {0} type {1}: {2}", assetUuid, assetType, e.Message); |
323 | throw; | 385 | GatheredUuids.Remove(assetUuid); |
386 | ErrorCount++; | ||
387 | FailedUUIDs.Add(assetUuid); | ||
324 | } | 388 | } |
325 | } | 389 | } |
326 | 390 | ||
327 | private void AddForInspection(UUID assetUuid, sbyte assetType) | 391 | private void AddForInspection(UUID assetUuid, sbyte assetType) |
328 | { | 392 | { |
393 | if(assetUuid == UUID.Zero) | ||
394 | return; | ||
395 | |||
329 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered | 396 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered |
397 | if(FailedUUIDs.Contains(assetUuid)) | ||
398 | { | ||
399 | if(UncertainAssetsUUIDs.Contains(assetUuid)) | ||
400 | possibleNotAssetCount++; | ||
401 | else | ||
402 | ErrorCount++; | ||
403 | return; | ||
404 | } | ||
405 | if(GatheredUuids.ContainsKey(assetUuid)) | ||
406 | return; | ||
330 | try | 407 | try |
331 | { | 408 | { |
332 | if ((sbyte)AssetType.Bodypart == assetType | 409 | if ((sbyte)AssetType.Bodypart == assetType |
@@ -458,8 +535,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | foreach (Match uuidMatch in uuidMatches) | 535 | foreach (Match uuidMatch in uuidMatches) |
459 | { | 536 | { |
460 | UUID uuid = new UUID(uuidMatch.Value); | 537 | UUID uuid = new UUID(uuidMatch.Value); |
538 | if(uuid == UUID.Zero) | ||
539 | continue; | ||
461 | // m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid); | 540 | // m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid); |
462 | 541 | if(!UncertainAssetsUUIDs.Contains(uuid)) | |
542 | UncertainAssetsUUIDs.Add(uuid); | ||
463 | AddForInspection(uuid); | 543 | AddForInspection(uuid); |
464 | } | 544 | } |
465 | } | 545 | } |
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index 79b80f8..a14d819 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |||
@@ -59,23 +59,23 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
59 | /// </summary> | 59 | /// </summary> |
60 | /// <remarks> | 60 | /// <remarks> |
61 | /// Config Settings Documentation. | 61 | /// Config Settings Documentation. |
62 | /// Each configuration setting can be specified in two places: OpenSim.ini or Regions.ini. | 62 | /// Configuration setting can be specified in two places: OpenSim.ini and/or Regions.ini. |
63 | /// If specified in Regions.ini, the settings should be within the region's section name. | ||
64 | /// If specified in OpenSim.ini, the settings should be within the [AutoBackupModule] section. | ||
65 | /// Region-specific settings take precedence. | ||
66 | /// | 63 | /// |
67 | /// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. This setting does not support per-region basis. | 64 | /// OpenSim.ini only settings section [AutoBackupModule] |
68 | /// All other settings under [AutoBackupModule] are ignored if AutoBackupModuleEnabled is false, even per-region settings! | 65 | /// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. |
69 | /// AutoBackup: True/False. Default: False. If True, activate auto backup functionality. | 66 | /// if false module is disable and all rest is ignored |
70 | /// This is the only required option for enabling auto-backup; the other options have sane defaults. | ||
71 | /// If False for a particular region, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored. | ||
72 | /// If False globally (the default), only regions that specifically override it in Regions.ini will get AutoBackup functionality. | ||
73 | /// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours). | 67 | /// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours). |
74 | /// The number of minutes between each backup attempt. | 68 | /// The number of minutes between each backup attempt. |
75 | /// If a negative or zero value is given, it is equivalent to setting AutoBackup = False. | 69 | /// AutoBackupDir: String. Default: "." (the current directory). |
76 | /// AutoBackupBusyCheck: True/False. Default: True. | 70 | /// A directory (absolute or relative) where backups should be saved. |
77 | /// If True, we will only take an auto-backup if a set of conditions are met. | 71 | /// AutoBackupKeepFilesForDays remove files older than this number of days. 0 disables |
78 | /// These conditions are heuristics to try and avoid taking a backup when the sim is busy. | 72 | /// |
73 | /// Next can be set on OpenSim.ini, as default, and or per region in Regions.ini | ||
74 | /// Region-specific settings take precedence. | ||
75 | /// | ||
76 | /// AutoBackup: True/False. Default: False. If True, activate auto backup functionality. | ||
77 | /// controls backup per region, with default optionaly set on OpenSim.ini | ||
78 | |||
79 | /// AutoBackupSkipAssets | 79 | /// AutoBackupSkipAssets |
80 | /// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately | 80 | /// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately |
81 | /// AutoBackupKeepFilesForDays | 81 | /// AutoBackupKeepFilesForDays |
@@ -89,40 +89,28 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
89 | /// AutoBackupNaming: string. Default: Time. | 89 | /// AutoBackupNaming: string. Default: Time. |
90 | /// One of three strings (case insensitive): | 90 | /// One of three strings (case insensitive): |
91 | /// "Time": Current timestamp is appended to file name. An existing file will never be overwritten. | 91 | /// "Time": Current timestamp is appended to file name. An existing file will never be overwritten. |
92 | /// "Sequential": A number is appended to the file name. So if RegionName_x.oar exists, we'll save to RegionName_{x+1}.oar next. An existing file will never be overwritten. | 92 | /// "Sequential": A number is appended to the file name. So if RegionName_x.oar exists, we'll save to RegionName_{x+1}.oar next. An existing file will never be overwritten. |
93 | /// "Overwrite": Always save to file named "${AutoBackupDir}/RegionName.oar", even if we have to overwrite an existing file. | 93 | /// "Overwrite": Always save to file named "${AutoBackupDir}/RegionName.oar", even if we have to overwrite an existing file. |
94 | /// AutoBackupDir: String. Default: "." (the current directory). | ||
95 | /// A directory (absolute or relative) where backups should be saved. | ||
96 | /// AutoBackupDilationThreshold: float. Default: 0.5. Lower bound on time dilation required for BusyCheck heuristics to pass. | ||
97 | /// If the time dilation is below this value, don't take a backup right now. | ||
98 | /// AutoBackupAgentThreshold: int. Default: 10. Upper bound on # of agents in region required for BusyCheck heuristics to pass. | ||
99 | /// If the number of agents is greater than this value, don't take a backup right now | ||
100 | /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions. | ||
101 | /// Also helps if you don't want AutoBackup at all. | ||
102 | /// </remarks> | 94 | /// </remarks> |
103 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AutoBackupModule")] | 95 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AutoBackupModule")] |
104 | public class AutoBackupModule : ISharedRegionModule | 96 | public class AutoBackupModule : ISharedRegionModule |
105 | { | 97 | { |
106 | private static readonly ILog m_log = | 98 | private static readonly ILog m_log = |
107 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 99 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
108 | private readonly Dictionary<Guid, IScene> m_pendingSaves = new Dictionary<Guid, IScene>(1); | ||
109 | private readonly AutoBackupModuleState m_defaultState = new AutoBackupModuleState(); | 100 | private readonly AutoBackupModuleState m_defaultState = new AutoBackupModuleState(); |
110 | private readonly Dictionary<IScene, AutoBackupModuleState> m_states = | 101 | private readonly Dictionary<IScene, AutoBackupModuleState> m_states = |
111 | new Dictionary<IScene, AutoBackupModuleState>(1); | 102 | new Dictionary<IScene, AutoBackupModuleState>(1); |
112 | private readonly Dictionary<Timer, List<IScene>> m_timerMap = | ||
113 | new Dictionary<Timer, List<IScene>>(1); | ||
114 | private readonly Dictionary<double, Timer> m_timers = new Dictionary<double, Timer>(1); | ||
115 | 103 | ||
116 | private delegate T DefaultGetter<T>(string settingName, T defaultValue); | 104 | private delegate T DefaultGetter<T>(string settingName, T defaultValue); |
117 | private bool m_enabled; | 105 | private bool m_enabled; |
118 | private ICommandConsole m_console; | 106 | private ICommandConsole m_console; |
119 | private List<Scene> m_Scenes = new List<Scene> (); | 107 | private List<Scene> m_Scenes = new List<Scene> (); |
120 | 108 | private Timer m_masterTimer; | |
121 | 109 | private bool m_busy; | |
122 | /// <summary> | 110 | private int m_KeepFilesForDays = -1; |
123 | /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState! | 111 | private string m_backupDir; |
124 | /// </summary> | 112 | private bool m_doneFirst; |
125 | private bool m_closed; | 113 | private double m_baseInterval; |
126 | 114 | ||
127 | private IConfigSource m_configSource; | 115 | private IConfigSource m_configSource; |
128 | 116 | ||
@@ -159,36 +147,38 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
159 | void IRegionModuleBase.Initialise(IConfigSource source) | 147 | void IRegionModuleBase.Initialise(IConfigSource source) |
160 | { | 148 | { |
161 | // Determine if we have been enabled at all in OpenSim.ini -- this is part and parcel of being an optional module | 149 | // Determine if we have been enabled at all in OpenSim.ini -- this is part and parcel of being an optional module |
162 | this.m_configSource = source; | 150 | m_configSource = source; |
163 | IConfig moduleConfig = source.Configs["AutoBackupModule"]; | 151 | IConfig moduleConfig = source.Configs["AutoBackupModule"]; |
164 | if (moduleConfig == null) | 152 | if (moduleConfig == null) |
165 | { | 153 | { |
166 | this.m_enabled = false; | 154 | m_enabled = false; |
167 | return; | 155 | return; |
168 | } | 156 | } |
169 | else | ||
170 | { | ||
171 | this.m_enabled = moduleConfig.GetBoolean("AutoBackupModuleEnabled", false); | ||
172 | if (this.m_enabled) | ||
173 | { | ||
174 | m_log.Info("[AUTO BACKUP]: AutoBackupModule enabled"); | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | return; | ||
179 | } | ||
180 | } | ||
181 | 157 | ||
182 | Timer defTimer = new Timer(43200000); | 158 | m_enabled = moduleConfig.GetBoolean("AutoBackupModuleEnabled", false); |
183 | this.m_defaultState.Timer = defTimer; | 159 | if(!m_enabled) |
184 | this.m_timers.Add(43200000, defTimer); | 160 | return; |
185 | defTimer.Elapsed += this.HandleElapsed; | 161 | |
186 | defTimer.AutoReset = true; | 162 | ParseDefaultConfig(moduleConfig); |
187 | defTimer.Start(); | 163 | if(!m_enabled) |
164 | return; | ||
165 | |||
166 | m_log.Debug("[AUTO BACKUP]: Default config:"); | ||
167 | m_log.Debug(m_defaultState.ToString()); | ||
168 | |||
169 | m_log.Info("[AUTO BACKUP]: AutoBackupModule enabled"); | ||
170 | m_masterTimer = new Timer(); | ||
171 | m_masterTimer.Interval = m_baseInterval; | ||
172 | m_masterTimer.Elapsed += HandleElapsed; | ||
173 | m_masterTimer.AutoReset = false; | ||
188 | 174 | ||
189 | AutoBackupModuleState abms = this.ParseConfig(null, true); | 175 | m_console = MainConsole.Instance; |
190 | m_log.Debug("[AUTO BACKUP]: Here is the default config:"); | 176 | |
191 | m_log.Debug(abms.ToString()); | 177 | m_console.Commands.AddCommand ( |
178 | "AutoBackup", true, "dooarbackup", | ||
179 | "dooarbackup <regionName> | ALL", | ||
180 | "saves the single region <regionName> to a oar or ALL regions in instance to oars, using same settings as AutoBackup. Note it restarts time interval", DoBackup); | ||
181 | m_busy = true; | ||
192 | } | 182 | } |
193 | 183 | ||
194 | /// <summary> | 184 | /// <summary> |
@@ -196,13 +186,11 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
196 | /// </summary> | 186 | /// </summary> |
197 | void IRegionModuleBase.Close() | 187 | void IRegionModuleBase.Close() |
198 | { | 188 | { |
199 | if (!this.m_enabled) | 189 | if (!m_enabled) |
200 | { | ||
201 | return; | 190 | return; |
202 | } | ||
203 | 191 | ||
204 | // We don't want any timers firing while the sim's coming down; strange things may happen. | 192 | // We don't want any timers firing while the sim's coming down; strange things may happen. |
205 | this.StopAllTimers(); | 193 | m_masterTimer.Dispose(); |
206 | } | 194 | } |
207 | 195 | ||
208 | /// <summary> | 196 | /// <summary> |
@@ -211,18 +199,11 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
211 | /// <param name="scene"></param> | 199 | /// <param name="scene"></param> |
212 | void IRegionModuleBase.AddRegion (Scene scene) | 200 | void IRegionModuleBase.AddRegion (Scene scene) |
213 | { | 201 | { |
214 | if (!this.m_enabled) { | 202 | if (!m_enabled) |
215 | return; | 203 | return; |
216 | } | ||
217 | lock (m_Scenes) { | ||
218 | m_Scenes.Add (scene); | ||
219 | } | ||
220 | m_console = MainConsole.Instance; | ||
221 | 204 | ||
222 | m_console.Commands.AddCommand ( | 205 | lock (m_Scenes) |
223 | "AutoBackup", false, "dobackup", | 206 | m_Scenes.Add (scene); |
224 | "dobackup", | ||
225 | "do backup.", DoBackup); | ||
226 | } | 207 | } |
227 | 208 | ||
228 | /// <summary> | 209 | /// <summary> |
@@ -231,28 +212,14 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
231 | /// <param name="scene">The scene (region) to stop performing AutoBackup on.</param> | 212 | /// <param name="scene">The scene (region) to stop performing AutoBackup on.</param> |
232 | void IRegionModuleBase.RemoveRegion(Scene scene) | 213 | void IRegionModuleBase.RemoveRegion(Scene scene) |
233 | { | 214 | { |
234 | if (!this.m_enabled) | 215 | if (m_enabled) |
235 | { | ||
236 | return; | 216 | return; |
237 | } | ||
238 | m_Scenes.Remove (scene); | ||
239 | if (this.m_states.ContainsKey(scene)) | ||
240 | { | ||
241 | AutoBackupModuleState abms = this.m_states[scene]; | ||
242 | 217 | ||
243 | // Remove this scene out of the timer map list | 218 | lock(m_Scenes) |
244 | Timer timer = abms.Timer; | 219 | { |
245 | List<IScene> list = this.m_timerMap[timer]; | 220 | if (m_states.ContainsKey(scene)) |
246 | list.Remove(scene); | 221 | m_states.Remove(scene); |
247 | 222 | m_Scenes.Remove(scene); | |
248 | // Shut down the timer if this was the last scene for the timer | ||
249 | if (list.Count == 0) | ||
250 | { | ||
251 | this.m_timerMap.Remove(timer); | ||
252 | this.m_timers.Remove(timer.Interval); | ||
253 | timer.Close(); | ||
254 | } | ||
255 | this.m_states.Remove(scene); | ||
256 | } | 223 | } |
257 | } | 224 | } |
258 | 225 | ||
@@ -263,22 +230,29 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
263 | /// <param name="scene">The scene to (possibly) perform AutoBackup on.</param> | 230 | /// <param name="scene">The scene to (possibly) perform AutoBackup on.</param> |
264 | void IRegionModuleBase.RegionLoaded(Scene scene) | 231 | void IRegionModuleBase.RegionLoaded(Scene scene) |
265 | { | 232 | { |
266 | if (!this.m_enabled) | 233 | if (!m_enabled) |
267 | { | ||
268 | return; | 234 | return; |
269 | } | ||
270 | 235 | ||
271 | // This really ought not to happen, but just in case, let's pretend it didn't... | 236 | // This really ought not to happen, but just in case, let's pretend it didn't... |
272 | if (scene == null) | 237 | if (scene == null) |
273 | { | ||
274 | return; | 238 | return; |
275 | } | ||
276 | 239 | ||
277 | AutoBackupModuleState abms = this.ParseConfig(scene, false); | 240 | AutoBackupModuleState abms = ParseConfig(scene); |
278 | m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName); | 241 | if(abms == null) |
279 | m_log.Debug((abms == null ? "DEFAULT" : abms.ToString())); | 242 | { |
243 | m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName); | ||
244 | m_log.Debug("DEFAULT"); | ||
245 | abms = new AutoBackupModuleState(m_defaultState); | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName); | ||
250 | m_log.Debug(abms.ToString()); | ||
251 | } | ||
280 | 252 | ||
281 | m_states.Add(scene, abms); | 253 | m_states.Add(scene, abms); |
254 | m_busy = false; | ||
255 | m_masterTimer.Start(); | ||
282 | } | 256 | } |
283 | 257 | ||
284 | /// <summary> | 258 | /// <summary> |
@@ -292,356 +266,174 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
292 | 266 | ||
293 | private void DoBackup (string module, string[] args) | 267 | private void DoBackup (string module, string[] args) |
294 | { | 268 | { |
295 | if (args.Length != 2) { | 269 | if (!m_enabled) |
296 | MainConsole.Instance.OutputFormat ("Usage: dobackup <regionname>"); | ||
297 | return; | 270 | return; |
298 | } | ||
299 | bool found = false; | ||
300 | string name = args [1]; | ||
301 | lock (m_Scenes) { | ||
302 | foreach (Scene s in m_Scenes) { | ||
303 | string test = s.Name.ToString (); | ||
304 | if (test == name) { | ||
305 | found = true; | ||
306 | DoRegionBackup (s); | ||
307 | } | ||
308 | } | ||
309 | if (!found) { | ||
310 | MainConsole.Instance.OutputFormat ("No such region {0}. Nothing to backup", name); | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | 271 | ||
315 | /// <summary> | 272 | if (args.Length != 2) |
316 | /// Set up internal state for a given scene. Fairly complex code. | ||
317 | /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. | ||
318 | /// </summary> | ||
319 | /// <param name="scene">The scene to look at.</param> | ||
320 | /// <param name="parseDefault">Whether this call is intended to figure out what we consider the "default" config (applied to all regions unless overridden by per-region settings).</param> | ||
321 | /// <returns>An AutoBackupModuleState contains most information you should need to know relevant to auto-backup, as applicable to a single region.</returns> | ||
322 | private AutoBackupModuleState ParseConfig(IScene scene, bool parseDefault) | ||
323 | { | ||
324 | string sRegionName; | ||
325 | string sRegionLabel; | ||
326 | // string prepend; | ||
327 | AutoBackupModuleState state; | ||
328 | |||
329 | if (parseDefault) | ||
330 | { | 273 | { |
331 | sRegionName = null; | 274 | MainConsole.Instance.OutputFormat ("Usage: dooarbackup <regionname>"); |
332 | sRegionLabel = "DEFAULT"; | 275 | return; |
333 | // prepend = ""; | ||
334 | state = this.m_defaultState; | ||
335 | } | ||
336 | else | ||
337 | { | ||
338 | sRegionName = scene.RegionInfo.RegionName; | ||
339 | sRegionLabel = sRegionName; | ||
340 | // prepend = sRegionName + "."; | ||
341 | state = null; | ||
342 | } | ||
343 | |||
344 | // Read the config settings and set variables. | ||
345 | IConfig regionConfig = (scene != null ? scene.Config.Configs[sRegionName] : null); | ||
346 | IConfig config = this.m_configSource.Configs["AutoBackupModule"]; | ||
347 | if (config == null) | ||
348 | { | ||
349 | // defaultState would be disabled too if the section doesn't exist. | ||
350 | state = this.m_defaultState; | ||
351 | return state; | ||
352 | } | 276 | } |
353 | 277 | ||
354 | bool tmpEnabled = ResolveBoolean("AutoBackup", this.m_defaultState.Enabled, config, regionConfig); | 278 | if(m_busy) |
355 | if (state == null && tmpEnabled != this.m_defaultState.Enabled) | ||
356 | //Varies from default state | ||
357 | { | 279 | { |
358 | state = new AutoBackupModuleState(); | 280 | MainConsole.Instance.OutputFormat ("Already doing a backup, please try later"); |
281 | return; | ||
359 | } | 282 | } |
360 | 283 | ||
361 | if (state != null) | 284 | m_masterTimer.Stop(); |
362 | { | 285 | m_busy = true; |
363 | state.Enabled = tmpEnabled; | ||
364 | } | ||
365 | 286 | ||
366 | // If you don't want AutoBackup, we stop. | 287 | bool found = false; |
367 | if ((state == null && !this.m_defaultState.Enabled) || (state != null && !state.Enabled)) | 288 | string name = args [1]; |
368 | { | 289 | Scene[] scenes; |
369 | return state; | 290 | lock (m_Scenes) |
370 | } | 291 | scenes = m_Scenes.ToArray(); |
371 | else | ||
372 | { | ||
373 | m_log.Info("[AUTO BACKUP]: Region " + sRegionLabel + " is AutoBackup ENABLED."); | ||
374 | } | ||
375 | |||
376 | // Borrow an existing timer if one exists for the same interval; otherwise, make a new one. | ||
377 | double interval = | ||
378 | this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes, | ||
379 | config, regionConfig) * 60000.0; | ||
380 | if (state == null && interval != this.m_defaultState.IntervalMinutes * 60000.0) | ||
381 | { | ||
382 | state = new AutoBackupModuleState(); | ||
383 | } | ||
384 | 292 | ||
385 | if (this.m_timers.ContainsKey(interval)) | 293 | if(scenes == null) |
386 | { | 294 | return; |
387 | if (state != null) | ||
388 | { | ||
389 | state.Timer = this.m_timers[interval]; | ||
390 | } | ||
391 | m_log.Debug("[AUTO BACKUP]: Reusing timer for " + interval + " msec for region " + | ||
392 | sRegionLabel); | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | // 0 or negative interval == do nothing. | ||
397 | if (interval <= 0.0 && state != null) | ||
398 | { | ||
399 | state.Enabled = false; | ||
400 | return state; | ||
401 | } | ||
402 | if (state == null) | ||
403 | { | ||
404 | state = new AutoBackupModuleState(); | ||
405 | } | ||
406 | Timer tim = new Timer(interval); | ||
407 | state.Timer = tim; | ||
408 | //Milliseconds -> minutes | ||
409 | this.m_timers.Add(interval, tim); | ||
410 | tim.Elapsed += this.HandleElapsed; | ||
411 | tim.AutoReset = true; | ||
412 | tim.Start(); | ||
413 | } | ||
414 | 295 | ||
415 | // Add the current region to the list of regions tied to this timer. | 296 | Scene s; |
416 | if (scene != null) | 297 | try |
417 | { | 298 | { |
418 | if (state != null) | 299 | if(name == "ALL") |
419 | { | 300 | { |
420 | if (this.m_timerMap.ContainsKey(state.Timer)) | 301 | for(int i = 0; i < scenes.Length; i++) |
421 | { | 302 | { |
422 | this.m_timerMap[state.Timer].Add(scene); | 303 | s = scenes[i]; |
423 | } | 304 | DoRegionBackup(s); |
424 | else | 305 | if (!m_enabled) |
425 | { | 306 | return; |
426 | List<IScene> scns = new List<IScene>(1); | ||
427 | scns.Add(scene); | ||
428 | this.m_timerMap.Add(state.Timer, scns); | ||
429 | } | 307 | } |
308 | return; | ||
430 | } | 309 | } |
431 | else | 310 | |
311 | for(int i = 0; i < scenes.Length; i++) | ||
432 | { | 312 | { |
433 | if (this.m_timerMap.ContainsKey(this.m_defaultState.Timer)) | 313 | s = scenes[i]; |
434 | { | 314 | if (s.Name == name) |
435 | this.m_timerMap[this.m_defaultState.Timer].Add(scene); | ||
436 | } | ||
437 | else | ||
438 | { | 315 | { |
439 | List<IScene> scns = new List<IScene>(1); | 316 | found = true; |
440 | scns.Add(scene); | 317 | DoRegionBackup(s); |
441 | this.m_timerMap.Add(this.m_defaultState.Timer, scns); | 318 | break; |
442 | } | 319 | } |
443 | } | 320 | } |
444 | } | 321 | } |
445 | 322 | catch { } | |
446 | bool tmpBusyCheck = ResolveBoolean("AutoBackupBusyCheck", | 323 | finally |
447 | this.m_defaultState.BusyCheck, config, regionConfig); | ||
448 | if (state == null && tmpBusyCheck != this.m_defaultState.BusyCheck) | ||
449 | { | 324 | { |
450 | state = new AutoBackupModuleState(); | 325 | if (m_enabled) |
451 | } | 326 | m_masterTimer.Start(); |
327 | m_busy = false; | ||
328 | } | ||
329 | if (!found) | ||
330 | MainConsole.Instance.OutputFormat ("No such region {0}. Nothing to backup", name); | ||
331 | } | ||
452 | 332 | ||
453 | if (state != null) | 333 | private void ParseDefaultConfig(IConfig config) |
454 | { | 334 | { |
455 | state.BusyCheck = tmpBusyCheck; | ||
456 | } | ||
457 | 335 | ||
458 | // Included Option To Skip Assets | 336 | m_backupDir = "."; |
459 | bool tmpSkipAssets = ResolveBoolean("AutoBackupSkipAssets", | 337 | string backupDir = config.GetString("AutoBackupDir", "."); |
460 | this.m_defaultState.SkipAssets, config, regionConfig); | 338 | if (backupDir != ".") |
461 | if (state == null && tmpSkipAssets != this.m_defaultState.SkipAssets) | ||
462 | { | 339 | { |
463 | state = new AutoBackupModuleState(); | 340 | try |
341 | { | ||
342 | DirectoryInfo dirinfo = new DirectoryInfo(backupDir); | ||
343 | if (!dirinfo.Exists) | ||
344 | dirinfo.Create(); | ||
345 | } | ||
346 | catch (Exception e) | ||
347 | { | ||
348 | m_enabled = false; | ||
349 | m_log.WarnFormat("[AUTO BACKUP]: Error accessing backup folder {0}. Module disabled. {1}", | ||
350 | backupDir, e); | ||
351 | return; | ||
352 | } | ||
464 | } | 353 | } |
354 | m_backupDir = backupDir; | ||
465 | 355 | ||
466 | if (state != null) | 356 | double interval = config.GetDouble("AutoBackupInterval", 720); |
467 | { | 357 | interval *= 60000.0; |
468 | state.SkipAssets = tmpSkipAssets; | 358 | m_baseInterval = interval; |
469 | } | ||
470 | 359 | ||
471 | // How long to keep backup files in days, 0 Disables this feature | 360 | // How long to keep backup files in days, 0 Disables this feature |
472 | int tmpKeepFilesForDays = ResolveInt("AutoBackupKeepFilesForDays", | 361 | m_KeepFilesForDays = config.GetInt("AutoBackupKeepFilesForDays",m_KeepFilesForDays); |
473 | this.m_defaultState.KeepFilesForDays, config, regionConfig); | ||
474 | if (state == null && tmpKeepFilesForDays != this.m_defaultState.KeepFilesForDays) | ||
475 | { | ||
476 | state = new AutoBackupModuleState(); | ||
477 | } | ||
478 | 362 | ||
479 | if (state != null) | 363 | m_defaultState.Enabled = config.GetBoolean("AutoBackup", m_defaultState.Enabled); |
480 | { | 364 | |
481 | state.KeepFilesForDays = tmpKeepFilesForDays; | 365 | m_defaultState.SkipAssets = config.GetBoolean("AutoBackupSkipAssets",m_defaultState.SkipAssets); |
482 | } | ||
483 | 366 | ||
484 | // Set file naming algorithm | 367 | // Set file naming algorithm |
485 | string stmpNamingType = ResolveString("AutoBackupNaming", | 368 | string stmpNamingType = config.GetString("AutoBackupNaming", m_defaultState.NamingType.ToString()); |
486 | this.m_defaultState.NamingType.ToString(), config, regionConfig); | ||
487 | NamingType tmpNamingType; | 369 | NamingType tmpNamingType; |
488 | if (stmpNamingType.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) | 370 | if (stmpNamingType.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) |
489 | { | ||
490 | tmpNamingType = NamingType.Time; | 371 | tmpNamingType = NamingType.Time; |
491 | } | ||
492 | else if (stmpNamingType.Equals("Sequential", StringComparison.CurrentCultureIgnoreCase)) | 372 | else if (stmpNamingType.Equals("Sequential", StringComparison.CurrentCultureIgnoreCase)) |
493 | { | ||
494 | tmpNamingType = NamingType.Sequential; | 373 | tmpNamingType = NamingType.Sequential; |
495 | } | ||
496 | else if (stmpNamingType.Equals("Overwrite", StringComparison.CurrentCultureIgnoreCase)) | 374 | else if (stmpNamingType.Equals("Overwrite", StringComparison.CurrentCultureIgnoreCase)) |
497 | { | ||
498 | tmpNamingType = NamingType.Overwrite; | 375 | tmpNamingType = NamingType.Overwrite; |
499 | } | ||
500 | else | 376 | else |
501 | { | 377 | { |
502 | m_log.Warn("Unknown naming type specified for region " + sRegionLabel + ": " + | 378 | m_log.Warn("Unknown naming type specified for Default"); |
503 | stmpNamingType); | ||
504 | tmpNamingType = NamingType.Time; | 379 | tmpNamingType = NamingType.Time; |
505 | } | 380 | } |
381 | m_defaultState.NamingType = tmpNamingType; | ||
506 | 382 | ||
507 | if (state == null && tmpNamingType != this.m_defaultState.NamingType) | 383 | m_defaultState.Script = config.GetString("AutoBackupScript", m_defaultState.Script); |
508 | { | ||
509 | state = new AutoBackupModuleState(); | ||
510 | } | ||
511 | 384 | ||
512 | if (state != null) | 385 | } |
513 | { | ||
514 | state.NamingType = tmpNamingType; | ||
515 | } | ||
516 | 386 | ||
517 | string tmpScript = ResolveString("AutoBackupScript", | 387 | /// <summary> |
518 | this.m_defaultState.Script, config, regionConfig); | 388 | /// Set up internal state for a given scene. Fairly complex code. |
519 | if (state == null && tmpScript != this.m_defaultState.Script) | 389 | /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. |
520 | { | 390 | /// </summary> |
521 | state = new AutoBackupModuleState(); | 391 | /// <param name="scene">The scene to look at.</param> |
522 | } | 392 | /// <param name="parseDefault">Whether this call is intended to figure out what we consider the "default" config (applied to all regions unless overridden by per-region settings).</param> |
393 | /// <returns>An AutoBackupModuleState contains most information you should need to know relevant to auto-backup, as applicable to a single region.</returns> | ||
394 | private AutoBackupModuleState ParseConfig(IScene scene) | ||
395 | { | ||
396 | if(scene == null) | ||
397 | return null; | ||
523 | 398 | ||
524 | if (state != null) | 399 | string sRegionName; |
525 | { | 400 | AutoBackupModuleState state = null; |
526 | state.Script = tmpScript; | ||
527 | } | ||
528 | 401 | ||
529 | string tmpBackupDir = ResolveString("AutoBackupDir", ".", config, regionConfig); | 402 | sRegionName = scene.RegionInfo.RegionName; |
530 | if (state == null && tmpBackupDir != this.m_defaultState.BackupDir) | ||
531 | { | ||
532 | state = new AutoBackupModuleState(); | ||
533 | } | ||
534 | 403 | ||
535 | if (state != null) | 404 | // Read the config settings and set variables. |
536 | { | 405 | IConfig regionConfig = scene.Config.Configs[sRegionName]; |
537 | state.BackupDir = tmpBackupDir; | 406 | if (regionConfig == null) |
538 | // Let's give the user some convenience and auto-mkdir | 407 | return null; |
539 | if (state.BackupDir != ".") | ||
540 | { | ||
541 | try | ||
542 | { | ||
543 | DirectoryInfo dirinfo = new DirectoryInfo(state.BackupDir); | ||
544 | if (!dirinfo.Exists) | ||
545 | { | ||
546 | dirinfo.Create(); | ||
547 | } | ||
548 | } | ||
549 | catch (Exception e) | ||
550 | { | ||
551 | m_log.Warn( | ||
552 | "[AUTO BACKUP]: BAD NEWS. You won't be able to save backups to directory " + | ||
553 | state.BackupDir + | ||
554 | " because it doesn't exist or there's a permissions issue with it. Here's the exception.", | ||
555 | e); | ||
556 | } | ||
557 | } | ||
558 | } | ||
559 | 408 | ||
560 | if(state == null) | 409 | state = new AutoBackupModuleState(); |
561 | return m_defaultState; | ||
562 | 410 | ||
563 | return state; | 411 | state.Enabled = regionConfig.GetBoolean("AutoBackup", m_defaultState.Enabled); |
564 | } | ||
565 | 412 | ||
566 | /// <summary> | 413 | // Included Option To Skip Assets |
567 | /// Helper function for ParseConfig. | 414 | state.SkipAssets = regionConfig.GetBoolean("AutoBackupSkipAssets", m_defaultState.SkipAssets); |
568 | /// </summary> | ||
569 | /// <param name="settingName"></param> | ||
570 | /// <param name="defaultValue"></param> | ||
571 | /// <param name="global"></param> | ||
572 | /// <param name="local"></param> | ||
573 | /// <returns></returns> | ||
574 | private bool ResolveBoolean(string settingName, bool defaultValue, IConfig global, IConfig local) | ||
575 | { | ||
576 | if(local != null) | ||
577 | { | ||
578 | return local.GetBoolean(settingName, global.GetBoolean(settingName, defaultValue)); | ||
579 | } | ||
580 | else | ||
581 | { | ||
582 | return global.GetBoolean(settingName, defaultValue); | ||
583 | } | ||
584 | } | ||
585 | 415 | ||
586 | /// <summary> | 416 | // Set file naming algorithm |
587 | /// Helper function for ParseConfig. | 417 | string stmpNamingType = regionConfig.GetString("AutoBackupNaming", m_defaultState.NamingType.ToString()); |
588 | /// </summary> | 418 | NamingType tmpNamingType; |
589 | /// <param name="settingName"></param> | 419 | if (stmpNamingType.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) |
590 | /// <param name="defaultValue"></param> | 420 | tmpNamingType = NamingType.Time; |
591 | /// <param name="global"></param> | 421 | else if (stmpNamingType.Equals("Sequential", StringComparison.CurrentCultureIgnoreCase)) |
592 | /// <param name="local"></param> | 422 | tmpNamingType = NamingType.Sequential; |
593 | /// <returns></returns> | 423 | else if (stmpNamingType.Equals("Overwrite", StringComparison.CurrentCultureIgnoreCase)) |
594 | private double ResolveDouble(string settingName, double defaultValue, IConfig global, IConfig local) | 424 | tmpNamingType = NamingType.Overwrite; |
595 | { | ||
596 | if (local != null) | ||
597 | { | ||
598 | return local.GetDouble(settingName, global.GetDouble(settingName, defaultValue)); | ||
599 | } | ||
600 | else | 425 | else |
601 | { | 426 | { |
602 | return global.GetDouble(settingName, defaultValue); | 427 | m_log.Warn("Unknown naming type specified for region " + sRegionName + ": " + |
428 | stmpNamingType); | ||
429 | tmpNamingType = NamingType.Time; | ||
603 | } | 430 | } |
604 | } | 431 | m_defaultState.NamingType = tmpNamingType; |
605 | 432 | ||
606 | /// <summary> | 433 | state.Script = regionConfig.GetString("AutoBackupScript", m_defaultState.Script); |
607 | /// Helper function for ParseConfig. | 434 | return state; |
608 | /// </summary> | ||
609 | /// <param name="settingName"></param> | ||
610 | /// <param name="defaultValue"></param> | ||
611 | /// <param name="global"></param> | ||
612 | /// <param name="local"></param> | ||
613 | /// <returns></returns> | ||
614 | private int ResolveInt(string settingName, int defaultValue, IConfig global, IConfig local) | ||
615 | { | ||
616 | if (local != null) | ||
617 | { | ||
618 | return local.GetInt(settingName, global.GetInt(settingName, defaultValue)); | ||
619 | } | ||
620 | else | ||
621 | { | ||
622 | return global.GetInt(settingName, defaultValue); | ||
623 | } | ||
624 | } | 435 | } |
625 | 436 | ||
626 | /// <summary> | ||
627 | /// Helper function for ParseConfig. | ||
628 | /// </summary> | ||
629 | /// <param name="settingName"></param> | ||
630 | /// <param name="defaultValue"></param> | ||
631 | /// <param name="global"></param> | ||
632 | /// <param name="local"></param> | ||
633 | /// <returns></returns> | ||
634 | private string ResolveString(string settingName, string defaultValue, IConfig global, IConfig local) | ||
635 | { | ||
636 | if (local != null) | ||
637 | { | ||
638 | return local.GetString(settingName, global.GetString(settingName, defaultValue)); | ||
639 | } | ||
640 | else | ||
641 | { | ||
642 | return global.GetString(settingName, defaultValue); | ||
643 | } | ||
644 | } | ||
645 | 437 | ||
646 | /// <summary> | 438 | /// <summary> |
647 | /// Called when any auto-backup timer expires. This starts the code path for actually performing a backup. | 439 | /// Called when any auto-backup timer expires. This starts the code path for actually performing a backup. |
@@ -650,63 +442,27 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
650 | /// <param name="e"></param> | 442 | /// <param name="e"></param> |
651 | private void HandleElapsed(object sender, ElapsedEventArgs e) | 443 | private void HandleElapsed(object sender, ElapsedEventArgs e) |
652 | { | 444 | { |
653 | // TODO: heuristic thresholds are per-region, so we should probably run heuristics once per region | 445 | if (!m_enabled || m_busy) |
654 | // XXX: Running heuristics once per region could add undue performance penalty for something that's supposed to | ||
655 | // check whether the region is too busy! Especially on sims with LOTS of regions. | ||
656 | // Alternative: make heuristics thresholds global to the module rather than per-region. Less flexible, | ||
657 | // but would allow us to be semantically correct while being easier on perf. | ||
658 | // Alternative 2: Run heuristics once per unique set of heuristics threshold parameters! Ay yi yi... | ||
659 | // Alternative 3: Don't support per-region heuristics at all; just accept them as a global only parameter. | ||
660 | // Since this is pretty experimental, I haven't decided which alternative makes the most sense. | ||
661 | if (this.m_closed) | ||
662 | { | ||
663 | return; | 446 | return; |
664 | } | 447 | |
665 | bool heuristicsRun = false; | 448 | m_busy = true; |
666 | bool heuristicsPassed = false; | 449 | if(m_doneFirst && m_KeepFilesForDays > 0) |
667 | if (!this.m_timerMap.ContainsKey((Timer) sender)) | 450 | RemoveOldFiles(); |
451 | |||
452 | foreach (IScene scene in m_Scenes) | ||
668 | { | 453 | { |
669 | m_log.Debug("[AUTO BACKUP]: Code-up error: timerMap doesn't contain timer " + sender); | 454 | if (!m_enabled) |
455 | return; | ||
456 | DoRegionBackup(scene); | ||
670 | } | 457 | } |
671 | 458 | ||
672 | List<IScene> tmap = this.m_timerMap[(Timer) sender]; | 459 | if (m_enabled) |
673 | if (tmap != null && tmap.Count > 0) | ||
674 | { | 460 | { |
675 | foreach (IScene scene in tmap) | 461 | m_masterTimer.Start(); |
676 | { | 462 | m_busy = false; |
677 | AutoBackupModuleState state = this.m_states[scene]; | ||
678 | bool heuristics = state.BusyCheck; | ||
679 | |||
680 | // Fast path: heuristics are on; already ran em; and sim is fine; OR, no heuristics for the region. | ||
681 | if ((heuristics && heuristicsRun && heuristicsPassed) || !heuristics) | ||
682 | { | ||
683 | this.DoRegionBackup(scene); | ||
684 | // Heuristics are on; ran but we're too busy -- keep going. Maybe another region will have heuristics off! | ||
685 | } | ||
686 | else if (heuristicsRun) | ||
687 | { | ||
688 | m_log.Info("[AUTO BACKUP]: Heuristics: too busy to backup " + | ||
689 | scene.RegionInfo.RegionName + " right now."); | ||
690 | continue; | ||
691 | // Logical Deduction: heuristics are on but haven't been run | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | heuristicsPassed = this.RunHeuristics(scene); | ||
696 | heuristicsRun = true; | ||
697 | if (!heuristicsPassed) | ||
698 | { | ||
699 | m_log.Info("[AUTO BACKUP]: Heuristics: too busy to backup " + | ||
700 | scene.RegionInfo.RegionName + " right now."); | ||
701 | continue; | ||
702 | } | ||
703 | this.DoRegionBackup(scene); | ||
704 | } | ||
705 | |||
706 | // Remove Old Backups | ||
707 | this.RemoveOldFiles(state); | ||
708 | } | ||
709 | } | 463 | } |
464 | |||
465 | m_doneFirst = true; | ||
710 | } | 466 | } |
711 | 467 | ||
712 | /// <summary> | 468 | /// <summary> |
@@ -723,21 +479,29 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
723 | return; | 479 | return; |
724 | } | 480 | } |
725 | 481 | ||
726 | AutoBackupModuleState state = this.m_states[scene]; | 482 | m_busy = true; |
483 | |||
484 | AutoBackupModuleState state; | ||
485 | if(!m_states.TryGetValue(scene, out state)) | ||
486 | return; | ||
487 | |||
488 | if(state == null || !state.Enabled) | ||
489 | return; | ||
490 | |||
727 | IRegionArchiverModule iram = scene.RequestModuleInterface<IRegionArchiverModule>(); | 491 | IRegionArchiverModule iram = scene.RequestModuleInterface<IRegionArchiverModule>(); |
492 | if(iram == null) | ||
493 | return; | ||
494 | |||
728 | string savePath = BuildOarPath(scene.RegionInfo.RegionName, | 495 | string savePath = BuildOarPath(scene.RegionInfo.RegionName, |
729 | state.BackupDir, | 496 | m_backupDir, |
730 | state.NamingType); | 497 | state.NamingType); |
731 | if (savePath == null) | 498 | if (savePath == null) |
732 | { | 499 | { |
733 | m_log.Warn("[AUTO BACKUP]: savePath is null in HandleElapsed"); | 500 | m_log.Warn("[AUTO BACKUP]: savePath is null in HandleElapsed"); |
734 | return; | 501 | return; |
735 | } | 502 | } |
736 | Guid guid = Guid.NewGuid(); | ||
737 | m_pendingSaves.Add(guid, scene); | ||
738 | state.LiveRequests.Add(guid, savePath); | ||
739 | ((Scene) scene).EventManager.OnOarFileSaved += new EventManager.OarFileSaved(EventManager_OnOarFileSaved); | ||
740 | 503 | ||
504 | Guid guid = Guid.NewGuid(); | ||
741 | m_log.Info("[AUTO BACKUP]: Backing up region " + scene.RegionInfo.RegionName); | 505 | m_log.Info("[AUTO BACKUP]: Backing up region " + scene.RegionInfo.RegionName); |
742 | 506 | ||
743 | // Must pass options, even if dictionary is empty! | 507 | // Must pass options, even if dictionary is empty! |
@@ -747,47 +511,37 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
747 | options["noassets"] = true; | 511 | options["noassets"] = true; |
748 | 512 | ||
749 | iram.ArchiveRegion(savePath, guid, options); | 513 | iram.ArchiveRegion(savePath, guid, options); |
514 | ExecuteScript(state.Script, savePath); | ||
750 | } | 515 | } |
751 | 516 | ||
752 | // For the given state, remove backup files older than the states KeepFilesForDays property | 517 | // For the given state, remove backup files older than the states KeepFilesForDays property |
753 | private void RemoveOldFiles(AutoBackupModuleState state) | 518 | private void RemoveOldFiles() |
754 | { | 519 | { |
755 | // 0 Means Disabled, Keep Files Indefinitely | 520 | string[] files; |
756 | if (state.KeepFilesForDays > 0) | 521 | try |
757 | { | 522 | { |
758 | string[] files = Directory.GetFiles(state.BackupDir, "*.oar"); | 523 | files = Directory.GetFiles(m_backupDir, "*.oar"); |
759 | DateTime CuttOffDate = DateTime.Now.AddDays(0 - state.KeepFilesForDays); | 524 | } |
760 | 525 | catch (Exception Ex) | |
761 | foreach (string file in files) | 526 | { |
762 | { | 527 | m_log.Error("[AUTO BACKUP]: Error reading backup folder " + m_backupDir + ": " + Ex.Message); |
763 | try | 528 | return; |
764 | { | ||
765 | FileInfo fi = new FileInfo(file); | ||
766 | if (fi.CreationTime < CuttOffDate) | ||
767 | fi.Delete(); | ||
768 | } | ||
769 | catch (Exception Ex) | ||
770 | { | ||
771 | m_log.Error("[AUTO BACKUP]: Error deleting old backup file '" + file + "': " + Ex.Message); | ||
772 | } | ||
773 | } | ||
774 | } | 529 | } |
775 | } | ||
776 | 530 | ||
777 | /// <summary> | 531 | DateTime CuttOffDate = DateTime.Now.AddDays(-m_KeepFilesForDays); |
778 | /// Called by the Event Manager when the OnOarFileSaved event is fired. | 532 | |
779 | /// </summary> | 533 | foreach (string file in files) |
780 | /// <param name="guid"></param> | ||
781 | /// <param name="message"></param> | ||
782 | void EventManager_OnOarFileSaved(Guid guid, string message) | ||
783 | { | ||
784 | // Ignore if the OAR save is being done by some other part of the system | ||
785 | if (m_pendingSaves.ContainsKey(guid)) | ||
786 | { | 534 | { |
787 | AutoBackupModuleState abms = m_states[(m_pendingSaves[guid])]; | 535 | try |
788 | ExecuteScript(abms.Script, abms.LiveRequests[guid]); | 536 | { |
789 | m_pendingSaves.Remove(guid); | 537 | FileInfo fi = new FileInfo(file); |
790 | abms.LiveRequests.Remove(guid); | 538 | if (fi.CreationTime < CuttOffDate) |
539 | fi.Delete(); | ||
540 | } | ||
541 | catch (Exception Ex) | ||
542 | { | ||
543 | m_log.Error("[AUTO BACKUP]: Error deleting old backup file '" + file + "': " + Ex.Message); | ||
544 | } | ||
791 | } | 545 | } |
792 | } | 546 | } |
793 | 547 | ||
@@ -817,63 +571,6 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
817 | return output; | 571 | return output; |
818 | } | 572 | } |
819 | 573 | ||
820 | /// <summary>Return value of true ==> not too busy; false ==> too busy to backup an OAR right now, or error.</summary> | ||
821 | private bool RunHeuristics(IScene region) | ||
822 | { | ||
823 | try | ||
824 | { | ||
825 | return this.RunTimeDilationHeuristic(region) && this.RunAgentLimitHeuristic(region); | ||
826 | } | ||
827 | catch (Exception e) | ||
828 | { | ||
829 | m_log.Warn("[AUTO BACKUP]: Exception in RunHeuristics", e); | ||
830 | return false; | ||
831 | } | ||
832 | } | ||
833 | |||
834 | /// <summary> | ||
835 | /// If the time dilation right at this instant is less than the threshold specified in AutoBackupDilationThreshold (default 0.5), | ||
836 | /// then we return false and trip the busy heuristic's "too busy" path (i.e. don't save an OAR). | ||
837 | /// AutoBackupDilationThreshold is a _LOWER BOUND_. Lower Time Dilation is bad, so if you go lower than our threshold, it's "too busy". | ||
838 | /// </summary> | ||
839 | /// <param name="region"></param> | ||
840 | /// <returns>Returns true if we're not too busy; false means we've got worse time dilation than the threshold.</returns> | ||
841 | private bool RunTimeDilationHeuristic(IScene region) | ||
842 | { | ||
843 | string regionName = region.RegionInfo.RegionName; | ||
844 | return region.TimeDilation >= | ||
845 | this.m_configSource.Configs["AutoBackupModule"].GetFloat( | ||
846 | regionName + ".AutoBackupDilationThreshold", 0.5f); | ||
847 | } | ||
848 | |||
849 | /// <summary> | ||
850 | /// If the root agent count right at this instant is less than the threshold specified in AutoBackupAgentThreshold (default 10), | ||
851 | /// then we return false and trip the busy heuristic's "too busy" path (i.e., don't save an OAR). | ||
852 | /// AutoBackupAgentThreshold is an _UPPER BOUND_. Higher Agent Count is bad, so if you go higher than our threshold, it's "too busy". | ||
853 | /// </summary> | ||
854 | /// <param name="region"></param> | ||
855 | /// <returns>Returns true if we're not too busy; false means we've got more agents on the sim than the threshold.</returns> | ||
856 | private bool RunAgentLimitHeuristic(IScene region) | ||
857 | { | ||
858 | string regionName = region.RegionInfo.RegionName; | ||
859 | try | ||
860 | { | ||
861 | Scene scene = (Scene) region; | ||
862 | // TODO: Why isn't GetRootAgentCount() a method in the IScene interface? Seems generally useful... | ||
863 | return scene.GetRootAgentCount() <= | ||
864 | this.m_configSource.Configs["AutoBackupModule"].GetInt( | ||
865 | regionName + ".AutoBackupAgentThreshold", 10); | ||
866 | } | ||
867 | catch (InvalidCastException ice) | ||
868 | { | ||
869 | m_log.Debug( | ||
870 | "[AUTO BACKUP]: I NEED MAINTENANCE: IScene is not a Scene; can't get root agent count!", | ||
871 | ice); | ||
872 | return true; | ||
873 | // Non-obstructionist safest answer... | ||
874 | } | ||
875 | } | ||
876 | |||
877 | /// <summary> | 574 | /// <summary> |
878 | /// Run the script or executable specified by the "AutoBackupScript" config setting. | 575 | /// Run the script or executable specified by the "AutoBackupScript" config setting. |
879 | /// Of course this is a security risk if you let anyone modify OpenSim.ini and they want to run some nasty bash script. | 576 | /// Of course this is a security risk if you let anyone modify OpenSim.ini and they want to run some nasty bash script. |
@@ -920,18 +617,6 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
920 | } | 617 | } |
921 | 618 | ||
922 | /// <summary> | 619 | /// <summary> |
923 | /// Quickly stop all timers from firing. | ||
924 | /// </summary> | ||
925 | private void StopAllTimers() | ||
926 | { | ||
927 | foreach (Timer t in this.m_timerMap.Keys) | ||
928 | { | ||
929 | t.Close(); | ||
930 | } | ||
931 | this.m_closed = true; | ||
932 | } | ||
933 | |||
934 | /// <summary> | ||
935 | /// Determine the next unique filename by number, for "Sequential" AutoBackupNamingType. | 620 | /// Determine the next unique filename by number, for "Sequential" AutoBackupNamingType. |
936 | /// </summary> | 621 | /// </summary> |
937 | /// <param name="dirName"></param> | 622 | /// <param name="dirName"></param> |
@@ -1033,5 +718,3 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
1033 | } | 718 | } |
1034 | } | 719 | } |
1035 | } | 720 | } |
1036 | |||
1037 | |||
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs index b90f0c4..fb87677 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs | |||
@@ -38,26 +38,20 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
38 | /// | 38 | /// |
39 | public class AutoBackupModuleState | 39 | public class AutoBackupModuleState |
40 | { | 40 | { |
41 | private Dictionary<Guid, string> m_liveRequests = null; | ||
42 | |||
43 | public AutoBackupModuleState() | 41 | public AutoBackupModuleState() |
44 | { | 42 | { |
45 | this.Enabled = false; | 43 | Enabled = false; |
46 | this.BackupDir = "."; | 44 | SkipAssets = false; |
47 | this.BusyCheck = true; | 45 | NamingType = NamingType.Time; |
48 | this.SkipAssets = false; | 46 | Script = null; |
49 | this.Timer = null; | ||
50 | this.NamingType = NamingType.Time; | ||
51 | this.Script = null; | ||
52 | this.KeepFilesForDays = 0; | ||
53 | } | 47 | } |
54 | 48 | ||
55 | public Dictionary<Guid, string> LiveRequests | 49 | public AutoBackupModuleState(AutoBackupModuleState copyFrom) |
56 | { | 50 | { |
57 | get { | 51 | Enabled = copyFrom.Enabled; |
58 | return this.m_liveRequests ?? | 52 | SkipAssets = copyFrom.SkipAssets; |
59 | (this.m_liveRequests = new Dictionary<Guid, string>(1)); | 53 | NamingType = copyFrom.NamingType; |
60 | } | 54 | Script = copyFrom.Script; |
61 | } | 55 | } |
62 | 56 | ||
63 | public bool Enabled | 57 | public bool Enabled |
@@ -66,33 +60,6 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
66 | set; | 60 | set; |
67 | } | 61 | } |
68 | 62 | ||
69 | public System.Timers.Timer Timer | ||
70 | { | ||
71 | get; | ||
72 | set; | ||
73 | } | ||
74 | |||
75 | public double IntervalMinutes | ||
76 | { | ||
77 | get | ||
78 | { | ||
79 | if (this.Timer == null) | ||
80 | { | ||
81 | return -1.0; | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | return this.Timer.Interval / 60000.0; | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
90 | public bool BusyCheck | ||
91 | { | ||
92 | get; | ||
93 | set; | ||
94 | } | ||
95 | |||
96 | public bool SkipAssets | 63 | public bool SkipAssets |
97 | { | 64 | { |
98 | get; | 65 | get; |
@@ -105,36 +72,19 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
105 | set; | 72 | set; |
106 | } | 73 | } |
107 | 74 | ||
108 | public string BackupDir | ||
109 | { | ||
110 | get; | ||
111 | set; | ||
112 | } | ||
113 | |||
114 | public NamingType NamingType | 75 | public NamingType NamingType |
115 | { | 76 | { |
116 | get; | 77 | get; |
117 | set; | 78 | set; |
118 | } | 79 | } |
119 | 80 | ||
120 | public int KeepFilesForDays | ||
121 | { | ||
122 | get; | ||
123 | set; | ||
124 | } | ||
125 | |||
126 | public new string ToString() | 81 | public new string ToString() |
127 | { | 82 | { |
128 | string retval = ""; | 83 | string retval = ""; |
129 | |||
130 | retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n"; | 84 | retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n"; |
131 | retval += "[AUTO BACKUP]: Interval: " + IntervalMinutes + " minutes" + "\n"; | ||
132 | retval += "[AUTO BACKUP]: Do Busy Check: " + (BusyCheck ? "Yes" : "No") + "\n"; | ||
133 | retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n"; | 85 | retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n"; |
134 | retval += "[AUTO BACKUP]: Backup Dir: " + BackupDir + "\n"; | ||
135 | retval += "[AUTO BACKUP]: Script: " + Script + "\n"; | 86 | retval += "[AUTO BACKUP]: Script: " + Script + "\n"; |
136 | return retval; | 87 | return retval; |
137 | } | 88 | } |
138 | } | 89 | } |
139 | } | 90 | } |
140 | |||
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index da8c9a3..6e1f8bb 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -27,8 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Timers; | 32 | using System.Timers; |
33 | using System.Threading; | ||
34 | using System.Xml; | ||
35 | using System.Xml.Serialization; | ||
36 | |||
32 | using OpenMetaverse; | 37 | using OpenMetaverse; |
33 | using log4net; | 38 | using log4net; |
34 | using Mono.Addins; | 39 | using Mono.Addins; |
@@ -38,9 +43,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | |||
38 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
40 | 45 | ||
41 | using System.Xml; | 46 | using Timer= System.Timers.Timer; |
42 | using System.Xml.Serialization; | ||
43 | using System.IO; | ||
44 | 47 | ||
45 | namespace OpenSim.Region.OptionalModules.World.TreePopulator | 48 | namespace OpenSim.Region.OptionalModules.World.TreePopulator |
46 | { | 49 | { |
@@ -48,7 +51,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
48 | /// Version 2.02 - Still hacky | 51 | /// Version 2.02 - Still hacky |
49 | /// </summary> | 52 | /// </summary> |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TreePopulatorModule")] | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TreePopulatorModule")] |
51 | public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule | 54 | public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule |
52 | { | 55 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | private readonly Commander m_commander = new Commander("tree"); | 57 | private readonly Commander m_commander = new Commander("tree"); |
@@ -82,20 +85,20 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
82 | { | 85 | { |
83 | Copse cp = (Copse)DeserializeObject(fileName); | 86 | Copse cp = (Copse)DeserializeObject(fileName); |
84 | 87 | ||
85 | this.m_name = cp.m_name; | 88 | m_name = cp.m_name; |
86 | this.m_frozen = cp.m_frozen; | 89 | m_frozen = cp.m_frozen; |
87 | this.m_tree_quantity = cp.m_tree_quantity; | 90 | m_tree_quantity = cp.m_tree_quantity; |
88 | this.m_treeline_high = cp.m_treeline_high; | 91 | m_treeline_high = cp.m_treeline_high; |
89 | this.m_treeline_low = cp.m_treeline_low; | 92 | m_treeline_low = cp.m_treeline_low; |
90 | this.m_range = cp.m_range; | 93 | m_range = cp.m_range; |
91 | this.m_tree_type = cp.m_tree_type; | 94 | m_tree_type = cp.m_tree_type; |
92 | this.m_seed_point = cp.m_seed_point; | 95 | m_seed_point = cp.m_seed_point; |
93 | this.m_initial_scale = cp.m_initial_scale; | 96 | m_initial_scale = cp.m_initial_scale; |
94 | this.m_maximum_scale = cp.m_maximum_scale; | 97 | m_maximum_scale = cp.m_maximum_scale; |
95 | this.m_initial_scale = cp.m_initial_scale; | 98 | m_initial_scale = cp.m_initial_scale; |
96 | this.m_rate = cp.m_rate; | 99 | m_rate = cp.m_rate; |
97 | this.m_planted = planted; | 100 | m_planted = planted; |
98 | this.m_trees = new List<UUID>(); | 101 | m_trees = new List<UUID>(); |
99 | } | 102 | } |
100 | 103 | ||
101 | public Copse(string copsedef) | 104 | public Copse(string copsedef) |
@@ -103,61 +106,63 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
103 | char[] delimiterChars = {':', ';'}; | 106 | char[] delimiterChars = {':', ';'}; |
104 | string[] field = copsedef.Split(delimiterChars); | 107 | string[] field = copsedef.Split(delimiterChars); |
105 | 108 | ||
106 | this.m_name = field[1].Trim(); | 109 | m_name = field[1].Trim(); |
107 | this.m_frozen = (copsedef[0] == 'F'); | 110 | m_frozen = (copsedef[0] == 'F'); |
108 | this.m_tree_quantity = int.Parse(field[2]); | 111 | m_tree_quantity = int.Parse(field[2]); |
109 | this.m_treeline_high = float.Parse(field[3], Culture.NumberFormatInfo); | 112 | m_treeline_high = float.Parse(field[3], Culture.NumberFormatInfo); |
110 | this.m_treeline_low = float.Parse(field[4], Culture.NumberFormatInfo); | 113 | m_treeline_low = float.Parse(field[4], Culture.NumberFormatInfo); |
111 | this.m_range = double.Parse(field[5], Culture.NumberFormatInfo); | 114 | m_range = double.Parse(field[5], Culture.NumberFormatInfo); |
112 | this.m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]); | 115 | m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]); |
113 | this.m_seed_point = Vector3.Parse(field[7]); | 116 | m_seed_point = Vector3.Parse(field[7]); |
114 | this.m_initial_scale = Vector3.Parse(field[8]); | 117 | m_initial_scale = Vector3.Parse(field[8]); |
115 | this.m_maximum_scale = Vector3.Parse(field[9]); | 118 | m_maximum_scale = Vector3.Parse(field[9]); |
116 | this.m_rate = Vector3.Parse(field[10]); | 119 | m_rate = Vector3.Parse(field[10]); |
117 | this.m_planted = true; | 120 | m_planted = true; |
118 | this.m_trees = new List<UUID>(); | 121 | m_trees = new List<UUID>(); |
119 | } | 122 | } |
120 | 123 | ||
121 | public Copse(string name, int quantity, float high, float low, double range, Vector3 point, Tree type, Vector3 scale, Vector3 max_scale, Vector3 rate, List<UUID> trees) | 124 | public Copse(string name, int quantity, float high, float low, double range, Vector3 point, Tree type, Vector3 scale, Vector3 max_scale, Vector3 rate, List<UUID> trees) |
122 | { | 125 | { |
123 | this.m_name = name; | 126 | m_name = name; |
124 | this.m_frozen = false; | 127 | m_frozen = false; |
125 | this.m_tree_quantity = quantity; | 128 | m_tree_quantity = quantity; |
126 | this.m_treeline_high = high; | 129 | m_treeline_high = high; |
127 | this.m_treeline_low = low; | 130 | m_treeline_low = low; |
128 | this.m_range = range; | 131 | m_range = range; |
129 | this.m_tree_type = type; | 132 | m_tree_type = type; |
130 | this.m_seed_point = point; | 133 | m_seed_point = point; |
131 | this.m_initial_scale = scale; | 134 | m_initial_scale = scale; |
132 | this.m_maximum_scale = max_scale; | 135 | m_maximum_scale = max_scale; |
133 | this.m_rate = rate; | 136 | m_rate = rate; |
134 | this.m_planted = false; | 137 | m_planted = false; |
135 | this.m_trees = trees; | 138 | m_trees = trees; |
136 | } | 139 | } |
137 | 140 | ||
138 | public override string ToString() | 141 | public override string ToString() |
139 | { | 142 | { |
140 | string frozen = (this.m_frozen ? "F" : "A"); | 143 | string frozen = (m_frozen ? "F" : "A"); |
141 | 144 | ||
142 | return string.Format("{0}TPM: {1}; {2}; {3:0.0}; {4:0.0}; {5:0.0}; {6}; {7:0.0}; {8:0.0}; {9:0.0}; {10:0.00};", | 145 | return string.Format("{0}TPM: {1}; {2}; {3:0.0}; {4:0.0}; {5:0.0}; {6}; {7:0.0}; {8:0.0}; {9:0.0}; {10:0.00};", |
143 | frozen, | 146 | frozen, |
144 | this.m_name, | 147 | m_name, |
145 | this.m_tree_quantity, | 148 | m_tree_quantity, |
146 | this.m_treeline_high, | 149 | m_treeline_high, |
147 | this.m_treeline_low, | 150 | m_treeline_low, |
148 | this.m_range, | 151 | m_range, |
149 | this.m_tree_type, | 152 | m_tree_type, |
150 | this.m_seed_point.ToString(), | 153 | m_seed_point.ToString(), |
151 | this.m_initial_scale.ToString(), | 154 | m_initial_scale.ToString(), |
152 | this.m_maximum_scale.ToString(), | 155 | m_maximum_scale.ToString(), |
153 | this.m_rate.ToString()); | 156 | m_rate.ToString()); |
154 | } | 157 | } |
155 | } | 158 | } |
156 | 159 | ||
157 | private List<Copse> m_copse; | 160 | private List<Copse> m_copses = new List<Copse>(); |
158 | 161 | private object mylock; | |
159 | private double m_update_ms = 1000.0; // msec between updates | 162 | private double m_update_ms = 1000.0; // msec between updates |
160 | private bool m_active_trees = false; | 163 | private bool m_active_trees = false; |
164 | private bool m_enabled = true; // original default | ||
165 | private bool m_allowGrow = true; // original default | ||
161 | 166 | ||
162 | Timer CalculateTrees; | 167 | Timer CalculateTrees; |
163 | 168 | ||
@@ -174,51 +179,51 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
174 | 179 | ||
175 | public void Initialise(IConfigSource config) | 180 | public void Initialise(IConfigSource config) |
176 | { | 181 | { |
177 | 182 | IConfig moduleConfig = config.Configs["Trees"]; | |
178 | // ini file settings | 183 | if (moduleConfig != null) |
179 | try | ||
180 | { | ||
181 | m_active_trees = config.Configs["Trees"].GetBoolean("active_trees", m_active_trees); | ||
182 | } | ||
183 | catch (Exception) | ||
184 | { | 184 | { |
185 | m_log.Debug("[TREES]: ini failure for active_trees - using default"); | 185 | m_enabled = moduleConfig.GetBoolean("enabled", m_enabled); |
186 | m_active_trees = moduleConfig.GetBoolean("active_trees", m_active_trees); | ||
187 | m_allowGrow = moduleConfig.GetBoolean("allowGrow", m_allowGrow); | ||
188 | m_update_ms = moduleConfig.GetDouble("update_rate", m_update_ms); | ||
186 | } | 189 | } |
187 | 190 | ||
188 | try | 191 | if(!m_enabled) |
189 | { | 192 | return; |
190 | m_update_ms = config.Configs["Trees"].GetDouble("update_rate", m_update_ms); | 193 | |
191 | } | 194 | m_copses = new List<Copse>(); |
192 | catch (Exception) | 195 | mylock = new object(); |
193 | { | ||
194 | m_log.Debug("[TREES]: ini failure for update_rate - using default"); | ||
195 | } | ||
196 | 196 | ||
197 | InstallCommands(); | 197 | InstallCommands(); |
198 | 198 | ||
199 | m_log.Debug("[TREES]: Initialised tree module"); | 199 | m_log.Debug("[TREES]: Initialised tree populator module"); |
200 | } | 200 | } |
201 | 201 | ||
202 | public void AddRegion(Scene scene) | 202 | public void AddRegion(Scene scene) |
203 | { | 203 | { |
204 | if(!m_enabled) | ||
205 | return; | ||
204 | m_scene = scene; | 206 | m_scene = scene; |
205 | m_scene.RegisterModuleCommander(m_commander); | 207 | m_scene.RegisterModuleCommander(m_commander); |
206 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 208 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
207 | 209 | m_scene.EventManager.OnPrimsLoaded += EventManager_OnPrimsLoaded; | |
208 | } | 210 | } |
209 | 211 | ||
210 | public void RemoveRegion(Scene scene) | 212 | public void RemoveRegion(Scene scene) |
211 | { | 213 | { |
212 | } | 214 | if(!m_enabled) |
215 | return; | ||
216 | if(m_active_trees && CalculateTrees != null) | ||
217 | { | ||
218 | CalculateTrees.Dispose(); | ||
219 | CalculateTrees = null; | ||
220 | } | ||
221 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | ||
222 | m_scene.EventManager.OnPrimsLoaded -= EventManager_OnPrimsLoaded; | ||
223 | } | ||
213 | 224 | ||
214 | public void RegionLoaded(Scene scene) | 225 | public void RegionLoaded(Scene scene) |
215 | { | 226 | { |
216 | ReloadCopse(); | ||
217 | if (m_copse.Count > 0) | ||
218 | m_log.Info("[TREES]: Copse load complete"); | ||
219 | |||
220 | if (m_active_trees) | ||
221 | activeizeTreeze(true); | ||
222 | } | 227 | } |
223 | 228 | ||
224 | public void Close() | 229 | public void Close() |
@@ -240,6 +245,16 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
240 | 245 | ||
241 | //-------------------------------------------------------------- | 246 | //-------------------------------------------------------------- |
242 | 247 | ||
248 | private void EventManager_OnPrimsLoaded(Scene s) | ||
249 | { | ||
250 | ReloadCopse(); | ||
251 | if (m_copses.Count > 0) | ||
252 | m_log.Info("[TREES]: Copses loaded" ); | ||
253 | |||
254 | if (m_active_trees) | ||
255 | activeizeTreeze(true); | ||
256 | } | ||
257 | |||
243 | #region ICommandableModule Members | 258 | #region ICommandableModule Members |
244 | 259 | ||
245 | private void HandleTreeActive(Object[] args) | 260 | private void HandleTreeActive(Object[] args) |
@@ -267,25 +282,57 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
267 | string copsename = ((string)args[0]).Trim(); | 282 | string copsename = ((string)args[0]).Trim(); |
268 | Boolean freezeState = (Boolean) args[1]; | 283 | Boolean freezeState = (Boolean) args[1]; |
269 | 284 | ||
270 | foreach (Copse cp in m_copse) | 285 | lock(mylock) |
271 | { | 286 | { |
272 | if (cp.m_name == copsename && (!cp.m_frozen && freezeState || cp.m_frozen && !freezeState)) | 287 | foreach (Copse cp in m_copses) |
273 | { | 288 | { |
274 | cp.m_frozen = freezeState; | 289 | if (cp.m_name != copsename) |
275 | foreach (UUID tree in cp.m_trees) | 290 | continue; |
291 | |||
292 | if(!cp.m_frozen && freezeState || cp.m_frozen && !freezeState) | ||
276 | { | 293 | { |
277 | SceneObjectPart sop = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | 294 | cp.m_frozen = freezeState; |
278 | sop.Name = (freezeState ? sop.Name.Replace("ATPM", "FTPM") : sop.Name.Replace("FTPM", "ATPM")); | 295 | List<UUID> losttrees = new List<UUID>(); |
279 | sop.ParentGroup.HasGroupChanged = true; | 296 | foreach (UUID tree in cp.m_trees) |
280 | } | 297 | { |
298 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); | ||
299 | if(sog != null && !sog.IsDeleted) | ||
300 | { | ||
301 | SceneObjectPart sop = sog.RootPart; | ||
302 | string name = sop.Name; | ||
303 | if(freezeState) | ||
304 | { | ||
305 | if(name.StartsWith("FTPM")) | ||
306 | continue; | ||
307 | if(!name.StartsWith("ATPM")) | ||
308 | continue; | ||
309 | sop.Name = sop.Name.Replace("ATPM", "FTPM"); | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | if(name.StartsWith("ATPM")) | ||
314 | continue; | ||
315 | if(!name.StartsWith("FTPM")) | ||
316 | continue; | ||
317 | sop.Name = sop.Name.Replace("FTPM", "ATPM"); | ||
318 | } | ||
319 | sop.ParentGroup.HasGroupChanged = true; | ||
320 | sog.ScheduleGroupForFullUpdate(); | ||
321 | } | ||
322 | else | ||
323 | losttrees.Add(tree); | ||
324 | } | ||
325 | foreach (UUID tree in losttrees) | ||
326 | cp.m_trees.Remove(tree); | ||
281 | 327 | ||
282 | m_log.InfoFormat("[TREES]: Activity for copse {0} is frozen {1}", copsename, freezeState); | 328 | m_log.InfoFormat("[TREES]: Activity for copse {0} is frozen {1}", copsename, freezeState); |
283 | return; | 329 | return; |
284 | } | 330 | } |
285 | else if (cp.m_name == copsename && (cp.m_frozen && freezeState || !cp.m_frozen && !freezeState)) | 331 | else |
286 | { | 332 | { |
287 | m_log.InfoFormat("[TREES]: Copse {0} is already in the requested freeze state", copsename); | 333 | m_log.InfoFormat("[TREES]: Copse {0} is already in the requested freeze state", copsename); |
288 | return; | 334 | return; |
335 | } | ||
289 | } | 336 | } |
290 | } | 337 | } |
291 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); | 338 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); |
@@ -297,17 +344,21 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
297 | 344 | ||
298 | m_log.InfoFormat("[TREES]: Loading copse definition...."); | 345 | m_log.InfoFormat("[TREES]: Loading copse definition...."); |
299 | 346 | ||
300 | copse = new Copse(((string)args[0]), false); | 347 | lock(mylock) |
301 | foreach (Copse cp in m_copse) | ||
302 | { | 348 | { |
303 | if (cp.m_name == copse.m_name) | 349 | copse = new Copse(((string)args[0]), false); |
304 | { | 350 | { |
305 | m_log.InfoFormat("[TREES]: Copse: {0} is already defined - command failed", copse.m_name); | 351 | foreach (Copse cp in m_copses) |
306 | return; | 352 | { |
353 | if (cp.m_name == copse.m_name) | ||
354 | { | ||
355 | m_log.InfoFormat("[TREES]: Copse: {0} is already defined - command failed", copse.m_name); | ||
356 | return; | ||
357 | } | ||
358 | } | ||
307 | } | 359 | } |
360 | m_copses.Add(copse); | ||
308 | } | 361 | } |
309 | |||
310 | m_copse.Add(copse); | ||
311 | m_log.InfoFormat("[TREES]: Loaded copse: {0}", copse.ToString()); | 362 | m_log.InfoFormat("[TREES]: Loaded copse: {0}", copse.ToString()); |
312 | } | 363 | } |
313 | 364 | ||
@@ -318,20 +369,24 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
318 | m_log.InfoFormat("[TREES]: New tree planting for copse {0}", copsename); | 369 | m_log.InfoFormat("[TREES]: New tree planting for copse {0}", copsename); |
319 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | 370 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; |
320 | 371 | ||
321 | foreach (Copse copse in m_copse) | 372 | lock(mylock) |
322 | { | 373 | { |
323 | if (copse.m_name == copsename) | 374 | foreach (Copse copse in m_copses) |
324 | { | 375 | { |
325 | if (!copse.m_planted) | 376 | if (copse.m_name == copsename) |
326 | { | ||
327 | // The first tree for a copse is created here | ||
328 | CreateTree(uuid, copse, copse.m_seed_point); | ||
329 | copse.m_planted = true; | ||
330 | return; | ||
331 | } | ||
332 | else | ||
333 | { | 377 | { |
334 | m_log.InfoFormat("[TREES]: Copse {0} has already been planted", copsename); | 378 | if (!copse.m_planted) |
379 | { | ||
380 | // The first tree for a copse is created here | ||
381 | CreateTree(uuid, copse, copse.m_seed_point, true); | ||
382 | copse.m_planted = true; | ||
383 | return; | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | m_log.InfoFormat("[TREES]: Copse {0} has already been planted", copsename); | ||
388 | return; | ||
389 | } | ||
335 | } | 390 | } |
336 | } | 391 | } |
337 | } | 392 | } |
@@ -376,45 +431,49 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
376 | string copsename = ((string)args[0]).Trim(); | 431 | string copsename = ((string)args[0]).Trim(); |
377 | Copse copseIdentity = null; | 432 | Copse copseIdentity = null; |
378 | 433 | ||
379 | foreach (Copse cp in m_copse) | 434 | lock(mylock) |
380 | { | 435 | { |
381 | if (cp.m_name == copsename) | 436 | foreach (Copse cp in m_copses) |
382 | { | 437 | { |
383 | copseIdentity = cp; | 438 | if (cp.m_name == copsename) |
439 | { | ||
440 | copseIdentity = cp; | ||
441 | } | ||
384 | } | 442 | } |
385 | } | ||
386 | 443 | ||
387 | if (copseIdentity != null) | 444 | if (copseIdentity != null) |
388 | { | ||
389 | foreach (UUID tree in copseIdentity.m_trees) | ||
390 | { | 445 | { |
391 | if (m_scene.Entities.ContainsKey(tree)) | 446 | foreach (UUID tree in copseIdentity.m_trees) |
392 | { | 447 | { |
393 | SceneObjectPart selectedTree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | 448 | if (m_scene.Entities.ContainsKey(tree)) |
394 | // Delete tree and alert clients (not silent) | 449 | { |
395 | m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); | 450 | SceneObjectPart selectedTree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; |
396 | } | 451 | // Delete tree and alert clients (not silent) |
397 | else | 452 | m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); |
398 | { | 453 | } |
399 | m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree); | 454 | else |
455 | { | ||
456 | m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree); | ||
457 | } | ||
400 | } | 458 | } |
459 | copseIdentity.m_trees = null; | ||
460 | m_copses.Remove(copseIdentity); | ||
461 | m_log.InfoFormat("[TREES]: Copse {0} has been removed", copsename); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); | ||
401 | } | 466 | } |
402 | copseIdentity.m_trees = new List<UUID>(); | ||
403 | m_copse.Remove(copseIdentity); | ||
404 | m_log.InfoFormat("[TREES]: Copse {0} has been removed", copsename); | ||
405 | } | ||
406 | else | ||
407 | { | ||
408 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); | ||
409 | } | 467 | } |
410 | } | 468 | } |
411 | 469 | ||
412 | private void HandleTreeStatistics(Object[] args) | 470 | private void HandleTreeStatistics(Object[] args) |
413 | { | 471 | { |
414 | m_log.InfoFormat("[TREES]: Activity State: {0}; Update Rate: {1}", m_active_trees, m_update_ms); | 472 | m_log.InfoFormat("[TREES]: region {0}:", m_scene.Name); |
415 | foreach (Copse cp in m_copse) | 473 | m_log.InfoFormat("[TREES]: Activity State: {0}; Update Rate: {1}", m_active_trees, m_update_ms); |
474 | foreach (Copse cp in m_copses) | ||
416 | { | 475 | { |
417 | m_log.InfoFormat("[TREES]: Copse {0}; {1} trees; frozen {2}", cp.m_name, cp.m_trees.Count, cp.m_frozen); | 476 | m_log.InfoFormat("[TREES]: Copse {0}; {1} trees; frozen {2}", cp.m_name, cp.m_trees.Count, cp.m_frozen); |
418 | } | 477 | } |
419 | } | 478 | } |
420 | 479 | ||
@@ -442,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
442 | treeRateCommand.AddArgument("updateRate", "The required update rate (minimum 1000.0)", "Double"); | 501 | treeRateCommand.AddArgument("updateRate", "The required update rate (minimum 1000.0)", "Double"); |
443 | 502 | ||
444 | Command treeReloadCommand = | 503 | Command treeReloadCommand = |
445 | new Command("reload", CommandIntentions.COMMAND_HAZARDOUS, HandleTreeReload, "Reload copse definitions from the in-scene trees"); | 504 | new Command("reload", CommandIntentions.COMMAND_HAZARDOUS, HandleTreeReload, "Reload copses from the in-scene trees"); |
446 | 505 | ||
447 | Command treeRemoveCommand = | 506 | Command treeRemoveCommand = |
448 | new Command("remove", CommandIntentions.COMMAND_HAZARDOUS, HandleTreeRemove, "Remove a copse definition and all its in-scene trees"); | 507 | new Command("remove", CommandIntentions.COMMAND_HAZARDOUS, HandleTreeRemove, "Remove a copse definition and all its in-scene trees"); |
@@ -499,34 +558,17 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
499 | treeShape.Scale = scale; | 558 | treeShape.Scale = scale; |
500 | treeShape.State = (byte)treeType; | 559 | treeShape.State = (byte)treeType; |
501 | 560 | ||
502 | return m_scene.AddNewPrim(uuid, groupID, position, rotation, treeShape); | 561 | SceneObjectGroup sog = new SceneObjectGroup(uuid, position, rotation, treeShape); |
503 | } | 562 | SceneObjectPart rootPart = sog.RootPart; |
504 | |||
505 | #endregion | ||
506 | |||
507 | #region IEntityCreator Members | ||
508 | |||
509 | protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.NewTree, PCode.Tree }; | ||
510 | public PCode[] CreationCapabilities { get { return creationCapabilities; } } | ||
511 | |||
512 | public SceneObjectGroup CreateEntity( | ||
513 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | ||
514 | { | ||
515 | if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0) | ||
516 | { | ||
517 | m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); | ||
518 | return null; | ||
519 | } | ||
520 | |||
521 | SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); | ||
522 | SceneObjectPart rootPart = sceneObject.GetPart(sceneObject.UUID); | ||
523 | 563 | ||
524 | rootPart.AddFlag(PrimFlags.Phantom); | 564 | rootPart.AddFlag(PrimFlags.Phantom); |
525 | 565 | ||
526 | sceneObject.SetGroup(groupID, null); | 566 | sog.SetGroup(groupID, null); |
527 | m_scene.AddNewSceneObject(sceneObject, true); | 567 | m_scene.AddNewSceneObject(sog, true, false); |
528 | sceneObject.InvalidateEffectivePerms(); | 568 | sog.IsSelected = false; |
529 | return sceneObject; | 569 | rootPart.IsSelected = false; |
570 | sog.InvalidateEffectivePerms(); | ||
571 | return sog; | ||
530 | } | 572 | } |
531 | 573 | ||
532 | #endregion | 574 | #endregion |
@@ -569,26 +611,27 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
569 | 611 | ||
570 | private void ReloadCopse() | 612 | private void ReloadCopse() |
571 | { | 613 | { |
572 | m_copse = new List<Copse>(); | 614 | m_copses = new List<Copse>(); |
573 | 615 | ||
574 | EntityBase[] objs = m_scene.GetEntities(); | 616 | List<SceneObjectGroup> grps = m_scene.GetSceneObjectGroups(); |
575 | foreach (EntityBase obj in objs) | 617 | foreach (SceneObjectGroup grp in grps) |
576 | { | 618 | { |
577 | if (obj is SceneObjectGroup) | 619 | if(grp.RootPart.Shape.PCode != (byte)PCode.NewTree && grp.RootPart.Shape.PCode != (byte)PCode.Tree) |
578 | { | 620 | continue; |
579 | SceneObjectGroup grp = (SceneObjectGroup)obj; | ||
580 | 621 | ||
581 | if (grp.Name.Length > 5 && (grp.Name.Substring(0, 5) == "ATPM:" || grp.Name.Substring(0, 5) == "FTPM:")) | 622 | if (grp.Name.Length > 5 && (grp.Name.Substring(0, 5) == "ATPM:" || grp.Name.Substring(0, 5) == "FTPM:")) |
623 | { | ||
624 | // Create a new copse definition or add uuid to an existing definition | ||
625 | try | ||
582 | { | 626 | { |
583 | // Create a new copse definition or add uuid to an existing definition | 627 | Boolean copsefound = false; |
584 | try | 628 | Copse grpcopse = new Copse(grp.Name); |
585 | { | ||
586 | Boolean copsefound = false; | ||
587 | Copse copse = new Copse(grp.Name); | ||
588 | 629 | ||
589 | foreach (Copse cp in m_copse) | 630 | lock(mylock) |
631 | { | ||
632 | foreach (Copse cp in m_copses) | ||
590 | { | 633 | { |
591 | if (cp.m_name == copse.m_name) | 634 | if (cp.m_name == grpcopse.m_name) |
592 | { | 635 | { |
593 | copsefound = true; | 636 | copsefound = true; |
594 | cp.m_trees.Add(grp.UUID); | 637 | cp.m_trees.Add(grp.UUID); |
@@ -598,15 +641,15 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
598 | 641 | ||
599 | if (!copsefound) | 642 | if (!copsefound) |
600 | { | 643 | { |
601 | m_log.InfoFormat("[TREES]: Found copse {0}", grp.Name); | 644 | m_log.InfoFormat("[TREES]: adding copse {0}", grpcopse.m_name); |
602 | m_copse.Add(copse); | 645 | grpcopse.m_trees.Add(grp.UUID); |
603 | copse.m_trees.Add(grp.UUID); | 646 | m_copses.Add(grpcopse); |
604 | } | 647 | } |
605 | } | 648 | } |
606 | catch | 649 | } |
607 | { | 650 | catch |
608 | m_log.InfoFormat("[TREES]: Ill formed copse definition {0} - ignoring", grp.Name); | 651 | { |
609 | } | 652 | m_log.InfoFormat("[TREES]: Ill formed copse definition {0} - ignoring", grp.Name); |
610 | } | 653 | } |
611 | } | 654 | } |
612 | } | 655 | } |
@@ -617,8 +660,10 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
617 | { | 660 | { |
618 | if (activeYN) | 661 | if (activeYN) |
619 | { | 662 | { |
620 | CalculateTrees = new Timer(m_update_ms); | 663 | if(CalculateTrees == null) |
664 | CalculateTrees = new Timer(m_update_ms); | ||
621 | CalculateTrees.Elapsed += CalculateTrees_Elapsed; | 665 | CalculateTrees.Elapsed += CalculateTrees_Elapsed; |
666 | CalculateTrees.AutoReset = false; | ||
622 | CalculateTrees.Start(); | 667 | CalculateTrees.Start(); |
623 | } | 668 | } |
624 | else | 669 | else |
@@ -629,154 +674,251 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
629 | 674 | ||
630 | private void growTrees() | 675 | private void growTrees() |
631 | { | 676 | { |
632 | foreach (Copse copse in m_copse) | 677 | if(!m_allowGrow) |
678 | return; | ||
679 | |||
680 | foreach (Copse copse in m_copses) | ||
633 | { | 681 | { |
634 | if (!copse.m_frozen) | 682 | if (copse.m_frozen) |
683 | continue; | ||
684 | |||
685 | if(copse.m_trees.Count == 0) | ||
686 | continue; | ||
687 | |||
688 | float maxscale = copse.m_maximum_scale.Z; | ||
689 | float ratescale = 1.0f; | ||
690 | List<UUID> losttrees = new List<UUID>(); | ||
691 | foreach (UUID tree in copse.m_trees) | ||
635 | { | 692 | { |
636 | foreach (UUID tree in copse.m_trees) | 693 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); |
637 | { | ||
638 | if (m_scene.Entities.ContainsKey(tree)) | ||
639 | { | ||
640 | SceneObjectPart s_tree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | ||
641 | 694 | ||
642 | if (s_tree.Scale.X < copse.m_maximum_scale.X && s_tree.Scale.Y < copse.m_maximum_scale.Y && s_tree.Scale.Z < copse.m_maximum_scale.Z) | 695 | if (sog != null && !sog.IsDeleted) |
643 | { | 696 | { |
644 | s_tree.Scale += copse.m_rate; | 697 | SceneObjectPart s_tree = sog.RootPart; |
645 | s_tree.ParentGroup.HasGroupChanged = true; | 698 | if (s_tree.Scale.Z < maxscale) |
646 | s_tree.ScheduleFullUpdate(); | ||
647 | } | ||
648 | } | ||
649 | else | ||
650 | { | 699 | { |
651 | m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree); | 700 | ratescale = (float)Util.RandomClass.NextDouble(); |
701 | if(ratescale < 0.2f) | ||
702 | ratescale = 0.2f; | ||
703 | s_tree.Scale += copse.m_rate * ratescale; | ||
704 | sog.HasGroupChanged = true; | ||
705 | s_tree.ScheduleFullUpdate(); | ||
652 | } | 706 | } |
653 | } | 707 | } |
708 | else | ||
709 | losttrees.Add(tree); | ||
654 | } | 710 | } |
711 | |||
712 | foreach (UUID tree in losttrees) | ||
713 | copse.m_trees.Remove(tree); | ||
655 | } | 714 | } |
656 | } | 715 | } |
657 | 716 | ||
658 | private void seedTrees() | 717 | private void seedTrees() |
659 | { | 718 | { |
660 | foreach (Copse copse in m_copse) | 719 | foreach (Copse copse in m_copses) |
661 | { | 720 | { |
662 | if (!copse.m_frozen) | 721 | if (copse.m_frozen) |
722 | continue; | ||
723 | |||
724 | if(copse.m_trees.Count == 0) | ||
725 | return; | ||
726 | |||
727 | bool low = copse.m_trees.Count < (int)(copse.m_tree_quantity * 0.8f); | ||
728 | |||
729 | if (!low && Util.RandomClass.NextDouble() < 0.75) | ||
730 | return; | ||
731 | |||
732 | int maxbirths = (int)(copse.m_tree_quantity) - copse.m_trees.Count; | ||
733 | if(maxbirths <= 1) | ||
734 | return; | ||
735 | |||
736 | if(maxbirths > 20) | ||
737 | maxbirths = 20; | ||
738 | |||
739 | float minscale = 0; | ||
740 | if(!low && m_allowGrow) | ||
741 | minscale = copse.m_maximum_scale.Z * 0.75f;; | ||
742 | |||
743 | int i = 0; | ||
744 | UUID[] current = copse.m_trees.ToArray(); | ||
745 | while(--maxbirths > 0) | ||
663 | { | 746 | { |
664 | foreach (UUID tree in copse.m_trees) | 747 | if(current.Length > 1) |
748 | i = Util.RandomClass.Next(current.Length -1); | ||
749 | |||
750 | UUID tree = current[i]; | ||
751 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); | ||
752 | |||
753 | if (sog != null && !sog.IsDeleted) | ||
665 | { | 754 | { |
666 | if (m_scene.Entities.ContainsKey(tree)) | 755 | SceneObjectPart s_tree = sog.RootPart; |
667 | { | ||
668 | SceneObjectPart s_tree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | ||
669 | 756 | ||
670 | if (copse.m_trees.Count < copse.m_tree_quantity) | 757 | // Tree has grown enough to seed if it has grown by at least 25% of seeded to full grown height |
671 | { | 758 | if (s_tree.Scale.Z > minscale) |
672 | // Tree has grown enough to seed if it has grown by at least 25% of seeded to full grown height | 759 | SpawnChild(copse, s_tree, true); |
673 | if (s_tree.Scale.Z > copse.m_initial_scale.Z + (copse.m_maximum_scale.Z - copse.m_initial_scale.Z) / 4.0) | ||
674 | { | ||
675 | if (Util.RandomClass.NextDouble() > 0.75) | ||
676 | { | ||
677 | SpawnChild(copse, s_tree); | ||
678 | } | ||
679 | } | ||
680 | } | ||
681 | } | ||
682 | else | ||
683 | { | ||
684 | m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree); | ||
685 | } | ||
686 | } | 760 | } |
687 | } | 761 | else if(copse.m_trees.Contains(tree)) |
762 | copse.m_trees.Remove(tree); | ||
763 | } | ||
688 | } | 764 | } |
689 | } | 765 | } |
690 | 766 | ||
691 | private void killTrees() | 767 | private void killTrees() |
692 | { | 768 | { |
693 | foreach (Copse copse in m_copse) | 769 | foreach (Copse copse in m_copses) |
694 | { | 770 | { |
695 | if (!copse.m_frozen && copse.m_trees.Count >= copse.m_tree_quantity) | 771 | if (copse.m_frozen) |
696 | { | 772 | continue; |
697 | foreach (UUID tree in copse.m_trees) | ||
698 | { | ||
699 | double killLikelyhood = 0.0; | ||
700 | |||
701 | if (m_scene.Entities.ContainsKey(tree)) | ||
702 | { | ||
703 | SceneObjectPart selectedTree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | ||
704 | double selectedTreeScale = Math.Sqrt(Math.Pow(selectedTree.Scale.X, 2) + | ||
705 | Math.Pow(selectedTree.Scale.Y, 2) + | ||
706 | Math.Pow(selectedTree.Scale.Z, 2)); | ||
707 | 773 | ||
708 | foreach (UUID picktree in copse.m_trees) | 774 | if (Util.RandomClass.NextDouble() < 0.25) |
709 | { | 775 | return; |
710 | if (picktree != tree) | ||
711 | { | ||
712 | SceneObjectPart pickedTree = ((SceneObjectGroup)m_scene.Entities[picktree]).RootPart; | ||
713 | |||
714 | double pickedTreeScale = Math.Sqrt(Math.Pow(pickedTree.Scale.X, 2) + | ||
715 | Math.Pow(pickedTree.Scale.Y, 2) + | ||
716 | Math.Pow(pickedTree.Scale.Z, 2)); | ||
717 | 776 | ||
718 | double pickedTreeDistance = Vector3.Distance(pickedTree.AbsolutePosition, selectedTree.AbsolutePosition); | 777 | int maxbdeaths = copse.m_trees.Count - (int)(copse.m_tree_quantity * .98f) ; |
778 | if(maxbdeaths < 1) | ||
779 | return; | ||
719 | 780 | ||
720 | killLikelyhood += (selectedTreeScale / (pickedTreeScale * pickedTreeDistance)) * 0.1; | 781 | float odds; |
721 | } | 782 | float scale = 1.0f / copse.m_maximum_scale.Z; |
722 | } | ||
723 | 783 | ||
724 | if (Util.RandomClass.NextDouble() < killLikelyhood) | 784 | int ntries = maxbdeaths * 4; |
725 | { | 785 | while(ntries-- > 0 ) |
726 | // Delete tree and alert clients (not silent) | 786 | { |
727 | m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); | 787 | int next = 0; |
728 | copse.m_trees.Remove(selectedTree.ParentGroup.UUID); | 788 | if (copse.m_trees.Count > 1) |
729 | break; | 789 | next = Util.RandomClass.Next(copse.m_trees.Count - 1); |
730 | } | 790 | UUID tree = copse.m_trees[next]; |
791 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); | ||
792 | if (sog != null && !sog.IsDeleted) | ||
793 | { | ||
794 | if(m_allowGrow) | ||
795 | { | ||
796 | odds = sog.RootPart.Scale.Z * scale; | ||
797 | odds = odds * odds * odds; | ||
798 | odds *= (float)Util.RandomClass.NextDouble(); | ||
731 | } | 799 | } |
732 | else | 800 | else |
733 | { | 801 | { |
734 | m_log.DebugFormat("[TREES]: Tree not in scene {0}", tree); | 802 | odds = (float)Util.RandomClass.NextDouble(); |
803 | odds = odds * odds * odds; | ||
804 | } | ||
805 | |||
806 | if(odds > 0.9f) | ||
807 | { | ||
808 | m_scene.DeleteSceneObject(sog, false); | ||
809 | if(maxbdeaths <= 0) | ||
810 | break; | ||
735 | } | 811 | } |
812 | } | ||
813 | else | ||
814 | { | ||
815 | copse.m_trees.Remove(tree); | ||
816 | if(copse.m_trees.Count - (int)(copse.m_tree_quantity * .98f) <= 0 ) | ||
817 | break; | ||
736 | } | 818 | } |
737 | } | 819 | } |
738 | } | 820 | } |
739 | } | 821 | } |
740 | 822 | ||
741 | private void SpawnChild(Copse copse, SceneObjectPart s_tree) | 823 | private void SpawnChild(Copse copse, SceneObjectPart s_tree, bool low) |
742 | { | 824 | { |
743 | Vector3 position = new Vector3(); | 825 | Vector3 position = new Vector3(); |
744 | 826 | ||
745 | double randX = ((Util.RandomClass.NextDouble() * 2.0) - 1.0) * (s_tree.Scale.X * 3); | 827 | float randX = copse.m_maximum_scale.X * 1.25f; |
746 | double randY = ((Util.RandomClass.NextDouble() * 2.0) - 1.0) * (s_tree.Scale.X * 3); | 828 | float randY = copse.m_maximum_scale.Y * 1.25f; |
747 | 829 | ||
830 | float r = (float)Util.RandomClass.NextDouble(); | ||
831 | randX *= 2.0f * r - 1.0f; | ||
748 | position.X = s_tree.AbsolutePosition.X + (float)randX; | 832 | position.X = s_tree.AbsolutePosition.X + (float)randX; |
833 | |||
834 | r = (float)Util.RandomClass.NextDouble(); | ||
835 | randY *= 2.0f * r - 1.0f; | ||
749 | position.Y = s_tree.AbsolutePosition.Y + (float)randY; | 836 | position.Y = s_tree.AbsolutePosition.Y + (float)randY; |
750 | 837 | ||
751 | if (position.X <= (m_scene.RegionInfo.RegionSizeX - 1) && position.X >= 0 && | 838 | if (position.X > (m_scene.RegionInfo.RegionSizeX - 1) || position.X <= 0 || |
752 | position.Y <= (m_scene.RegionInfo.RegionSizeY - 1) && position.Y >= 0 && | 839 | position.Y > (m_scene.RegionInfo.RegionSizeY - 1) || position.Y <= 0) |
753 | Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range) | 840 | return; |
754 | { | ||
755 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
756 | 841 | ||
757 | CreateTree(uuid, copse, position); | 842 | randX = position.X - copse.m_seed_point.X; |
758 | } | 843 | randX *= randX; |
844 | randY = position.Y - copse.m_seed_point.Y; | ||
845 | randY *= randY; | ||
846 | randX += randY; | ||
847 | |||
848 | if(randX > copse.m_range * copse.m_range) | ||
849 | return; | ||
850 | |||
851 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
852 | CreateTree(uuid, copse, position, low); | ||
759 | } | 853 | } |
760 | 854 | ||
761 | private void CreateTree(UUID uuid, Copse copse, Vector3 position) | 855 | private void CreateTree(UUID uuid, Copse copse, Vector3 position, bool randomScale) |
762 | { | 856 | { |
763 | |||
764 | position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y]; | 857 | position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y]; |
765 | if (position.Z >= copse.m_treeline_low && position.Z <= copse.m_treeline_high) | 858 | if (position.Z < copse.m_treeline_low || position.Z > copse.m_treeline_high) |
766 | { | 859 | return; |
767 | SceneObjectGroup tree = AddTree(uuid, UUID.Zero, copse.m_initial_scale, Quaternion.Identity, position, copse.m_tree_type, false); | ||
768 | 860 | ||
769 | tree.Name = copse.ToString(); | 861 | Vector3 scale = copse.m_initial_scale; |
770 | copse.m_trees.Add(tree.UUID); | 862 | if(randomScale) |
771 | tree.SendGroupFullUpdate(); | 863 | { |
864 | try | ||
865 | { | ||
866 | float t; | ||
867 | float r = (float)Util.RandomClass.NextDouble(); | ||
868 | r *= (float)Util.RandomClass.NextDouble(); | ||
869 | r *= (float)Util.RandomClass.NextDouble(); | ||
870 | |||
871 | t = copse.m_maximum_scale.X / copse.m_initial_scale.X; | ||
872 | if(t < 1.0) | ||
873 | t = 1 / t; | ||
874 | t = t * r + 1.0f; | ||
875 | scale.X *= t; | ||
876 | |||
877 | t = copse.m_maximum_scale.Y / copse.m_initial_scale.Y; | ||
878 | if(t < 1.0) | ||
879 | t = 1 / t; | ||
880 | t = t * r + 1.0f; | ||
881 | scale.Y *= t; | ||
882 | |||
883 | t = copse.m_maximum_scale.Z / copse.m_initial_scale.Z; | ||
884 | if(t < 1.0) | ||
885 | t = 1 / t; | ||
886 | t = t * r + 1.0f; | ||
887 | scale.Z *= t; | ||
888 | } | ||
889 | catch | ||
890 | { | ||
891 | scale = copse.m_initial_scale; | ||
892 | } | ||
772 | } | 893 | } |
894 | |||
895 | SceneObjectGroup tree = AddTree(uuid, UUID.Zero, scale, Quaternion.Identity, position, copse.m_tree_type, false); | ||
896 | tree.Name = copse.ToString(); | ||
897 | copse.m_trees.Add(tree.UUID); | ||
898 | tree.RootPart.ScheduleFullUpdate(); | ||
773 | } | 899 | } |
774 | 900 | ||
775 | private void CalculateTrees_Elapsed(object sender, ElapsedEventArgs e) | 901 | private void CalculateTrees_Elapsed(object sender, ElapsedEventArgs e) |
776 | { | 902 | { |
777 | growTrees(); | 903 | if(!m_scene.IsRunning) |
778 | seedTrees(); | 904 | return; |
779 | killTrees(); | 905 | |
906 | if(Monitor.TryEnter(mylock)) | ||
907 | { | ||
908 | try | ||
909 | { | ||
910 | if(m_scene.LoginsEnabled ) | ||
911 | { | ||
912 | growTrees(); | ||
913 | seedTrees(); | ||
914 | killTrees(); | ||
915 | } | ||
916 | } | ||
917 | catch { } | ||
918 | if(CalculateTrees != null) | ||
919 | CalculateTrees.Start(); | ||
920 | Monitor.Exit(mylock); | ||
921 | } | ||
780 | } | 922 | } |
781 | } | 923 | } |
782 | } | 924 | } |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index de7e879..0e46471 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
103 | 103 | ||
104 | public float walkDivisor = 1.3f; | 104 | public float walkDivisor = 1.3f; |
105 | public float runDivisor = 0.8f; | 105 | public float runDivisor = 0.8f; |
106 | private bool flying = false; | 106 | private bool m_flying = false; |
107 | private bool m_iscolliding = false; | 107 | private bool m_iscolliding = false; |
108 | private bool m_iscollidingGround = false; | 108 | private bool m_iscollidingGround = false; |
109 | private bool m_iscollidingObj = false; | 109 | private bool m_iscollidingObj = false; |
@@ -298,10 +298,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
298 | 298 | ||
299 | public override bool Flying | 299 | public override bool Flying |
300 | { | 300 | { |
301 | get { return flying; } | 301 | get { return m_flying; } |
302 | set | 302 | set |
303 | { | 303 | { |
304 | flying = value; | 304 | m_flying = value; |
305 | // m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); | 305 | // m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); |
306 | } | 306 | } |
307 | } | 307 | } |
@@ -899,9 +899,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
899 | y = tx * sin + y * cos; | 899 | y = tx * sin + y * cos; |
900 | } | 900 | } |
901 | 901 | ||
902 | public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, | 902 | public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, |
903 | ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) | 903 | ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) |
904 | { | 904 | { |
905 | feetcollision = false; | 905 | feetcollision = false; |
906 | useAltcontact = false; | 906 | useAltcontact = false; |
907 | 907 | ||
@@ -943,12 +943,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
943 | } | 943 | } |
944 | return true; | 944 | return true; |
945 | } | 945 | } |
946 | /* | 946 | |
947 | d.AABB aabb; | 947 | if (gtype == d.GeomClassID.SphereClass && d.GeomGetBody(other) != IntPtr.Zero) |
948 | d.GeomGetAABB(other,out aabb); | 948 | { |
949 | float othertop = aabb.MaxZ - _position.Z; | 949 | if(d.GeomSphereGetRadius(other) < 0.5) |
950 | */ | 950 | return true; |
951 | // if (offset.Z > 0 || othertop > -feetOff || contact.normal.Z > 0.35f) | 951 | } |
952 | |||
952 | if (offset.Z > 0 || contact.normal.Z > 0.35f) | 953 | if (offset.Z > 0 || contact.normal.Z > 0.35f) |
953 | { | 954 | { |
954 | if (offset.Z <= 0) | 955 | if (offset.Z <= 0) |
@@ -965,6 +966,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
965 | return true; | 966 | return true; |
966 | } | 967 | } |
967 | 968 | ||
969 | if(m_flying) | ||
970 | return true; | ||
971 | |||
972 | feetcollision = true; | ||
973 | if (h < boneOff) | ||
974 | { | ||
975 | m_collideNormal.X = contact.normal.X; | ||
976 | m_collideNormal.Y = contact.normal.Y; | ||
977 | m_collideNormal.Z = contact.normal.Z; | ||
978 | IsColliding = true; | ||
979 | } | ||
980 | |||
968 | altContact = contact; | 981 | altContact = contact; |
969 | useAltcontact = true; | 982 | useAltcontact = true; |
970 | 983 | ||
@@ -972,8 +985,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
972 | 985 | ||
973 | offset.Normalize(); | 986 | offset.Normalize(); |
974 | 987 | ||
975 | if (contact.depth > 0.1f) | 988 | float tdp = contact.depth; |
976 | contact.depth = 0.1f; | 989 | float t = offset.X; |
990 | t = Math.Abs(t); | ||
991 | if(t > 1e-6) | ||
992 | { | ||
993 | tdp /= t; | ||
994 | tdp *= contact.normal.X; | ||
995 | } | ||
996 | else | ||
997 | tdp *= 10; | ||
998 | |||
999 | if (tdp > 0.25f) | ||
1000 | tdp = 0.25f; | ||
1001 | |||
1002 | altContact.depth = tdp; | ||
977 | 1003 | ||
978 | if (reverse) | 1004 | if (reverse) |
979 | { | 1005 | { |
@@ -987,15 +1013,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
987 | altContact.normal.Y = -offset.Y; | 1013 | altContact.normal.Y = -offset.Y; |
988 | altContact.normal.Z = -offset.Z; | 1014 | altContact.normal.Z = -offset.Z; |
989 | } | 1015 | } |
990 | |||
991 | feetcollision = true; | ||
992 | if (h < boneOff) | ||
993 | { | ||
994 | m_collideNormal.X = contact.normal.X; | ||
995 | m_collideNormal.Y = contact.normal.Y; | ||
996 | m_collideNormal.Z = contact.normal.Z; | ||
997 | IsColliding = true; | ||
998 | } | ||
999 | return true; | 1016 | return true; |
1000 | } | 1017 | } |
1001 | return false; | 1018 | return false; |
@@ -1098,7 +1115,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1098 | 1115 | ||
1099 | float ftmp; | 1116 | float ftmp; |
1100 | 1117 | ||
1101 | if (flying) | 1118 | if (m_flying) |
1102 | { | 1119 | { |
1103 | ftmp = timeStep; | 1120 | ftmp = timeStep; |
1104 | posch.X += vel.X * ftmp; | 1121 | posch.X += vel.X * ftmp; |
@@ -1122,7 +1139,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1122 | 1139 | ||
1123 | vec.Z = depth * PID_P * 50; | 1140 | vec.Z = depth * PID_P * 50; |
1124 | 1141 | ||
1125 | if (!flying) | 1142 | if (!m_flying) |
1126 | { | 1143 | { |
1127 | vec.Z += -vel.Z * PID_D; | 1144 | vec.Z += -vel.Z * PID_D; |
1128 | if(n.Z < 0.4f) | 1145 | if(n.Z < 0.4f) |
@@ -1259,7 +1276,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1259 | 1276 | ||
1260 | // movement relative to surface if moving on it | 1277 | // movement relative to surface if moving on it |
1261 | // dont disturbe vertical movement, ie jumps | 1278 | // dont disturbe vertical movement, ie jumps |
1262 | if (m_iscolliding && !flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) | 1279 | if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) |
1263 | { | 1280 | { |
1264 | float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; | 1281 | float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; |
1265 | ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); | 1282 | ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); |
@@ -1276,7 +1293,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1276 | { | 1293 | { |
1277 | 1294 | ||
1278 | // if velocity is zero, use position control; otherwise, velocity control | 1295 | // if velocity is zero, use position control; otherwise, velocity control |
1279 | if (tviszero && m_iscolliding && !flying) | 1296 | if (tviszero && m_iscolliding && !m_flying) |
1280 | { | 1297 | { |
1281 | // keep track of where we stopped. No more slippin' & slidin' | 1298 | // keep track of where we stopped. No more slippin' & slidin' |
1282 | if (!_zeroFlag) | 1299 | if (!_zeroFlag) |
@@ -1313,7 +1330,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1313 | 1330 | ||
1314 | if (m_iscolliding) | 1331 | if (m_iscolliding) |
1315 | { | 1332 | { |
1316 | if (!flying) | 1333 | if (!m_flying) |
1317 | { | 1334 | { |
1318 | // we are on a surface | 1335 | // we are on a surface |
1319 | if (ctz.Z > 0f) | 1336 | if (ctz.Z > 0f) |
@@ -1361,7 +1378,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1361 | } | 1378 | } |
1362 | else // ie not colliding | 1379 | else // ie not colliding |
1363 | { | 1380 | { |
1364 | if (flying || hoverPIDActive) //(!m_iscolliding && flying) | 1381 | if (m_flying || hoverPIDActive) //(!m_iscolliding && flying) |
1365 | { | 1382 | { |
1366 | // we're in mid air suspended | 1383 | // we're in mid air suspended |
1367 | vec.X += (ctz.X - vel.X) * (PID_D); | 1384 | vec.X += (ctz.X - vel.X) * (PID_D); |
@@ -1397,13 +1414,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1397 | breakfactor = m_mass; | 1414 | breakfactor = m_mass; |
1398 | vec.X -= breakfactor * vel.X; | 1415 | vec.X -= breakfactor * vel.X; |
1399 | vec.Y -= breakfactor * vel.Y; | 1416 | vec.Y -= breakfactor * vel.Y; |
1400 | if (flying) | 1417 | if (m_flying) |
1401 | vec.Z -= 0.5f * breakfactor * vel.Z; | 1418 | vec.Z -= 0.5f * breakfactor * vel.Z; |
1402 | else | 1419 | else |
1403 | vec.Z -= .16f* m_mass * vel.Z; | 1420 | vec.Z -= .16f* m_mass * vel.Z; |
1404 | } | 1421 | } |
1405 | 1422 | ||
1406 | if (flying || hoverPIDActive) | 1423 | if (m_flying || hoverPIDActive) |
1407 | { | 1424 | { |
1408 | vec.Z -= m_parent_scene.gravityz * m_mass; | 1425 | vec.Z -= m_parent_scene.gravityz * m_mass; |
1409 | 1426 | ||
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs index 2e6a7db..ce10065 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs | |||
@@ -345,6 +345,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
345 | if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) | 345 | if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) |
346 | && !rootPrim.m_isSelected && !rootPrim.m_disabled) | 346 | && !rootPrim.m_isSelected && !rootPrim.m_disabled) |
347 | d.BodyEnable(rootPrim.Body); | 347 | d.BodyEnable(rootPrim.Body); |
348 | |||
348 | break; | 349 | break; |
349 | case Vehicle.LINEAR_FRICTION_TIMESCALE: | 350 | case Vehicle.LINEAR_FRICTION_TIMESCALE: |
350 | if (pValue < m_timestep) pValue = m_timestep; | 351 | if (pValue < m_timestep) pValue = m_timestep; |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 4bed0d2..76ef88b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -1043,7 +1043,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1043 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | 1043 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it |
1044 | d.BodySetAngularVel(Body, 0, 0, 0); | 1044 | d.BodySetAngularVel(Body, 0, 0, 0); |
1045 | } | 1045 | } |
1046 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1046 | if(prim_geom != IntPtr.Zero) |
1047 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
1047 | disableBodySoft(); // stop collisions | 1048 | disableBodySoft(); // stop collisions |
1048 | UnSubscribeEvents(); | 1049 | UnSubscribeEvents(); |
1049 | } | 1050 | } |
@@ -1240,7 +1241,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1240 | SentEmptyCollisionsEvent = true; | 1241 | SentEmptyCollisionsEvent = true; |
1241 | // _parent_scene.RemoveCollisionEventReporting(this); | 1242 | // _parent_scene.RemoveCollisionEventReporting(this); |
1242 | } | 1243 | } |
1243 | else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body)) | 1244 | else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) |
1244 | { | 1245 | { |
1245 | SentEmptyCollisionsEvent = false; | 1246 | SentEmptyCollisionsEvent = false; |
1246 | CollisionEventsThisFrame.Clear(); | 1247 | CollisionEventsThisFrame.Clear(); |
@@ -1847,8 +1848,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1847 | ApplyCollisionCatFlags(); | 1848 | ApplyCollisionCatFlags(); |
1848 | 1849 | ||
1849 | _zeroFlag = true; | 1850 | _zeroFlag = true; |
1851 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
1850 | d.BodyEnable(Body); | 1852 | d.BodyEnable(Body); |
1851 | |||
1852 | } | 1853 | } |
1853 | } | 1854 | } |
1854 | resetCollisionAccounting(); | 1855 | resetCollisionAccounting(); |
@@ -2900,6 +2901,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2900 | if (Body != IntPtr.Zero && !m_disabled) | 2901 | if (Body != IntPtr.Zero && !m_disabled) |
2901 | { | 2902 | { |
2902 | _zeroFlag = true; | 2903 | _zeroFlag = true; |
2904 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2903 | d.BodyEnable(Body); | 2905 | d.BodyEnable(Body); |
2904 | } | 2906 | } |
2905 | } | 2907 | } |
@@ -2933,6 +2935,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2933 | if (!d.BodyIsEnabled(Body)) | 2935 | if (!d.BodyIsEnabled(Body)) |
2934 | { | 2936 | { |
2935 | _zeroFlag = true; | 2937 | _zeroFlag = true; |
2938 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2936 | d.BodyEnable(Body); | 2939 | d.BodyEnable(Body); |
2937 | } | 2940 | } |
2938 | } | 2941 | } |
@@ -2947,6 +2950,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2947 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 2950 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
2948 | { | 2951 | { |
2949 | _zeroFlag = true; | 2952 | _zeroFlag = true; |
2953 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
2950 | d.BodyEnable(Body); | 2954 | d.BodyEnable(Body); |
2951 | } | 2955 | } |
2952 | } | 2956 | } |
@@ -3012,6 +3016,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3012 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3016 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3013 | { | 3017 | { |
3014 | _zeroFlag = true; | 3018 | _zeroFlag = true; |
3019 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3015 | d.BodyEnable(Body); | 3020 | d.BodyEnable(Body); |
3016 | } | 3021 | } |
3017 | } | 3022 | } |
@@ -3070,6 +3075,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3070 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3075 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3071 | { | 3076 | { |
3072 | _zeroFlag = true; | 3077 | _zeroFlag = true; |
3078 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3073 | d.BodyEnable(Body); | 3079 | d.BodyEnable(Body); |
3074 | } | 3080 | } |
3075 | } | 3081 | } |
@@ -3312,8 +3318,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3312 | if (m_disabled) | 3318 | if (m_disabled) |
3313 | enableBodySoft(); | 3319 | enableBodySoft(); |
3314 | else if (!d.BodyIsEnabled(Body)) | 3320 | else if (!d.BodyIsEnabled(Body)) |
3321 | { | ||
3322 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3315 | d.BodyEnable(Body); | 3323 | d.BodyEnable(Body); |
3316 | 3324 | } | |
3317 | } | 3325 | } |
3318 | m_torque = newtorque; | 3326 | m_torque = newtorque; |
3319 | } | 3327 | } |
@@ -3323,7 +3331,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3323 | { | 3331 | { |
3324 | m_force = force; | 3332 | m_force = force; |
3325 | if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 3333 | if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) |
3334 | { | ||
3335 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3326 | d.BodyEnable(Body); | 3336 | d.BodyEnable(Body); |
3337 | } | ||
3327 | } | 3338 | } |
3328 | 3339 | ||
3329 | private void changeAddForce(Vector3 theforce) | 3340 | private void changeAddForce(Vector3 theforce) |
@@ -3339,7 +3350,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3339 | if (m_disabled) | 3350 | if (m_disabled) |
3340 | enableBodySoft(); | 3351 | enableBodySoft(); |
3341 | else if (!d.BodyIsEnabled(Body)) | 3352 | else if (!d.BodyIsEnabled(Body)) |
3353 | { | ||
3354 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3342 | d.BodyEnable(Body); | 3355 | d.BodyEnable(Body); |
3356 | } | ||
3343 | } | 3357 | } |
3344 | } | 3358 | } |
3345 | m_collisionscore = 0; | 3359 | m_collisionscore = 0; |
@@ -3359,7 +3373,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3359 | if (m_disabled) | 3373 | if (m_disabled) |
3360 | enableBodySoft(); | 3374 | enableBodySoft(); |
3361 | else if (!d.BodyIsEnabled(Body)) | 3375 | else if (!d.BodyIsEnabled(Body)) |
3376 | { | ||
3377 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3362 | d.BodyEnable(Body); | 3378 | d.BodyEnable(Body); |
3379 | } | ||
3363 | } | 3380 | } |
3364 | } | 3381 | } |
3365 | m_collisionscore = 0; | 3382 | m_collisionscore = 0; |
@@ -3382,7 +3399,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3382 | if (m_disabled) | 3399 | if (m_disabled) |
3383 | enableBodySoft(); | 3400 | enableBodySoft(); |
3384 | else if (!d.BodyIsEnabled(Body)) | 3401 | else if (!d.BodyIsEnabled(Body)) |
3402 | { | ||
3403 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3385 | d.BodyEnable(Body); | 3404 | d.BodyEnable(Body); |
3405 | } | ||
3386 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); | 3406 | d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); |
3387 | } | 3407 | } |
3388 | //resetCollisionAccounting(); | 3408 | //resetCollisionAccounting(); |
@@ -3406,7 +3426,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3406 | if (m_disabled) | 3426 | if (m_disabled) |
3407 | enableBodySoft(); | 3427 | enableBodySoft(); |
3408 | else if (!d.BodyIsEnabled(Body)) | 3428 | else if (!d.BodyIsEnabled(Body)) |
3429 | { | ||
3430 | d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3409 | d.BodyEnable(Body); | 3431 | d.BodyEnable(Body); |
3432 | } | ||
3410 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); | 3433 | d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); |
3411 | } | 3434 | } |
3412 | //resetCollisionAccounting(); | 3435 | //resetCollisionAccounting(); |
@@ -3571,12 +3594,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3571 | d.BodySetAngularVel(Body,0f,0f,0f); | 3594 | d.BodySetAngularVel(Body,0f,0f,0f); |
3572 | d.BodySetLinearVel(Body,0f,0f,0f); | 3595 | d.BodySetLinearVel(Body,0f,0f,0f); |
3573 | _zeroFlag = true; | 3596 | _zeroFlag = true; |
3597 | d.BodySetAutoDisableSteps(Body, 1); | ||
3574 | d.BodyEnable(Body); | 3598 | d.BodyEnable(Body); |
3575 | m_bodydisablecontrol = -4; | 3599 | m_bodydisablecontrol = -3; |
3576 | } | 3600 | } |
3577 | 3601 | ||
3578 | if(m_bodydisablecontrol < 0) | 3602 | if(m_bodydisablecontrol < 0) |
3579 | m_bodydisablecontrol ++; | 3603 | m_bodydisablecontrol++; |
3580 | 3604 | ||
3581 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator | 3605 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator |
3582 | 3606 | ||
@@ -3741,13 +3765,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3741 | 3765 | ||
3742 | public void UpdatePositionAndVelocity(int frame) | 3766 | public void UpdatePositionAndVelocity(int frame) |
3743 | { | 3767 | { |
3744 | if (_parent == null && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero) | 3768 | if (_parent == null && !m_isSelected && !m_disabled && !m_building && !m_outbounds && Body != IntPtr.Zero) |
3745 | { | 3769 | { |
3746 | bool bodyenabled = d.BodyIsEnabled(Body); | ||
3747 | |||
3748 | if(m_bodydisablecontrol < 0) | 3770 | if(m_bodydisablecontrol < 0) |
3749 | return; | 3771 | return; |
3750 | 3772 | ||
3773 | bool bodyenabled = d.BodyIsEnabled(Body); | ||
3751 | if (bodyenabled || !_zeroFlag) | 3774 | if (bodyenabled || !_zeroFlag) |
3752 | { | 3775 | { |
3753 | bool lastZeroFlag = _zeroFlag; | 3776 | bool lastZeroFlag = _zeroFlag; |
@@ -3891,7 +3914,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3891 | // disable interpolators | 3914 | // disable interpolators |
3892 | _velocity = Vector3.Zero; | 3915 | _velocity = Vector3.Zero; |
3893 | m_acceleration = Vector3.Zero; | 3916 | m_acceleration = Vector3.Zero; |
3894 | m_rotationalVelocity = Vector3.Zero; | 3917 | m_rotationalVelocity = Vector3.Zero; |
3895 | } | 3918 | } |
3896 | else | 3919 | else |
3897 | { | 3920 | { |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 86d41ea..004ee7f 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -203,8 +203,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
203 | private float metersInSpace = 25.6f; | 203 | private float metersInSpace = 25.6f; |
204 | private float m_timeDilation = 1.0f; | 204 | private float m_timeDilation = 1.0f; |
205 | 205 | ||
206 | private DateTime m_lastframe; | 206 | private double m_lastframe; |
207 | private DateTime m_lastMeshExpire; | 207 | private double m_lastMeshExpire; |
208 | 208 | ||
209 | public float gravityx = 0f; | 209 | public float gravityx = 0f; |
210 | public float gravityy = 0f; | 210 | public float gravityy = 0f; |
@@ -481,7 +481,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
481 | contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", contactsPerCollision); | 481 | contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", contactsPerCollision); |
482 | 482 | ||
483 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); | 483 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); |
484 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); | 484 | // bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); |
485 | 485 | ||
486 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); | 486 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); |
487 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); | 487 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); |
@@ -629,8 +629,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
629 | staticPrimspaceOffRegion[i] = newspace; | 629 | staticPrimspaceOffRegion[i] = newspace; |
630 | } | 630 | } |
631 | 631 | ||
632 | m_lastframe = DateTime.UtcNow; | 632 | m_lastframe = Util.GetTimeStamp(); |
633 | m_lastMeshExpire = m_lastframe; | 633 | m_lastMeshExpire = m_lastframe; |
634 | step_time = -1; | ||
634 | } | 635 | } |
635 | 636 | ||
636 | internal void waitForSpaceUnlock(IntPtr space) | 637 | internal void waitForSpaceUnlock(IntPtr space) |
@@ -952,8 +953,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
952 | SharedTmpcontact.surface.bounce = bounce; | 953 | SharedTmpcontact.surface.bounce = bounce; |
953 | 954 | ||
954 | d.ContactGeom altContact = new d.ContactGeom(); | 955 | d.ContactGeom altContact = new d.ContactGeom(); |
955 | bool useAltcontact = false; | 956 | bool useAltcontact; |
956 | bool noskip = true; | 957 | bool noskip; |
957 | 958 | ||
958 | if(dop1ava || dop2ava) | 959 | if(dop1ava || dop2ava) |
959 | smoothMesh = false; | 960 | smoothMesh = false; |
@@ -1000,7 +1001,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1000 | Joint = CreateContacJoint(ref altContact,smoothMesh); | 1001 | Joint = CreateContacJoint(ref altContact,smoothMesh); |
1001 | else | 1002 | else |
1002 | Joint = CreateContacJoint(ref curContact,smoothMesh); | 1003 | Joint = CreateContacJoint(ref curContact,smoothMesh); |
1003 | |||
1004 | if (Joint == IntPtr.Zero) | 1004 | if (Joint == IntPtr.Zero) |
1005 | break; | 1005 | break; |
1006 | 1006 | ||
@@ -1626,6 +1626,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1626 | } | 1626 | } |
1627 | m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count); | 1627 | m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count); |
1628 | } | 1628 | } |
1629 | m_lastframe = Util.GetTimeStamp() + 0.5; | ||
1630 | step_time = -0.5f; | ||
1629 | } | 1631 | } |
1630 | 1632 | ||
1631 | /// <summary> | 1633 | /// <summary> |
@@ -1639,13 +1641,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1639 | /// <returns></returns> | 1641 | /// <returns></returns> |
1640 | public override float Simulate(float reqTimeStep) | 1642 | public override float Simulate(float reqTimeStep) |
1641 | { | 1643 | { |
1642 | DateTime now = DateTime.UtcNow; | 1644 | double now = Util.GetTimeStamp(); |
1643 | TimeSpan timedif = now - m_lastframe; | 1645 | double timeStep = now - m_lastframe; |
1644 | float timeStep = (float)timedif.TotalSeconds; | ||
1645 | m_lastframe = now; | 1646 | m_lastframe = now; |
1646 | 1647 | ||
1647 | // acumulate time so we can reduce error | 1648 | // acumulate time so we can reduce error |
1648 | step_time += timeStep; | 1649 | step_time += (float)timeStep; |
1649 | 1650 | ||
1650 | if (step_time < HalfOdeStep) | 1651 | if (step_time < HalfOdeStep) |
1651 | return 0; | 1652 | return 0; |
@@ -1854,14 +1855,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1854 | } | 1855 | } |
1855 | } | 1856 | } |
1856 | 1857 | ||
1857 | timedif = now - m_lastMeshExpire; | ||
1858 | |||
1859 | if (timedif.Seconds > 10) | ||
1860 | { | ||
1861 | mesher.ExpireReleaseMeshs(); | ||
1862 | m_lastMeshExpire = now; | ||
1863 | } | ||
1864 | |||
1865 | // information block for in debug breakpoint only | 1858 | // information block for in debug breakpoint only |
1866 | /* | 1859 | /* |
1867 | int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); | 1860 | int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); |
@@ -1941,7 +1934,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1941 | // if we lag too much skip frames | 1934 | // if we lag too much skip frames |
1942 | m_timeDilation = 0.0f; | 1935 | m_timeDilation = 0.0f; |
1943 | step_time = 0; | 1936 | step_time = 0; |
1944 | m_lastframe = DateTime.UtcNow; // skip also the time lost | 1937 | m_lastframe = Util.GetTimeStamp(); // skip also the time lost |
1945 | } | 1938 | } |
1946 | else | 1939 | else |
1947 | { | 1940 | { |
@@ -1949,6 +1942,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1949 | if (m_timeDilation > 1) | 1942 | if (m_timeDilation > 1) |
1950 | m_timeDilation = 1; | 1943 | m_timeDilation = 1; |
1951 | } | 1944 | } |
1945 | |||
1946 | if (m_timeDilation == 1 && now - m_lastMeshExpire > 30) | ||
1947 | { | ||
1948 | mesher.ExpireReleaseMeshs(); | ||
1949 | m_lastMeshExpire = now; | ||
1950 | } | ||
1951 | |||
1952 | |||
1952 | } | 1953 | } |
1953 | 1954 | ||
1954 | return fps; | 1955 | return fps; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index af88e4f..c13e8b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3534,32 +3534,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3534 | public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot) | 3534 | public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot) |
3535 | { | 3535 | { |
3536 | m_host.AddScriptLPS(1); | 3536 | m_host.AddScriptLPS(1); |
3537 | if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) | ||
3538 | return; | ||
3537 | 3539 | ||
3538 | Util.FireAndForget(x => | 3540 | float dist = (float)llVecDist(llGetPos(), pos); |
3539 | { | ||
3540 | if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) | ||
3541 | return; | ||
3542 | 3541 | ||
3543 | float dist = (float)llVecDist(llGetPos(), pos); | 3542 | if (dist > m_ScriptDistanceFactor * 10.0f) |
3543 | return; | ||
3544 | 3544 | ||
3545 | if (dist > m_ScriptDistanceFactor * 10.0f) | 3545 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); |
3546 | return; | ||
3547 | 3546 | ||
3548 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); | 3547 | if (item == null) |
3548 | { | ||
3549 | Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'"); | ||
3550 | return; | ||
3551 | } | ||
3549 | 3552 | ||
3550 | if (item == null) | 3553 | if (item.InvType != (int)InventoryType.Object) |
3551 | { | 3554 | { |
3552 | Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'"); | 3555 | Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database"); |
3553 | return; | 3556 | return; |
3554 | } | 3557 | } |
3555 | 3558 | ||
3556 | if (item.InvType != (int)InventoryType.Object) | 3559 | Util.FireAndForget(x => |
3557 | { | 3560 | { |
3558 | Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database"); | ||
3559 | return; | ||
3560 | } | ||
3561 | 3561 | ||
3562 | List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param, atRoot); | 3562 | Quaternion wrot = rot; |
3563 | wrot.Normalize(); | ||
3564 | List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, wrot, vel, param, atRoot); | ||
3563 | 3565 | ||
3564 | // If either of these are null, then there was an unknown error. | 3566 | // If either of these are null, then there was an unknown error. |
3565 | if (new_groups == null) | 3567 | if (new_groups == null) |
@@ -3596,9 +3598,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3596 | } | 3598 | } |
3597 | } | 3599 | } |
3598 | } | 3600 | } |
3599 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) | 3601 | } |
3600 | } | ||
3601 | |||
3602 | }, null, "LSL_Api.doObjectRez"); | 3602 | }, null, "LSL_Api.doObjectRez"); |
3603 | 3603 | ||
3604 | //ScriptSleep((int)((groupmass * velmag) / 10)); | 3604 | //ScriptSleep((int)((groupmass * velmag) / 10)); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e51a078..79367fb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -264,6 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
264 | // for safe funtions always active | 264 | // for safe funtions always active |
265 | public void CheckThreatLevel() | 265 | public void CheckThreatLevel() |
266 | { | 266 | { |
267 | m_host.AddScriptLPS(1); | ||
267 | if (!m_OSFunctionsEnabled) | 268 | if (!m_OSFunctionsEnabled) |
268 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws | 269 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws |
269 | } | 270 | } |
@@ -271,6 +272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
271 | // Returns if the function is allowed. Throws a script exception if not allowed. | 272 | // Returns if the function is allowed. Throws a script exception if not allowed. |
272 | public void CheckThreatLevel(ThreatLevel level, string function) | 273 | public void CheckThreatLevel(ThreatLevel level, string function) |
273 | { | 274 | { |
275 | m_host.AddScriptLPS(1); | ||
274 | if (!m_OSFunctionsEnabled) | 276 | if (!m_OSFunctionsEnabled) |
275 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws | 277 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws |
276 | 278 | ||
@@ -452,7 +454,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
452 | } | 454 | } |
453 | } | 455 | } |
454 | 456 | ||
455 | |||
456 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) | 457 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
457 | return( | 458 | return( |
458 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 459 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
@@ -499,8 +500,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
499 | 500 | ||
500 | private LSL_Integer SetTerrainHeight(int x, int y, double val) | 501 | private LSL_Integer SetTerrainHeight(int x, int y, double val) |
501 | { | 502 | { |
502 | m_host.AddScriptLPS(1); | ||
503 | |||
504 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) | 503 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
505 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); | 504 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); |
506 | 505 | ||
@@ -517,20 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
517 | 516 | ||
518 | public LSL_Float osGetTerrainHeight(int x, int y) | 517 | public LSL_Float osGetTerrainHeight(int x, int y) |
519 | { | 518 | { |
520 | CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); | 519 | CheckThreatLevel(); |
521 | return GetTerrainHeight(x, y); | 520 | return GetTerrainHeight(x, y); |
522 | } | 521 | } |
523 | 522 | ||
524 | public LSL_Float osTerrainGetHeight(int x, int y) | 523 | public LSL_Float osTerrainGetHeight(int x, int y) |
525 | { | 524 | { |
526 | CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); | 525 | CheckThreatLevel(); |
527 | OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); | 526 | OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); |
528 | return GetTerrainHeight(x, y); | 527 | return GetTerrainHeight(x, y); |
529 | } | 528 | } |
530 | 529 | ||
531 | private LSL_Float GetTerrainHeight(int x, int y) | 530 | private LSL_Float GetTerrainHeight(int x, int y) |
532 | { | 531 | { |
533 | m_host.AddScriptLPS(1); | ||
534 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) | 532 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
535 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); | 533 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); |
536 | 534 | ||
@@ -540,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
540 | public void osTerrainFlush() | 538 | public void osTerrainFlush() |
541 | { | 539 | { |
542 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); | 540 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); |
543 | m_host.AddScriptLPS(1); | ||
544 | 541 | ||
545 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); | 542 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); |
546 | if (terrainModule != null) terrainModule.TaintTerrain(); | 543 | if (terrainModule != null) terrainModule.TaintTerrain(); |
@@ -557,7 +554,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
557 | CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); | 554 | CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); |
558 | 555 | ||
559 | IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); | 556 | IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); |
560 | m_host.AddScriptLPS(1); | ||
561 | if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) | 557 | if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) |
562 | { | 558 | { |
563 | if (seconds < 15) | 559 | if (seconds < 15) |
@@ -580,7 +576,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
580 | CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); | 576 | CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); |
581 | 577 | ||
582 | IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); | 578 | IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>(); |
583 | m_host.AddScriptLPS(1); | ||
584 | if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) | 579 | if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null)) |
585 | { | 580 | { |
586 | if (seconds < 15) | 581 | if (seconds < 15) |
@@ -631,8 +626,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
631 | // | 626 | // |
632 | CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); | 627 | CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); |
633 | 628 | ||
634 | m_host.AddScriptLPS(1); | ||
635 | |||
636 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | 629 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); |
637 | 630 | ||
638 | if (dm != null) | 631 | if (dm != null) |
@@ -646,7 +639,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
646 | // | 639 | // |
647 | CheckThreatLevel(ThreatLevel.VeryHigh, "osSetRot"); | 640 | CheckThreatLevel(ThreatLevel.VeryHigh, "osSetRot"); |
648 | 641 | ||
649 | m_host.AddScriptLPS(1); | ||
650 | if (World.Entities.ContainsKey(target)) | 642 | if (World.Entities.ContainsKey(target)) |
651 | { | 643 | { |
652 | EntityBase entity; | 644 | EntityBase entity; |
@@ -672,13 +664,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
672 | // | 664 | // |
673 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURL"); | 665 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURL"); |
674 | 666 | ||
675 | m_host.AddScriptLPS(1); | ||
676 | if (dynamicID == String.Empty) | 667 | if (dynamicID == String.Empty) |
677 | { | 668 | { |
678 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 669 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
679 | UUID createdTexture = | 670 | UUID createdTexture = |
680 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | 671 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, |
681 | extraParams, timer); | 672 | extraParams); |
682 | return createdTexture.ToString(); | 673 | return createdTexture.ToString(); |
683 | } | 674 | } |
684 | else | 675 | else |
@@ -694,13 +685,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
694 | { | 685 | { |
695 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend"); | 686 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend"); |
696 | 687 | ||
697 | m_host.AddScriptLPS(1); | ||
698 | if (dynamicID == String.Empty) | 688 | if (dynamicID == String.Empty) |
699 | { | 689 | { |
700 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 690 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
701 | UUID createdTexture = | 691 | UUID createdTexture = |
702 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | 692 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, |
703 | extraParams, timer, true, (byte) alpha); | 693 | extraParams, true, (byte) alpha); |
704 | return createdTexture.ToString(); | 694 | return createdTexture.ToString(); |
705 | } | 695 | } |
706 | else | 696 | else |
@@ -716,13 +706,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
716 | { | 706 | { |
717 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlendFace"); | 707 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlendFace"); |
718 | 708 | ||
719 | m_host.AddScriptLPS(1); | ||
720 | if (dynamicID == String.Empty) | 709 | if (dynamicID == String.Empty) |
721 | { | 710 | { |
722 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 711 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
723 | UUID createdTexture = | 712 | UUID createdTexture = |
724 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | 713 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, |
725 | extraParams, timer, blend, disp, (byte) alpha, face); | 714 | extraParams, blend, disp, (byte) alpha, face); |
726 | return createdTexture.ToString(); | 715 | return createdTexture.ToString(); |
727 | } | 716 | } |
728 | else | 717 | else |
@@ -736,9 +725,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
736 | public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, | 725 | public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, |
737 | int timer) | 726 | int timer) |
738 | { | 727 | { |
728 | return osSetDynamicTextureDataFace(dynamicID, contentType, data, extraParams, timer, -1); | ||
729 | } | ||
730 | |||
731 | public string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams, | ||
732 | int timer, int face) | ||
733 | { | ||
739 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData"); | 734 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData"); |
740 | 735 | ||
741 | m_host.AddScriptLPS(1); | ||
742 | if (dynamicID == String.Empty) | 736 | if (dynamicID == String.Empty) |
743 | { | 737 | { |
744 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 738 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
@@ -750,7 +744,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
750 | } | 744 | } |
751 | UUID createdTexture = | 745 | UUID createdTexture = |
752 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, | 746 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, |
753 | extraParams, timer); | 747 | extraParams, false, 3, 255, face); |
748 | |||
754 | return createdTexture.ToString(); | 749 | return createdTexture.ToString(); |
755 | } | 750 | } |
756 | } | 751 | } |
@@ -767,7 +762,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
767 | { | 762 | { |
768 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend"); | 763 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend"); |
769 | 764 | ||
770 | m_host.AddScriptLPS(1); | ||
771 | if (dynamicID == String.Empty) | 765 | if (dynamicID == String.Empty) |
772 | { | 766 | { |
773 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 767 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
@@ -779,7 +773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
779 | } | 773 | } |
780 | UUID createdTexture = | 774 | UUID createdTexture = |
781 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, | 775 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, |
782 | extraParams, timer, true, (byte) alpha); | 776 | extraParams, true, (byte) alpha); |
783 | return createdTexture.ToString(); | 777 | return createdTexture.ToString(); |
784 | } | 778 | } |
785 | } | 779 | } |
@@ -794,9 +788,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
794 | public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, | 788 | public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, |
795 | bool blend, int disp, int timer, int alpha, int face) | 789 | bool blend, int disp, int timer, int alpha, int face) |
796 | { | 790 | { |
797 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlendFace"); | 791 | CheckThreatLevel(ThreatLevel.VeryLow , "osSetDynamicTextureDataBlendFace"); |
798 | 792 | ||
799 | m_host.AddScriptLPS(1); | ||
800 | if (dynamicID == String.Empty) | 793 | if (dynamicID == String.Empty) |
801 | { | 794 | { |
802 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 795 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
@@ -808,7 +801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
808 | } | 801 | } |
809 | UUID createdTexture = | 802 | UUID createdTexture = |
810 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, | 803 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, |
811 | extraParams, timer, blend, disp, (byte) alpha, face); | 804 | extraParams, blend, disp, (byte) alpha, face); |
812 | return createdTexture.ToString(); | 805 | return createdTexture.ToString(); |
813 | } | 806 | } |
814 | } | 807 | } |
@@ -824,8 +817,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
824 | { | 817 | { |
825 | CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand"); | 818 | CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand"); |
826 | 819 | ||
827 | m_host.AddScriptLPS(1); | ||
828 | |||
829 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions | 820 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions |
830 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 821 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
831 | { | 822 | { |
@@ -840,11 +831,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
840 | { | 831 | { |
841 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); | 832 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); |
842 | 833 | ||
843 | m_host.AddScriptLPS(1); | ||
844 | |||
845 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); | 834 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); |
846 | } | 835 | } |
847 | 836 | ||
837 | private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos) | ||
838 | { | ||
839 | UUID hostOwner = m_host.OwnerID; | ||
840 | |||
841 | if(hostOwner == agentId) | ||
842 | return true; | ||
843 | |||
844 | if (m_item.PermsGranter == agentId) | ||
845 | { | ||
846 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) | ||
847 | return true; | ||
848 | } | ||
849 | |||
850 | ILandObject land = World.LandChannel.GetLandObject(pos); | ||
851 | if(land == null) | ||
852 | return true; | ||
853 | |||
854 | LandData landdata = land.LandData; | ||
855 | if(landdata == null) | ||
856 | return true; | ||
857 | |||
858 | if(landdata.OwnerID == hostOwner) | ||
859 | return true; | ||
860 | |||
861 | EstateSettings es = World.RegionInfo.EstateSettings; | ||
862 | if(es != null && es.IsEstateManagerOrOwner(hostOwner)) | ||
863 | return true; | ||
864 | |||
865 | if(!landdata.IsGroupOwned) | ||
866 | return false; | ||
867 | |||
868 | UUID landGroup = landdata.GroupID; | ||
869 | if(landGroup == UUID.Zero) | ||
870 | return false; | ||
871 | |||
872 | if(landGroup == m_host.GroupID) | ||
873 | return true; | ||
874 | |||
875 | return false; | ||
876 | } | ||
877 | |||
848 | // Teleport functions | 878 | // Teleport functions |
849 | public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 879 | public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
850 | { | 880 | { |
@@ -852,41 +882,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
852 | // | 882 | // |
853 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); | 883 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
854 | 884 | ||
855 | TeleportAgent(agent, regionName, position, lookat, false); | 885 | TeleportAgent(agent, regionName, position, lookat); |
856 | } | 886 | } |
857 | 887 | ||
858 | private void TeleportAgent(string agent, string regionName, | 888 | private void TeleportAgent(string agent, string regionName, |
859 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | 889 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
860 | { | 890 | { |
861 | m_host.AddScriptLPS(1); | 891 | if(String.IsNullOrEmpty(regionName)) |
862 | UUID agentId = new UUID(); | 892 | regionName = World.RegionInfo.RegionName; |
893 | |||
894 | UUID agentId; | ||
863 | if (UUID.TryParse(agent, out agentId)) | 895 | if (UUID.TryParse(agent, out agentId)) |
864 | { | 896 | { |
865 | ScenePresence presence = World.GetScenePresence(agentId); | 897 | ScenePresence presence = World.GetScenePresence(agentId); |
866 | if (presence != null) | 898 | if (presence == null || presence.IsDeleted || presence.IsInTransit) |
867 | { | 899 | return; |
868 | // For osTeleportAgent, agent must be over owners land to avoid abuse | ||
869 | // For osTeleportOwner, this restriction isn't necessary | ||
870 | |||
871 | // commented out because its redundant and uneeded please remove eventually. | ||
872 | // if (relaxRestrictions || | ||
873 | // m_host.OwnerID | ||
874 | // == World.LandChannel.GetLandObject( | ||
875 | // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
876 | // { | ||
877 | |||
878 | // We will launch the teleport on a new thread so that when the script threads are terminated | ||
879 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. | ||
880 | Util.FireAndForget( | ||
881 | o => World.RequestTeleportLocation( | ||
882 | presence.ControllingClient, regionName, position, | ||
883 | lookat, (uint)TPFlags.ViaLocation), | ||
884 | null, "OSSL_Api.TeleportAgentByRegionCoords"); | ||
885 | |||
886 | ScriptSleep(5000); | ||
887 | 900 | ||
888 | // } | 901 | Vector3 pos = presence.AbsolutePosition; |
902 | if(!checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
903 | { | ||
904 | ScriptSleep(500); | ||
905 | return; | ||
906 | } | ||
889 | 907 | ||
908 | if(regionName == World.RegionInfo.RegionName) | ||
909 | { | ||
910 | // should be faster than going to threadpool | ||
911 | World.RequestTeleportLocation(presence.ControllingClient, regionName, position, | ||
912 | lookat, (uint)TPFlags.ViaLocation); | ||
913 | ScriptSleep(500); | ||
914 | } | ||
915 | else | ||
916 | { | ||
917 | // We will launch the teleport on a new thread so that when the script threads are terminated | ||
918 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. | ||
919 | Util.FireAndForget( | ||
920 | o => World.RequestTeleportLocation( | ||
921 | presence.ControllingClient, regionName, position, | ||
922 | lookat, (uint)TPFlags.ViaLocation), | ||
923 | null, "OSSL_Api.TeleportAgentByRegionCoords"); | ||
924 | ScriptSleep(5000); | ||
890 | } | 925 | } |
891 | } | 926 | } |
892 | } | 927 | } |
@@ -897,50 +932,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
897 | // | 932 | // |
898 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); | 933 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
899 | 934 | ||
900 | TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false); | 935 | TeleportAgent(agent, regionGridX, regionGridY, position, lookat); |
901 | } | 936 | } |
902 | 937 | ||
903 | private void TeleportAgent(string agent, int regionGridX, int regionGridY, | 938 | private void TeleportAgent(string agent, int regionGridX, int regionGridY, |
904 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | 939 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
905 | { | 940 | { |
906 | ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); | 941 | ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); |
907 | 942 | ||
908 | m_host.AddScriptLPS(1); | 943 | UUID agentId; |
909 | UUID agentId = new UUID(); | ||
910 | if (UUID.TryParse(agent, out agentId)) | 944 | if (UUID.TryParse(agent, out agentId)) |
911 | { | 945 | { |
912 | ScenePresence presence = World.GetScenePresence(agentId); | 946 | ScenePresence presence = World.GetScenePresence(agentId); |
913 | if (presence != null) | 947 | if (presence == null || presence.IsDeleted || presence.IsInTransit) |
914 | { | 948 | return; |
915 | // For osTeleportAgent, agent must be over owners land to avoid abuse | ||
916 | // For osTeleportOwner, this restriction isn't necessary | ||
917 | |||
918 | // commented out because its redundant and uneeded please remove eventually. | ||
919 | // if (relaxRestrictions || | ||
920 | // m_host.OwnerID | ||
921 | // == World.LandChannel.GetLandObject( | ||
922 | // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
923 | // { | ||
924 | |||
925 | // We will launch the teleport on a new thread so that when the script threads are terminated | ||
926 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. | ||
927 | Util.FireAndForget( | ||
928 | o => World.RequestTeleportLocation( | ||
929 | presence.ControllingClient, regionHandle, | ||
930 | position, lookat, (uint)TPFlags.ViaLocation), | ||
931 | null, "OSSL_Api.TeleportAgentByRegionName"); | ||
932 | 949 | ||
933 | ScriptSleep(5000); | 950 | Vector3 pos = presence.AbsolutePosition; |
951 | if(!checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
952 | { | ||
953 | ScriptSleep(500); | ||
954 | return; | ||
955 | } | ||
934 | 956 | ||
935 | // } | 957 | Util.FireAndForget( |
958 | o => World.RequestTeleportLocation( | ||
959 | presence.ControllingClient, regionHandle, | ||
960 | position, lookat, (uint)TPFlags.ViaLocation), | ||
961 | null, "OSSL_Api.TeleportAgentByRegionName"); | ||
936 | 962 | ||
937 | } | 963 | ScriptSleep(5000); |
938 | } | 964 | } |
939 | } | 965 | } |
940 | 966 | ||
941 | public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 967 | public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
942 | { | 968 | { |
943 | osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); | 969 | UUID agentId; |
970 | if (UUID.TryParse(agent, out agentId)) | ||
971 | { | ||
972 | ScenePresence presence = World.GetScenePresence(agentId); | ||
973 | if (presence == null || presence.IsDeleted || presence.IsInTransit) | ||
974 | return; | ||
975 | |||
976 | Vector3 pos = presence.AbsolutePosition; | ||
977 | if(!checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
978 | { | ||
979 | ScriptSleep(500); | ||
980 | return; | ||
981 | } | ||
982 | |||
983 | World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position, | ||
984 | lookat, (uint)TPFlags.ViaLocation); | ||
985 | ScriptSleep(500); | ||
986 | } | ||
944 | } | 987 | } |
945 | 988 | ||
946 | public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 989 | public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
@@ -948,19 +991,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
948 | // Threat level None because this is what can already be done with the World Map in the viewer | 991 | // Threat level None because this is what can already be done with the World Map in the viewer |
949 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 992 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
950 | 993 | ||
951 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); | 994 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); |
952 | } | 995 | } |
953 | 996 | ||
954 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 997 | public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
955 | { | 998 | { |
956 | osTeleportOwner(World.RegionInfo.RegionName, position, lookat); | 999 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
1000 | |||
1001 | TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat); | ||
957 | } | 1002 | } |
958 | 1003 | ||
959 | public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 1004 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
960 | { | 1005 | { |
961 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 1006 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
962 | 1007 | ||
963 | TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, true); | 1008 | osTeleportAgent(m_host.OwnerID.ToString(), position, lookat); |
964 | } | 1009 | } |
965 | 1010 | ||
966 | ///<summary> | 1011 | ///<summary> |
@@ -974,8 +1019,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
974 | { | 1019 | { |
975 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); | 1020 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); |
976 | 1021 | ||
977 | m_host.AddScriptLPS(1); | ||
978 | |||
979 | ForceSit(avatar, m_host.UUID); | 1022 | ForceSit(avatar, m_host.UUID); |
980 | } | 1023 | } |
981 | 1024 | ||
@@ -989,8 +1032,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
989 | { | 1032 | { |
990 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); | 1033 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); |
991 | 1034 | ||
992 | m_host.AddScriptLPS(1); | ||
993 | |||
994 | UUID targetID = new UUID(target); | 1035 | UUID targetID = new UUID(target); |
995 | 1036 | ||
996 | ForceSit(avatar, targetID); | 1037 | ForceSit(avatar, targetID); |
@@ -1015,21 +1056,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1015 | targetID, | 1056 | targetID, |
1016 | part.SitTargetPosition); | 1057 | part.SitTargetPosition); |
1017 | } | 1058 | } |
1059 | |||
1060 | // Get a list of all the avatars/agents in the region | ||
1061 | public LSL_List osGetAgents() | ||
1062 | { | ||
1063 | // threat level is None as we could get this information with an | ||
1064 | // in-world script as well, just not as efficient | ||
1065 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); | ||
1066 | |||
1067 | LSL_List result = new LSL_List(); | ||
1068 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
1069 | { | ||
1070 | result.Add(new LSL_String(sp.Name)); | ||
1071 | }); | ||
1072 | return result; | ||
1073 | } | ||
1018 | 1074 | ||
1019 | // Functions that get information from the agent itself. | ||
1020 | // | ||
1021 | // osGetAgentIP - this is used to determine the IP address of | ||
1022 | //the client. This is needed to help configure other in world | ||
1023 | //resources based on the IP address of the clients connected. | ||
1024 | //I think High is a good risk level for this, as it is an | ||
1025 | //information leak. | ||
1026 | public string osGetAgentIP(string agent) | 1075 | public string osGetAgentIP(string agent) |
1027 | { | 1076 | { |
1028 | CheckThreatLevel(ThreatLevel.High, "osGetAgentIP"); | 1077 | CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP"); |
1078 | if(!(World.Permissions.IsGod(m_host.OwnerID))) // user god always needed | ||
1079 | return ""; | ||
1029 | 1080 | ||
1030 | UUID avatarID = (UUID)agent; | 1081 | UUID avatarID = (UUID)agent; |
1031 | 1082 | ||
1032 | m_host.AddScriptLPS(1); | ||
1033 | if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) | 1083 | if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) |
1034 | { | 1084 | { |
1035 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 1085 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; |
@@ -1040,22 +1090,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1040 | return ""; | 1090 | return ""; |
1041 | } | 1091 | } |
1042 | 1092 | ||
1043 | // Get a list of all the avatars/agents in the region | ||
1044 | public LSL_List osGetAgents() | ||
1045 | { | ||
1046 | // threat level is None as we could get this information with an | ||
1047 | // in-world script as well, just not as efficient | ||
1048 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); | ||
1049 | m_host.AddScriptLPS(1); | ||
1050 | |||
1051 | LSL_List result = new LSL_List(); | ||
1052 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
1053 | { | ||
1054 | result.Add(new LSL_String(sp.Name)); | ||
1055 | }); | ||
1056 | return result; | ||
1057 | } | ||
1058 | |||
1059 | // Adam's super super custom animation functions | 1093 | // Adam's super super custom animation functions |
1060 | public void osAvatarPlayAnimation(string avatar, string animation) | 1094 | public void osAvatarPlayAnimation(string avatar, string animation) |
1061 | { | 1095 | { |
@@ -1066,19 +1100,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1066 | 1100 | ||
1067 | private void AvatarPlayAnimation(string avatar, string animation) | 1101 | private void AvatarPlayAnimation(string avatar, string animation) |
1068 | { | 1102 | { |
1069 | m_host.AddScriptLPS(1); | ||
1070 | |||
1071 | UUID avatarID; | 1103 | UUID avatarID; |
1072 | if(!UUID.TryParse(avatar, out avatarID)) | 1104 | if(!UUID.TryParse(avatar, out avatarID)) |
1073 | return; | 1105 | return; |
1074 | 1106 | ||
1075 | if(!World.Entities.ContainsKey(avatarID)) | 1107 | ScenePresence target = World.GetScenePresence(avatarID); |
1076 | return; | ||
1077 | |||
1078 | ScenePresence target = null; | ||
1079 | if ((World.Entities[avatarID] is ScenePresence)) | ||
1080 | target = (ScenePresence)World.Entities[avatarID]; | ||
1081 | |||
1082 | if (target == null) | 1108 | if (target == null) |
1083 | return; | 1109 | return; |
1084 | 1110 | ||
@@ -1114,8 +1140,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1114 | { | 1140 | { |
1115 | UUID avatarID = (UUID)avatar; | 1141 | UUID avatarID = (UUID)avatar; |
1116 | 1142 | ||
1117 | m_host.AddScriptLPS(1); | ||
1118 | |||
1119 | // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common | 1143 | // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common |
1120 | // method (though see that doesn't do the is animation check, which is probably a bug) and have both | 1144 | // method (though see that doesn't do the is animation check, which is probably a bug) and have both |
1121 | // these functions call that common code. However, this does mean navigating the brain-dead requirement | 1145 | // these functions call that common code. However, this does mean navigating the brain-dead requirement |
@@ -1146,29 +1170,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1146 | } | 1170 | } |
1147 | 1171 | ||
1148 | //Texture draw functions | 1172 | //Texture draw functions |
1173 | |||
1174 | public string osDrawResetTransform(string drawList) | ||
1175 | { | ||
1176 | CheckThreatLevel(); | ||
1177 | |||
1178 | drawList += "ResetTransf;"; | ||
1179 | return drawList; | ||
1180 | } | ||
1181 | |||
1182 | public string osDrawRotationTransform(string drawList, LSL_Float x) | ||
1183 | { | ||
1184 | CheckThreatLevel(); | ||
1185 | |||
1186 | drawList += "RotTransf " + x + ";"; | ||
1187 | return drawList; | ||
1188 | } | ||
1189 | |||
1190 | public string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y) | ||
1191 | { | ||
1192 | CheckThreatLevel(); | ||
1193 | |||
1194 | drawList += "ScaleTransf " + x + "," + y + ";"; | ||
1195 | return drawList; | ||
1196 | } | ||
1197 | |||
1198 | public string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y) | ||
1199 | { | ||
1200 | CheckThreatLevel(); | ||
1201 | |||
1202 | drawList += "TransTransf " + x + "," + y + ";"; | ||
1203 | return drawList; | ||
1204 | } | ||
1205 | |||
1149 | public string osMovePen(string drawList, int x, int y) | 1206 | public string osMovePen(string drawList, int x, int y) |
1150 | { | 1207 | { |
1151 | CheckThreatLevel(ThreatLevel.None, "osMovePen"); | 1208 | CheckThreatLevel(); |
1152 | 1209 | ||
1153 | m_host.AddScriptLPS(1); | ||
1154 | drawList += "MoveTo " + x + "," + y + ";"; | 1210 | drawList += "MoveTo " + x + "," + y + ";"; |
1155 | return drawList; | 1211 | return drawList; |
1156 | } | 1212 | } |
1157 | 1213 | ||
1158 | public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) | 1214 | public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) |
1159 | { | 1215 | { |
1160 | CheckThreatLevel(ThreatLevel.None, "osDrawLine"); | 1216 | CheckThreatLevel(); |
1161 | 1217 | ||
1162 | m_host.AddScriptLPS(1); | ||
1163 | drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; "; | 1218 | drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; "; |
1164 | return drawList; | 1219 | return drawList; |
1165 | } | 1220 | } |
1166 | 1221 | ||
1167 | public string osDrawLine(string drawList, int endX, int endY) | 1222 | public string osDrawLine(string drawList, int endX, int endY) |
1168 | { | 1223 | { |
1169 | CheckThreatLevel(ThreatLevel.None, "osDrawLine"); | 1224 | CheckThreatLevel(); |
1170 | 1225 | ||
1171 | m_host.AddScriptLPS(1); | ||
1172 | drawList += "LineTo " + endX + "," + endY + "; "; | 1226 | drawList += "LineTo " + endX + "," + endY + "; "; |
1173 | return drawList; | 1227 | return drawList; |
1174 | } | 1228 | } |
@@ -1177,43 +1231,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1177 | { | 1231 | { |
1178 | CheckThreatLevel(ThreatLevel.None, "osDrawText"); | 1232 | CheckThreatLevel(ThreatLevel.None, "osDrawText"); |
1179 | 1233 | ||
1180 | m_host.AddScriptLPS(1); | ||
1181 | drawList += "Text " + text + "; "; | 1234 | drawList += "Text " + text + "; "; |
1182 | return drawList; | 1235 | return drawList; |
1183 | } | 1236 | } |
1184 | 1237 | ||
1185 | public string osDrawEllipse(string drawList, int width, int height) | 1238 | public string osDrawEllipse(string drawList, int width, int height) |
1186 | { | 1239 | { |
1187 | CheckThreatLevel(ThreatLevel.None, "osDrawEllipse"); | 1240 | CheckThreatLevel(); |
1188 | 1241 | ||
1189 | m_host.AddScriptLPS(1); | ||
1190 | drawList += "Ellipse " + width + "," + height + "; "; | 1242 | drawList += "Ellipse " + width + "," + height + "; "; |
1191 | return drawList; | 1243 | return drawList; |
1192 | } | 1244 | } |
1193 | 1245 | ||
1246 | public string osDrawFilledEllipse(string drawList, int width, int height) | ||
1247 | { | ||
1248 | CheckThreatLevel(); | ||
1249 | |||
1250 | drawList += "FillEllipse " + width + "," + height + "; "; | ||
1251 | return drawList; | ||
1252 | } | ||
1253 | |||
1194 | public string osDrawRectangle(string drawList, int width, int height) | 1254 | public string osDrawRectangle(string drawList, int width, int height) |
1195 | { | 1255 | { |
1196 | CheckThreatLevel(ThreatLevel.None, "osDrawRectangle"); | 1256 | CheckThreatLevel(); |
1197 | 1257 | ||
1198 | m_host.AddScriptLPS(1); | ||
1199 | drawList += "Rectangle " + width + "," + height + "; "; | 1258 | drawList += "Rectangle " + width + "," + height + "; "; |
1200 | return drawList; | 1259 | return drawList; |
1201 | } | 1260 | } |
1202 | 1261 | ||
1203 | public string osDrawFilledRectangle(string drawList, int width, int height) | 1262 | public string osDrawFilledRectangle(string drawList, int width, int height) |
1204 | { | 1263 | { |
1205 | CheckThreatLevel(ThreatLevel.None, "osDrawFilledRectangle"); | 1264 | CheckThreatLevel(); |
1206 | 1265 | ||
1207 | m_host.AddScriptLPS(1); | ||
1208 | drawList += "FillRectangle " + width + "," + height + "; "; | 1266 | drawList += "FillRectangle " + width + "," + height + "; "; |
1209 | return drawList; | 1267 | return drawList; |
1210 | } | 1268 | } |
1211 | 1269 | ||
1212 | public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y) | 1270 | public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y) |
1213 | { | 1271 | { |
1214 | CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon"); | 1272 | CheckThreatLevel(); |
1215 | |||
1216 | m_host.AddScriptLPS(1); | ||
1217 | 1273 | ||
1218 | if (x.Length != y.Length || x.Length < 3) | 1274 | if (x.Length != y.Length || x.Length < 3) |
1219 | { | 1275 | { |
@@ -1230,9 +1286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1230 | 1286 | ||
1231 | public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) | 1287 | public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) |
1232 | { | 1288 | { |
1233 | CheckThreatLevel(ThreatLevel.None, "osDrawPolygon"); | 1289 | CheckThreatLevel(); |
1234 | |||
1235 | m_host.AddScriptLPS(1); | ||
1236 | 1290 | ||
1237 | if (x.Length != y.Length || x.Length < 3) | 1291 | if (x.Length != y.Length || x.Length < 3) |
1238 | { | 1292 | { |
@@ -1249,36 +1303,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1249 | 1303 | ||
1250 | public string osSetFontSize(string drawList, int fontSize) | 1304 | public string osSetFontSize(string drawList, int fontSize) |
1251 | { | 1305 | { |
1252 | CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); | 1306 | CheckThreatLevel(); |
1253 | 1307 | ||
1254 | m_host.AddScriptLPS(1); | ||
1255 | drawList += "FontSize "+ fontSize +"; "; | 1308 | drawList += "FontSize "+ fontSize +"; "; |
1256 | return drawList; | 1309 | return drawList; |
1257 | } | 1310 | } |
1258 | 1311 | ||
1259 | public string osSetFontName(string drawList, string fontName) | 1312 | public string osSetFontName(string drawList, string fontName) |
1260 | { | 1313 | { |
1261 | CheckThreatLevel(ThreatLevel.None, "osSetFontName"); | 1314 | CheckThreatLevel(); |
1262 | 1315 | ||
1263 | m_host.AddScriptLPS(1); | ||
1264 | drawList += "FontName "+ fontName +"; "; | 1316 | drawList += "FontName "+ fontName +"; "; |
1265 | return drawList; | 1317 | return drawList; |
1266 | } | 1318 | } |
1267 | 1319 | ||
1268 | public string osSetPenSize(string drawList, int penSize) | 1320 | public string osSetPenSize(string drawList, int penSize) |
1269 | { | 1321 | { |
1270 | CheckThreatLevel(ThreatLevel.None, "osSetPenSize"); | 1322 | CheckThreatLevel(); |
1271 | 1323 | ||
1272 | m_host.AddScriptLPS(1); | ||
1273 | drawList += "PenSize " + penSize + "; "; | 1324 | drawList += "PenSize " + penSize + "; "; |
1274 | return drawList; | 1325 | return drawList; |
1275 | } | 1326 | } |
1276 | 1327 | ||
1277 | public string osSetPenColor(string drawList, string color) | 1328 | public string osSetPenColor(string drawList, string color) |
1278 | { | 1329 | { |
1279 | CheckThreatLevel(ThreatLevel.None, "osSetPenColor"); | 1330 | CheckThreatLevel(); |
1280 | 1331 | ||
1281 | m_host.AddScriptLPS(1); | ||
1282 | drawList += "PenColor " + color + "; "; | 1332 | drawList += "PenColor " + color + "; "; |
1283 | return drawList; | 1333 | return drawList; |
1284 | } | 1334 | } |
@@ -1286,36 +1336,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1286 | // Deprecated | 1336 | // Deprecated |
1287 | public string osSetPenColour(string drawList, string colour) | 1337 | public string osSetPenColour(string drawList, string colour) |
1288 | { | 1338 | { |
1289 | CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); | 1339 | CheckThreatLevel(); |
1290 | OSSLDeprecated("osSetPenColour", "osSetPenColor"); | 1340 | OSSLDeprecated("osSetPenColour", "osSetPenColor"); |
1291 | 1341 | ||
1292 | m_host.AddScriptLPS(1); | ||
1293 | drawList += "PenColour " + colour + "; "; | 1342 | drawList += "PenColour " + colour + "; "; |
1294 | return drawList; | 1343 | return drawList; |
1295 | } | 1344 | } |
1296 | 1345 | ||
1297 | public string osSetPenCap(string drawList, string direction, string type) | 1346 | public string osSetPenCap(string drawList, string direction, string type) |
1298 | { | 1347 | { |
1299 | CheckThreatLevel(ThreatLevel.None, "osSetPenCap"); | 1348 | CheckThreatLevel(); |
1300 | 1349 | ||
1301 | m_host.AddScriptLPS(1); | ||
1302 | drawList += "PenCap " + direction + "," + type + "; "; | 1350 | drawList += "PenCap " + direction + "," + type + "; "; |
1303 | return drawList; | 1351 | return drawList; |
1304 | } | 1352 | } |
1305 | 1353 | ||
1306 | public string osDrawImage(string drawList, int width, int height, string imageUrl) | 1354 | public string osDrawImage(string drawList, int width, int height, string imageUrl) |
1307 | { | 1355 | { |
1308 | CheckThreatLevel(ThreatLevel.None, "osDrawImage"); | 1356 | CheckThreatLevel(); |
1309 | 1357 | ||
1310 | m_host.AddScriptLPS(1); | ||
1311 | drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ; | 1358 | drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ; |
1312 | return drawList; | 1359 | return drawList; |
1313 | } | 1360 | } |
1314 | 1361 | ||
1315 | public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) | 1362 | public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) |
1316 | { | 1363 | { |
1317 | CheckThreatLevel(ThreatLevel.VeryLow, "osGetDrawStringSize"); | 1364 | CheckThreatLevel(); |
1318 | m_host.AddScriptLPS(1); | ||
1319 | 1365 | ||
1320 | LSL_Vector vec = new LSL_Vector(0,0,0); | 1366 | LSL_Vector vec = new LSL_Vector(0,0,0); |
1321 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | 1367 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
@@ -1338,7 +1384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1338 | // should be removed | 1384 | // should be removed |
1339 | // | 1385 | // |
1340 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); | 1386 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); |
1341 | m_host.AddScriptLPS(1); | ||
1342 | 1387 | ||
1343 | m_host.SetScriptEvents(m_item.ItemID, events); | 1388 | m_host.SetScriptEvents(m_item.ItemID, events); |
1344 | } | 1389 | } |
@@ -1347,8 +1392,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1347 | { | 1392 | { |
1348 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1393 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1349 | 1394 | ||
1350 | m_host.AddScriptLPS(1); | ||
1351 | |||
1352 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | 1395 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1353 | } | 1396 | } |
1354 | 1397 | ||
@@ -1362,8 +1405,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1362 | { | 1405 | { |
1363 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); | 1406 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1364 | 1407 | ||
1365 | m_host.AddScriptLPS(1); | ||
1366 | |||
1367 | while (sunHour > 24.0) | 1408 | while (sunHour > 24.0) |
1368 | sunHour -= 24.0; | 1409 | sunHour -= 24.0; |
1369 | 1410 | ||
@@ -1387,8 +1428,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1387 | { | 1428 | { |
1388 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); | 1429 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1389 | 1430 | ||
1390 | m_host.AddScriptLPS(1); | ||
1391 | |||
1392 | while (sunHour > 24.0) | 1431 | while (sunHour > 24.0) |
1393 | sunHour -= 24.0; | 1432 | sunHour -= 24.0; |
1394 | 1433 | ||
@@ -1409,9 +1448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1409 | /// <returns></returns> | 1448 | /// <returns></returns> |
1410 | public double osGetCurrentSunHour() | 1449 | public double osGetCurrentSunHour() |
1411 | { | 1450 | { |
1412 | CheckThreatLevel(ThreatLevel.None, "osGetCurrentSunHour"); | 1451 | CheckThreatLevel(); |
1413 | |||
1414 | m_host.AddScriptLPS(1); | ||
1415 | 1452 | ||
1416 | // Must adjust for the fact that Region Sun Settings are still LL offset | 1453 | // Must adjust for the fact that Region Sun Settings are still LL offset |
1417 | double sunHour = World.RegionInfo.RegionSettings.SunPosition - 6; | 1454 | double sunHour = World.RegionInfo.RegionSettings.SunPosition - 6; |
@@ -1435,14 +1472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1435 | 1472 | ||
1436 | public double osGetSunParam(string param) | 1473 | public double osGetSunParam(string param) |
1437 | { | 1474 | { |
1438 | CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); | 1475 | CheckThreatLevel(); |
1439 | return GetSunParam(param); | 1476 | return GetSunParam(param); |
1440 | } | 1477 | } |
1441 | 1478 | ||
1442 | private double GetSunParam(string param) | 1479 | private double GetSunParam(string param) |
1443 | { | 1480 | { |
1444 | m_host.AddScriptLPS(1); | ||
1445 | |||
1446 | double value = 0.0; | 1481 | double value = 0.0; |
1447 | 1482 | ||
1448 | ISunModule module = World.RequestModuleInterface<ISunModule>(); | 1483 | ISunModule module = World.RequestModuleInterface<ISunModule>(); |
@@ -1469,8 +1504,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1469 | 1504 | ||
1470 | private void SetSunParam(string param, double value) | 1505 | private void SetSunParam(string param, double value) |
1471 | { | 1506 | { |
1472 | m_host.AddScriptLPS(1); | ||
1473 | |||
1474 | ISunModule module = World.RequestModuleInterface<ISunModule>(); | 1507 | ISunModule module = World.RequestModuleInterface<ISunModule>(); |
1475 | if (module != null) | 1508 | if (module != null) |
1476 | { | 1509 | { |
@@ -1481,7 +1514,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1481 | public string osWindActiveModelPluginName() | 1514 | public string osWindActiveModelPluginName() |
1482 | { | 1515 | { |
1483 | CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); | 1516 | CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); |
1484 | m_host.AddScriptLPS(1); | ||
1485 | 1517 | ||
1486 | IWindModule module = World.RequestModuleInterface<IWindModule>(); | 1518 | IWindModule module = World.RequestModuleInterface<IWindModule>(); |
1487 | if (module != null) | 1519 | if (module != null) |
@@ -1495,7 +1527,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1495 | public void osSetWindParam(string plugin, string param, LSL_Float value) | 1527 | public void osSetWindParam(string plugin, string param, LSL_Float value) |
1496 | { | 1528 | { |
1497 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); | 1529 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); |
1498 | m_host.AddScriptLPS(1); | ||
1499 | 1530 | ||
1500 | IWindModule module = World.RequestModuleInterface<IWindModule>(); | 1531 | IWindModule module = World.RequestModuleInterface<IWindModule>(); |
1501 | if (module != null) | 1532 | if (module != null) |
@@ -1511,7 +1542,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1511 | public LSL_Float osGetWindParam(string plugin, string param) | 1542 | public LSL_Float osGetWindParam(string plugin, string param) |
1512 | { | 1543 | { |
1513 | CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); | 1544 | CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); |
1514 | m_host.AddScriptLPS(1); | ||
1515 | 1545 | ||
1516 | IWindModule module = World.RequestModuleInterface<IWindModule>(); | 1546 | IWindModule module = World.RequestModuleInterface<IWindModule>(); |
1517 | if (module != null) | 1547 | if (module != null) |
@@ -1526,7 +1556,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1526 | public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) | 1556 | public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) |
1527 | { | 1557 | { |
1528 | CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); | 1558 | CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); |
1529 | m_host.AddScriptLPS(1); | ||
1530 | 1559 | ||
1531 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | 1560 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); |
1532 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | 1561 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); |
@@ -1539,7 +1568,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1539 | public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) | 1568 | public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) |
1540 | { | 1569 | { |
1541 | CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); | 1570 | CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); |
1542 | m_host.AddScriptLPS(1); | ||
1543 | 1571 | ||
1544 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | 1572 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); |
1545 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | 1573 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); |
@@ -1566,8 +1594,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1566 | 1594 | ||
1567 | private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) | 1595 | private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) |
1568 | { | 1596 | { |
1569 | m_host.AddScriptLPS(1); | ||
1570 | |||
1571 | // Get a reference to the land data and make sure the owner of the script | 1597 | // Get a reference to the land data and make sure the owner of the script |
1572 | // can modify it | 1598 | // can modify it |
1573 | 1599 | ||
@@ -1580,13 +1606,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1580 | 1606 | ||
1581 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) | 1607 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) |
1582 | { | 1608 | { |
1583 | OSSLShoutError("You do not have permission to modify the parcel"); | 1609 | OSSLShoutError("script owner does not have permission to modify the parcel"); |
1584 | return; | 1610 | return; |
1585 | } | 1611 | } |
1586 | 1612 | ||
1587 | // Create a new land data object we can modify | 1613 | // Create a new land data object we can modify |
1588 | LandData newLand = startLandObject.LandData.Copy(); | 1614 | LandData newLand = startLandObject.LandData.Copy(); |
1589 | UUID uuid; | 1615 | UUID uuid; |
1616 | EstateSettings es = World.RegionInfo.EstateSettings; | ||
1617 | |||
1618 | bool changed = false; | ||
1619 | bool changedSeeAvs = false; | ||
1620 | bool changedoverlay = false; | ||
1621 | bool changedneedupdate = false; | ||
1590 | 1622 | ||
1591 | // Process the rules, not sure what the impact would be of changing owner or group | 1623 | // Process the rules, not sure what the impact would be of changing owner or group |
1592 | for (int idx = 0; idx < rules.Length;) | 1624 | for (int idx = 0; idx < rules.Length;) |
@@ -1596,35 +1628,151 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1596 | switch (code) | 1628 | switch (code) |
1597 | { | 1629 | { |
1598 | case ScriptBaseClass.PARCEL_DETAILS_NAME: | 1630 | case ScriptBaseClass.PARCEL_DETAILS_NAME: |
1599 | newLand.Name = arg; | 1631 | if(newLand.Name != arg) |
1632 | { | ||
1633 | newLand.Name = arg; | ||
1634 | changed = true; | ||
1635 | } | ||
1600 | break; | 1636 | break; |
1601 | 1637 | ||
1602 | case ScriptBaseClass.PARCEL_DETAILS_DESC: | 1638 | case ScriptBaseClass.PARCEL_DETAILS_DESC: |
1603 | newLand.Description = arg; | 1639 | if(newLand.Description != arg) |
1640 | { | ||
1641 | newLand.Description = arg; | ||
1642 | changed = true; | ||
1643 | } | ||
1604 | break; | 1644 | break; |
1605 | 1645 | ||
1606 | case ScriptBaseClass.PARCEL_DETAILS_OWNER: | 1646 | case ScriptBaseClass.PARCEL_DETAILS_OWNER: |
1607 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1647 | if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1608 | if (UUID.TryParse(arg, out uuid)) | 1648 | { |
1609 | newLand.OwnerID = uuid; | 1649 | OSSLError("script owner does not have permission to modify the parcel owner"); |
1650 | } | ||
1651 | else | ||
1652 | { | ||
1653 | if (UUID.TryParse(arg, out uuid)) | ||
1654 | { | ||
1655 | if(newLand.OwnerID != uuid) | ||
1656 | { | ||
1657 | changed = true; | ||
1658 | newLand.OwnerID = uuid; | ||
1659 | newLand.GroupID = UUID.Zero; | ||
1660 | } | ||
1661 | } | ||
1662 | } | ||
1610 | break; | 1663 | break; |
1611 | 1664 | ||
1612 | case ScriptBaseClass.PARCEL_DETAILS_GROUP: | 1665 | case ScriptBaseClass.PARCEL_DETAILS_GROUP: |
1613 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1666 | if(m_host.OwnerID == newLand.OwnerID || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1614 | if (UUID.TryParse(arg, out uuid)) | 1667 | { |
1615 | newLand.GroupID = uuid; | 1668 | if (UUID.TryParse(arg, out uuid)) |
1669 | { | ||
1670 | if(newLand.GroupID != uuid) | ||
1671 | { | ||
1672 | if(uuid == UUID.Zero) | ||
1673 | { | ||
1674 | changed = true; | ||
1675 | newLand.GroupID = uuid; | ||
1676 | } | ||
1677 | else | ||
1678 | { | ||
1679 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
1680 | GroupMembershipData member = null; | ||
1681 | if (groupsModule != null) | ||
1682 | member = groupsModule.GetMembershipData(uuid, newLand.OwnerID); | ||
1683 | if (member == null) | ||
1684 | OSSLError(string.Format("land owner is not member of the new group for parcel")); | ||
1685 | else | ||
1686 | { | ||
1687 | changed = true; | ||
1688 | newLand.GroupID = uuid; | ||
1689 | } | ||
1690 | } | ||
1691 | } | ||
1692 | } | ||
1693 | } | ||
1694 | else | ||
1695 | { | ||
1696 | OSSLError("script owner does not have permission to modify the parcel group"); | ||
1697 | } | ||
1616 | break; | 1698 | break; |
1617 | 1699 | ||
1618 | case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: | 1700 | case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: |
1619 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1701 | if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1620 | newLand.ClaimDate = Convert.ToInt32(arg); | 1702 | { |
1621 | if (newLand.ClaimDate == 0) | 1703 | OSSLError("script owner does not have permission to modify the parcel CLAIM DATE"); |
1622 | newLand.ClaimDate = Util.UnixTimeSinceEpoch(); | 1704 | } |
1705 | else | ||
1706 | { | ||
1707 | int date = Convert.ToInt32(arg); | ||
1708 | if (date == 0) | ||
1709 | date = Util.UnixTimeSinceEpoch(); | ||
1710 | if(newLand.ClaimDate != date) | ||
1711 | { | ||
1712 | changed = true; | ||
1713 | newLand.ClaimDate = date; | ||
1714 | } | ||
1715 | } | ||
1716 | break; | ||
1717 | |||
1718 | case ScriptBaseClass.PARCEL_DETAILS_SEE_AVATARS: | ||
1719 | bool newavs = (Convert.ToInt32(arg) != 0); | ||
1720 | if(newLand.SeeAVs != newavs) | ||
1721 | { | ||
1722 | changed = true; | ||
1723 | changedSeeAvs = true; | ||
1724 | changedoverlay = true; | ||
1725 | changedneedupdate = true; | ||
1726 | newLand.SeeAVs = newavs; | ||
1727 | } | ||
1728 | break; | ||
1729 | |||
1730 | case ScriptBaseClass.PARCEL_DETAILS_ANY_AVATAR_SOUNDS: | ||
1731 | bool newavsounds = (Convert.ToInt32(arg) != 0); | ||
1732 | if(newLand.AnyAVSounds != newavsounds) | ||
1733 | { | ||
1734 | changed = true; | ||
1735 | newLand.AnyAVSounds = newavsounds; | ||
1736 | } | ||
1623 | break; | 1737 | break; |
1624 | } | ||
1625 | } | ||
1626 | 1738 | ||
1627 | World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); | 1739 | case ScriptBaseClass.PARCEL_DETAILS_GROUP_SOUNDS: |
1740 | bool newgrpsounds = (Convert.ToInt32(arg) != 0); | ||
1741 | if(newLand.GroupAVSounds != newgrpsounds) | ||
1742 | { | ||
1743 | changed = true; | ||
1744 | newLand.GroupAVSounds = newgrpsounds; | ||
1745 | } | ||
1746 | break; | ||
1747 | } | ||
1748 | } | ||
1749 | if(changed) | ||
1750 | { | ||
1751 | World.LandChannel.UpdateLandObject(newLand.LocalID, newLand); | ||
1752 | |||
1753 | if(changedneedupdate) | ||
1754 | { | ||
1755 | UUID parcelID= newLand.GlobalID; | ||
1756 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) | ||
1757 | { | ||
1758 | if (avatar == null || avatar.IsDeleted || avatar.IsInTransit) | ||
1759 | return; | ||
1760 | |||
1761 | if(changedSeeAvs && avatar.currentParcelUUID == parcelID ) | ||
1762 | avatar.currentParcelUUID = parcelID; // force parcel flags review | ||
1763 | |||
1764 | if(avatar.ControllingClient == null) | ||
1765 | return; | ||
1766 | |||
1767 | // this will be needed for some things like damage etc | ||
1768 | // if(avatar.currentParcelUUID == parcelID) | ||
1769 | // startLandObject.SendLandUpdateToClient(avatar.ControllingClient); | ||
1770 | |||
1771 | if(changedoverlay && !avatar.IsNPC) | ||
1772 | World.LandChannel.SendParcelsOverlay(avatar.ControllingClient); | ||
1773 | }); | ||
1774 | } | ||
1775 | } | ||
1628 | } | 1776 | } |
1629 | 1777 | ||
1630 | public double osList2Double(LSL_Types.list src, int index) | 1778 | public double osList2Double(LSL_Types.list src, int index) |
@@ -1634,9 +1782,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1634 | // is not allowed to contain any. | 1782 | // is not allowed to contain any. |
1635 | // This really should be removed. | 1783 | // This really should be removed. |
1636 | // | 1784 | // |
1637 | CheckThreatLevel(ThreatLevel.None, "osList2Double"); | 1785 | CheckThreatLevel(); |
1638 | 1786 | ||
1639 | m_host.AddScriptLPS(1); | ||
1640 | if (index < 0) | 1787 | if (index < 0) |
1641 | { | 1788 | { |
1642 | index = src.Length + index; | 1789 | index = src.Length + index; |
@@ -1654,8 +1801,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1654 | // | 1801 | // |
1655 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); | 1802 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); |
1656 | 1803 | ||
1657 | m_host.AddScriptLPS(1); | ||
1658 | |||
1659 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); | 1804 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1660 | 1805 | ||
1661 | if (land.LandData.OwnerID != m_host.OwnerID) | 1806 | if (land.LandData.OwnerID != m_host.OwnerID) |
@@ -1670,8 +1815,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1670 | // | 1815 | // |
1671 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress"); | 1816 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress"); |
1672 | 1817 | ||
1673 | m_host.AddScriptLPS(1); | ||
1674 | |||
1675 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); | 1818 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1676 | 1819 | ||
1677 | if (land.LandData.OwnerID != m_host.OwnerID) | 1820 | if (land.LandData.OwnerID != m_host.OwnerID) |
@@ -1698,8 +1841,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1698 | // | 1841 | // |
1699 | CheckThreatLevel(ThreatLevel.High, "osGetScriptEngineName"); | 1842 | CheckThreatLevel(ThreatLevel.High, "osGetScriptEngineName"); |
1700 | 1843 | ||
1701 | m_host.AddScriptLPS(1); | ||
1702 | |||
1703 | int scriptEngineNameIndex = 0; | 1844 | int scriptEngineNameIndex = 0; |
1704 | 1845 | ||
1705 | if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName)) | 1846 | if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName)) |
@@ -1725,7 +1866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1725 | public LSL_Integer osCheckODE() | 1866 | public LSL_Integer osCheckODE() |
1726 | { | 1867 | { |
1727 | CheckThreatLevel(); | 1868 | CheckThreatLevel(); |
1728 | m_host.AddScriptLPS(1); | ||
1729 | 1869 | ||
1730 | LSL_Integer ret = 0; // false | 1870 | LSL_Integer ret = 0; // false |
1731 | if (m_ScriptEngine.World.PhysicsScene != null) | 1871 | if (m_ScriptEngine.World.PhysicsScene != null) |
@@ -1749,6 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1749 | // about the physics engine, this function returns an empty string if | 1889 | // about the physics engine, this function returns an empty string if |
1750 | // the user does not have permission to see it. This as opposed to | 1890 | // the user does not have permission to see it. This as opposed to |
1751 | // throwing an exception. | 1891 | // throwing an exception. |
1892 | |||
1752 | m_host.AddScriptLPS(1); | 1893 | m_host.AddScriptLPS(1); |
1753 | string ret = String.Empty; | 1894 | string ret = String.Empty; |
1754 | if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) | 1895 | if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) |
@@ -1768,7 +1909,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1768 | public string osGetPhysicsEngineName() | 1909 | public string osGetPhysicsEngineName() |
1769 | { | 1910 | { |
1770 | CheckThreatLevel(); | 1911 | CheckThreatLevel(); |
1771 | m_host.AddScriptLPS(1); | ||
1772 | 1912 | ||
1773 | string ret = "NoEngine"; | 1913 | string ret = "NoEngine"; |
1774 | if (m_ScriptEngine.World.PhysicsScene != null) | 1914 | if (m_ScriptEngine.World.PhysicsScene != null) |
@@ -1789,7 +1929,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1789 | // kiddie) | 1929 | // kiddie) |
1790 | // | 1930 | // |
1791 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); | 1931 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); |
1792 | m_host.AddScriptLPS(1); | ||
1793 | 1932 | ||
1794 | return m_ScriptEngine.World.GetSimulatorVersion(); | 1933 | return m_ScriptEngine.World.GetSimulatorVersion(); |
1795 | } | 1934 | } |
@@ -1835,8 +1974,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1835 | { | 1974 | { |
1836 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); | 1975 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1837 | 1976 | ||
1838 | m_host.AddScriptLPS(1); | ||
1839 | |||
1840 | try | 1977 | try |
1841 | { | 1978 | { |
1842 | OSD decoded = OSDParser.DeserializeJson(JSON); | 1979 | OSD decoded = OSDParser.DeserializeJson(JSON); |
@@ -1853,8 +1990,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1853 | { | 1990 | { |
1854 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1991 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); |
1855 | 1992 | ||
1856 | m_host.AddScriptLPS(1); | ||
1857 | |||
1858 | Object decoded = osParseJSONNew(JSON); | 1993 | Object decoded = osParseJSONNew(JSON); |
1859 | 1994 | ||
1860 | if ( decoded is Hashtable ) { | 1995 | if ( decoded is Hashtable ) { |
@@ -1885,7 +2020,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1885 | public void osMessageObject(LSL_Key objectUUID, string message) | 2020 | public void osMessageObject(LSL_Key objectUUID, string message) |
1886 | { | 2021 | { |
1887 | CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); | 2022 | CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); |
1888 | m_host.AddScriptLPS(1); | ||
1889 | 2023 | ||
1890 | UUID objUUID; | 2024 | UUID objUUID; |
1891 | if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. | 2025 | if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. |
@@ -1926,7 +2060,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1926 | // if this is restricted to objects rezzed by this host level can be reduced | 2060 | // if this is restricted to objects rezzed by this host level can be reduced |
1927 | 2061 | ||
1928 | CheckThreatLevel(ThreatLevel.Low, "osDie"); | 2062 | CheckThreatLevel(ThreatLevel.Low, "osDie"); |
1929 | m_host.AddScriptLPS(1); | ||
1930 | 2063 | ||
1931 | UUID objUUID; | 2064 | UUID objUUID; |
1932 | if (!UUID.TryParse(objectUUID, out objUUID)) | 2065 | if (!UUID.TryParse(objectUUID, out objUUID)) |
@@ -1976,7 +2109,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1976 | public void osMakeNotecard(string notecardName, LSL_Types.list contents) | 2109 | public void osMakeNotecard(string notecardName, LSL_Types.list contents) |
1977 | { | 2110 | { |
1978 | CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); | 2111 | CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); |
1979 | m_host.AddScriptLPS(1); | ||
1980 | 2112 | ||
1981 | StringBuilder notecardData = new StringBuilder(); | 2113 | StringBuilder notecardData = new StringBuilder(); |
1982 | 2114 | ||
@@ -2162,7 +2294,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2162 | public string osGetNotecardLine(string name, int line) | 2294 | public string osGetNotecardLine(string name, int line) |
2163 | { | 2295 | { |
2164 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); | 2296 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); |
2165 | m_host.AddScriptLPS(1); | ||
2166 | 2297 | ||
2167 | UUID assetID = CacheNotecard(name); | 2298 | UUID assetID = CacheNotecard(name); |
2168 | 2299 | ||
@@ -2190,7 +2321,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2190 | public string osGetNotecard(string name) | 2321 | public string osGetNotecard(string name) |
2191 | { | 2322 | { |
2192 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); | 2323 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); |
2193 | m_host.AddScriptLPS(1); | ||
2194 | 2324 | ||
2195 | string text = LoadNotecard(name); | 2325 | string text = LoadNotecard(name); |
2196 | 2326 | ||
@@ -2220,7 +2350,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2220 | public int osGetNumberOfNotecardLines(string name) | 2350 | public int osGetNumberOfNotecardLines(string name) |
2221 | { | 2351 | { |
2222 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); | 2352 | CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); |
2223 | m_host.AddScriptLPS(1); | ||
2224 | 2353 | ||
2225 | UUID assetID = CacheNotecard(name); | 2354 | UUID assetID = CacheNotecard(name); |
2226 | 2355 | ||
@@ -2236,7 +2365,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2236 | public string osAvatarName2Key(string firstname, string lastname) | 2365 | public string osAvatarName2Key(string firstname, string lastname) |
2237 | { | 2366 | { |
2238 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); | 2367 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); |
2239 | m_host.AddScriptLPS(1); | ||
2240 | 2368 | ||
2241 | IUserManagement userManager = World.RequestModuleInterface<IUserManagement>(); | 2369 | IUserManagement userManager = World.RequestModuleInterface<IUserManagement>(); |
2242 | if (userManager == null) | 2370 | if (userManager == null) |
@@ -2288,7 +2416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2288 | public string osKey2Name(string id) | 2416 | public string osKey2Name(string id) |
2289 | { | 2417 | { |
2290 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); | 2418 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); |
2291 | m_host.AddScriptLPS(1); | ||
2292 | 2419 | ||
2293 | UUID key = new UUID(); | 2420 | UUID key = new UUID(); |
2294 | 2421 | ||
@@ -2398,7 +2525,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2398 | public string osGetGridNick() | 2525 | public string osGetGridNick() |
2399 | { | 2526 | { |
2400 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); | 2527 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); |
2401 | m_host.AddScriptLPS(1); | ||
2402 | 2528 | ||
2403 | string nick = String.Empty; | 2529 | string nick = String.Empty; |
2404 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2530 | IConfigSource config = m_ScriptEngine.ConfigSource; |
@@ -2415,7 +2541,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2415 | public string osGetGridName() | 2541 | public string osGetGridName() |
2416 | { | 2542 | { |
2417 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); | 2543 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); |
2418 | m_host.AddScriptLPS(1); | ||
2419 | 2544 | ||
2420 | string name = String.Empty; | 2545 | string name = String.Empty; |
2421 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2546 | IConfigSource config = m_ScriptEngine.ConfigSource; |
@@ -2432,7 +2557,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2432 | public string osGetGridLoginURI() | 2557 | public string osGetGridLoginURI() |
2433 | { | 2558 | { |
2434 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); | 2559 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); |
2435 | m_host.AddScriptLPS(1); | ||
2436 | 2560 | ||
2437 | string loginURI = String.Empty; | 2561 | string loginURI = String.Empty; |
2438 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2562 | IConfigSource config = m_ScriptEngine.ConfigSource; |
@@ -2449,7 +2573,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2449 | public string osGetGridHomeURI() | 2573 | public string osGetGridHomeURI() |
2450 | { | 2574 | { |
2451 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); | 2575 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); |
2452 | m_host.AddScriptLPS(1); | ||
2453 | 2576 | ||
2454 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2577 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2455 | string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", | 2578 | string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
@@ -2471,7 +2594,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2471 | public string osGetGridGatekeeperURI() | 2594 | public string osGetGridGatekeeperURI() |
2472 | { | 2595 | { |
2473 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); | 2596 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); |
2474 | m_host.AddScriptLPS(1); | ||
2475 | 2597 | ||
2476 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2598 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2477 | string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", | 2599 | string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
@@ -2490,7 +2612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2490 | public string osGetGridCustom(string key) | 2612 | public string osGetGridCustom(string key) |
2491 | { | 2613 | { |
2492 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); | 2614 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); |
2493 | m_host.AddScriptLPS(1); | ||
2494 | 2615 | ||
2495 | string retval = String.Empty; | 2616 | string retval = String.Empty; |
2496 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2617 | IConfigSource config = m_ScriptEngine.ConfigSource; |
@@ -2507,7 +2628,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2507 | public string osGetAvatarHomeURI(string uuid) | 2628 | public string osGetAvatarHomeURI(string uuid) |
2508 | { | 2629 | { |
2509 | CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI"); | 2630 | CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI"); |
2510 | m_host.AddScriptLPS(1); | ||
2511 | 2631 | ||
2512 | IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>(); | 2632 | IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>(); |
2513 | string returnValue = ""; | 2633 | string returnValue = ""; |
@@ -2540,7 +2660,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2540 | public LSL_String osFormatString(string str, LSL_List strings) | 2660 | public LSL_String osFormatString(string str, LSL_List strings) |
2541 | { | 2661 | { |
2542 | CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); | 2662 | CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); |
2543 | m_host.AddScriptLPS(1); | ||
2544 | 2663 | ||
2545 | return String.Format(str, strings.Data); | 2664 | return String.Format(str, strings.Data); |
2546 | } | 2665 | } |
@@ -2548,7 +2667,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2548 | public LSL_List osMatchString(string src, string pattern, int start) | 2667 | public LSL_List osMatchString(string src, string pattern, int start) |
2549 | { | 2668 | { |
2550 | CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString"); | 2669 | CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString"); |
2551 | m_host.AddScriptLPS(1); | ||
2552 | 2670 | ||
2553 | LSL_List result = new LSL_List(); | 2671 | LSL_List result = new LSL_List(); |
2554 | 2672 | ||
@@ -2590,7 +2708,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2590 | public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) | 2708 | public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) |
2591 | { | 2709 | { |
2592 | CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString"); | 2710 | CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString"); |
2593 | m_host.AddScriptLPS(1); | ||
2594 | 2711 | ||
2595 | // Normalize indices (if negative). | 2712 | // Normalize indices (if negative). |
2596 | // After normlaization they may still be | 2713 | // After normlaization they may still be |
@@ -2615,7 +2732,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2615 | public string osLoadedCreationDate() | 2732 | public string osLoadedCreationDate() |
2616 | { | 2733 | { |
2617 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); | 2734 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); |
2618 | m_host.AddScriptLPS(1); | ||
2619 | 2735 | ||
2620 | return World.RegionInfo.RegionSettings.LoadedCreationDate; | 2736 | return World.RegionInfo.RegionSettings.LoadedCreationDate; |
2621 | } | 2737 | } |
@@ -2623,7 +2739,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2623 | public string osLoadedCreationTime() | 2739 | public string osLoadedCreationTime() |
2624 | { | 2740 | { |
2625 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime"); | 2741 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime"); |
2626 | m_host.AddScriptLPS(1); | ||
2627 | 2742 | ||
2628 | return World.RegionInfo.RegionSettings.LoadedCreationTime; | 2743 | return World.RegionInfo.RegionSettings.LoadedCreationTime; |
2629 | } | 2744 | } |
@@ -2631,7 +2746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2631 | public string osLoadedCreationID() | 2746 | public string osLoadedCreationID() |
2632 | { | 2747 | { |
2633 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID"); | 2748 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID"); |
2634 | m_host.AddScriptLPS(1); | ||
2635 | 2749 | ||
2636 | return World.RegionInfo.RegionSettings.LoadedCreationID; | 2750 | return World.RegionInfo.RegionSettings.LoadedCreationID; |
2637 | } | 2751 | } |
@@ -2652,7 +2766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2652 | public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) | 2766 | public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) |
2653 | { | 2767 | { |
2654 | CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); | 2768 | CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); |
2655 | m_host.AddScriptLPS(1); | 2769 | |
2656 | InitLSL(); | 2770 | InitLSL(); |
2657 | // One needs to cast m_LSL_Api because we're using functions not | 2771 | // One needs to cast m_LSL_Api because we're using functions not |
2658 | // on the ILSL_Api interface. | 2772 | // on the ILSL_Api interface. |
@@ -2681,8 +2795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2681 | { | 2795 | { |
2682 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); | 2796 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); |
2683 | 2797 | ||
2684 | m_host.AddScriptLPS(1); | ||
2685 | |||
2686 | InitLSL(); | 2798 | InitLSL(); |
2687 | ((LSL_Api)m_LSL_Api).CreateLink(target, parent); | 2799 | ((LSL_Api)m_LSL_Api).CreateLink(target, parent); |
2688 | } | 2800 | } |
@@ -2691,8 +2803,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2691 | { | 2803 | { |
2692 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink"); | 2804 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink"); |
2693 | 2805 | ||
2694 | m_host.AddScriptLPS(1); | ||
2695 | |||
2696 | InitLSL(); | 2806 | InitLSL(); |
2697 | ((LSL_Api)m_LSL_Api).BreakLink(linknum); | 2807 | ((LSL_Api)m_LSL_Api).BreakLink(linknum); |
2698 | } | 2808 | } |
@@ -2701,16 +2811,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2701 | { | 2811 | { |
2702 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks"); | 2812 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks"); |
2703 | 2813 | ||
2704 | m_host.AddScriptLPS(1); | ||
2705 | |||
2706 | InitLSL(); | 2814 | InitLSL(); |
2707 | ((LSL_Api)m_LSL_Api).BreakAllLinks(); | 2815 | ((LSL_Api)m_LSL_Api).BreakAllLinks(); |
2708 | } | 2816 | } |
2709 | 2817 | ||
2710 | public LSL_Integer osIsNpc(LSL_Key npc) | 2818 | public LSL_Integer osIsNpc(LSL_Key npc) |
2711 | { | 2819 | { |
2712 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); | 2820 | CheckThreatLevel(); |
2713 | m_host.AddScriptLPS(1); | ||
2714 | 2821 | ||
2715 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2822 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2716 | if (module != null) | 2823 | if (module != null) |
@@ -2727,7 +2834,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2727 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2834 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2728 | { | 2835 | { |
2729 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2836 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2730 | m_host.AddScriptLPS(1); | ||
2731 | 2837 | ||
2732 | // have to get the npc module also here to set the default Not Owned | 2838 | // have to get the npc module also here to set the default Not Owned |
2733 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2839 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -2742,7 +2848,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2742 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | 2848 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) |
2743 | { | 2849 | { |
2744 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2850 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2745 | m_host.AddScriptLPS(1); | ||
2746 | 2851 | ||
2747 | return NpcCreate( | 2852 | return NpcCreate( |
2748 | firstname, lastname, position, notecard, | 2853 | firstname, lastname, position, notecard, |
@@ -2885,7 +2990,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2885 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) | 2990 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) |
2886 | { | 2991 | { |
2887 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); | 2992 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); |
2888 | m_host.AddScriptLPS(1); | ||
2889 | 2993 | ||
2890 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2994 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2891 | 2995 | ||
@@ -2907,7 +3011,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2907 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) | 3011 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) |
2908 | { | 3012 | { |
2909 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); | 3013 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); |
2910 | m_host.AddScriptLPS(1); | ||
2911 | 3014 | ||
2912 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3015 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2913 | 3016 | ||
@@ -2939,7 +3042,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2939 | public LSL_Key osNpcGetOwner(LSL_Key npc) | 3042 | public LSL_Key osNpcGetOwner(LSL_Key npc) |
2940 | { | 3043 | { |
2941 | CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner"); | 3044 | CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner"); |
2942 | m_host.AddScriptLPS(1); | ||
2943 | 3045 | ||
2944 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3046 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2945 | if (npcModule != null) | 3047 | if (npcModule != null) |
@@ -2961,7 +3063,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2961 | public LSL_Vector osNpcGetPos(LSL_Key npc) | 3063 | public LSL_Vector osNpcGetPos(LSL_Key npc) |
2962 | { | 3064 | { |
2963 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); | 3065 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); |
2964 | m_host.AddScriptLPS(1); | ||
2965 | 3066 | ||
2966 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3067 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2967 | if (npcModule != null) | 3068 | if (npcModule != null) |
@@ -2985,7 +3086,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2985 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) | 3086 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) |
2986 | { | 3087 | { |
2987 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); | 3088 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); |
2988 | m_host.AddScriptLPS(1); | ||
2989 | 3089 | ||
2990 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3090 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2991 | if (module != null) | 3091 | if (module != null) |
@@ -3004,7 +3104,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3004 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) | 3104 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) |
3005 | { | 3105 | { |
3006 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); | 3106 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); |
3007 | m_host.AddScriptLPS(1); | ||
3008 | 3107 | ||
3009 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3108 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3010 | if (module != null) | 3109 | if (module != null) |
@@ -3029,7 +3128,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3029 | public LSL_Rotation osNpcGetRot(LSL_Key npc) | 3128 | public LSL_Rotation osNpcGetRot(LSL_Key npc) |
3030 | { | 3129 | { |
3031 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); | 3130 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); |
3032 | m_host.AddScriptLPS(1); | ||
3033 | 3131 | ||
3034 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3132 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
3035 | if (npcModule != null) | 3133 | if (npcModule != null) |
@@ -3053,7 +3151,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3053 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 3151 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
3054 | { | 3152 | { |
3055 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); | 3153 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); |
3056 | m_host.AddScriptLPS(1); | ||
3057 | 3154 | ||
3058 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3155 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
3059 | if (npcModule != null) | 3156 | if (npcModule != null) |
@@ -3075,7 +3172,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3075 | public void osNpcStopMoveToTarget(LSL_Key npc) | 3172 | public void osNpcStopMoveToTarget(LSL_Key npc) |
3076 | { | 3173 | { |
3077 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); | 3174 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
3078 | m_host.AddScriptLPS(1); | ||
3079 | 3175 | ||
3080 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3176 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3081 | if (module != null) | 3177 | if (module != null) |
@@ -3092,7 +3188,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3092 | public void osNpcSetProfileAbout(LSL_Key npc, string about) | 3188 | public void osNpcSetProfileAbout(LSL_Key npc, string about) |
3093 | { | 3189 | { |
3094 | CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileAbout"); | 3190 | CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileAbout"); |
3095 | m_host.AddScriptLPS(1); | ||
3096 | 3191 | ||
3097 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3192 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3098 | if (module != null) | 3193 | if (module != null) |
@@ -3111,7 +3206,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3111 | public void osNpcSetProfileImage(LSL_Key npc, string image) | 3206 | public void osNpcSetProfileImage(LSL_Key npc, string image) |
3112 | { | 3207 | { |
3113 | CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileImage"); | 3208 | CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileImage"); |
3114 | m_host.AddScriptLPS(1); | ||
3115 | 3209 | ||
3116 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3210 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3117 | if (module != null) | 3211 | if (module != null) |
@@ -3145,7 +3239,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3145 | public void osNpcSay(LSL_Key npc, int channel, string message) | 3239 | public void osNpcSay(LSL_Key npc, int channel, string message) |
3146 | { | 3240 | { |
3147 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 3241 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
3148 | m_host.AddScriptLPS(1); | ||
3149 | 3242 | ||
3150 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3243 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3151 | if (module != null) | 3244 | if (module != null) |
@@ -3162,7 +3255,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3162 | public void osNpcShout(LSL_Key npc, int channel, string message) | 3255 | public void osNpcShout(LSL_Key npc, int channel, string message) |
3163 | { | 3256 | { |
3164 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | 3257 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); |
3165 | m_host.AddScriptLPS(1); | ||
3166 | 3258 | ||
3167 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3259 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3168 | if (module != null) | 3260 | if (module != null) |
@@ -3179,7 +3271,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3179 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 3271 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
3180 | { | 3272 | { |
3181 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); | 3273 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); |
3182 | m_host.AddScriptLPS(1); | ||
3183 | 3274 | ||
3184 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3275 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3185 | if (module != null) | 3276 | if (module != null) |
@@ -3196,7 +3287,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3196 | public void osNpcStand(LSL_Key npc) | 3287 | public void osNpcStand(LSL_Key npc) |
3197 | { | 3288 | { |
3198 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); | 3289 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); |
3199 | m_host.AddScriptLPS(1); | ||
3200 | 3290 | ||
3201 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3291 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3202 | if (module != null) | 3292 | if (module != null) |
@@ -3213,7 +3303,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3213 | public void osNpcRemove(LSL_Key npc) | 3303 | public void osNpcRemove(LSL_Key npc) |
3214 | { | 3304 | { |
3215 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); | 3305 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); |
3216 | m_host.AddScriptLPS(1); | ||
3217 | 3306 | ||
3218 | try | 3307 | try |
3219 | { | 3308 | { |
@@ -3234,7 +3323,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3234 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | 3323 | public void osNpcPlayAnimation(LSL_Key npc, string animation) |
3235 | { | 3324 | { |
3236 | CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); | 3325 | CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); |
3237 | m_host.AddScriptLPS(1); | ||
3238 | 3326 | ||
3239 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3327 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3240 | if (module != null) | 3328 | if (module != null) |
@@ -3249,7 +3337,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3249 | public void osNpcStopAnimation(LSL_Key npc, string animation) | 3337 | public void osNpcStopAnimation(LSL_Key npc, string animation) |
3250 | { | 3338 | { |
3251 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); | 3339 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); |
3252 | m_host.AddScriptLPS(1); | ||
3253 | 3340 | ||
3254 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3341 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3255 | if (module != null) | 3342 | if (module != null) |
@@ -3264,7 +3351,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3264 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | 3351 | public void osNpcWhisper(LSL_Key npc, int channel, string message) |
3265 | { | 3352 | { |
3266 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | 3353 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); |
3267 | m_host.AddScriptLPS(1); | ||
3268 | 3354 | ||
3269 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3355 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3270 | if (module != null) | 3356 | if (module != null) |
@@ -3281,7 +3367,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3281 | public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) | 3367 | public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) |
3282 | { | 3368 | { |
3283 | CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); | 3369 | CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); |
3284 | m_host.AddScriptLPS(1); | ||
3285 | 3370 | ||
3286 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 3371 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
3287 | int linkNum = link_num.value; | 3372 | int linkNum = link_num.value; |
@@ -3326,7 +3411,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3326 | public LSL_Key osOwnerSaveAppearance(string notecard) | 3411 | public LSL_Key osOwnerSaveAppearance(string notecard) |
3327 | { | 3412 | { |
3328 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); | 3413 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); |
3329 | m_host.AddScriptLPS(1); | ||
3330 | 3414 | ||
3331 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); | 3415 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); |
3332 | } | 3416 | } |
@@ -3334,7 +3418,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3334 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) | 3418 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) |
3335 | { | 3419 | { |
3336 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); | 3420 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); |
3337 | m_host.AddScriptLPS(1); | ||
3338 | 3421 | ||
3339 | return SaveAppearanceToNotecard(avatarId, notecard); | 3422 | return SaveAppearanceToNotecard(avatarId, notecard); |
3340 | } | 3423 | } |
@@ -3387,7 +3470,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3387 | public LSL_String osGetGender(LSL_Key rawAvatarId) | 3470 | public LSL_String osGetGender(LSL_Key rawAvatarId) |
3388 | { | 3471 | { |
3389 | CheckThreatLevel(ThreatLevel.None, "osGetGender"); | 3472 | CheckThreatLevel(ThreatLevel.None, "osGetGender"); |
3390 | m_host.AddScriptLPS(1); | ||
3391 | 3473 | ||
3392 | UUID avatarId; | 3474 | UUID avatarId; |
3393 | if (!UUID.TryParse(rawAvatarId, out avatarId)) | 3475 | if (!UUID.TryParse(rawAvatarId, out avatarId)) |
@@ -3430,8 +3512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3430 | /// <returns></returns> | 3512 | /// <returns></returns> |
3431 | public LSL_Key osGetMapTexture() | 3513 | public LSL_Key osGetMapTexture() |
3432 | { | 3514 | { |
3433 | CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); | 3515 | CheckThreatLevel(); |
3434 | m_host.AddScriptLPS(1); | ||
3435 | 3516 | ||
3436 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); | 3517 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); |
3437 | } | 3518 | } |
@@ -3444,7 +3525,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3444 | public LSL_Key osGetRegionMapTexture(string regionName) | 3525 | public LSL_Key osGetRegionMapTexture(string regionName) |
3445 | { | 3526 | { |
3446 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); | 3527 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); |
3447 | m_host.AddScriptLPS(1); | ||
3448 | 3528 | ||
3449 | Scene scene = m_ScriptEngine.World; | 3529 | Scene scene = m_ScriptEngine.World; |
3450 | UUID key = UUID.Zero; | 3530 | UUID key = UUID.Zero; |
@@ -3475,7 +3555,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3475 | public LSL_List osGetRegionStats() | 3555 | public LSL_List osGetRegionStats() |
3476 | { | 3556 | { |
3477 | CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); | 3557 | CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); |
3478 | m_host.AddScriptLPS(1); | 3558 | |
3479 | LSL_List ret = new LSL_List(); | 3559 | LSL_List ret = new LSL_List(); |
3480 | float[] stats = World.StatsReporter.LastReportedSimStats; | 3560 | float[] stats = World.StatsReporter.LastReportedSimStats; |
3481 | 3561 | ||
@@ -3488,8 +3568,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3488 | 3568 | ||
3489 | public LSL_Vector osGetRegionSize() | 3569 | public LSL_Vector osGetRegionSize() |
3490 | { | 3570 | { |
3491 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); | 3571 | CheckThreatLevel(); |
3492 | m_host.AddScriptLPS(1); | ||
3493 | 3572 | ||
3494 | Scene scene = m_ScriptEngine.World; | 3573 | Scene scene = m_ScriptEngine.World; |
3495 | RegionInfo reg = World.RegionInfo; | 3574 | RegionInfo reg = World.RegionInfo; |
@@ -3501,7 +3580,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3501 | public int osGetSimulatorMemory() | 3580 | public int osGetSimulatorMemory() |
3502 | { | 3581 | { |
3503 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 3582 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); |
3504 | m_host.AddScriptLPS(1); | 3583 | |
3505 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | 3584 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; |
3506 | 3585 | ||
3507 | if (pws > Int32.MaxValue) | 3586 | if (pws > Int32.MaxValue) |
@@ -3515,7 +3594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3515 | public void osSetSpeed(string UUID, LSL_Float SpeedModifier) | 3594 | public void osSetSpeed(string UUID, LSL_Float SpeedModifier) |
3516 | { | 3595 | { |
3517 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); | 3596 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); |
3518 | m_host.AddScriptLPS(1); | 3597 | |
3519 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); | 3598 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); |
3520 | 3599 | ||
3521 | if (avatar != null) | 3600 | if (avatar != null) |
@@ -3525,7 +3604,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3525 | public void osKickAvatar(string FirstName, string SurName, string alert) | 3604 | public void osKickAvatar(string FirstName, string SurName, string alert) |
3526 | { | 3605 | { |
3527 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 3606 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
3528 | m_host.AddScriptLPS(1); | ||
3529 | 3607 | ||
3530 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 3608 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
3531 | { | 3609 | { |
@@ -3544,7 +3622,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3544 | public LSL_Float osGetHealth(string avatar) | 3622 | public LSL_Float osGetHealth(string avatar) |
3545 | { | 3623 | { |
3546 | CheckThreatLevel(ThreatLevel.None, "osGetHealth"); | 3624 | CheckThreatLevel(ThreatLevel.None, "osGetHealth"); |
3547 | m_host.AddScriptLPS(1); | ||
3548 | 3625 | ||
3549 | LSL_Float health = new LSL_Float(-1); | 3626 | LSL_Float health = new LSL_Float(-1); |
3550 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); | 3627 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); |
@@ -3556,7 +3633,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3556 | public void osCauseDamage(string avatar, double damage) | 3633 | public void osCauseDamage(string avatar, double damage) |
3557 | { | 3634 | { |
3558 | CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); | 3635 | CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); |
3559 | m_host.AddScriptLPS(1); | ||
3560 | 3636 | ||
3561 | UUID avatarId = new UUID(avatar); | 3637 | UUID avatarId = new UUID(avatar); |
3562 | Vector3 pos = m_host.GetWorldPosition(); | 3638 | Vector3 pos = m_host.GetWorldPosition(); |
@@ -3584,7 +3660,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3584 | public void osCauseHealing(string avatar, double healing) | 3660 | public void osCauseHealing(string avatar, double healing) |
3585 | { | 3661 | { |
3586 | CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); | 3662 | CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); |
3587 | m_host.AddScriptLPS(1); | ||
3588 | 3663 | ||
3589 | UUID avatarId = new UUID(avatar); | 3664 | UUID avatarId = new UUID(avatar); |
3590 | ScenePresence presence = World.GetScenePresence(avatarId); | 3665 | ScenePresence presence = World.GetScenePresence(avatarId); |
@@ -3604,7 +3679,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3604 | public void osSetHealth(string avatar, double health) | 3679 | public void osSetHealth(string avatar, double health) |
3605 | { | 3680 | { |
3606 | CheckThreatLevel(ThreatLevel.High, "osSetHealth"); | 3681 | CheckThreatLevel(ThreatLevel.High, "osSetHealth"); |
3607 | m_host.AddScriptLPS(1); | ||
3608 | 3682 | ||
3609 | UUID avatarId = new UUID(avatar); | 3683 | UUID avatarId = new UUID(avatar); |
3610 | ScenePresence presence = World.GetScenePresence(avatarId); | 3684 | ScenePresence presence = World.GetScenePresence(avatarId); |
@@ -3623,7 +3697,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3623 | public void osSetHealRate(string avatar, double healrate) | 3697 | public void osSetHealRate(string avatar, double healrate) |
3624 | { | 3698 | { |
3625 | CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); | 3699 | CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); |
3626 | m_host.AddScriptLPS(1); | ||
3627 | 3700 | ||
3628 | UUID avatarId = new UUID(avatar); | 3701 | UUID avatarId = new UUID(avatar); |
3629 | ScenePresence presence = World.GetScenePresence(avatarId); | 3702 | ScenePresence presence = World.GetScenePresence(avatarId); |
@@ -3635,7 +3708,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3635 | public LSL_Float osGetHealRate(string avatar) | 3708 | public LSL_Float osGetHealRate(string avatar) |
3636 | { | 3709 | { |
3637 | CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); | 3710 | CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); |
3638 | m_host.AddScriptLPS(1); | ||
3639 | 3711 | ||
3640 | LSL_Float rate = new LSL_Float(0); | 3712 | LSL_Float rate = new LSL_Float(0); |
3641 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); | 3713 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); |
@@ -3647,18 +3719,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3647 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) | 3719 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) |
3648 | { | 3720 | { |
3649 | CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); | 3721 | CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); |
3650 | m_host.AddScriptLPS(1); | ||
3651 | InitLSL(); | ||
3652 | 3722 | ||
3723 | InitLSL(); | ||
3653 | return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); | 3724 | return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); |
3654 | } | 3725 | } |
3655 | 3726 | ||
3656 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) | 3727 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) |
3657 | { | 3728 | { |
3658 | CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); | 3729 | CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); |
3659 | m_host.AddScriptLPS(1); | ||
3660 | InitLSL(); | ||
3661 | 3730 | ||
3731 | InitLSL(); | ||
3662 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams"); | 3732 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams"); |
3663 | } | 3733 | } |
3664 | 3734 | ||
@@ -3667,8 +3737,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3667 | /// </summary> | 3737 | /// </summary> |
3668 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) | 3738 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) |
3669 | { | 3739 | { |
3670 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | ||
3671 | |||
3672 | osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); | 3740 | osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); |
3673 | } | 3741 | } |
3674 | 3742 | ||
@@ -3678,7 +3746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3678 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) | 3746 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) |
3679 | { | 3747 | { |
3680 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | 3748 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); |
3681 | m_host.AddScriptLPS(1); | ||
3682 | 3749 | ||
3683 | SceneObjectPart obj = null; | 3750 | SceneObjectPart obj = null; |
3684 | if (prim == UUID.Zero.ToString()) | 3751 | if (prim == UUID.Zero.ToString()) |
@@ -3709,12 +3776,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3709 | public LSL_List osGetAvatarList() | 3776 | public LSL_List osGetAvatarList() |
3710 | { | 3777 | { |
3711 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); | 3778 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); |
3712 | m_host.AddScriptLPS(1); | ||
3713 | 3779 | ||
3714 | LSL_List result = new LSL_List(); | 3780 | LSL_List result = new LSL_List(); |
3715 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) | 3781 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) |
3716 | { | 3782 | { |
3717 | if (avatar != null && avatar.UUID != m_host.OwnerID) | 3783 | if (avatar != null && !avatar.IsDeleted && avatar.UUID != m_host.OwnerID ) |
3784 | { | ||
3785 | result.Add(new LSL_String(avatar.UUID.ToString())); | ||
3786 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); | ||
3787 | result.Add(new LSL_String(avatar.Name)); | ||
3788 | } | ||
3789 | }); | ||
3790 | |||
3791 | return result; | ||
3792 | } | ||
3793 | |||
3794 | public LSL_List osGetNPCList() | ||
3795 | { | ||
3796 | CheckThreatLevel(ThreatLevel.None, "osGetNPCList"); | ||
3797 | |||
3798 | LSL_List result = new LSL_List(); | ||
3799 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) | ||
3800 | { | ||
3801 | // npcs are not childagents but that is now. | ||
3802 | if (avatar != null && avatar.IsNPC && !avatar.IsDeleted && !avatar.IsChildAgent && !avatar.IsInTransit) | ||
3718 | { | 3803 | { |
3719 | result.Add(new LSL_String(avatar.UUID.ToString())); | 3804 | result.Add(new LSL_String(avatar.UUID.ToString())); |
3720 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); | 3805 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); |
@@ -3733,7 +3818,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3733 | public LSL_String osUnixTimeToTimestamp(long time) | 3818 | public LSL_String osUnixTimeToTimestamp(long time) |
3734 | { | 3819 | { |
3735 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); | 3820 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); |
3736 | m_host.AddScriptLPS(1); | ||
3737 | 3821 | ||
3738 | long baseTicks = 621355968000000000; | 3822 | long baseTicks = 621355968000000000; |
3739 | long tickResolution = 10000000; | 3823 | long tickResolution = 10000000; |
@@ -3750,7 +3834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3750 | /// <returns>Item description</returns> | 3834 | /// <returns>Item description</returns> |
3751 | public LSL_String osGetInventoryDesc(string item) | 3835 | public LSL_String osGetInventoryDesc(string item) |
3752 | { | 3836 | { |
3753 | m_host.AddScriptLPS(1); | 3837 | CheckThreatLevel(); |
3754 | 3838 | ||
3755 | lock (m_host.TaskInventory) | 3839 | lock (m_host.TaskInventory) |
3756 | { | 3840 | { |
@@ -3774,7 +3858,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3774 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | 3858 | public LSL_Integer osInviteToGroup(LSL_Key agentId) |
3775 | { | 3859 | { |
3776 | CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); | 3860 | CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); |
3777 | m_host.AddScriptLPS(1); | ||
3778 | 3861 | ||
3779 | UUID agent = new UUID(agentId); | 3862 | UUID agent = new UUID(agentId); |
3780 | 3863 | ||
@@ -3809,7 +3892,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3809 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | 3892 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) |
3810 | { | 3893 | { |
3811 | CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); | 3894 | CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); |
3812 | m_host.AddScriptLPS(1); | ||
3813 | 3895 | ||
3814 | UUID agent = new UUID(agentId); | 3896 | UUID agent = new UUID(agentId); |
3815 | 3897 | ||
@@ -3845,7 +3927,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3845 | { | 3927 | { |
3846 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | 3928 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); |
3847 | 3929 | ||
3848 | m_host.AddScriptLPS(1); | ||
3849 | //Check to make sure that the script's owner is the estate manager/master | 3930 | //Check to make sure that the script's owner is the estate manager/master |
3850 | //World.Permissions.GenericEstatePermission( | 3931 | //World.Permissions.GenericEstatePermission( |
3851 | if (World.Permissions.IsGod(m_host.OwnerID)) | 3932 | if (World.Permissions.IsGod(m_host.OwnerID)) |
@@ -3875,7 +3956,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3875 | { | 3956 | { |
3876 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | 3957 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); |
3877 | 3958 | ||
3878 | m_host.AddScriptLPS(1); | ||
3879 | //Check to make sure that the script's owner is the estate manager/master | 3959 | //Check to make sure that the script's owner is the estate manager/master |
3880 | //World.Permissions.GenericEstatePermission( | 3960 | //World.Permissions.GenericEstatePermission( |
3881 | if (World.Permissions.IsGod(m_host.OwnerID)) | 3961 | if (World.Permissions.IsGod(m_host.OwnerID)) |
@@ -3896,8 +3976,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3896 | { | 3976 | { |
3897 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); | 3977 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); |
3898 | 3978 | ||
3899 | m_host.AddScriptLPS(1); | ||
3900 | |||
3901 | InitLSL(); | 3979 | InitLSL(); |
3902 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); | 3980 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); |
3903 | } | 3981 | } |
@@ -3906,8 +3984,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3906 | { | 3984 | { |
3907 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); | 3985 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); |
3908 | 3986 | ||
3909 | m_host.AddScriptLPS(1); | ||
3910 | |||
3911 | ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint); | 3987 | ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint); |
3912 | } | 3988 | } |
3913 | 3989 | ||
@@ -3915,8 +3991,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3915 | { | 3991 | { |
3916 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory"); | 3992 | CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory"); |
3917 | 3993 | ||
3918 | m_host.AddScriptLPS(1); | ||
3919 | |||
3920 | UUID avatarId; | 3994 | UUID avatarId; |
3921 | 3995 | ||
3922 | if (!UUID.TryParse(rawAvatarId, out avatarId)) | 3996 | if (!UUID.TryParse(rawAvatarId, out avatarId)) |
@@ -3976,8 +4050,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3976 | { | 4050 | { |
3977 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); | 4051 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); |
3978 | 4052 | ||
3979 | m_host.AddScriptLPS(1); | ||
3980 | |||
3981 | InitLSL(); | 4053 | InitLSL(); |
3982 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); | 4054 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); |
3983 | } | 4055 | } |
@@ -3986,8 +4058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3986 | { | 4058 | { |
3987 | CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments"); | 4059 | CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments"); |
3988 | 4060 | ||
3989 | m_host.AddScriptLPS(1); | ||
3990 | |||
3991 | UUID targetUUID; | 4061 | UUID targetUUID; |
3992 | ScenePresence target; | 4062 | ScenePresence target; |
3993 | LSL_List resp = new LSL_List(); | 4063 | LSL_List resp = new LSL_List(); |
@@ -4021,7 +4091,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4021 | public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options) | 4091 | public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options) |
4022 | { | 4092 | { |
4023 | CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); | 4093 | CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); |
4024 | m_host.AddScriptLPS(1); | ||
4025 | 4094 | ||
4026 | UUID targetUUID; | 4095 | UUID targetUUID; |
4027 | if(!UUID.TryParse(avatar.ToString(), out targetUUID)) | 4096 | if(!UUID.TryParse(avatar.ToString(), out targetUUID)) |
@@ -4130,8 +4199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4130 | /// <returns>1 if thing is a valid UUID, 0 otherwise</returns> | 4199 | /// <returns>1 if thing is a valid UUID, 0 otherwise</returns> |
4131 | public LSL_Integer osIsUUID(string thing) | 4200 | public LSL_Integer osIsUUID(string thing) |
4132 | { | 4201 | { |
4133 | CheckThreatLevel(ThreatLevel.None, "osIsUUID"); | 4202 | CheckThreatLevel(); |
4134 | m_host.AddScriptLPS(1); | ||
4135 | 4203 | ||
4136 | UUID test; | 4204 | UUID test; |
4137 | return UUID.TryParse(thing, out test) ? 1 : 0; | 4205 | return UUID.TryParse(thing, out test) ? 1 : 0; |
@@ -4145,8 +4213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4145 | /// <returns></returns> | 4213 | /// <returns></returns> |
4146 | public LSL_Float osMin(double a, double b) | 4214 | public LSL_Float osMin(double a, double b) |
4147 | { | 4215 | { |
4148 | CheckThreatLevel(ThreatLevel.None, "osMin"); | 4216 | CheckThreatLevel(); |
4149 | m_host.AddScriptLPS(1); | ||
4150 | 4217 | ||
4151 | return Math.Min(a, b); | 4218 | return Math.Min(a, b); |
4152 | } | 4219 | } |
@@ -4159,8 +4226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4159 | /// <returns></returns> | 4226 | /// <returns></returns> |
4160 | public LSL_Float osMax(double a, double b) | 4227 | public LSL_Float osMax(double a, double b) |
4161 | { | 4228 | { |
4162 | CheckThreatLevel(ThreatLevel.None, "osMax"); | 4229 | CheckThreatLevel(); |
4163 | m_host.AddScriptLPS(1); | ||
4164 | 4230 | ||
4165 | return Math.Max(a, b); | 4231 | return Math.Max(a, b); |
4166 | } | 4232 | } |
@@ -4168,7 +4234,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4168 | public LSL_Key osGetRezzingObject() | 4234 | public LSL_Key osGetRezzingObject() |
4169 | { | 4235 | { |
4170 | CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); | 4236 | CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); |
4171 | m_host.AddScriptLPS(1); | 4237 | |
4172 | UUID rezID = m_host.ParentGroup.RezzerID; | 4238 | UUID rezID = m_host.ParentGroup.RezzerID; |
4173 | if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) | 4239 | if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) |
4174 | return new LSL_Key(UUID.Zero.ToString()); | 4240 | return new LSL_Key(UUID.Zero.ToString()); |
@@ -4193,7 +4259,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4193 | /// <returns>boolean indicating whether an error was shouted.</returns> | 4259 | /// <returns>boolean indicating whether an error was shouted.</returns> |
4194 | protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) | 4260 | protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) |
4195 | { | 4261 | { |
4196 | m_host.AddScriptLPS(1); | ||
4197 | bool fail = false; | 4262 | bool fail = false; |
4198 | if (m_item.PermsGranter != m_host.OwnerID) | 4263 | if (m_item.PermsGranter != m_host.OwnerID) |
4199 | { | 4264 | { |
@@ -4244,7 +4309,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4244 | public void osDropAttachment() | 4309 | public void osDropAttachment() |
4245 | { | 4310 | { |
4246 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); | 4311 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); |
4247 | m_host.AddScriptLPS(1); | ||
4248 | 4312 | ||
4249 | DropAttachment(true); | 4313 | DropAttachment(true); |
4250 | } | 4314 | } |
@@ -4252,7 +4316,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4252 | public void osForceDropAttachment() | 4316 | public void osForceDropAttachment() |
4253 | { | 4317 | { |
4254 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment"); | 4318 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment"); |
4255 | m_host.AddScriptLPS(1); | ||
4256 | 4319 | ||
4257 | DropAttachment(false); | 4320 | DropAttachment(false); |
4258 | } | 4321 | } |
@@ -4260,7 +4323,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4260 | public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) | 4323 | public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) |
4261 | { | 4324 | { |
4262 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); | 4325 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); |
4263 | m_host.AddScriptLPS(1); | ||
4264 | 4326 | ||
4265 | DropAttachmentAt(true, pos, rot); | 4327 | DropAttachmentAt(true, pos, rot); |
4266 | } | 4328 | } |
@@ -4268,7 +4330,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4268 | public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) | 4330 | public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) |
4269 | { | 4331 | { |
4270 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); | 4332 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); |
4271 | m_host.AddScriptLPS(1); | ||
4272 | 4333 | ||
4273 | DropAttachmentAt(false, pos, rot); | 4334 | DropAttachmentAt(false, pos, rot); |
4274 | } | 4335 | } |
@@ -4276,7 +4337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4276 | public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) | 4337 | public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) |
4277 | { | 4338 | { |
4278 | CheckThreatLevel(ThreatLevel.Low, "osListenRegex"); | 4339 | CheckThreatLevel(ThreatLevel.Low, "osListenRegex"); |
4279 | m_host.AddScriptLPS(1); | 4340 | |
4280 | UUID keyID; | 4341 | UUID keyID; |
4281 | UUID.TryParse(ID, out keyID); | 4342 | UUID.TryParse(ID, out keyID); |
4282 | 4343 | ||
@@ -4324,7 +4385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4324 | public LSL_Integer osRegexIsMatch(string input, string pattern) | 4385 | public LSL_Integer osRegexIsMatch(string input, string pattern) |
4325 | { | 4386 | { |
4326 | CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch"); | 4387 | CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch"); |
4327 | m_host.AddScriptLPS(1); | 4388 | |
4328 | try | 4389 | try |
4329 | { | 4390 | { |
4330 | return Regex.IsMatch(input, pattern) ? 1 : 0; | 4391 | return Regex.IsMatch(input, pattern) ? 1 : 0; |
@@ -4339,7 +4400,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4339 | public LSL_String osRequestURL(LSL_List options) | 4400 | public LSL_String osRequestURL(LSL_List options) |
4340 | { | 4401 | { |
4341 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); | 4402 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); |
4342 | m_host.AddScriptLPS(1); | ||
4343 | 4403 | ||
4344 | Hashtable opts = new Hashtable(); | 4404 | Hashtable opts = new Hashtable(); |
4345 | for (int i = 0 ; i < options.Length ; i++) | 4405 | for (int i = 0 ; i < options.Length ; i++) |
@@ -4357,7 +4417,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4357 | public LSL_String osRequestSecureURL(LSL_List options) | 4417 | public LSL_String osRequestSecureURL(LSL_List options) |
4358 | { | 4418 | { |
4359 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); | 4419 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); |
4360 | m_host.AddScriptLPS(1); | ||
4361 | 4420 | ||
4362 | Hashtable opts = new Hashtable(); | 4421 | Hashtable opts = new Hashtable(); |
4363 | for (int i = 0 ; i < options.Length ; i++) | 4422 | for (int i = 0 ; i < options.Length ; i++) |
@@ -4375,7 +4434,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4375 | public void osCollisionSound(string impact_sound, double impact_volume) | 4434 | public void osCollisionSound(string impact_sound, double impact_volume) |
4376 | { | 4435 | { |
4377 | CheckThreatLevel(); | 4436 | CheckThreatLevel(); |
4378 | m_host.AddScriptLPS(1); | ||
4379 | 4437 | ||
4380 | if(impact_sound == "") | 4438 | if(impact_sound == "") |
4381 | { | 4439 | { |
@@ -4408,7 +4466,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4408 | public void osVolumeDetect(int detect) | 4466 | public void osVolumeDetect(int detect) |
4409 | { | 4467 | { |
4410 | CheckThreatLevel(); | 4468 | CheckThreatLevel(); |
4411 | m_host.AddScriptLPS(1); | ||
4412 | 4469 | ||
4413 | if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) | 4470 | if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) |
4414 | return; | 4471 | return; |
@@ -4431,7 +4488,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4431 | public LSL_List osGetInertiaData() | 4488 | public LSL_List osGetInertiaData() |
4432 | { | 4489 | { |
4433 | CheckThreatLevel(); | 4490 | CheckThreatLevel(); |
4434 | m_host.AddScriptLPS(1); | ||
4435 | 4491 | ||
4436 | LSL_List result = new LSL_List(); | 4492 | LSL_List result = new LSL_List(); |
4437 | float TotalMass; | 4493 | float TotalMass; |
@@ -4479,7 +4535,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4479 | public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot) | 4535 | public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot) |
4480 | { | 4536 | { |
4481 | CheckThreatLevel(); | 4537 | CheckThreatLevel(); |
4482 | m_host.AddScriptLPS(1); | ||
4483 | 4538 | ||
4484 | SceneObjectGroup sog = m_host.ParentGroup; | 4539 | SceneObjectGroup sog = m_host.ParentGroup; |
4485 | if(sog== null || sog.IsDeleted) | 4540 | if(sog== null || sog.IsDeleted) |
@@ -4518,7 +4573,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4518 | public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot) | 4573 | public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot) |
4519 | { | 4574 | { |
4520 | CheckThreatLevel(); | 4575 | CheckThreatLevel(); |
4521 | m_host.AddScriptLPS(1); | ||
4522 | 4576 | ||
4523 | SceneObjectGroup sog = m_host.ParentGroup; | 4577 | SceneObjectGroup sog = m_host.ParentGroup; |
4524 | if(sog== null || sog.IsDeleted) | 4578 | if(sog== null || sog.IsDeleted) |
@@ -4560,7 +4614,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4560 | public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass) | 4614 | public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass) |
4561 | { | 4615 | { |
4562 | CheckThreatLevel(); | 4616 | CheckThreatLevel(); |
4563 | m_host.AddScriptLPS(1); | ||
4564 | 4617 | ||
4565 | SceneObjectGroup sog = m_host.ParentGroup; | 4618 | SceneObjectGroup sog = m_host.ParentGroup; |
4566 | if(sog== null || sog.IsDeleted) | 4619 | if(sog== null || sog.IsDeleted) |
@@ -4600,7 +4653,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4600 | public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot) | 4653 | public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot) |
4601 | { | 4654 | { |
4602 | CheckThreatLevel(); | 4655 | CheckThreatLevel(); |
4603 | m_host.AddScriptLPS(1); | ||
4604 | 4656 | ||
4605 | SceneObjectGroup sog = m_host.ParentGroup; | 4657 | SceneObjectGroup sog = m_host.ParentGroup; |
4606 | if(sog== null || sog.IsDeleted) | 4658 | if(sog== null || sog.IsDeleted) |
@@ -4639,7 +4691,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4639 | public void osClearInertia() | 4691 | public void osClearInertia() |
4640 | { | 4692 | { |
4641 | CheckThreatLevel(); | 4693 | CheckThreatLevel(); |
4642 | m_host.AddScriptLPS(1); | ||
4643 | 4694 | ||
4644 | SceneObjectGroup sog = m_host.ParentGroup; | 4695 | SceneObjectGroup sog = m_host.ParentGroup; |
4645 | if(sog== null || sog.IsDeleted) | 4696 | if(sog== null || sog.IsDeleted) |
@@ -4648,6 +4699,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4648 | sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero ); | 4699 | sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero ); |
4649 | } | 4700 | } |
4650 | 4701 | ||
4702 | private bool checkAllowObjectTPbyLandOwner(Vector3 pos) | ||
4703 | { | ||
4704 | ILandObject land = World.LandChannel.GetLandObject(pos); | ||
4705 | if(land == null) | ||
4706 | return true; | ||
4707 | |||
4708 | LandData landdata = land.LandData; | ||
4709 | if(landdata == null) | ||
4710 | return true; | ||
4711 | |||
4712 | UUID hostOwner = m_host.OwnerID; | ||
4713 | if(landdata.OwnerID == hostOwner) | ||
4714 | return true; | ||
4715 | |||
4716 | EstateSettings es = World.RegionInfo.EstateSettings; | ||
4717 | if(es != null && es.IsEstateManagerOrOwner(hostOwner)) | ||
4718 | return true; | ||
4719 | |||
4720 | if(!landdata.IsGroupOwned) | ||
4721 | return false; | ||
4722 | |||
4723 | UUID landGroup = landdata.GroupID; | ||
4724 | if(landGroup == UUID.Zero) | ||
4725 | return false; | ||
4726 | |||
4727 | if(landGroup == m_host.GroupID) | ||
4728 | return true; | ||
4729 | |||
4730 | return false; | ||
4731 | } | ||
4732 | |||
4651 | /// <summary> | 4733 | /// <summary> |
4652 | /// teleports a object (full linkset) | 4734 | /// teleports a object (full linkset) |
4653 | /// </summary> | 4735 | /// </summary> |
@@ -4667,7 +4749,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4667 | public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) | 4749 | public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) |
4668 | { | 4750 | { |
4669 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject"); | 4751 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject"); |
4670 | m_host.AddScriptLPS(1); | ||
4671 | 4752 | ||
4672 | UUID objUUID; | 4753 | UUID objUUID; |
4673 | if (!UUID.TryParse(objectUUID, out objUUID)) | 4754 | if (!UUID.TryParse(objectUUID, out objUUID)) |
@@ -4677,9 +4758,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4677 | } | 4758 | } |
4678 | 4759 | ||
4679 | SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID); | 4760 | SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID); |
4680 | if(sog== null || sog.IsDeleted) | 4761 | if(sog== null || sog.IsDeleted || sog.inTransit) |
4681 | return -1; | 4762 | return -1; |
4682 | 4763 | ||
4764 | if(sog.OwnerID != m_host.OwnerID) | ||
4765 | { | ||
4766 | Vector3 pos = sog.AbsolutePosition; | ||
4767 | if(!checkAllowObjectTPbyLandOwner(pos)) | ||
4768 | return -1; | ||
4769 | } | ||
4770 | |||
4683 | UUID myid = m_host.ParentGroup.UUID; | 4771 | UUID myid = m_host.ParentGroup.UUID; |
4684 | 4772 | ||
4685 | return sog.TeleportObject(myid, targetPos, rotation, flags); | 4773 | return sog.TeleportObject(myid, targetPos, rotation, flags); |
@@ -4689,7 +4777,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4689 | public LSL_Integer osGetLinkNumber(LSL_String name) | 4777 | public LSL_Integer osGetLinkNumber(LSL_String name) |
4690 | { | 4778 | { |
4691 | CheckThreatLevel(); | 4779 | CheckThreatLevel(); |
4692 | m_host.AddScriptLPS(1); | ||
4693 | 4780 | ||
4694 | SceneObjectGroup sog = m_host.ParentGroup; | 4781 | SceneObjectGroup sog = m_host.ParentGroup; |
4695 | if(sog== null || sog.IsDeleted) | 4782 | if(sog== null || sog.IsDeleted) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index bd5d008..8f863af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -123,6 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
123 | string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, | 123 | string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, |
124 | bool blend, int disp, int timer, int alpha, int face); | 124 | bool blend, int disp, int timer, int alpha, int face); |
125 | string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); | 125 | string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); |
126 | string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams, int timer, int face); | ||
126 | string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, | 127 | string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, |
127 | int timer, int alpha); | 128 | int timer, int alpha); |
128 | string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, | 129 | string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, |
@@ -143,8 +144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
143 | void osSetParcelSIPAddress(string SIPAddress); | 144 | void osSetParcelSIPAddress(string SIPAddress); |
144 | 145 | ||
145 | // Avatar Info Commands | 146 | // Avatar Info Commands |
146 | string osGetAgentIP(string agent); | ||
147 | LSL_List osGetAgents(); | 147 | LSL_List osGetAgents(); |
148 | string osGetAgentIP(string agent); | ||
148 | 149 | ||
149 | // Teleport commands | 150 | // Teleport commands |
150 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 151 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
@@ -222,10 +223,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
222 | string osDrawLine(string drawList, int endX, int endY); | 223 | string osDrawLine(string drawList, int endX, int endY); |
223 | string osDrawText(string drawList, string text); | 224 | string osDrawText(string drawList, string text); |
224 | string osDrawEllipse(string drawList, int width, int height); | 225 | string osDrawEllipse(string drawList, int width, int height); |
226 | string osDrawFilledEllipse(string drawList, int width, int height); | ||
225 | string osDrawRectangle(string drawList, int width, int height); | 227 | string osDrawRectangle(string drawList, int width, int height); |
226 | string osDrawFilledRectangle(string drawList, int width, int height); | 228 | string osDrawFilledRectangle(string drawList, int width, int height); |
227 | string osDrawPolygon(string drawList, LSL_List x, LSL_List y); | 229 | string osDrawPolygon(string drawList, LSL_List x, LSL_List y); |
228 | string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); | 230 | string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); |
231 | string osDrawResetTransform(string drawList); | ||
232 | string osDrawRotationTransform(string drawList, LSL_Float x); | ||
233 | string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y); | ||
234 | string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y); | ||
229 | string osSetFontName(string drawList, string fontName); | 235 | string osSetFontName(string drawList, string fontName); |
230 | string osSetFontSize(string drawList, int fontSize); | 236 | string osSetFontSize(string drawList, int fontSize); |
231 | string osSetPenSize(string drawList, int penSize); | 237 | string osSetPenSize(string drawList, int penSize); |
@@ -389,6 +395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
389 | void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); | 395 | void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); |
390 | 396 | ||
391 | LSL_List osGetAvatarList(); | 397 | LSL_List osGetAvatarList(); |
398 | LSL_List osGetNPCList(); | ||
392 | 399 | ||
393 | LSL_String osUnixTimeToTimestamp(long time); | 400 | LSL_String osUnixTimeToTimestamp(long time); |
394 | 401 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index a277f6c..e4c1ca0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -697,7 +697,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
697 | public const int PARCEL_DETAILS_GROUP = 3; | 697 | public const int PARCEL_DETAILS_GROUP = 3; |
698 | public const int PARCEL_DETAILS_AREA = 4; | 698 | public const int PARCEL_DETAILS_AREA = 4; |
699 | public const int PARCEL_DETAILS_ID = 5; | 699 | public const int PARCEL_DETAILS_ID = 5; |
700 | public const int PARCEL_DETAILS_SEE_AVATARS = 6; // not implemented | 700 | public const int PARCEL_DETAILS_SEE_AVATARS = 6; |
701 | public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7; | ||
702 | public const int PARCEL_DETAILS_GROUP_SOUNDS = 8; | ||
701 | 703 | ||
702 | //osSetParcelDetails | 704 | //osSetParcelDetails |
703 | public const int PARCEL_DETAILS_CLAIMDATE = 10; | 705 | public const int PARCEL_DETAILS_CLAIMDATE = 10; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9eac114..42e7bfb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -153,6 +153,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
153 | return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); | 153 | return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); |
154 | } | 154 | } |
155 | 155 | ||
156 | public string osSetDynamicTextureDataFace(string dynamicID, string contentType, string data, string extraParams, | ||
157 | int timer, int face) | ||
158 | { | ||
159 | return m_OSSL_Functions.osSetDynamicTextureDataFace(dynamicID, contentType, data, extraParams, timer, face); | ||
160 | } | ||
161 | |||
156 | public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, | 162 | public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, |
157 | int timer, int alpha) | 163 | int timer, int alpha) |
158 | { | 164 | { |
@@ -271,15 +277,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
271 | m_OSSL_Functions.osTeleportOwner(position, lookat); | 277 | m_OSSL_Functions.osTeleportOwner(position, lookat); |
272 | } | 278 | } |
273 | 279 | ||
274 | // Avatar info functions | 280 | public LSL_List osGetAgents() |
275 | public string osGetAgentIP(string agent) | ||
276 | { | 281 | { |
277 | return m_OSSL_Functions.osGetAgentIP(agent); | 282 | return m_OSSL_Functions.osGetAgents(); |
278 | } | 283 | } |
279 | 284 | ||
280 | public LSL_List osGetAgents() | 285 | public string osGetAgentIP(string agent) |
281 | { | 286 | { |
282 | return m_OSSL_Functions.osGetAgents(); | 287 | return m_OSSL_Functions.osGetAgentIP(agent); |
283 | } | 288 | } |
284 | 289 | ||
285 | // Animation Functions | 290 | // Animation Functions |
@@ -355,6 +360,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
355 | return m_OSSL_Functions.osDrawEllipse(drawList, width, height); | 360 | return m_OSSL_Functions.osDrawEllipse(drawList, width, height); |
356 | } | 361 | } |
357 | 362 | ||
363 | public string osDrawFilledEllipse(string drawList, int width, int height) | ||
364 | { | ||
365 | return m_OSSL_Functions.osDrawFilledEllipse(drawList, width, height); | ||
366 | } | ||
367 | |||
358 | public string osDrawRectangle(string drawList, int width, int height) | 368 | public string osDrawRectangle(string drawList, int width, int height) |
359 | { | 369 | { |
360 | return m_OSSL_Functions.osDrawRectangle(drawList, width, height); | 370 | return m_OSSL_Functions.osDrawRectangle(drawList, width, height); |
@@ -375,6 +385,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
375 | return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y); | 385 | return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y); |
376 | } | 386 | } |
377 | 387 | ||
388 | public string osDrawResetTransform(string drawList) | ||
389 | { | ||
390 | return m_OSSL_Functions.osDrawResetTransform(drawList); | ||
391 | } | ||
392 | |||
393 | public string osDrawRotationTransform(string drawList, LSL_Float x) | ||
394 | { | ||
395 | return m_OSSL_Functions.osDrawRotationTransform(drawList, x); | ||
396 | } | ||
397 | |||
398 | public string osDrawScaleTransform(string drawList, LSL_Float x, LSL_Float y) | ||
399 | { | ||
400 | return m_OSSL_Functions.osDrawScaleTransform(drawList, x, y); | ||
401 | } | ||
402 | |||
403 | public string osDrawTranslationTransform(string drawList, LSL_Float x, LSL_Float y) | ||
404 | { | ||
405 | return m_OSSL_Functions.osDrawTranslationTransform(drawList, x, y); | ||
406 | } | ||
407 | |||
378 | public string osSetFontSize(string drawList, int fontSize) | 408 | public string osSetFontSize(string drawList, int fontSize) |
379 | { | 409 | { |
380 | return m_OSSL_Functions.osSetFontSize(drawList, fontSize); | 410 | return m_OSSL_Functions.osSetFontSize(drawList, fontSize); |
@@ -399,6 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
399 | { | 429 | { |
400 | return m_OSSL_Functions.osSetPenColor(drawList, color); | 430 | return m_OSSL_Functions.osSetPenColor(drawList, color); |
401 | } | 431 | } |
432 | |||
402 | // Deprecated | 433 | // Deprecated |
403 | public string osSetPenColour(string drawList, string colour) | 434 | public string osSetPenColour(string drawList, string colour) |
404 | { | 435 | { |
@@ -1010,6 +1041,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1010 | return m_OSSL_Functions.osGetAvatarList(); | 1041 | return m_OSSL_Functions.osGetAvatarList(); |
1011 | } | 1042 | } |
1012 | 1043 | ||
1044 | public LSL_List osGetNPCList() | ||
1045 | { | ||
1046 | return m_OSSL_Functions.osGetNPCList(); | ||
1047 | } | ||
1048 | |||
1013 | public LSL_String osUnixTimeToTimestamp(long time) | 1049 | public LSL_String osUnixTimeToTimestamp(long time) |
1014 | { | 1050 | { |
1015 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); | 1051 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 4d7a698..8780e49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -39,7 +39,6 @@ using OMV_Quaternion = OpenMetaverse.Quaternion; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.ScriptEngine.Shared | 40 | namespace OpenSim.Region.ScriptEngine.Shared |
41 | { | 41 | { |
42 | [Serializable] | ||
43 | public partial class LSL_Types | 42 | public partial class LSL_Types |
44 | { | 43 | { |
45 | // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain | 44 | // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain |
@@ -526,7 +525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
526 | } | 525 | } |
527 | 526 | ||
528 | [Serializable] | 527 | [Serializable] |
529 | public class list | 528 | public class list: MarshalByRefObject |
530 | { | 529 | { |
531 | private object[] m_data; | 530 | private object[] m_data; |
532 | 531 | ||