aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs32
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs30
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs23
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs5
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs158
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs41
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs2
11 files changed, 209 insertions, 118 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 17e4400..276b367 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4632,28 +4632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4632 4632
4633 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) 4633 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
4634 { 4634 {
4635// if (!m_udpServer.IsRunningOutbound)
4636// return;
4637
4638 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) 4635 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
4639 { 4636 {
4640// if (!m_udpServer.IsRunningOutbound)
4641// return;
4642/*
4643 if (m_maxUpdates == 0 || m_LastQueueFill == 0)
4644 {
4645 m_maxUpdates = m_udpServer.PrimUpdatesPerCallback;
4646 }
4647 else
4648 {
4649 if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200)
4650 m_maxUpdates += 5;
4651 else
4652 m_maxUpdates = m_maxUpdates >> 1;
4653 }
4654 m_maxUpdates = Util.Clamp<Int32>(m_maxUpdates,10,500);
4655 m_LastQueueFill = Util.EnvironmentTickCount();
4656*/
4657 int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); 4637 int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30);
4658 4638
4659 if (m_entityUpdates.Count > 0) 4639 if (m_entityUpdates.Count > 0)
@@ -4669,23 +4649,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4669 4649
4670 internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories) 4650 internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories)
4671 { 4651 {
4672 bool hasUpdates = false;
4673
4674 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) 4652 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
4675 { 4653 {
4676 if (m_entityUpdates.Count > 0) 4654 if (m_entityUpdates.Count > 0)
4677 hasUpdates = true; 4655 return true;
4678 else if (m_entityProps.Count > 0) 4656 if (m_entityProps.Count > 0)
4679 hasUpdates = true; 4657 return true;
4680 } 4658 }
4681 4659
4682 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) 4660 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
4683 { 4661 {
4684 if (ImageManager.HasUpdates()) 4662 if (ImageManager.HasUpdates())
4685 hasUpdates = true; 4663 return true;
4686 } 4664 }
4687 4665
4688 return hasUpdates; 4666 return false;
4689 } 4667 }
4690 4668
4691 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 4669 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 4e68a9b..246f003 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
166 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary> 166 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
167 private int m_packetsSentReported; 167 private int m_packetsSentReported;
168 /// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary> 168 /// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary>
169 private int m_nextOnQueueEmpty = 1; 169 private double m_nextOnQueueEmpty = 0;
170 170
171 /// <summary>Throttle bucket for this agent's connection</summary> 171 /// <summary>Throttle bucket for this agent's connection</summary>
172 private readonly AdaptiveTokenBucket m_throttleClient; 172 private readonly AdaptiveTokenBucket m_throttleClient;
@@ -771,7 +771,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
771 RTO = Math.Min(RTO * 2, m_maxRTO); 771 RTO = Math.Min(RTO * 2, m_maxRTO);
772 } 772 }
773 773
774 const int MIN_CALLBACK_MS = 20; 774 const double MIN_CALLBACK_MS = 20.0;
775 private bool m_isQueueEmptyRunning;
775 776
776 /// <summary> 777 /// <summary>
777 /// Does an early check to see if this queue empty callback is already 778 /// Does an early check to see if this queue empty callback is already
@@ -782,35 +783,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
782 { 783 {
783 if (!m_isQueueEmptyRunning) 784 if (!m_isQueueEmptyRunning)
784 { 785 {
785 int start = Environment.TickCount & Int32.MaxValue; 786 if (!HasUpdates(categories))
787 return;
786 788
789 double start = Util.GetTimeStampMS();
787 if (start < m_nextOnQueueEmpty) 790 if (start < m_nextOnQueueEmpty)
788 return; 791 return;
789 792
790 m_isQueueEmptyRunning = true; 793 m_isQueueEmptyRunning = true;
791
792 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; 794 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
793 if (m_nextOnQueueEmpty == 0)
794 m_nextOnQueueEmpty = 1;
795 795
796 if (HasUpdates(categories)) 796 // Asynchronously run the callback
797 { 797 if (m_udpServer.OqrEngine.IsRunning)
798 if (!m_udpServer.OqrEngine.IsRunning) 798 m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
799 {
800 // Asynchronously run the callback
801 Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
802 }
803 else
804 {
805 m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
806 }
807 }
808 else 799 else
809 m_isQueueEmptyRunning = false; 800 Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
810 } 801 }
811 } 802 }
812 803
813 private bool m_isQueueEmptyRunning;
814 804
815 805
816 /// <summary> 806 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
index 076551f..a476b91 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
@@ -100,11 +100,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
100 BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); 100 BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10);
101 BrustTime *= 1e-3f; 101 BrustTime *= 1e-3f;
102 102
103 AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); 103 // Adaptive is broken
104// AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
105 AdaptiveThrottlesEnabled = false;
104 MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000); 106 MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);
105 107
106 CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); 108 // http textures do use udp bandwidth setting
107 CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); 109// CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
110// CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
111 CannibalizeTextureRate = 0f;
112
108 } 113 }
109 catch (Exception) { } 114 catch (Exception) { }
110 } 115 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs
index 0333747..a147e9b 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs
@@ -144,14 +144,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
144 144
145 private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) 145 private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
146 { 146 {
147 sb.AppendFormat("Attachments for {0}\n", sp.Name); 147 sb.AppendFormat("Attachments for {0}\n\n", sp.Name);
148 148
149 ConsoleDisplayTable ct = new ConsoleDisplayTable() { Indent = 2 }; 149 ConsoleDisplayList ct = new ConsoleDisplayList();
150 ct.Columns.Add(new ConsoleDisplayTableColumn("Attachment Name", 50));
151 ct.Columns.Add(new ConsoleDisplayTableColumn("Local ID", 10));
152 ct.Columns.Add(new ConsoleDisplayTableColumn("Item ID", 36));
153 ct.Columns.Add(new ConsoleDisplayTableColumn("Attach Point", 14));
154 ct.Columns.Add(new ConsoleDisplayTableColumn("Position", 15));
155 150
156// sb.AppendFormat( 151// sb.AppendFormat(
157// " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", 152// " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n",
@@ -177,17 +172,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
177// attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, 172// attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID,
178// (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); 173// (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos);
179 174
180 ct.AddRow( 175 ct.Indent = 2;
181 attachmentObject.Name, 176 ct.AddRow("Attachment Name", attachmentObject.Name);
182 attachmentObject.LocalId, 177 ct.AddRow("Local ID", attachmentObject.LocalId);
183 attachmentObject.FromItemID, 178 ct.AddRow("Item ID", attachmentObject.UUID);
184 ((AttachmentPoint)attachmentObject.AttachmentPoint), 179 ct.AddRow("From Item ID", attachmentObject.FromItemID);
185 attachmentObject.RootPart.AttachedPos); 180 ct.AddRow("Attach Point", ((AttachmentPoint)attachmentObject.AttachmentPoint));
181 ct.AddRow("Position", attachmentObject.RootPart.AttachedPos + "\n\n");
186// } 182// }
187 } 183 }
188 184
189 ct.AddToStringBuilder(sb); 185 ct.AddToStringBuilder(sb);
190 sb.Append("\n");
191 } 186 }
192 } 187 }
193} \ No newline at end of file 188} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs
index b8c90cd..5c791e6 100644
--- a/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs
@@ -120,12 +120,15 @@ namespace OpenSim.Region.DataSnapshot.Providers
120 120
121 public XmlNode RequestSnapshotData(XmlDocument nodeFactory) 121 public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
122 { 122 {
123 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
123 ILandChannel landChannel = m_scene.LandChannel; 124 ILandChannel landChannel = m_scene.LandChannel;
125 if(landChannel == null)
126 return parent;
127
124 List<ILandObject> parcels = landChannel.AllParcels(); 128 List<ILandObject> parcels = landChannel.AllParcels();
125 129
126 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); 130 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
127 131
128 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
129 if (parcels != null) 132 if (parcels != null)
130 { 133 {
131 134
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
index b82d593..adefd5e 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
@@ -317,8 +317,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
317 // current ode land to ray collisions is very bad 317 // current ode land to ray collisions is very bad
318 // so for now limit its range badly 318 // so for now limit its range badly
319 if (req.length > 60.0f) 319 if (req.length > 60.0f)
320 d.GeomRaySetLength(ray, 60.0f); 320 {
321 Vector3 t = req.Normal * req.length;
322 float tmp = t.X * t.X + t.Y * t.Y;
323 if(tmp > 2500)
324 {
325 float tmp2 = req.length * req.length - tmp + 2500;
326 tmp2 = (float)Math.Sqrt(tmp2);
327 d.GeomRaySetLength(ray, tmp2);
328 }
321 329
330 }
322 d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); 331 d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
323 } 332 }
324 333
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ced81ad..1a73c3e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
113 protected float m_MinTimerInterval = 0.5f; 113 protected float m_MinTimerInterval = 0.5f;
114 protected float m_recoilScaleFactor = 0.0f; 114 protected float m_recoilScaleFactor = 0.0f;
115 115
116 protected DateTime m_timer = DateTime.Now; 116 protected double m_timer = Util.GetTimeStampMS();
117 protected bool m_waitingForScriptAnswer = false; 117 protected bool m_waitingForScriptAnswer = false;
118 protected bool m_automaticLinkPermission = false; 118 protected bool m_automaticLinkPermission = false;
119 protected IMessageTransferModule m_TransferModule = null; 119 protected IMessageTransferModule m_TransferModule = null;
@@ -662,15 +662,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
662 List<SceneObjectPart> ret = new List<SceneObjectPart>(); 662 List<SceneObjectPart> ret = new List<SceneObjectPart>();
663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
664 return ret; 664 return ret;
665 ret.Add(part);
666 665
667 switch (linkType) 666 switch (linkType)
668 { 667 {
669 case ScriptBaseClass.LINK_SET: 668 case ScriptBaseClass.LINK_SET:
670 return new List<SceneObjectPart>(part.ParentGroup.Parts); 669 return new List<SceneObjectPart>(part.ParentGroup.Parts);
671 670
672 case ScriptBaseClass.LINK_ROOT: 671 case ScriptBaseClass.LINK_ROOT:
673 ret = new List<SceneObjectPart>();
674 ret.Add(part.ParentGroup.RootPart); 672 ret.Add(part.ParentGroup.RootPart);
675 return ret; 673 return ret;
676 674
@@ -690,16 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
690 return ret; 688 return ret;
691 689
692 case ScriptBaseClass.LINK_THIS: 690 case ScriptBaseClass.LINK_THIS:
691 ret.Add(part);
693 return ret; 692 return ret;
694 693
695 default: 694 default:
696 if (linkType < 0) 695 if (linkType < 0)
697 return new List<SceneObjectPart>(); 696 return ret;
698 697
699 SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType); 698 SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
700 if (target == null) 699 if (target == null)
701 return new List<SceneObjectPart>(); 700 return ret;
702 ret = new List<SceneObjectPart>();
703 ret.Add(target); 701 ret.Add(target);
704 return ret; 702 return ret;
705 } 703 }
@@ -3050,22 +3048,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3050 public LSL_Float llGetTime() 3048 public LSL_Float llGetTime()
3051 { 3049 {
3052 m_host.AddScriptLPS(1); 3050 m_host.AddScriptLPS(1);
3053 TimeSpan ScriptTime = DateTime.Now - m_timer; 3051 double ScriptTime = Util.GetTimeStampMS() - m_timer;
3054 return (double)(ScriptTime.TotalMilliseconds / 1000); 3052 return (ScriptTime / 1000.0);
3055 } 3053 }
3056 3054
3057 public void llResetTime() 3055 public void llResetTime()
3058 { 3056 {
3059 m_host.AddScriptLPS(1); 3057 m_host.AddScriptLPS(1);
3060 m_timer = DateTime.Now; 3058 m_timer = Util.GetTimeStampMS();
3061 } 3059 }
3062 3060
3063 public LSL_Float llGetAndResetTime() 3061 public LSL_Float llGetAndResetTime()
3064 { 3062 {
3065 m_host.AddScriptLPS(1); 3063 m_host.AddScriptLPS(1);
3066 TimeSpan ScriptTime = DateTime.Now - m_timer; 3064 double now = Util.GetTimeStampMS();
3067 m_timer = DateTime.Now; 3065 double ScriptTime = now - m_timer;
3068 return (double)(ScriptTime.TotalMilliseconds / 1000); 3066 m_timer = now;
3067 return (ScriptTime / 1000.0);
3069 } 3068 }
3070 3069
3071 public void llSound(string sound, double volume, int queue, int loop) 3070 public void llSound(string sound, double volume, int queue, int loop)
@@ -10086,6 +10085,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10086 part.UpdateSlice((float)slice.x, (float)slice.y); 10085 part.UpdateSlice((float)slice.x, (float)slice.y);
10087 break; 10086 break;
10088 10087
10088 case ScriptBaseClass.PRIM_SIT_TARGET:
10089 if (remain < 3)
10090 return new LSL_List();
10091
10092 int active;
10093 try
10094 {
10095 active = rules.GetLSLIntegerItem(idx++);
10096 }
10097 catch(InvalidCastException)
10098 {
10099 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
10100 return new LSL_List();
10101 }
10102 LSL_Vector offset;
10103 try
10104 {
10105 offset = rules.GetVector3Item(idx++);
10106 }
10107 catch(InvalidCastException)
10108 {
10109 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10110 return new LSL_List();
10111 }
10112 LSL_Rotation sitrot;
10113 try
10114 {
10115 sitrot = rules.GetQuaternionItem(idx++);
10116 }
10117 catch(InvalidCastException)
10118 {
10119 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1));
10120 return new LSL_List();
10121 }
10122
10123 // not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation
10124 if(active == 1)
10125 {
10126 if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0)
10127 offset.z = 1e-5f; // hack
10128 SitTarget(part,offset,sitrot);
10129 }
10130 else if(active == 0)
10131 SitTarget(part, Vector3.Zero , Quaternion.Identity);
10132
10133 break;
10134
10089 case ScriptBaseClass.PRIM_LINK_TARGET: 10135 case ScriptBaseClass.PRIM_LINK_TARGET:
10090 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 10136 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
10091 return new LSL_List(); 10137 return new LSL_List();
@@ -11182,7 +11228,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11182 res.Add(new LSL_Float(spin)); 11228 res.Add(new LSL_Float(spin));
11183 res.Add(new LSL_Float(gain)); 11229 res.Add(new LSL_Float(gain));
11184 break; 11230 break;
11185 11231
11232 case (int)ScriptBaseClass.PRIM_SIT_TARGET:
11233 if(part.IsSitTargetSet)
11234 {
11235 res.Add(new LSL_Integer(1));
11236 res.Add(new LSL_Vector(part.SitTargetPosition));
11237 res.Add(new LSL_Rotation(part.SitTargetOrientation));
11238 }
11239 else
11240 {
11241 res.Add(new LSL_Integer(0));
11242 res.Add(new LSL_Vector(Vector3.Zero));
11243 res.Add(new LSL_Rotation(Quaternion.Identity));
11244 }
11245 break;
11246
11186 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 11247 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
11187 11248
11188 // TODO: Should be issuing a runtime script warning in this case. 11249 // TODO: Should be issuing a runtime script warning in this case.
@@ -14155,18 +14216,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14155 return false; 14216 return false;
14156 } 14217 }
14157 14218
14158 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd) 14219 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd, bool skipPhys)
14159 { 14220 {
14160 List<ContactResult> contacts = new List<ContactResult>(); 14221 List<ContactResult> contacts = new List<ContactResult>();
14161 14222
14162 Vector3 ab = rayEnd - rayStart; 14223 Vector3 ab = rayEnd - rayStart;
14224 float ablen = ab.Length();
14163 14225
14164 World.ForEachScenePresence(delegate(ScenePresence sp) 14226 World.ForEachScenePresence(delegate(ScenePresence sp)
14165 { 14227 {
14228 if(skipPhys && sp.PhysicsActor != null)
14229 return;
14230
14166 Vector3 ac = sp.AbsolutePosition - rayStart; 14231 Vector3 ac = sp.AbsolutePosition - rayStart;
14167// Vector3 bc = sp.AbsolutePosition - rayEnd;
14168 14232
14169 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 14233 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / ablen);
14170 14234
14171 if (d > 1.5) 14235 if (d > 1.5)
14172 return; 14236 return;
@@ -14455,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14455 Vector3 rayEnd = end; 14519 Vector3 rayEnd = end;
14456 Vector3 dir = rayEnd - rayStart; 14520 Vector3 dir = rayEnd - rayStart;
14457 14521
14458 float dist = Vector3.Mag(dir); 14522 float dist = dir.Length();
14459 14523
14460 int count = 1; 14524 int count = 1;
14461 bool detectPhantom = false; 14525 bool detectPhantom = false;
@@ -14484,7 +14548,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14484 bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL); 14548 bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
14485 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); 14549 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
14486 14550
14487
14488 if (World.SupportsRayCastFiltered()) 14551 if (World.SupportsRayCastFiltered())
14489 { 14552 {
14490 if (dist == 0) 14553 if (dist == 0)
@@ -14493,8 +14556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14493 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; 14556 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
14494 if (checkTerrain) 14557 if (checkTerrain)
14495 rayfilter |= RayFilterFlags.land; 14558 rayfilter |= RayFilterFlags.land;
14496// if (checkAgents) 14559 if (checkAgents)
14497// rayfilter |= RayFilterFlags.agent; 14560 rayfilter |= RayFilterFlags.agent;
14498 if (checkPhysical) 14561 if (checkPhysical)
14499 rayfilter |= RayFilterFlags.physical; 14562 rayfilter |= RayFilterFlags.physical;
14500 if (checkNonPhysical) 14563 if (checkNonPhysical)
@@ -14520,16 +14583,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14520 14583
14521 if (physresults == null) 14584 if (physresults == null)
14522 { 14585 {
14523 list.Add(new LSL_Integer(-3)); // timeout error 14586// list.Add(new LSL_Integer(-3)); // timeout error
14524 return list; 14587// return list;
14588 results = new List<ContactResult>();
14525 } 14589 }
14526 14590 else
14527 results = (List<ContactResult>)physresults; 14591 results = (List<ContactResult>)physresults;
14528 14592
14529 // for now physics doesn't detect sitted avatars so do it outside physics 14593 // for now physics doesn't detect sitted avatars so do it outside physics
14530 if (checkAgents) 14594 if (checkAgents)
14531 { 14595 {
14532 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14596 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, true);
14533 foreach (ContactResult r in agentHits) 14597 foreach (ContactResult r in agentHits)
14534 results.Add(r); 14598 results.Add(r);
14535 } 14599 }
@@ -14545,12 +14609,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14545 foreach (ContactResult r in objectHits) 14609 foreach (ContactResult r in objectHits)
14546 results.Add(r); 14610 results.Add(r);
14547 } 14611 }
14612 // Double check this because of current ODE distance problems
14613 if (checkTerrain && dist > 60)
14614 {
14615 bool skipGroundCheck = false;
14616
14617 foreach (ContactResult c in results)
14618 {
14619 if (c.ConsumerID == 0) // Physics gave us a ground collision
14620 skipGroundCheck = true;
14621 }
14622
14623 if (!skipGroundCheck)
14624 {
14625 float tmp = dir.X * dir.X + dir.Y * dir.Y;
14626 if(tmp > 2500)
14627 {
14628 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
14629 if (groundContact != null)
14630 results.Add((ContactResult)groundContact);
14631 }
14632 }
14633 }
14548 } 14634 }
14549 else 14635 else
14550 { 14636 {
14551 if (checkAgents) 14637 if (checkAgents)
14552 { 14638 {
14553 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14639 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, false);
14554 foreach (ContactResult r in agentHits) 14640 foreach (ContactResult r in agentHits)
14555 results.Add(r); 14641 results.Add(r);
14556 } 14642 }
@@ -14565,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14565 results.Add(objectHits[iter]); 14651 results.Add(objectHits[iter]);
14566 } 14652 }
14567 } 14653 }
14568 }
14569 14654
14570 // Double check this 14655 if (checkTerrain)
14571 if (checkTerrain)
14572 {
14573 bool skipGroundCheck = false;
14574
14575 foreach (ContactResult c in results)
14576 {
14577 if (c.ConsumerID == 0) // Physics gave us a ground collision
14578 skipGroundCheck = true;
14579 }
14580
14581 if (!skipGroundCheck)
14582 { 14656 {
14583 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); 14657 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
14584 if (groundContact != null) 14658 if (groundContact != null)
@@ -14590,7 +14664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14590 { 14664 {
14591 return a.Depth.CompareTo(b.Depth); 14665 return a.Depth.CompareTo(b.Depth);
14592 }); 14666 });
14593 14667
14594 int values = 0; 14668 int values = 0;
14595 SceneObjectGroup thisgrp = m_host.ParentGroup; 14669 SceneObjectGroup thisgrp = m_host.ParentGroup;
14596 14670
@@ -14644,7 +14718,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14644 } 14718 }
14645 14719
14646 list.Add(new LSL_Integer(values)); 14720 list.Add(new LSL_Integer(values));
14647
14648 return list; 14721 return list;
14649 } 14722 }
14650 14723
@@ -15919,6 +15992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15919 case (int)ScriptBaseClass.PRIM_TEXT: 15992 case (int)ScriptBaseClass.PRIM_TEXT:
15920 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 15993 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
15921 case (int)ScriptBaseClass.PRIM_OMEGA: 15994 case (int)ScriptBaseClass.PRIM_OMEGA:
15995 case (int)ScriptBaseClass.PRIM_SIT_TARGET:
15922 if (remain < 3) 15996 if (remain < 3)
15923 return new LSL_List(); 15997 return new LSL_List();
15924 idx += 3; 15998 idx += 3;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 7bd4fa7..1e26036 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -365,8 +365,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
365 /// </summary> 365 /// </summary>
366 protected object ConvertFromLSL(object lslparm, Type type, string fname) 366 protected object ConvertFromLSL(object lslparm, Type type, string fname)
367 { 367 {
368
369 if(lslparm.GetType() == type)
370 return lslparm;
371
368 // ---------- String ---------- 372 // ---------- String ----------
369 if (lslparm is LSL_String) 373 else if (lslparm is LSL_String)
370 { 374 {
371 if (type == typeof(string)) 375 if (type == typeof(string))
372 return (string)(LSL_String)lslparm; 376 return (string)(LSL_String)lslparm;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 4a8e885..cee66b2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -254,6 +254,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
254 public const int ATTACH_HUD_BOTTOM_RIGHT = 38; 254 public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
255 public const int ATTACH_NECK = 39; 255 public const int ATTACH_NECK = 39;
256 public const int ATTACH_AVATAR_CENTER = 40; 256 public const int ATTACH_AVATAR_CENTER = 40;
257 public const int ATTACH_LHAND_RING1 = 41;
258 public const int ATTACH_RHAND_RING1 = 42;
259 public const int ATTACH_TAIL_BASE = 43;
260 public const int ATTACH_TAIL_TIP = 44;
261 public const int ATTACH_LWING = 45;
262 public const int ATTACH_RWING = 46;
263 public const int ATTACH_FACE_JAW = 47;
264 public const int ATTACH_FACE_LEAR = 48;
265 public const int ATTACH_FACE_REAR = 49;
266 public const int ATTACH_FACE_LEYE = 50;
267 public const int ATTACH_FACE_REYE = 51;
268 public const int ATTACH_FACE_TONGUE = 52;
269 public const int ATTACH_GROIN = 53;
270 public const int ATTACH_HIND_LFOOT = 54;
271 public const int ATTACH_HIND_RFOOT = 55;
257 272
258 #region osMessageAttachments constants 273 #region osMessageAttachments constants
259 274
@@ -336,11 +351,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
336 public const int ROTATE = 32; 351 public const int ROTATE = 32;
337 public const int SCALE = 64; 352 public const int SCALE = 64;
338 public const int ALL_SIDES = -1; 353 public const int ALL_SIDES = -1;
354
355 // LINK flags
339 public const int LINK_SET = -1; 356 public const int LINK_SET = -1;
340 public const int LINK_ROOT = 1; 357 public const int LINK_ROOT = 1;
341 public const int LINK_ALL_OTHERS = -2; 358 public const int LINK_ALL_OTHERS = -2;
342 public const int LINK_ALL_CHILDREN = -3; 359 public const int LINK_ALL_CHILDREN = -3;
343 public const int LINK_THIS = -4; 360 public const int LINK_THIS = -4;
361
344 public const int CHANGED_INVENTORY = 1; 362 public const int CHANGED_INVENTORY = 1;
345 public const int CHANGED_COLOR = 2; 363 public const int CHANGED_COLOR = 2;
346 public const int CHANGED_SHAPE = 4; 364 public const int CHANGED_SHAPE = 4;
@@ -356,6 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
356 public const int CHANGED_MEDIA = 2048; 374 public const int CHANGED_MEDIA = 2048;
357 public const int CHANGED_ANIMATION = 16384; 375 public const int CHANGED_ANIMATION = 16384;
358 public const int CHANGED_POSITION = 32768; 376 public const int CHANGED_POSITION = 32768;
377
359 public const int TYPE_INVALID = 0; 378 public const int TYPE_INVALID = 0;
360 public const int TYPE_INTEGER = 1; 379 public const int TYPE_INTEGER = 1;
361 public const int TYPE_FLOAT = 2; 380 public const int TYPE_FLOAT = 2;
@@ -389,6 +408,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
389 public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded 408 public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded
390 public const int CONTENT_TYPE_RSS = 8; //application/rss+xml 409 public const int CONTENT_TYPE_RSS = 8; //application/rss+xml
391 410
411 //parameters comand flags
392 public const int PRIM_MATERIAL = 2; 412 public const int PRIM_MATERIAL = 2;
393 public const int PRIM_PHYSICS = 3; 413 public const int PRIM_PHYSICS = 3;
394 public const int PRIM_TEMP_ON_REZ = 4; 414 public const int PRIM_TEMP_ON_REZ = 4;
@@ -397,19 +417,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
397 public const int PRIM_SIZE = 7; 417 public const int PRIM_SIZE = 7;
398 public const int PRIM_ROTATION = 8; 418 public const int PRIM_ROTATION = 8;
399 public const int PRIM_TYPE = 9; 419 public const int PRIM_TYPE = 9;
420 // gap 10-16
400 public const int PRIM_TEXTURE = 17; 421 public const int PRIM_TEXTURE = 17;
401 public const int PRIM_COLOR = 18; 422 public const int PRIM_COLOR = 18;
402 public const int PRIM_BUMP_SHINY = 19; 423 public const int PRIM_BUMP_SHINY = 19;
403 public const int PRIM_FULLBRIGHT = 20; 424 public const int PRIM_FULLBRIGHT = 20;
404 public const int PRIM_FLEXIBLE = 21; 425 public const int PRIM_FLEXIBLE = 21;
405 public const int PRIM_TEXGEN = 22; 426 public const int PRIM_TEXGEN = 22;
406 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
407 public const int PRIM_POINT_LIGHT = 23; // Huh? 427 public const int PRIM_POINT_LIGHT = 23; // Huh?
428 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
408 public const int PRIM_GLOW = 25; 429 public const int PRIM_GLOW = 25;
409 public const int PRIM_TEXT = 26; 430 public const int PRIM_TEXT = 26;
410 public const int PRIM_NAME = 27; 431 public const int PRIM_NAME = 27;
411 public const int PRIM_DESC = 28; 432 public const int PRIM_DESC = 28;
412 public const int PRIM_ROT_LOCAL = 29; 433 public const int PRIM_ROT_LOCAL = 29;
434 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
435 public const int PRIM_PHYSICS_MATERIAL = 31; // apparently not on SL wiki
413 public const int PRIM_OMEGA = 32; 436 public const int PRIM_OMEGA = 32;
414 public const int PRIM_POS_LOCAL = 33; 437 public const int PRIM_POS_LOCAL = 33;
415 public const int PRIM_LINK_TARGET = 34; 438 public const int PRIM_LINK_TARGET = 34;
@@ -417,6 +440,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
417 public const int PRIM_SPECULAR = 36; 440 public const int PRIM_SPECULAR = 36;
418 public const int PRIM_NORMAL = 37; 441 public const int PRIM_NORMAL = 37;
419 public const int PRIM_ALPHA_MODE = 38; 442 public const int PRIM_ALPHA_MODE = 38;
443 public const int PRIM_ALLOW_UNSIT = 39; // experiences related. unsupported
444 public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. unsupported
445 public const int PRIM_SIT_TARGET = 41;
446
447
448 // parameters
420 public const int PRIM_TEXGEN_DEFAULT = 0; 449 public const int PRIM_TEXGEN_DEFAULT = 0;
421 public const int PRIM_TEXGEN_PLANAR = 1; 450 public const int PRIM_TEXGEN_PLANAR = 1;
422 451
@@ -473,6 +502,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
473 public const int PRIM_SCULPT_FLAG_INVERT = 64; 502 public const int PRIM_SCULPT_FLAG_INVERT = 64;
474 public const int PRIM_SCULPT_FLAG_MIRROR = 128; 503 public const int PRIM_SCULPT_FLAG_MIRROR = 128;
475 504
505 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
506 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
507 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
508
476 public const int PROFILE_NONE = 0; 509 public const int PROFILE_NONE = 0;
477 public const int PROFILE_SCRIPT_MEMORY = 1; 510 public const int PROFILE_SCRIPT_MEMORY = 1;
478 511
@@ -701,12 +734,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
701 public const int PRIM_MEDIA_PERM_GROUP = 2; 734 public const int PRIM_MEDIA_PERM_GROUP = 2;
702 public const int PRIM_MEDIA_PERM_ANYONE = 4; 735 public const int PRIM_MEDIA_PERM_ANYONE = 4;
703 736
704 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
705 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
706 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
707 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
708
709 public const int PRIM_PHYSICS_MATERIAL = 31;
710 public const int DENSITY = 1; 737 public const int DENSITY = 1;
711 public const int FRICTION = 2; 738 public const int FRICTION = 2;
712 public const int RESTITUTION = 4; 739 public const int RESTITUTION = 4;
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 9fb1e2c..c36e7c6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
704 { 704 {
705 if (Data[itemIndex] is LSL_Types.Quaternion) 705 if (Data[itemIndex] is LSL_Types.Quaternion)
706 { 706 {
707 return (LSL_Types.Quaternion)Data[itemIndex]; 707 LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex];
708 q.Normalize();
709 return q;
708 } 710 }
709 else if(Data[itemIndex] is OpenMetaverse.Quaternion) 711 else if(Data[itemIndex] is OpenMetaverse.Quaternion)
710 { 712 {
711 return new LSL_Types.Quaternion( 713 LSL_Types.Quaternion q = new LSL_Types.Quaternion(
712 (OpenMetaverse.Quaternion)Data[itemIndex]); 714 (OpenMetaverse.Quaternion)Data[itemIndex]);
715 q.Normalize();
716 return q;
713 } 717 }
714 else 718 else
715 { 719 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
index 71b88bc..fe2113b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
@@ -270,6 +270,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
270 TestHelpers.InMethod(); 270 TestHelpers.InMethod();
271 271
272 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); 272 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
273 // make that nonsense a quaternion
274 testValue.Normalize();
273 LSL_Types.list testList = new LSL_Types.list(testValue); 275 LSL_Types.list testList = new LSL_Types.list(testValue);
274 276
275 Assert.AreEqual(testValue, testList.GetQuaternionItem(0)); 277 Assert.AreEqual(testValue, testList.GetQuaternionItem(0));