diff options
author | Jeff Ames | 2008-06-04 09:59:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-06-04 09:59:27 +0000 |
commit | 4ec4e16c809cf86a63b736d2b7b6ad7291595a5f (patch) | |
tree | cfa896ef9057228171e2ee39c4807060101ba90b /OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs | |
parent | * If a ThreadAbortException reaches AuthUser() then let it pass through unmol... (diff) | |
download | opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.zip opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.gz opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.bz2 opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.xz |
Formatting cleanup, minor refactoring, svn properties.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs | 300 |
1 files changed, 159 insertions, 141 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs index ca209b6..0f2d2a5 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs | |||
@@ -111,8 +111,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
111 | { | 111 | { |
112 | m_host.AddScriptLPS(1); | 112 | m_host.AddScriptLPS(1); |
113 | 113 | ||
114 | if(text.Length > 1023) | 114 | if (text.Length > 1023) |
115 | text=text.Substring(0, 1023); | 115 | text = text.Substring(0, 1023); |
116 | 116 | ||
117 | World.SimChat(Helpers.StringToField(text), | 117 | World.SimChat(Helpers.StringToField(text), |
118 | ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 118 | ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
@@ -129,13 +129,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
129 | 129 | ||
130 | private LLUUID InventorySelf() | 130 | private LLUUID InventorySelf() |
131 | { | 131 | { |
132 | LLUUID invItemID=new LLUUID(); | 132 | LLUUID invItemID = new LLUUID(); |
133 | 133 | ||
134 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 134 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
135 | { | 135 | { |
136 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | 136 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) |
137 | { | 137 | { |
138 | invItemID=inv.Key; | 138 | invItemID = inv.Key; |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | } | 141 | } |
@@ -300,7 +300,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
300 | return angle; | 300 | return angle; |
301 | } | 301 | } |
302 | 302 | ||
303 | |||
304 | // Old implementation of llRot2Euler, now normalized | 303 | // Old implementation of llRot2Euler, now normalized |
305 | 304 | ||
306 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | 305 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) |
@@ -322,7 +321,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
322 | return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); | 321 | return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); |
323 | } | 322 | } |
324 | 323 | ||
325 | |||
326 | // Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like | 324 | // Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like |
327 | // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler. | 325 | // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler. |
328 | 326 | ||
@@ -363,7 +361,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
363 | return new LSL_Types.Quaternion(x, y, z, s); | 361 | return new LSL_Types.Quaternion(x, y, z, s); |
364 | } | 362 | } |
365 | 363 | ||
366 | |||
367 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) | 364 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) |
368 | { | 365 | { |
369 | m_host.AddScriptLPS(1); | 366 | m_host.AddScriptLPS(1); |
@@ -388,6 +385,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
388 | m_host.AddScriptLPS(1); | 385 | m_host.AddScriptLPS(1); |
389 | return (new LSL_Types.Vector3(0, 0, 1) * r); | 386 | return (new LSL_Types.Vector3(0, 0, 1) * r); |
390 | } | 387 | } |
388 | |||
391 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | 389 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) |
392 | { | 390 | { |
393 | //A and B should both be normalized | 391 | //A and B should both be normalized |
@@ -401,12 +399,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
401 | 399 | ||
402 | return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2)); | 400 | return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2)); |
403 | } | 401 | } |
402 | |||
404 | public void llWhisper(int channelID, string text) | 403 | public void llWhisper(int channelID, string text) |
405 | { | 404 | { |
406 | m_host.AddScriptLPS(1); | 405 | m_host.AddScriptLPS(1); |
407 | 406 | ||
408 | if(text.Length > 1023) | 407 | if (text.Length > 1023) |
409 | text=text.Substring(0, 1023); | 408 | text = text.Substring(0, 1023); |
410 | 409 | ||
411 | World.SimChat(Helpers.StringToField(text), | 410 | World.SimChat(Helpers.StringToField(text), |
412 | ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 411 | ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
@@ -419,8 +418,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
419 | { | 418 | { |
420 | m_host.AddScriptLPS(1); | 419 | m_host.AddScriptLPS(1); |
421 | 420 | ||
422 | if(text.Length > 1023) | 421 | if (text.Length > 1023) |
423 | text=text.Substring(0, 1023); | 422 | text = text.Substring(0, 1023); |
424 | 423 | ||
425 | World.SimChat(Helpers.StringToField(text), | 424 | World.SimChat(Helpers.StringToField(text), |
426 | ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true); | 425 | ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true); |
@@ -437,9 +436,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
437 | return; | 436 | return; |
438 | } | 437 | } |
439 | 438 | ||
440 | 439 | if (text.Length > 1023) | |
441 | if(text.Length > 1023) | 440 | text = text.Substring(0, 1023); |
442 | text=text.Substring(0, 1023); | ||
443 | 441 | ||
444 | m_host.AddScriptLPS(1); | 442 | m_host.AddScriptLPS(1); |
445 | 443 | ||
@@ -486,7 +484,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
486 | LLUUID.TryParse(id, out keyID); | 484 | LLUUID.TryParse(id, out keyID); |
487 | 485 | ||
488 | m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); | 486 | m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); |
489 | } | 487 | } |
490 | 488 | ||
491 | public void llSensorRemove() | 489 | public void llSensorRemove() |
492 | { | 490 | { |
@@ -520,17 +518,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
520 | if (SensedObject == null) | 518 | if (SensedObject == null) |
521 | return String.Empty; | 519 | return String.Empty; |
522 | return SensedObject.Name; | 520 | return SensedObject.Name; |
523 | |||
524 | } | 521 | } |
525 | 522 | ||
526 | public string llDetectedName(int number) | 523 | public string llDetectedName(int number) |
527 | { | 524 | { |
528 | m_host.AddScriptLPS(1); | 525 | m_host.AddScriptLPS(1); |
529 | LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); | 526 | LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); |
530 | if(sensedUUID != null) | 527 | if (sensedUUID != null) |
531 | return resolveName(sensedUUID); | 528 | return resolveName(sensedUUID); |
532 | return String.Empty; | 529 | return String.Empty; |
533 | } | 530 | } |
534 | 531 | ||
535 | public LLUUID uuidDetectedKey(int number) | 532 | public LLUUID uuidDetectedKey(int number) |
536 | { | 533 | { |
@@ -540,7 +537,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
540 | public EntityBase entityDetectedKey(int number) | 537 | public EntityBase entityDetectedKey(int number) |
541 | { | 538 | { |
542 | LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); | 539 | LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); |
543 | if(sensedUUID != null) | 540 | if (sensedUUID != null) |
544 | { | 541 | { |
545 | EntityBase SensedObject = null; | 542 | EntityBase SensedObject = null; |
546 | lock (World.Entities) | 543 | lock (World.Entities) |
@@ -567,7 +564,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
567 | // returns UUID of owner of object detected | 564 | // returns UUID of owner of object detected |
568 | m_host.AddScriptLPS(1); | 565 | m_host.AddScriptLPS(1); |
569 | EntityBase SensedObject = entityDetectedKey(number); | 566 | EntityBase SensedObject = entityDetectedKey(number); |
570 | if (SensedObject ==null) | 567 | if (SensedObject == null) |
571 | return String.Empty; | 568 | return String.Empty; |
572 | LLUUID SensedUUID = uuidDetectedKey(number); | 569 | LLUUID SensedUUID = uuidDetectedKey(number); |
573 | if (World.GetScenePresence(SensedUUID) == null) | 570 | if (World.GetScenePresence(SensedUUID) == null) |
@@ -575,7 +572,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
575 | // sensed object is not an avatar | 572 | // sensed object is not an avatar |
576 | // so get the owner of the sensed object | 573 | // so get the owner of the sensed object |
577 | SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID); | 574 | SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID); |
578 | if (SOP != null) { return SOP.ObjectOwner.ToString(); } | 575 | if (SOP != null) |
576 | { | ||
577 | return SOP.ObjectOwner.ToString(); | ||
578 | } | ||
579 | } | 579 | } |
580 | else | 580 | else |
581 | { | 581 | { |
@@ -583,9 +583,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
583 | return SensedUUID.ToString(); | 583 | return SensedUUID.ToString(); |
584 | } | 584 | } |
585 | 585 | ||
586 | |||
587 | return String.Empty; | 586 | return String.Empty; |
588 | |||
589 | } | 587 | } |
590 | 588 | ||
591 | public LSL_Types.LSLInteger llDetectedType(int number) | 589 | public LSL_Types.LSLInteger llDetectedType(int number) |
@@ -599,14 +597,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
599 | LLUUID SensedUUID = uuidDetectedKey(number); | 597 | LLUUID SensedUUID = uuidDetectedKey(number); |
600 | LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0); | 598 | LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0); |
601 | 599 | ||
602 | if (World.GetScenePresence(SensedUUID) != null) mask |= 0x01; // actor | 600 | if (World.GetScenePresence(SensedUUID) != null) |
601 | mask |= 0x01; // actor | ||
602 | |||
603 | if (SensedObject.Velocity.Equals(ZeroVector)) | 603 | if (SensedObject.Velocity.Equals(ZeroVector)) |
604 | mask |= 0x04; // passive non-moving | 604 | mask |= 0x04; // passive non-moving |
605 | else | 605 | else |
606 | mask |= 0x02; // active moving | 606 | mask |= 0x02; // active moving |
607 | if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ... | ||
608 | return mask; | ||
609 | 607 | ||
608 | if (SensedObject is IScript) | ||
609 | mask |= 0x08; // Scripted. It COULD have one hidden ... | ||
610 | |||
611 | return mask; | ||
610 | } | 612 | } |
611 | 613 | ||
612 | public LSL_Types.Vector3 llDetectedPos(int number) | 614 | public LSL_Types.Vector3 llDetectedPos(int number) |
@@ -627,7 +629,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
627 | return new LSL_Types.Vector3(0, 0, 0); | 629 | return new LSL_Types.Vector3(0, 0, 0); |
628 | 630 | ||
629 | return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); | 631 | return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); |
630 | // return new LSL_Types.Vector3(); | 632 | // return new LSL_Types.Vector3(); |
631 | } | 633 | } |
632 | 634 | ||
633 | public LSL_Types.Vector3 llDetectedGrab(int number) | 635 | public LSL_Types.Vector3 llDetectedGrab(int number) |
@@ -702,8 +704,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
702 | m_host.ScriptSetPhysicsStatus(true); | 704 | m_host.ScriptSetPhysicsStatus(true); |
703 | else | 705 | else |
704 | m_host.ScriptSetPhysicsStatus(false); | 706 | m_host.ScriptSetPhysicsStatus(false); |
705 | |||
706 | } | 707 | } |
708 | |||
707 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) | 709 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) |
708 | { | 710 | { |
709 | if (value == 1) | 711 | if (value == 1) |
@@ -711,27 +713,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
711 | else | 713 | else |
712 | m_host.ScriptSetPhantomStatus(false); | 714 | m_host.ScriptSetPhantomStatus(false); |
713 | } | 715 | } |
716 | |||
714 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) | 717 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) |
715 | { | 718 | { |
716 | m_host.AddFlag(LLObject.ObjectFlags.CastShadows); | 719 | m_host.AddFlag(LLObject.ObjectFlags.CastShadows); |
717 | } | 720 | } |
721 | |||
718 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) | 722 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) |
719 | { | 723 | { |
720 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; | 724 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; |
721 | |||
722 | } | 725 | } |
726 | |||
723 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) | 727 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) |
724 | { | 728 | { |
725 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; | 729 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; |
726 | } | 730 | } |
731 | |||
727 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) | 732 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) |
728 | { | 733 | { |
729 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; | 734 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; |
730 | } | 735 | } |
736 | |||
731 | if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) | 737 | if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) |
732 | { | 738 | { |
733 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); | 739 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); |
734 | } | 740 | } |
741 | |||
735 | if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) | 742 | if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) |
736 | { | 743 | { |
737 | if (value == 1) | 744 | if (value == 1) |
@@ -739,18 +746,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
739 | else | 746 | else |
740 | m_host.SetDieAtEdge(false); | 747 | m_host.SetDieAtEdge(false); |
741 | } | 748 | } |
749 | |||
742 | if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) | 750 | if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) |
743 | { | 751 | { |
744 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); | 752 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); |
745 | } | 753 | } |
754 | |||
746 | if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) | 755 | if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) |
747 | { | 756 | { |
748 | NotImplemented("llSetStatus - STATUS_SANDBOX"); | 757 | NotImplemented("llSetStatus - STATUS_SANDBOX"); |
749 | } | 758 | } |
759 | |||
750 | if (statusrotationaxis != 0) | 760 | if (statusrotationaxis != 0) |
751 | { | 761 | { |
752 | m_host.SetAxisRotation(statusrotationaxis, value); | 762 | m_host.SetAxisRotation(statusrotationaxis, value); |
753 | |||
754 | } | 763 | } |
755 | } | 764 | } |
756 | 765 | ||
@@ -766,23 +775,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
766 | return 1; | 775 | return 1; |
767 | } | 776 | } |
768 | return 0; | 777 | return 0; |
778 | |||
769 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: | 779 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: |
770 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) | 780 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) |
771 | { | 781 | { |
772 | return 1; | 782 | return 1; |
773 | } | 783 | } |
774 | return 0; | 784 | return 0; |
785 | |||
775 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: | 786 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: |
776 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) | 787 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) |
777 | { | 788 | { |
778 | return 1; | 789 | return 1; |
779 | } | 790 | } |
780 | return 0; | 791 | return 0; |
792 | |||
781 | case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: | 793 | case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: |
782 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); | 794 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); |
783 | return 0; | 795 | return 0; |
784 | case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE: | ||
785 | 796 | ||
797 | case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE: | ||
786 | if (m_host.GetDieAtEdge()) | 798 | if (m_host.GetDieAtEdge()) |
787 | return 1; | 799 | return 1; |
788 | else | 800 | else |
@@ -791,15 +803,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
791 | case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: | 803 | case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: |
792 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); | 804 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); |
793 | return 0; | 805 | return 0; |
806 | |||
794 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: | 807 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: |
795 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); | 808 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); |
796 | return 0; | 809 | return 0; |
810 | |||
797 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: | 811 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: |
798 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); | 812 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); |
799 | return 0; | 813 | return 0; |
814 | |||
800 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: | 815 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: |
801 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); | 816 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); |
802 | return 0; | 817 | return 0; |
818 | |||
803 | case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: | 819 | case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: |
804 | NotImplemented("llGetStatus - STATUS_SANDBOX"); | 820 | NotImplemented("llGetStatus - STATUS_SANDBOX"); |
805 | return 0; | 821 | return 0; |
@@ -2499,17 +2515,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2499 | 2515 | ||
2500 | string reply = String.Empty; | 2516 | string reply = String.Empty; |
2501 | 2517 | ||
2502 | switch(data) | 2518 | switch (data) |
2503 | { | 2519 | { |
2504 | case 1: // DATA_ONLINE (0|1) | 2520 | case 1: // DATA_ONLINE (0|1) |
2505 | // TODO: implement fetching of this information | 2521 | // TODO: implement fetching of this information |
2506 | // if(userProfile.CurrentAgent.AgentOnline) | 2522 | // if (userProfile.CurrentAgent.AgentOnline) |
2507 | // reply = "1"; | 2523 | // reply = "1"; |
2508 | // else | 2524 | // else |
2509 | reply = "0"; | 2525 | reply = "0"; |
2510 | break; | 2526 | break; |
2511 | case 2: // DATA_NAME (First Last) | 2527 | case 2: // DATA_NAME (First Last) |
2512 | reply = userProfile.FirstName+" "+userProfile.SurName; | 2528 | reply = userProfile.FirstName + " " + userProfile.SurName; |
2513 | break; | 2529 | break; |
2514 | case 3: // DATA_BORN (YYYY-MM-DD) | 2530 | case 3: // DATA_BORN (YYYY-MM-DD) |
2515 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); | 2531 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); |
@@ -2529,8 +2545,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2529 | LLUUID rq = LLUUID.Random(); | 2545 | LLUUID rq = LLUUID.Random(); |
2530 | 2546 | ||
2531 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 2547 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
2532 | m_Dataserver.RegisterRequest(m_localID, | 2548 | m_Dataserver.RegisterRequest(m_localID, |
2533 | m_itemID, rq.ToString()); | 2549 | m_itemID, rq.ToString()); |
2534 | 2550 | ||
2535 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 2551 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
2536 | m_Dataserver.DataserverReply(rq.ToString(), reply); | 2552 | m_Dataserver.DataserverReply(rq.ToString(), reply); |
@@ -2547,8 +2563,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2547 | if (item.Type == 3 && item.Name == name) | 2563 | if (item.Type == 3 && item.Name == name) |
2548 | { | 2564 | { |
2549 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 2565 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
2550 | m_Dataserver.RegisterRequest(m_localID, | 2566 | m_Dataserver.RegisterRequest(m_localID, |
2551 | m_itemID, item.AssetID.ToString()); | 2567 | m_itemID, item.AssetID.ToString()); |
2552 | 2568 | ||
2553 | LLVector3 region = new LLVector3( | 2569 | LLVector3 region = new LLVector3( |
2554 | World.RegionInfo.RegionLocX * Constants.RegionSize, | 2570 | World.RegionInfo.RegionLocX * Constants.RegionSize, |
@@ -2565,8 +2581,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2565 | string reply = region.ToString(); | 2581 | string reply = region.ToString(); |
2566 | 2582 | ||
2567 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 2583 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
2568 | m_Dataserver.DataserverReply(i.ToString(), | 2584 | m_Dataserver.DataserverReply(i.ToString(), |
2569 | reply); | 2585 | reply); |
2570 | }, false); | 2586 | }, false); |
2571 | 2587 | ||
2572 | return tid.ToString(); | 2588 | return tid.ToString(); |
@@ -3314,25 +3330,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
3314 | { | 3330 | { |
3315 | switch (src[i]) | 3331 | switch (src[i]) |
3316 | { | 3332 | { |
3317 | case '<' : | 3333 | case '<': |
3318 | parens++; | 3334 | parens++; |
3319 | length++; | 3335 | length++; |
3320 | break; | 3336 | break; |
3321 | case '>' : | 3337 | case '>': |
3322 | if (parens > 0) | 3338 | if (parens > 0) |
3323 | parens--; | 3339 | parens--; |
3324 | length++; | 3340 | length++; |
3325 | break; | 3341 | break; |
3326 | case ',' : | 3342 | case ',': |
3327 | if (parens == 0) | 3343 | if (parens == 0) |
3328 | { | 3344 | { |
3329 | result.Add(src.Substring(start,length).Trim()); | 3345 | result.Add(src.Substring(start,length).Trim()); |
3330 | start += length+1; | 3346 | start += length+1; |
3331 | length = 0; | 3347 | length = 0; |
3332 | } else | 3348 | } |
3349 | else | ||
3350 | { | ||
3333 | length++; | 3351 | length++; |
3352 | } | ||
3334 | break; | 3353 | break; |
3335 | default : | 3354 | default: |
3336 | length++; | 3355 | length++; |
3337 | break; | 3356 | break; |
3338 | } | 3357 | } |
@@ -3341,7 +3360,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
3341 | result.Add(src.Substring(start,length).Trim()); | 3360 | result.Add(src.Substring(start,length).Trim()); |
3342 | 3361 | ||
3343 | return result; | 3362 | return result; |
3344 | |||
3345 | } | 3363 | } |
3346 | 3364 | ||
3347 | /// <summary> | 3365 | /// <summary> |
@@ -5290,11 +5308,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
5290 | if (active[j]) | 5308 | if (active[j]) |
5291 | { | 5309 | { |
5292 | // scan all of the markers | 5310 | // scan all of the markers |
5293 | if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) | 5311 | if ((offset[j] = src.IndexOf((string)spcarray[j-seplen], beginning)) == -1) |
5294 | { | 5312 | { |
5295 | // not present at all | 5313 | // not present at all |
5296 | active[j] = false; | 5314 | active[j] = false; |
5297 | } else | 5315 | } |
5316 | else | ||
5298 | { | 5317 | { |
5299 | // present and correct | 5318 | // present and correct |
5300 | if (offset[j] < offset[best]) | 5319 | if (offset[j] < offset[best]) |
@@ -5313,7 +5332,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
5313 | { | 5332 | { |
5314 | // no markers were found on this pass | 5333 | // no markers were found on this pass |
5315 | // so we're pretty much done | 5334 | // so we're pretty much done |
5316 | tokens.Add(src.Substring(beginning, srclen-beginning)); | 5335 | tokens.Add(src.Substring(beginning, srclen - beginning)); |
5317 | break; | 5336 | break; |
5318 | } | 5337 | } |
5319 | 5338 | ||
@@ -5322,15 +5341,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
5322 | 5341 | ||
5323 | tokens.Add(src.Substring(beginning,offset[best]-beginning)); | 5342 | tokens.Add(src.Substring(beginning,offset[best]-beginning)); |
5324 | 5343 | ||
5325 | if (best<seplen) | 5344 | if (best < seplen) |
5326 | { | 5345 | { |
5327 | beginning = offset[best]+((string)separray[best]).Length; | 5346 | beginning = offset[best] + ((string)separray[best]).Length; |
5328 | } else | 5347 | } |
5348 | else | ||
5329 | { | 5349 | { |
5330 | beginning = offset[best]+((string)spcarray[best-seplen]).Length; | 5350 | beginning = offset[best] + ((string)spcarray[best - seplen]).Length; |
5331 | tokens.Add(spcarray[best-seplen]); | 5351 | tokens.Add(spcarray[best - seplen]); |
5332 | } | 5352 | } |
5333 | |||
5334 | } | 5353 | } |
5335 | 5354 | ||
5336 | // This an awkward an not very intuitive boundary case. If the | 5355 | // This an awkward an not very intuitive boundary case. If the |
@@ -5475,60 +5494,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
5475 | 5494 | ||
5476 | public string llRequestSimulatorData(string simulator, int data) | 5495 | public string llRequestSimulatorData(string simulator, int data) |
5477 | { | 5496 | { |
5478 | try | 5497 | try |
5479 | { | 5498 | { |
5480 | m_host.AddScriptLPS(1); | 5499 | m_host.AddScriptLPS(1); |
5481 | 5500 | ||
5482 | string reply = String.Empty; | 5501 | string reply = String.Empty; |
5483 | 5502 | ||
5484 | RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); | 5503 | RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); |
5485 | 5504 | ||
5486 | switch(data) | 5505 | switch (data) |
5487 | { | 5506 | { |
5488 | case 5: // DATA_SIM_POS | 5507 | case 5: // DATA_SIM_POS |
5489 | if(info == null) | 5508 | if (info == null) |
5490 | return LLUUID.Zero.ToString(); | 5509 | return LLUUID.Zero.ToString(); |
5491 | reply = new LSL_Types.Vector3( | 5510 | reply = new LSL_Types.Vector3( |
5492 | info.RegionLocX * Constants.RegionSize, | 5511 | info.RegionLocX * Constants.RegionSize, |
5493 | info.RegionLocY * Constants.RegionSize, | 5512 | info.RegionLocY * Constants.RegionSize, |
5494 | 0).ToString(); | 5513 | 0).ToString(); |
5495 | break; | 5514 | break; |
5496 | case 6: // DATA_SIM_STATUS | 5515 | case 6: // DATA_SIM_STATUS |
5497 | if(info != null) | 5516 | if (info != null) |
5498 | reply = "up"; // Duh! | 5517 | reply = "up"; // Duh! |
5499 | else | 5518 | else |
5500 | reply = "unknown"; | 5519 | reply = "unknown"; |
5501 | break; | 5520 | break; |
5502 | case 7: // DATA_SIM_RATING | 5521 | case 7: // DATA_SIM_RATING |
5503 | if(info == null) | 5522 | if (info == null) |
5504 | return LLUUID.Zero.ToString(); | 5523 | return LLUUID.Zero.ToString(); |
5505 | int access = (int)info.EstateSettings.simAccess; | 5524 | int access = (int)info.EstateSettings.simAccess; |
5506 | if(access == 21) | 5525 | if (access == 21) |
5507 | reply = "MATURE"; | 5526 | reply = "MATURE"; |
5508 | else if(access == 13) | 5527 | else if (access == 13) |
5509 | reply = "MATURE"; | 5528 | reply = "MATURE"; |
5510 | else | 5529 | else |
5511 | reply = "UNKNOWN"; | 5530 | reply = "UNKNOWN"; |
5512 | break; | 5531 | break; |
5513 | default: | 5532 | default: |
5514 | return LLUUID.Zero.ToString(); // Raise no event | 5533 | return LLUUID.Zero.ToString(); // Raise no event |
5515 | } | 5534 | } |
5516 | LLUUID rq = LLUUID.Random(); | 5535 | LLUUID rq = LLUUID.Random(); |
5517 | 5536 | ||
5518 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 5537 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
5519 | m_Dataserver.RegisterRequest(m_localID, | 5538 | m_Dataserver.RegisterRequest(m_localID, |
5520 | m_itemID, rq.ToString()); | 5539 | m_itemID, rq.ToString()); |
5521 | 5540 | ||
5522 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 5541 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
5523 | m_Dataserver.DataserverReply(rq.ToString(), reply); | 5542 | m_Dataserver.DataserverReply(rq.ToString(), reply); |
5524 | 5543 | ||
5525 | return tid.ToString(); | 5544 | return tid.ToString(); |
5526 | } | 5545 | } |
5527 | catch(Exception e) | 5546 | catch(Exception e) |
5528 | { | 5547 | { |
5529 | Console.WriteLine(e.ToString()); | 5548 | Console.WriteLine(e.ToString()); |
5530 | return LLUUID.Zero.ToString(); | 5549 | return LLUUID.Zero.ToString(); |
5531 | } | 5550 | } |
5532 | } | 5551 | } |
5533 | 5552 | ||
5534 | public void llForceMouselook(int mouselook) | 5553 | public void llForceMouselook(int mouselook) |
@@ -5543,7 +5562,7 @@ return LLUUID.Zero.ToString(); | |||
5543 | LLUUID key = new LLUUID(); | 5562 | LLUUID key = new LLUUID(); |
5544 | if (LLUUID.TryParse(id,out key)) | 5563 | if (LLUUID.TryParse(id,out key)) |
5545 | { | 5564 | { |
5546 | return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); | 5565 | return (double) World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); |
5547 | } | 5566 | } |
5548 | return 0; | 5567 | return 0; |
5549 | } | 5568 | } |
@@ -5562,7 +5581,6 @@ return LLUUID.Zero.ToString(); | |||
5562 | 5581 | ||
5563 | public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) | 5582 | public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) |
5564 | { | 5583 | { |
5565 | |||
5566 | LSL_Types.list pref = null; | 5584 | LSL_Types.list pref = null; |
5567 | 5585 | ||
5568 | m_host.AddScriptLPS(1); | 5586 | m_host.AddScriptLPS(1); |
@@ -5592,9 +5610,9 @@ return LLUUID.Zero.ToString(); | |||
5592 | pref = dest.GetSublist(0,start-1); | 5610 | pref = dest.GetSublist(0,start-1); |
5593 | // Only add a suffix if there is something | 5611 | // Only add a suffix if there is something |
5594 | // beyond the end index (it's inclusive too). | 5612 | // beyond the end index (it's inclusive too). |
5595 | if (end+1 < dest.Length) | 5613 | if (end + 1 < dest.Length) |
5596 | { | 5614 | { |
5597 | return pref + src + dest.GetSublist(end+1,-1); | 5615 | return pref + src + dest.GetSublist(end + 1, -1); |
5598 | } | 5616 | } |
5599 | else | 5617 | else |
5600 | { | 5618 | { |
@@ -5609,9 +5627,9 @@ return LLUUID.Zero.ToString(); | |||
5609 | // is removed. | 5627 | // is removed. |
5610 | else | 5628 | else |
5611 | { | 5629 | { |
5612 | if (end+1 < dest.Length) | 5630 | if (end + 1 < dest.Length) |
5613 | { | 5631 | { |
5614 | return src + dest.GetSublist(end+1,-1); | 5632 | return src + dest.GetSublist(end + 1, -1); |
5615 | } | 5633 | } |
5616 | else | 5634 | else |
5617 | { | 5635 | { |
@@ -5627,7 +5645,7 @@ return LLUUID.Zero.ToString(); | |||
5627 | // might have been negative. | 5645 | // might have been negative. |
5628 | else | 5646 | else |
5629 | { | 5647 | { |
5630 | return dest.GetSublist(end+1,start-1)+src; | 5648 | return dest.GetSublist(end + 1, start - 1) + src; |
5631 | } | 5649 | } |
5632 | } | 5650 | } |
5633 | 5651 | ||
@@ -6250,7 +6268,7 @@ return LLUUID.Zero.ToString(); | |||
6250 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 6268 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
6251 | m_Dataserver.RegisterRequest(m_localID, | 6269 | m_Dataserver.RegisterRequest(m_localID, |
6252 | m_itemID, item.AssetID.ToString()); | 6270 | m_itemID, item.AssetID.ToString()); |
6253 | if(NotecardCache.IsCached(item.AssetID)) | 6271 | if (NotecardCache.IsCached(item.AssetID)) |
6254 | { | 6272 | { |
6255 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 6273 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
6256 | m_Dataserver.DataserverReply(item.AssetID.ToString(), | 6274 | m_Dataserver.DataserverReply(item.AssetID.ToString(), |
@@ -6286,7 +6304,7 @@ return LLUUID.Zero.ToString(); | |||
6286 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 6304 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
6287 | m_Dataserver.RegisterRequest(m_localID, | 6305 | m_Dataserver.RegisterRequest(m_localID, |
6288 | m_itemID, item.AssetID.ToString()); | 6306 | m_itemID, item.AssetID.ToString()); |
6289 | if(NotecardCache.IsCached(item.AssetID)) | 6307 | if (NotecardCache.IsCached(item.AssetID)) |
6290 | { | 6308 | { |
6291 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 6309 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
6292 | m_Dataserver.DataserverReply(item.AssetID.ToString(), | 6310 | m_Dataserver.DataserverReply(item.AssetID.ToString(), |
@@ -6329,13 +6347,13 @@ return LLUUID.Zero.ToString(); | |||
6329 | { | 6347 | { |
6330 | CacheCheck(); | 6348 | CacheCheck(); |
6331 | 6349 | ||
6332 | lock(m_Notecards) | 6350 | lock (m_Notecards) |
6333 | { | 6351 | { |
6334 | if(m_Notecards.ContainsKey(assetID)) | 6352 | if (m_Notecards.ContainsKey(assetID)) |
6335 | return; | 6353 | return; |
6336 | 6354 | ||
6337 | Notecard nc = new Notecard(); | 6355 | Notecard nc = new Notecard(); |
6338 | nc.lastRef=DateTime.Now; | 6356 | nc.lastRef = DateTime.Now; |
6339 | nc.text = ParseText(text.Replace("\r", "").Split('\n')); | 6357 | nc.text = ParseText(text.Replace("\r", "").Split('\n')); |
6340 | m_Notecards[assetID] = nc; | 6358 | m_Notecards[assetID] = nc; |
6341 | } | 6359 | } |
@@ -6343,56 +6361,57 @@ return LLUUID.Zero.ToString(); | |||
6343 | 6361 | ||
6344 | private static string[] ParseText(string[] input) | 6362 | private static string[] ParseText(string[] input) |
6345 | { | 6363 | { |
6346 | int idx=0; | 6364 | int idx = 0; |
6347 | int level=0; | 6365 | int level = 0; |
6348 | List<string> output = new List<string>(); | 6366 | List<string> output = new List<string>(); |
6349 | string[] words; | 6367 | string[] words; |
6350 | 6368 | ||
6351 | while(idx < input.Length) | 6369 | while (idx < input.Length) |
6352 | { | 6370 | { |
6353 | if(input[idx] == "{") | 6371 | if (input[idx] == "{") |
6354 | { | 6372 | { |
6355 | level++; | 6373 | level++; |
6356 | idx++; | 6374 | idx++; |
6357 | continue; | 6375 | continue; |
6358 | } | 6376 | } |
6359 | if(input[idx]== "}") | 6377 | |
6378 | if (input[idx]== "}") | ||
6360 | { | 6379 | { |
6361 | level--; | 6380 | level--; |
6362 | idx++; | 6381 | idx++; |
6363 | continue; | 6382 | continue; |
6364 | } | 6383 | } |
6365 | 6384 | ||
6366 | switch(level) | 6385 | switch (level) |
6367 | { | 6386 | { |
6368 | case 0: | 6387 | case 0: |
6369 | words = input[idx].Split(' '); // Linden text ver | 6388 | words = input[idx].Split(' '); // Linden text ver |
6370 | int version = int.Parse(words[3]); | 6389 | int version = int.Parse(words[3]); |
6371 | if(version != 2) | 6390 | if (version != 2) |
6372 | return new String[0]; | 6391 | return new String[0]; |
6373 | break; | 6392 | break; |
6374 | case 1: | 6393 | case 1: |
6375 | words = input[idx].Split(' '); | 6394 | words = input[idx].Split(' '); |
6376 | if(words[0] == "LLEmbeddedItems") | 6395 | if (words[0] == "LLEmbeddedItems") |
6377 | break; | 6396 | break; |
6378 | if(words[0] == "Text") | 6397 | if (words[0] == "Text") |
6379 | { | 6398 | { |
6380 | int len = int.Parse(words[2]); | 6399 | int len = int.Parse(words[2]); |
6381 | idx++; | 6400 | idx++; |
6382 | 6401 | ||
6383 | int count=-1; | 6402 | int count = -1; |
6384 | 6403 | ||
6385 | while(count < len) | 6404 | while (count < len) |
6386 | { | 6405 | { |
6387 | int l = input[idx].Length; | 6406 | int l = input[idx].Length; |
6388 | string ln = input[idx]; | 6407 | string ln = input[idx]; |
6389 | 6408 | ||
6390 | int need = len-count-1; | 6409 | int need = len-count-1; |
6391 | if(ln.Length > need) | 6410 | if (ln.Length > need) |
6392 | ln=ln.Substring(0, need); | 6411 | ln = ln.Substring(0, need); |
6393 | 6412 | ||
6394 | output.Add(ln); | 6413 | output.Add(ln); |
6395 | count+=ln.Length+1; | 6414 | count += ln.Length + 1; |
6396 | idx++; | 6415 | idx++; |
6397 | } | 6416 | } |
6398 | 6417 | ||
@@ -6401,10 +6420,10 @@ return LLUUID.Zero.ToString(); | |||
6401 | break; | 6420 | break; |
6402 | case 2: | 6421 | case 2: |
6403 | words = input[idx].Split(' '); // count | 6422 | words = input[idx].Split(' '); // count |
6404 | if(words[0] == "count") | 6423 | if (words[0] == "count") |
6405 | { | 6424 | { |
6406 | int c = int.Parse(words[1]); | 6425 | int c = int.Parse(words[1]); |
6407 | if(c > 0) | 6426 | if (c > 0) |
6408 | return new String[0]; | 6427 | return new String[0]; |
6409 | break; | 6428 | break; |
6410 | } | 6429 | } |
@@ -6417,7 +6436,7 @@ return LLUUID.Zero.ToString(); | |||
6417 | 6436 | ||
6418 | public static bool IsCached(LLUUID assetID) | 6437 | public static bool IsCached(LLUUID assetID) |
6419 | { | 6438 | { |
6420 | lock(m_Notecards) | 6439 | lock (m_Notecards) |
6421 | { | 6440 | { |
6422 | return m_Notecards.ContainsKey(assetID); | 6441 | return m_Notecards.ContainsKey(assetID); |
6423 | } | 6442 | } |
@@ -6425,10 +6444,10 @@ return LLUUID.Zero.ToString(); | |||
6425 | 6444 | ||
6426 | public static int GetLines(LLUUID assetID) | 6445 | public static int GetLines(LLUUID assetID) |
6427 | { | 6446 | { |
6428 | if(!IsCached(assetID)) | 6447 | if (!IsCached(assetID)) |
6429 | return -1; | 6448 | return -1; |
6430 | 6449 | ||
6431 | lock(m_Notecards) | 6450 | lock (m_Notecards) |
6432 | { | 6451 | { |
6433 | m_Notecards[assetID].lastRef = DateTime.Now; | 6452 | m_Notecards[assetID].lastRef = DateTime.Now; |
6434 | return m_Notecards[assetID].text.Length; | 6453 | return m_Notecards[assetID].text.Length; |
@@ -6437,23 +6456,23 @@ return LLUUID.Zero.ToString(); | |||
6437 | 6456 | ||
6438 | public static string GetLine(LLUUID assetID, int line) | 6457 | public static string GetLine(LLUUID assetID, int line) |
6439 | { | 6458 | { |
6440 | if(line < 0) | 6459 | if (line < 0) |
6441 | return ""; | 6460 | return ""; |
6442 | 6461 | ||
6443 | string data; | 6462 | string data; |
6444 | 6463 | ||
6445 | if(!IsCached(assetID)) | 6464 | if (!IsCached(assetID)) |
6446 | return ""; | 6465 | return ""; |
6447 | 6466 | ||
6448 | lock(m_Notecards) | 6467 | lock (m_Notecards) |
6449 | { | 6468 | { |
6450 | m_Notecards[assetID].lastRef = DateTime.Now; | 6469 | m_Notecards[assetID].lastRef = DateTime.Now; |
6451 | 6470 | ||
6452 | if(line >= m_Notecards[assetID].text.Length) | 6471 | if (line >= m_Notecards[assetID].text.Length) |
6453 | return "\n\n\n"; | 6472 | return "\n\n\n"; |
6454 | 6473 | ||
6455 | data=m_Notecards[assetID].text[line]; | 6474 | data = m_Notecards[assetID].text[line]; |
6456 | if(data.Length > 255) | 6475 | if (data.Length > 255) |
6457 | data = data.Substring(0, 255); | 6476 | data = data.Substring(0, 255); |
6458 | 6477 | ||
6459 | return data; | 6478 | return data; |
@@ -6465,10 +6484,9 @@ return LLUUID.Zero.ToString(); | |||
6465 | foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys)) | 6484 | foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys)) |
6466 | { | 6485 | { |
6467 | Notecard nc = m_Notecards[key]; | 6486 | Notecard nc = m_Notecards[key]; |
6468 | if(nc.lastRef.AddSeconds(30) < DateTime.Now) | 6487 | if (nc.lastRef.AddSeconds(30) < DateTime.Now) |
6469 | m_Notecards.Remove(key); | 6488 | m_Notecards.Remove(key); |
6470 | } | 6489 | } |
6471 | } | 6490 | } |
6472 | |||
6473 | } | 6491 | } |
6474 | } | 6492 | } |