Merge branch 'master' into httptests
commit
93ea7bd7f4
|
@ -4632,28 +4632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||||
{
|
{
|
||||||
// if (!m_udpServer.IsRunningOutbound)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
||||||
{
|
{
|
||||||
// if (!m_udpServer.IsRunningOutbound)
|
|
||||||
// return;
|
|
||||||
/*
|
|
||||||
if (m_maxUpdates == 0 || m_LastQueueFill == 0)
|
|
||||||
{
|
|
||||||
m_maxUpdates = m_udpServer.PrimUpdatesPerCallback;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200)
|
|
||||||
m_maxUpdates += 5;
|
|
||||||
else
|
|
||||||
m_maxUpdates = m_maxUpdates >> 1;
|
|
||||||
}
|
|
||||||
m_maxUpdates = Util.Clamp<Int32>(m_maxUpdates,10,500);
|
|
||||||
m_LastQueueFill = Util.EnvironmentTickCount();
|
|
||||||
*/
|
|
||||||
int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30);
|
int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30);
|
||||||
|
|
||||||
if (m_entityUpdates.Count > 0)
|
if (m_entityUpdates.Count > 0)
|
||||||
|
@ -4669,23 +4649,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories)
|
internal bool HandleHasUpdates(ThrottleOutPacketTypeFlags categories)
|
||||||
{
|
{
|
||||||
bool hasUpdates = false;
|
|
||||||
|
|
||||||
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
||||||
{
|
{
|
||||||
if (m_entityUpdates.Count > 0)
|
if (m_entityUpdates.Count > 0)
|
||||||
hasUpdates = true;
|
return true;
|
||||||
else if (m_entityProps.Count > 0)
|
if (m_entityProps.Count > 0)
|
||||||
hasUpdates = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
|
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
|
||||||
{
|
{
|
||||||
if (ImageManager.HasUpdates())
|
if (ImageManager.HasUpdates())
|
||||||
hasUpdates = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasUpdates;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
|
/// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
|
||||||
private int m_packetsSentReported;
|
private int m_packetsSentReported;
|
||||||
/// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary>
|
/// <summary>Holds the Environment.TickCount value of when the next OnQueueEmpty can be fired</summary>
|
||||||
private int m_nextOnQueueEmpty = 1;
|
private double m_nextOnQueueEmpty = 0;
|
||||||
|
|
||||||
/// <summary>Throttle bucket for this agent's connection</summary>
|
/// <summary>Throttle bucket for this agent's connection</summary>
|
||||||
private readonly AdaptiveTokenBucket m_throttleClient;
|
private readonly AdaptiveTokenBucket m_throttleClient;
|
||||||
|
@ -771,7 +771,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
RTO = Math.Min(RTO * 2, m_maxRTO);
|
RTO = Math.Min(RTO * 2, m_maxRTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int MIN_CALLBACK_MS = 20;
|
const double MIN_CALLBACK_MS = 20.0;
|
||||||
|
private bool m_isQueueEmptyRunning;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does an early check to see if this queue empty callback is already
|
/// Does an early check to see if this queue empty callback is already
|
||||||
|
@ -782,35 +783,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
if (!m_isQueueEmptyRunning)
|
if (!m_isQueueEmptyRunning)
|
||||||
{
|
{
|
||||||
int start = Environment.TickCount & Int32.MaxValue;
|
if (!HasUpdates(categories))
|
||||||
|
return;
|
||||||
|
|
||||||
|
double start = Util.GetTimeStampMS();
|
||||||
if (start < m_nextOnQueueEmpty)
|
if (start < m_nextOnQueueEmpty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_isQueueEmptyRunning = true;
|
m_isQueueEmptyRunning = true;
|
||||||
|
|
||||||
m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
|
m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
|
||||||
if (m_nextOnQueueEmpty == 0)
|
|
||||||
m_nextOnQueueEmpty = 1;
|
|
||||||
|
|
||||||
if (HasUpdates(categories))
|
|
||||||
{
|
|
||||||
if (!m_udpServer.OqrEngine.IsRunning)
|
|
||||||
{
|
|
||||||
// Asynchronously run the callback
|
// Asynchronously run the callback
|
||||||
|
if (m_udpServer.OqrEngine.IsRunning)
|
||||||
|
m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
|
||||||
|
else
|
||||||
Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
|
Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_isQueueEmptyRunning = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_isQueueEmptyRunning;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -100,11 +100,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10);
|
BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10);
|
||||||
BrustTime *= 1e-3f;
|
BrustTime *= 1e-3f;
|
||||||
|
|
||||||
AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
|
// Adaptive is broken
|
||||||
|
// AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
|
||||||
|
AdaptiveThrottlesEnabled = false;
|
||||||
MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);
|
MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);
|
||||||
|
|
||||||
CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
|
// http textures do use udp bandwidth setting
|
||||||
CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
|
// CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
|
||||||
|
// CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
|
||||||
|
CannibalizeTextureRate = 0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,14 +144,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||||
|
|
||||||
private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
|
private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
|
||||||
{
|
{
|
||||||
sb.AppendFormat("Attachments for {0}\n", sp.Name);
|
sb.AppendFormat("Attachments for {0}\n\n", sp.Name);
|
||||||
|
|
||||||
ConsoleDisplayTable ct = new ConsoleDisplayTable() { Indent = 2 };
|
ConsoleDisplayList ct = new ConsoleDisplayList();
|
||||||
ct.Columns.Add(new ConsoleDisplayTableColumn("Attachment Name", 50));
|
|
||||||
ct.Columns.Add(new ConsoleDisplayTableColumn("Local ID", 10));
|
|
||||||
ct.Columns.Add(new ConsoleDisplayTableColumn("Item ID", 36));
|
|
||||||
ct.Columns.Add(new ConsoleDisplayTableColumn("Attach Point", 14));
|
|
||||||
ct.Columns.Add(new ConsoleDisplayTableColumn("Position", 15));
|
|
||||||
|
|
||||||
// sb.AppendFormat(
|
// sb.AppendFormat(
|
||||||
// " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n",
|
// " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n",
|
||||||
|
@ -177,17 +172,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||||
// attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID,
|
// attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID,
|
||||||
// (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos);
|
// (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos);
|
||||||
|
|
||||||
ct.AddRow(
|
ct.Indent = 2;
|
||||||
attachmentObject.Name,
|
ct.AddRow("Attachment Name", attachmentObject.Name);
|
||||||
attachmentObject.LocalId,
|
ct.AddRow("Local ID", attachmentObject.LocalId);
|
||||||
attachmentObject.FromItemID,
|
ct.AddRow("Item ID", attachmentObject.UUID);
|
||||||
((AttachmentPoint)attachmentObject.AttachmentPoint),
|
ct.AddRow("From Item ID", attachmentObject.FromItemID);
|
||||||
attachmentObject.RootPart.AttachedPos);
|
ct.AddRow("Attach Point", ((AttachmentPoint)attachmentObject.AttachmentPoint));
|
||||||
|
ct.AddRow("Position", attachmentObject.RootPart.AttachedPos + "\n\n");
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
ct.AddToStringBuilder(sb);
|
ct.AddToStringBuilder(sb);
|
||||||
sb.Append("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -120,12 +120,15 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
||||||
|
|
||||||
public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
|
public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
|
||||||
{
|
{
|
||||||
|
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
|
||||||
ILandChannel landChannel = m_scene.LandChannel;
|
ILandChannel landChannel = m_scene.LandChannel;
|
||||||
|
if(landChannel == null)
|
||||||
|
return parent;
|
||||||
|
|
||||||
List<ILandObject> parcels = landChannel.AllParcels();
|
List<ILandObject> parcels = landChannel.AllParcels();
|
||||||
|
|
||||||
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
|
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
|
||||||
|
|
||||||
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
|
|
||||||
if (parcels != null)
|
if (parcels != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -317,8 +317,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
// current ode land to ray collisions is very bad
|
// current ode land to ray collisions is very bad
|
||||||
// so for now limit its range badly
|
// so for now limit its range badly
|
||||||
if (req.length > 60.0f)
|
if (req.length > 60.0f)
|
||||||
d.GeomRaySetLength(ray, 60.0f);
|
{
|
||||||
|
Vector3 t = req.Normal * req.length;
|
||||||
|
float tmp = t.X * t.X + t.Y * t.Y;
|
||||||
|
if(tmp > 2500)
|
||||||
|
{
|
||||||
|
float tmp2 = req.length * req.length - tmp + 2500;
|
||||||
|
tmp2 = (float)Math.Sqrt(tmp2);
|
||||||
|
d.GeomRaySetLength(ray, tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
|
d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected float m_MinTimerInterval = 0.5f;
|
protected float m_MinTimerInterval = 0.5f;
|
||||||
protected float m_recoilScaleFactor = 0.0f;
|
protected float m_recoilScaleFactor = 0.0f;
|
||||||
|
|
||||||
protected DateTime m_timer = DateTime.Now;
|
protected double m_timer = Util.GetTimeStampMS();
|
||||||
protected bool m_waitingForScriptAnswer = false;
|
protected bool m_waitingForScriptAnswer = false;
|
||||||
protected bool m_automaticLinkPermission = false;
|
protected bool m_automaticLinkPermission = false;
|
||||||
protected IMessageTransferModule m_TransferModule = null;
|
protected IMessageTransferModule m_TransferModule = null;
|
||||||
|
@ -662,7 +662,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
List<SceneObjectPart> ret = new List<SceneObjectPart>();
|
List<SceneObjectPart> ret = new List<SceneObjectPart>();
|
||||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||||
return ret;
|
return ret;
|
||||||
ret.Add(part);
|
|
||||||
|
|
||||||
switch (linkType)
|
switch (linkType)
|
||||||
{
|
{
|
||||||
|
@ -670,7 +669,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new List<SceneObjectPart>(part.ParentGroup.Parts);
|
return new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||||
|
|
||||||
case ScriptBaseClass.LINK_ROOT:
|
case ScriptBaseClass.LINK_ROOT:
|
||||||
ret = new List<SceneObjectPart>();
|
|
||||||
ret.Add(part.ParentGroup.RootPart);
|
ret.Add(part.ParentGroup.RootPart);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -690,16 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case ScriptBaseClass.LINK_THIS:
|
case ScriptBaseClass.LINK_THIS:
|
||||||
|
ret.Add(part);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (linkType < 0)
|
if (linkType < 0)
|
||||||
return new List<SceneObjectPart>();
|
return ret;
|
||||||
|
|
||||||
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
|
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return new List<SceneObjectPart>();
|
return ret;
|
||||||
ret = new List<SceneObjectPart>();
|
|
||||||
ret.Add(target);
|
ret.Add(target);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3050,22 +3048,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Float llGetTime()
|
public LSL_Float llGetTime()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
TimeSpan ScriptTime = DateTime.Now - m_timer;
|
double ScriptTime = Util.GetTimeStampMS() - m_timer;
|
||||||
return (double)(ScriptTime.TotalMilliseconds / 1000);
|
return (ScriptTime / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llResetTime()
|
public void llResetTime()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
m_timer = DateTime.Now;
|
m_timer = Util.GetTimeStampMS();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Float llGetAndResetTime()
|
public LSL_Float llGetAndResetTime()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
TimeSpan ScriptTime = DateTime.Now - m_timer;
|
double now = Util.GetTimeStampMS();
|
||||||
m_timer = DateTime.Now;
|
double ScriptTime = now - m_timer;
|
||||||
return (double)(ScriptTime.TotalMilliseconds / 1000);
|
m_timer = now;
|
||||||
|
return (ScriptTime / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSound(string sound, double volume, int queue, int loop)
|
public void llSound(string sound, double volume, int queue, int loop)
|
||||||
|
@ -10086,6 +10085,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateSlice((float)slice.x, (float)slice.y);
|
part.UpdateSlice((float)slice.x, (float)slice.y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ScriptBaseClass.PRIM_SIT_TARGET:
|
||||||
|
if (remain < 3)
|
||||||
|
return new LSL_List();
|
||||||
|
|
||||||
|
int active;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
active = rules.GetLSLIntegerItem(idx++);
|
||||||
|
}
|
||||||
|
catch(InvalidCastException)
|
||||||
|
{
|
||||||
|
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
|
||||||
|
return new LSL_List();
|
||||||
|
}
|
||||||
|
LSL_Vector offset;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
offset = rules.GetVector3Item(idx++);
|
||||||
|
}
|
||||||
|
catch(InvalidCastException)
|
||||||
|
{
|
||||||
|
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
|
||||||
|
return new LSL_List();
|
||||||
|
}
|
||||||
|
LSL_Rotation sitrot;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sitrot = rules.GetQuaternionItem(idx++);
|
||||||
|
}
|
||||||
|
catch(InvalidCastException)
|
||||||
|
{
|
||||||
|
Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1));
|
||||||
|
return new LSL_List();
|
||||||
|
}
|
||||||
|
|
||||||
|
// not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation
|
||||||
|
if(active == 1)
|
||||||
|
{
|
||||||
|
if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0)
|
||||||
|
offset.z = 1e-5f; // hack
|
||||||
|
SitTarget(part,offset,sitrot);
|
||||||
|
}
|
||||||
|
else if(active == 0)
|
||||||
|
SitTarget(part, Vector3.Zero , Quaternion.Identity);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case ScriptBaseClass.PRIM_LINK_TARGET:
|
case ScriptBaseClass.PRIM_LINK_TARGET:
|
||||||
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
|
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
|
@ -11183,6 +11229,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
res.Add(new LSL_Float(gain));
|
res.Add(new LSL_Float(gain));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (int)ScriptBaseClass.PRIM_SIT_TARGET:
|
||||||
|
if(part.IsSitTargetSet)
|
||||||
|
{
|
||||||
|
res.Add(new LSL_Integer(1));
|
||||||
|
res.Add(new LSL_Vector(part.SitTargetPosition));
|
||||||
|
res.Add(new LSL_Rotation(part.SitTargetOrientation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res.Add(new LSL_Integer(0));
|
||||||
|
res.Add(new LSL_Vector(Vector3.Zero));
|
||||||
|
res.Add(new LSL_Rotation(Quaternion.Identity));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
||||||
|
|
||||||
// TODO: Should be issuing a runtime script warning in this case.
|
// TODO: Should be issuing a runtime script warning in this case.
|
||||||
|
@ -14155,18 +14216,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd)
|
private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd, bool skipPhys)
|
||||||
{
|
{
|
||||||
List<ContactResult> contacts = new List<ContactResult>();
|
List<ContactResult> contacts = new List<ContactResult>();
|
||||||
|
|
||||||
Vector3 ab = rayEnd - rayStart;
|
Vector3 ab = rayEnd - rayStart;
|
||||||
|
float ablen = ab.Length();
|
||||||
|
|
||||||
World.ForEachScenePresence(delegate(ScenePresence sp)
|
World.ForEachScenePresence(delegate(ScenePresence sp)
|
||||||
{
|
{
|
||||||
Vector3 ac = sp.AbsolutePosition - rayStart;
|
if(skipPhys && sp.PhysicsActor != null)
|
||||||
// Vector3 bc = sp.AbsolutePosition - rayEnd;
|
return;
|
||||||
|
|
||||||
double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
|
Vector3 ac = sp.AbsolutePosition - rayStart;
|
||||||
|
|
||||||
|
double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / ablen);
|
||||||
|
|
||||||
if (d > 1.5)
|
if (d > 1.5)
|
||||||
return;
|
return;
|
||||||
|
@ -14455,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
Vector3 rayEnd = end;
|
Vector3 rayEnd = end;
|
||||||
Vector3 dir = rayEnd - rayStart;
|
Vector3 dir = rayEnd - rayStart;
|
||||||
|
|
||||||
float dist = Vector3.Mag(dir);
|
float dist = dir.Length();
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
bool detectPhantom = false;
|
bool detectPhantom = false;
|
||||||
|
@ -14484,7 +14548,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
|
bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
|
||||||
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
|
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
|
||||||
|
|
||||||
|
|
||||||
if (World.SupportsRayCastFiltered())
|
if (World.SupportsRayCastFiltered())
|
||||||
{
|
{
|
||||||
if (dist == 0)
|
if (dist == 0)
|
||||||
|
@ -14493,8 +14556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
|
RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
|
||||||
if (checkTerrain)
|
if (checkTerrain)
|
||||||
rayfilter |= RayFilterFlags.land;
|
rayfilter |= RayFilterFlags.land;
|
||||||
// if (checkAgents)
|
if (checkAgents)
|
||||||
// rayfilter |= RayFilterFlags.agent;
|
rayfilter |= RayFilterFlags.agent;
|
||||||
if (checkPhysical)
|
if (checkPhysical)
|
||||||
rayfilter |= RayFilterFlags.physical;
|
rayfilter |= RayFilterFlags.physical;
|
||||||
if (checkNonPhysical)
|
if (checkNonPhysical)
|
||||||
|
@ -14520,16 +14583,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
if (physresults == null)
|
if (physresults == null)
|
||||||
{
|
{
|
||||||
list.Add(new LSL_Integer(-3)); // timeout error
|
// list.Add(new LSL_Integer(-3)); // timeout error
|
||||||
return list;
|
// return list;
|
||||||
|
results = new List<ContactResult>();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
results = (List<ContactResult>)physresults;
|
results = (List<ContactResult>)physresults;
|
||||||
|
|
||||||
// for now physics doesn't detect sitted avatars so do it outside physics
|
// for now physics doesn't detect sitted avatars so do it outside physics
|
||||||
if (checkAgents)
|
if (checkAgents)
|
||||||
{
|
{
|
||||||
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
|
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, true);
|
||||||
foreach (ContactResult r in agentHits)
|
foreach (ContactResult r in agentHits)
|
||||||
results.Add(r);
|
results.Add(r);
|
||||||
}
|
}
|
||||||
|
@ -14545,12 +14609,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
foreach (ContactResult r in objectHits)
|
foreach (ContactResult r in objectHits)
|
||||||
results.Add(r);
|
results.Add(r);
|
||||||
}
|
}
|
||||||
|
// Double check this because of current ODE distance problems
|
||||||
|
if (checkTerrain && dist > 60)
|
||||||
|
{
|
||||||
|
bool skipGroundCheck = false;
|
||||||
|
|
||||||
|
foreach (ContactResult c in results)
|
||||||
|
{
|
||||||
|
if (c.ConsumerID == 0) // Physics gave us a ground collision
|
||||||
|
skipGroundCheck = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skipGroundCheck)
|
||||||
|
{
|
||||||
|
float tmp = dir.X * dir.X + dir.Y * dir.Y;
|
||||||
|
if(tmp > 2500)
|
||||||
|
{
|
||||||
|
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
|
||||||
|
if (groundContact != null)
|
||||||
|
results.Add((ContactResult)groundContact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (checkAgents)
|
if (checkAgents)
|
||||||
{
|
{
|
||||||
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
|
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, false);
|
||||||
foreach (ContactResult r in agentHits)
|
foreach (ContactResult r in agentHits)
|
||||||
results.Add(r);
|
results.Add(r);
|
||||||
}
|
}
|
||||||
|
@ -14565,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
results.Add(objectHits[iter]);
|
results.Add(objectHits[iter]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Double check this
|
|
||||||
if (checkTerrain)
|
if (checkTerrain)
|
||||||
{
|
|
||||||
bool skipGroundCheck = false;
|
|
||||||
|
|
||||||
foreach (ContactResult c in results)
|
|
||||||
{
|
|
||||||
if (c.ConsumerID == 0) // Physics gave us a ground collision
|
|
||||||
skipGroundCheck = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!skipGroundCheck)
|
|
||||||
{
|
{
|
||||||
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
|
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
|
||||||
if (groundContact != null)
|
if (groundContact != null)
|
||||||
|
@ -14644,7 +14718,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
list.Add(new LSL_Integer(values));
|
list.Add(new LSL_Integer(values));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15919,6 +15992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case (int)ScriptBaseClass.PRIM_TEXT:
|
case (int)ScriptBaseClass.PRIM_TEXT:
|
||||||
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
|
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
|
||||||
case (int)ScriptBaseClass.PRIM_OMEGA:
|
case (int)ScriptBaseClass.PRIM_OMEGA:
|
||||||
|
case (int)ScriptBaseClass.PRIM_SIT_TARGET:
|
||||||
if (remain < 3)
|
if (remain < 3)
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
idx += 3;
|
idx += 3;
|
||||||
|
|
|
@ -365,8 +365,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected object ConvertFromLSL(object lslparm, Type type, string fname)
|
protected object ConvertFromLSL(object lslparm, Type type, string fname)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(lslparm.GetType() == type)
|
||||||
|
return lslparm;
|
||||||
|
|
||||||
// ---------- String ----------
|
// ---------- String ----------
|
||||||
if (lslparm is LSL_String)
|
else if (lslparm is LSL_String)
|
||||||
{
|
{
|
||||||
if (type == typeof(string))
|
if (type == typeof(string))
|
||||||
return (string)(LSL_String)lslparm;
|
return (string)(LSL_String)lslparm;
|
||||||
|
|
|
@ -254,6 +254,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
|
public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
|
||||||
public const int ATTACH_NECK = 39;
|
public const int ATTACH_NECK = 39;
|
||||||
public const int ATTACH_AVATAR_CENTER = 40;
|
public const int ATTACH_AVATAR_CENTER = 40;
|
||||||
|
public const int ATTACH_LHAND_RING1 = 41;
|
||||||
|
public const int ATTACH_RHAND_RING1 = 42;
|
||||||
|
public const int ATTACH_TAIL_BASE = 43;
|
||||||
|
public const int ATTACH_TAIL_TIP = 44;
|
||||||
|
public const int ATTACH_LWING = 45;
|
||||||
|
public const int ATTACH_RWING = 46;
|
||||||
|
public const int ATTACH_FACE_JAW = 47;
|
||||||
|
public const int ATTACH_FACE_LEAR = 48;
|
||||||
|
public const int ATTACH_FACE_REAR = 49;
|
||||||
|
public const int ATTACH_FACE_LEYE = 50;
|
||||||
|
public const int ATTACH_FACE_REYE = 51;
|
||||||
|
public const int ATTACH_FACE_TONGUE = 52;
|
||||||
|
public const int ATTACH_GROIN = 53;
|
||||||
|
public const int ATTACH_HIND_LFOOT = 54;
|
||||||
|
public const int ATTACH_HIND_RFOOT = 55;
|
||||||
|
|
||||||
#region osMessageAttachments constants
|
#region osMessageAttachments constants
|
||||||
|
|
||||||
|
@ -336,11 +351,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int ROTATE = 32;
|
public const int ROTATE = 32;
|
||||||
public const int SCALE = 64;
|
public const int SCALE = 64;
|
||||||
public const int ALL_SIDES = -1;
|
public const int ALL_SIDES = -1;
|
||||||
|
|
||||||
|
// LINK flags
|
||||||
public const int LINK_SET = -1;
|
public const int LINK_SET = -1;
|
||||||
public const int LINK_ROOT = 1;
|
public const int LINK_ROOT = 1;
|
||||||
public const int LINK_ALL_OTHERS = -2;
|
public const int LINK_ALL_OTHERS = -2;
|
||||||
public const int LINK_ALL_CHILDREN = -3;
|
public const int LINK_ALL_CHILDREN = -3;
|
||||||
public const int LINK_THIS = -4;
|
public const int LINK_THIS = -4;
|
||||||
|
|
||||||
public const int CHANGED_INVENTORY = 1;
|
public const int CHANGED_INVENTORY = 1;
|
||||||
public const int CHANGED_COLOR = 2;
|
public const int CHANGED_COLOR = 2;
|
||||||
public const int CHANGED_SHAPE = 4;
|
public const int CHANGED_SHAPE = 4;
|
||||||
|
@ -356,6 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int CHANGED_MEDIA = 2048;
|
public const int CHANGED_MEDIA = 2048;
|
||||||
public const int CHANGED_ANIMATION = 16384;
|
public const int CHANGED_ANIMATION = 16384;
|
||||||
public const int CHANGED_POSITION = 32768;
|
public const int CHANGED_POSITION = 32768;
|
||||||
|
|
||||||
public const int TYPE_INVALID = 0;
|
public const int TYPE_INVALID = 0;
|
||||||
public const int TYPE_INTEGER = 1;
|
public const int TYPE_INTEGER = 1;
|
||||||
public const int TYPE_FLOAT = 2;
|
public const int TYPE_FLOAT = 2;
|
||||||
|
@ -389,6 +408,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded
|
public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded
|
||||||
public const int CONTENT_TYPE_RSS = 8; //application/rss+xml
|
public const int CONTENT_TYPE_RSS = 8; //application/rss+xml
|
||||||
|
|
||||||
|
//parameters comand flags
|
||||||
public const int PRIM_MATERIAL = 2;
|
public const int PRIM_MATERIAL = 2;
|
||||||
public const int PRIM_PHYSICS = 3;
|
public const int PRIM_PHYSICS = 3;
|
||||||
public const int PRIM_TEMP_ON_REZ = 4;
|
public const int PRIM_TEMP_ON_REZ = 4;
|
||||||
|
@ -397,19 +417,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int PRIM_SIZE = 7;
|
public const int PRIM_SIZE = 7;
|
||||||
public const int PRIM_ROTATION = 8;
|
public const int PRIM_ROTATION = 8;
|
||||||
public const int PRIM_TYPE = 9;
|
public const int PRIM_TYPE = 9;
|
||||||
|
// gap 10-16
|
||||||
public const int PRIM_TEXTURE = 17;
|
public const int PRIM_TEXTURE = 17;
|
||||||
public const int PRIM_COLOR = 18;
|
public const int PRIM_COLOR = 18;
|
||||||
public const int PRIM_BUMP_SHINY = 19;
|
public const int PRIM_BUMP_SHINY = 19;
|
||||||
public const int PRIM_FULLBRIGHT = 20;
|
public const int PRIM_FULLBRIGHT = 20;
|
||||||
public const int PRIM_FLEXIBLE = 21;
|
public const int PRIM_FLEXIBLE = 21;
|
||||||
public const int PRIM_TEXGEN = 22;
|
public const int PRIM_TEXGEN = 22;
|
||||||
public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
|
|
||||||
public const int PRIM_POINT_LIGHT = 23; // Huh?
|
public const int PRIM_POINT_LIGHT = 23; // Huh?
|
||||||
|
public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
|
||||||
public const int PRIM_GLOW = 25;
|
public const int PRIM_GLOW = 25;
|
||||||
public const int PRIM_TEXT = 26;
|
public const int PRIM_TEXT = 26;
|
||||||
public const int PRIM_NAME = 27;
|
public const int PRIM_NAME = 27;
|
||||||
public const int PRIM_DESC = 28;
|
public const int PRIM_DESC = 28;
|
||||||
public const int PRIM_ROT_LOCAL = 29;
|
public const int PRIM_ROT_LOCAL = 29;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
|
||||||
|
public const int PRIM_PHYSICS_MATERIAL = 31; // apparently not on SL wiki
|
||||||
public const int PRIM_OMEGA = 32;
|
public const int PRIM_OMEGA = 32;
|
||||||
public const int PRIM_POS_LOCAL = 33;
|
public const int PRIM_POS_LOCAL = 33;
|
||||||
public const int PRIM_LINK_TARGET = 34;
|
public const int PRIM_LINK_TARGET = 34;
|
||||||
|
@ -417,6 +440,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int PRIM_SPECULAR = 36;
|
public const int PRIM_SPECULAR = 36;
|
||||||
public const int PRIM_NORMAL = 37;
|
public const int PRIM_NORMAL = 37;
|
||||||
public const int PRIM_ALPHA_MODE = 38;
|
public const int PRIM_ALPHA_MODE = 38;
|
||||||
|
public const int PRIM_ALLOW_UNSIT = 39; // experiences related. unsupported
|
||||||
|
public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. unsupported
|
||||||
|
public const int PRIM_SIT_TARGET = 41;
|
||||||
|
|
||||||
|
|
||||||
|
// parameters
|
||||||
public const int PRIM_TEXGEN_DEFAULT = 0;
|
public const int PRIM_TEXGEN_DEFAULT = 0;
|
||||||
public const int PRIM_TEXGEN_PLANAR = 1;
|
public const int PRIM_TEXGEN_PLANAR = 1;
|
||||||
|
|
||||||
|
@ -473,6 +502,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int PRIM_SCULPT_FLAG_INVERT = 64;
|
public const int PRIM_SCULPT_FLAG_INVERT = 64;
|
||||||
public const int PRIM_SCULPT_FLAG_MIRROR = 128;
|
public const int PRIM_SCULPT_FLAG_MIRROR = 128;
|
||||||
|
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_NONE = 1;
|
||||||
|
public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
|
||||||
|
|
||||||
public const int PROFILE_NONE = 0;
|
public const int PROFILE_NONE = 0;
|
||||||
public const int PROFILE_SCRIPT_MEMORY = 1;
|
public const int PROFILE_SCRIPT_MEMORY = 1;
|
||||||
|
|
||||||
|
@ -701,12 +734,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int PRIM_MEDIA_PERM_GROUP = 2;
|
public const int PRIM_MEDIA_PERM_GROUP = 2;
|
||||||
public const int PRIM_MEDIA_PERM_ANYONE = 4;
|
public const int PRIM_MEDIA_PERM_ANYONE = 4;
|
||||||
|
|
||||||
public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
|
|
||||||
public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
|
|
||||||
public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
|
|
||||||
public const int PRIM_PHYSICS_SHAPE_NONE = 1;
|
|
||||||
|
|
||||||
public const int PRIM_PHYSICS_MATERIAL = 31;
|
|
||||||
public const int DENSITY = 1;
|
public const int DENSITY = 1;
|
||||||
public const int FRICTION = 2;
|
public const int FRICTION = 2;
|
||||||
public const int RESTITUTION = 4;
|
public const int RESTITUTION = 4;
|
||||||
|
|
|
@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
{
|
{
|
||||||
if (Data[itemIndex] is LSL_Types.Quaternion)
|
if (Data[itemIndex] is LSL_Types.Quaternion)
|
||||||
{
|
{
|
||||||
return (LSL_Types.Quaternion)Data[itemIndex];
|
LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex];
|
||||||
|
q.Normalize();
|
||||||
|
return q;
|
||||||
}
|
}
|
||||||
else if(Data[itemIndex] is OpenMetaverse.Quaternion)
|
else if(Data[itemIndex] is OpenMetaverse.Quaternion)
|
||||||
{
|
{
|
||||||
return new LSL_Types.Quaternion(
|
LSL_Types.Quaternion q = new LSL_Types.Quaternion(
|
||||||
(OpenMetaverse.Quaternion)Data[itemIndex]);
|
(OpenMetaverse.Quaternion)Data[itemIndex]);
|
||||||
|
q.Normalize();
|
||||||
|
return q;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -270,6 +270,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
|
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
|
||||||
|
// make that nonsense a quaternion
|
||||||
|
testValue.Normalize();
|
||||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||||
|
|
||||||
Assert.AreEqual(testValue, testList.GetQuaternionItem(0));
|
Assert.AreEqual(testValue, testList.GetQuaternionItem(0));
|
||||||
|
|
Loading…
Reference in New Issue