Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
commit
8a1640f0a1
|
@ -2734,32 +2734,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
|
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
|
||||||
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
|
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
|
||||||
|
|
||||||
packet.QueryReplies =
|
|
||||||
new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
|
|
||||||
|
|
||||||
packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
|
|
||||||
data.Length];
|
|
||||||
|
|
||||||
packet.AgentData.AgentID = AgentId;
|
packet.AgentData.AgentID = AgentId;
|
||||||
|
|
||||||
packet.QueryData[0].QueryID = queryID;
|
packet.QueryData[0].QueryID = queryID;
|
||||||
|
|
||||||
|
DirPlacesReplyPacket.QueryRepliesBlock[] replies =
|
||||||
|
new DirPlacesReplyPacket.QueryRepliesBlock[0];
|
||||||
|
DirPlacesReplyPacket.StatusDataBlock[] status =
|
||||||
|
new DirPlacesReplyPacket.StatusDataBlock[0];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (DirPlacesReplyData d in data)
|
foreach (DirPlacesReplyData d in data)
|
||||||
{
|
{
|
||||||
packet.QueryReplies[i] =
|
int idx = replies.Length;
|
||||||
new DirPlacesReplyPacket.QueryRepliesBlock();
|
Array.Resize(ref replies, idx + 1);
|
||||||
packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock();
|
Array.Resize(ref status, idx + 1);
|
||||||
packet.QueryReplies[i].ParcelID = d.parcelID;
|
|
||||||
packet.QueryReplies[i].Name = Utils.StringToBytes(d.name);
|
replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock();
|
||||||
packet.QueryReplies[i].ForSale = d.forSale;
|
status[idx] = new DirPlacesReplyPacket.StatusDataBlock();
|
||||||
packet.QueryReplies[i].Auction = d.auction;
|
replies[idx].ParcelID = d.parcelID;
|
||||||
packet.QueryReplies[i].Dwell = d.dwell;
|
replies[idx].Name = Utils.StringToBytes(d.name);
|
||||||
packet.StatusData[i].Status = d.Status;
|
replies[idx].ForSale = d.forSale;
|
||||||
i++;
|
replies[idx].Auction = d.auction;
|
||||||
|
replies[idx].Dwell = d.dwell;
|
||||||
|
status[idx].Status = d.Status;
|
||||||
|
|
||||||
|
packet.QueryReplies = replies;
|
||||||
|
packet.StatusData = status;
|
||||||
|
|
||||||
|
if (packet.Length >= 1000)
|
||||||
|
{
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
|
|
||||||
|
packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
|
||||||
|
|
||||||
|
packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
|
||||||
|
|
||||||
|
packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
|
||||||
|
packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
|
||||||
|
|
||||||
|
packet.AgentData.AgentID = AgentId;
|
||||||
|
|
||||||
|
packet.QueryData[0].QueryID = queryID;
|
||||||
|
|
||||||
|
replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
|
||||||
|
status = new DirPlacesReplyPacket.StatusDataBlock[0];
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
if (replies.Length > 0)
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
|
public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
|
||||||
|
|
|
@ -658,6 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_persistAfter *= 10000000;
|
m_persistAfter *= 10000000;
|
||||||
|
|
||||||
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
||||||
|
m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
|
||||||
|
|
||||||
IConfig packetConfig = m_config.Configs["PacketPool"];
|
IConfig packetConfig = m_config.Configs["PacketPool"];
|
||||||
if (packetConfig != null)
|
if (packetConfig != null)
|
||||||
|
@ -692,9 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[SCENE]: Failed to load StartupConfig");
|
m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Region Config
|
#endregion Region Config
|
||||||
|
|
|
@ -422,6 +422,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void ResumeScripts()
|
public void ResumeScripts()
|
||||||
{
|
{
|
||||||
|
if (m_scene.RegionInfo.RegionSettings.DisableScripts)
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
part.Inventory.ResumeScripts();
|
part.Inventory.ResumeScripts();
|
||||||
|
|
|
@ -5122,7 +5122,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
else if (src.Data[index] is LSL_Float)
|
else if (src.Data[index] is LSL_Float)
|
||||||
return Convert.ToDouble(((LSL_Float) src.Data[index]).value);
|
return Convert.ToDouble(((LSL_Float) src.Data[index]).value);
|
||||||
else if (src.Data[index] is LSL_String)
|
else if (src.Data[index] is LSL_String)
|
||||||
return Convert.ToDouble(Regex.Replace(((LSL_String)src.Data[index]).m_string, "[^0-9]", ""));
|
{
|
||||||
|
string str = ((LSL_String) src.Data[index]).m_string;
|
||||||
|
Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
|
||||||
|
if (m != Match.Empty)
|
||||||
|
{
|
||||||
|
str = m.Value;
|
||||||
|
double d = 0.0;
|
||||||
|
if (!Double.TryParse(str, out d))
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
return Convert.ToDouble(src.Data[index]);
|
return Convert.ToDouble(src.Data[index]);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
|
@ -7823,55 +7836,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID objID = UUID.Zero;
|
UUID objID = UUID.Zero;
|
||||||
LSL_List result = new LSL_List();
|
LSL_List result = new LSL_List();
|
||||||
|
|
||||||
|
// If the ID is not valid, return null result
|
||||||
if (!UUID.TryParse(obj, out objID))
|
if (!UUID.TryParse(obj, out objID))
|
||||||
{
|
{
|
||||||
result.Add(new LSL_Vector());
|
result.Add(new LSL_Vector());
|
||||||
result.Add(new LSL_Vector());
|
result.Add(new LSL_Vector());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if this is an attached prim. If so, replace
|
||||||
|
// the UUID with the avatar UUID and report it's bounding box
|
||||||
|
SceneObjectPart part = World.GetSceneObjectPart(objID);
|
||||||
|
if (part != null && part.ParentGroup.IsAttachment)
|
||||||
|
objID = part.ParentGroup.RootPart.AttachedAvatar;
|
||||||
|
|
||||||
|
// Find out if this is an avatar ID. If so, return it's box
|
||||||
ScenePresence presence = World.GetScenePresence(objID);
|
ScenePresence presence = World.GetScenePresence(objID);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if (presence.ParentID == 0) // not sat on an object
|
// As per LSL Wiki, there is no difference between sitting
|
||||||
|
// and standing avatar since server 1.36
|
||||||
|
LSL_Vector lower;
|
||||||
|
LSL_Vector upper;
|
||||||
|
if (presence.Animator.Animations.DefaultAnimation.AnimID
|
||||||
|
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||||
{
|
{
|
||||||
LSL_Vector lower;
|
// This is for ground sitting avatars
|
||||||
LSL_Vector upper;
|
float height = presence.Appearance.AvatarHeight / 2.66666667f;
|
||||||
if (presence.Animator.Animations.DefaultAnimation.AnimID
|
lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
|
||||||
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
|
||||||
{
|
|
||||||
// This is for ground sitting avatars
|
|
||||||
float height = presence.Appearance.AvatarHeight / 2.66666667f;
|
|
||||||
lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
|
|
||||||
upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This is for standing/flying avatars
|
|
||||||
float height = presence.Appearance.AvatarHeight / 2.0f;
|
|
||||||
lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
|
|
||||||
upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
|
|
||||||
}
|
|
||||||
result.Add(lower);
|
|
||||||
result.Add(upper);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// sitting on an object so we need the bounding box of that
|
// This is for standing/flying avatars
|
||||||
// which should include the avatar so set the UUID to the
|
float height = presence.Appearance.AvatarHeight / 2.0f;
|
||||||
// UUID of the object the avatar is sat on and allow it to fall through
|
lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
|
||||||
// to processing an object
|
upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
|
||||||
SceneObjectPart p = World.GetSceneObjectPart(presence.ParentID);
|
|
||||||
objID = p.UUID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust to the documented error offsets (see LSL Wiki)
|
||||||
|
lower += new LSL_Vector(0.05f, 0.05f, 0.05f);
|
||||||
|
upper -= new LSL_Vector(0.05f, 0.05f, 0.05f);
|
||||||
|
|
||||||
|
if (lower.x > upper.x)
|
||||||
|
lower.x = upper.x;
|
||||||
|
if (lower.y > upper.y)
|
||||||
|
lower.y = upper.y;
|
||||||
|
if (lower.z > upper.z)
|
||||||
|
lower.z = upper.z;
|
||||||
|
|
||||||
|
result.Add(lower);
|
||||||
|
result.Add(upper);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
SceneObjectPart part = World.GetSceneObjectPart(objID);
|
|
||||||
|
part = World.GetSceneObjectPart(objID);
|
||||||
// Currently only works for single prims without a sitting avatar
|
// Currently only works for single prims without a sitting avatar
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
Vector3 halfSize = part.Scale / 2.0f;
|
float minX;
|
||||||
LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f);
|
float maxX;
|
||||||
LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z);
|
float minY;
|
||||||
|
float maxY;
|
||||||
|
float minZ;
|
||||||
|
float maxZ;
|
||||||
|
|
||||||
|
// This BBox is in sim coordinates, with the offset being
|
||||||
|
// a contained point.
|
||||||
|
Vector3[] offsets = World.GetCombinedBoundingBox(new List<SceneObjectGroup> { part.ParentGroup },
|
||||||
|
out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
|
||||||
|
|
||||||
|
minX -= offsets[0].X;
|
||||||
|
maxX -= offsets[0].X;
|
||||||
|
minY -= offsets[0].Y;
|
||||||
|
maxY -= offsets[0].Y;
|
||||||
|
minZ -= offsets[0].Z;
|
||||||
|
maxZ -= offsets[0].Z;
|
||||||
|
|
||||||
|
LSL_Vector lower;
|
||||||
|
LSL_Vector upper;
|
||||||
|
|
||||||
|
// Adjust to the documented error offsets (see LSL Wiki)
|
||||||
|
lower = new LSL_Vector(minX + 0.05f, minY + 0.05f, minZ + 0.05f);
|
||||||
|
upper = new LSL_Vector(maxX - 0.05f, maxY - 0.05f, maxZ - 0.05f);
|
||||||
|
|
||||||
|
if (lower.x > upper.x)
|
||||||
|
lower.x = upper.x;
|
||||||
|
if (lower.y > upper.y)
|
||||||
|
lower.y = upper.y;
|
||||||
|
if (lower.z > upper.z)
|
||||||
|
lower.z = upper.z;
|
||||||
|
|
||||||
result.Add(lower);
|
result.Add(lower);
|
||||||
result.Add(upper);
|
result.Add(upper);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue