aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authormeta72010-08-22 09:32:49 -0700
committermeta72010-08-22 09:32:49 -0700
commit8a1640f0a1838a0cfc05ec6bab6d5d6166fde221 (patch)
tree94c0d096eb9889f425269a926ef2090590f75ae7 /OpenSim/Region
parentFix llGetLinkKey and llGetNumberOfPrims to play nice with avatars in the link... (diff)
parentRefix the fix (diff)
downloadopensim-SC_OLD-8a1640f0a1838a0cfc05ec6bab6d5d6166fde221.zip
opensim-SC_OLD-8a1640f0a1838a0cfc05ec6bab6d5d6166fde221.tar.gz
opensim-SC_OLD-8a1640f0a1838a0cfc05ec6bab6d5d6166fde221.tar.bz2
opensim-SC_OLD-8a1640f0a1838a0cfc05ec6bab6d5d6166fde221.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs120
4 files changed, 136 insertions, 51 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index d41df3d..fa72410 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2734,32 +2734,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2734 packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; 2734 packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
2735 packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); 2735 packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
2736 2736
2737 packet.QueryReplies =
2738 new DirPlacesReplyPacket.QueryRepliesBlock[data.Length];
2739
2740 packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[
2741 data.Length];
2742
2743 packet.AgentData.AgentID = AgentId; 2737 packet.AgentData.AgentID = AgentId;
2744 2738
2745 packet.QueryData[0].QueryID = queryID; 2739 packet.QueryData[0].QueryID = queryID;
2746 2740
2741 DirPlacesReplyPacket.QueryRepliesBlock[] replies =
2742 new DirPlacesReplyPacket.QueryRepliesBlock[0];
2743 DirPlacesReplyPacket.StatusDataBlock[] status =
2744 new DirPlacesReplyPacket.StatusDataBlock[0];
2745
2747 int i = 0; 2746 int i = 0;
2748 foreach (DirPlacesReplyData d in data) 2747 foreach (DirPlacesReplyData d in data)
2749 { 2748 {
2750 packet.QueryReplies[i] = 2749 int idx = replies.Length;
2751 new DirPlacesReplyPacket.QueryRepliesBlock(); 2750 Array.Resize(ref replies, idx + 1);
2752 packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock(); 2751 Array.Resize(ref status, idx + 1);
2753 packet.QueryReplies[i].ParcelID = d.parcelID; 2752
2754 packet.QueryReplies[i].Name = Utils.StringToBytes(d.name); 2753 replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock();
2755 packet.QueryReplies[i].ForSale = d.forSale; 2754 status[idx] = new DirPlacesReplyPacket.StatusDataBlock();
2756 packet.QueryReplies[i].Auction = d.auction; 2755 replies[idx].ParcelID = d.parcelID;
2757 packet.QueryReplies[i].Dwell = d.dwell; 2756 replies[idx].Name = Utils.StringToBytes(d.name);
2758 packet.StatusData[i].Status = d.Status; 2757 replies[idx].ForSale = d.forSale;
2759 i++; 2758 replies[idx].Auction = d.auction;
2759 replies[idx].Dwell = d.dwell;
2760 status[idx].Status = d.Status;
2761
2762 packet.QueryReplies = replies;
2763 packet.StatusData = status;
2764
2765 if (packet.Length >= 1000)
2766 {
2767 OutPacket(packet, ThrottleOutPacketType.Task);
2768
2769 packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply);
2770
2771 packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock();
2772
2773 packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1];
2774 packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock();
2775
2776 packet.AgentData.AgentID = AgentId;
2777
2778 packet.QueryData[0].QueryID = queryID;
2779
2780 replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
2781 status = new DirPlacesReplyPacket.StatusDataBlock[0];
2782
2783 }
2760 } 2784 }
2761 2785
2762 OutPacket(packet, ThrottleOutPacketType.Task); 2786 if (replies.Length > 0)
2787 OutPacket(packet, ThrottleOutPacketType.Task);
2763 } 2788 }
2764 2789
2765 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) 2790 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 32211c4..957c4e8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -658,6 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
658 m_persistAfter *= 10000000; 658 m_persistAfter *= 10000000;
659 659
660 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 660 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
661 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
661 662
662 IConfig packetConfig = m_config.Configs["PacketPool"]; 663 IConfig packetConfig = m_config.Configs["PacketPool"];
663 if (packetConfig != null) 664 if (packetConfig != null)
@@ -692,9 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
692 } 693 }
693 } 694 }
694 } 695 }
695 catch 696 catch (Exception e)
696 { 697 {
697 m_log.Warn("[SCENE]: Failed to load StartupConfig"); 698 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString());
698 } 699 }
699 700
700 #endregion Region Config 701 #endregion Region Config
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index abb4de6..a7003c4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -422,6 +422,9 @@ namespace OpenSim.Region.Framework.Scenes
422 422
423 public void ResumeScripts() 423 public void ResumeScripts()
424 { 424 {
425 if (m_scene.RegionInfo.RegionSettings.DisableScripts)
426 return;
427
425 foreach (SceneObjectPart part in m_parts.Values) 428 foreach (SceneObjectPart part in m_parts.Values)
426 { 429 {
427 part.Inventory.ResumeScripts(); 430 part.Inventory.ResumeScripts();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b4134a4..94b9d40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5122,7 +5122,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5122 else if (src.Data[index] is LSL_Float) 5122 else if (src.Data[index] is LSL_Float)
5123 return Convert.ToDouble(((LSL_Float) src.Data[index]).value); 5123 return Convert.ToDouble(((LSL_Float) src.Data[index]).value);
5124 else if (src.Data[index] is LSL_String) 5124 else if (src.Data[index] is LSL_String)
5125 return Convert.ToDouble(Regex.Replace(((LSL_String)src.Data[index]).m_string, "[^0-9]", "")); 5125 {
5126 string str = ((LSL_String) src.Data[index]).m_string;
5127 Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
5128 if (m != Match.Empty)
5129 {
5130 str = m.Value;
5131 double d = 0.0;
5132 if (!Double.TryParse(str, out d))
5133 return 0.0;
5134
5135 return d;
5136 }
5137 return 0.0;
5138 }
5126 return Convert.ToDouble(src.Data[index]); 5139 return Convert.ToDouble(src.Data[index]);
5127 } 5140 }
5128 catch (FormatException) 5141 catch (FormatException)
@@ -7823,55 +7836,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7823 m_host.AddScriptLPS(1); 7836 m_host.AddScriptLPS(1);
7824 UUID objID = UUID.Zero; 7837 UUID objID = UUID.Zero;
7825 LSL_List result = new LSL_List(); 7838 LSL_List result = new LSL_List();
7839
7840 // If the ID is not valid, return null result
7826 if (!UUID.TryParse(obj, out objID)) 7841 if (!UUID.TryParse(obj, out objID))
7827 { 7842 {
7828 result.Add(new LSL_Vector()); 7843 result.Add(new LSL_Vector());
7829 result.Add(new LSL_Vector()); 7844 result.Add(new LSL_Vector());
7830 return result; 7845 return result;
7831 } 7846 }
7847
7848 // Check if this is an attached prim. If so, replace
7849 // the UUID with the avatar UUID and report it's bounding box
7850 SceneObjectPart part = World.GetSceneObjectPart(objID);
7851 if (part != null && part.ParentGroup.IsAttachment)
7852 objID = part.ParentGroup.RootPart.AttachedAvatar;
7853
7854 // Find out if this is an avatar ID. If so, return it's box
7832 ScenePresence presence = World.GetScenePresence(objID); 7855 ScenePresence presence = World.GetScenePresence(objID);
7833 if (presence != null) 7856 if (presence != null)
7834 { 7857 {
7835 if (presence.ParentID == 0) // not sat on an object 7858 // As per LSL Wiki, there is no difference between sitting
7859 // and standing avatar since server 1.36
7860 LSL_Vector lower;
7861 LSL_Vector upper;
7862 if (presence.Animator.Animations.DefaultAnimation.AnimID
7863 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7836 { 7864 {
7837 LSL_Vector lower; 7865 // This is for ground sitting avatars
7838 LSL_Vector upper; 7866 float height = presence.Appearance.AvatarHeight / 2.66666667f;
7839 if (presence.Animator.Animations.DefaultAnimation.AnimID 7867 lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
7840 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7868 upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
7841 {
7842 // This is for ground sitting avatars
7843 float height = presence.Appearance.AvatarHeight / 2.66666667f;
7844 lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
7845 upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
7846 }
7847 else
7848 {
7849 // This is for standing/flying avatars
7850 float height = presence.Appearance.AvatarHeight / 2.0f;
7851 lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
7852 upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
7853 }
7854 result.Add(lower);
7855 result.Add(upper);
7856 return result;
7857 } 7869 }
7858 else 7870 else
7859 { 7871 {
7860 // sitting on an object so we need the bounding box of that 7872 // This is for standing/flying avatars
7861 // which should include the avatar so set the UUID to the 7873 float height = presence.Appearance.AvatarHeight / 2.0f;
7862 // UUID of the object the avatar is sat on and allow it to fall through 7874 lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
7863 // to processing an object 7875 upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
7864 SceneObjectPart p = World.GetSceneObjectPart(presence.ParentID);
7865 objID = p.UUID;
7866 } 7876 }
7877
7878 // Adjust to the documented error offsets (see LSL Wiki)
7879 lower += new LSL_Vector(0.05f, 0.05f, 0.05f);
7880 upper -= new LSL_Vector(0.05f, 0.05f, 0.05f);
7881
7882 if (lower.x > upper.x)
7883 lower.x = upper.x;
7884 if (lower.y > upper.y)
7885 lower.y = upper.y;
7886 if (lower.z > upper.z)
7887 lower.z = upper.z;
7888
7889 result.Add(lower);
7890 result.Add(upper);
7891 return result;
7867 } 7892 }
7868 SceneObjectPart part = World.GetSceneObjectPart(objID); 7893
7894 part = World.GetSceneObjectPart(objID);
7869 // Currently only works for single prims without a sitting avatar 7895 // Currently only works for single prims without a sitting avatar
7870 if (part != null) 7896 if (part != null)
7871 { 7897 {
7872 Vector3 halfSize = part.Scale / 2.0f; 7898 float minX;
7873 LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f); 7899 float maxX;
7874 LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z); 7900 float minY;
7901 float maxY;
7902 float minZ;
7903 float maxZ;
7904
7905 // This BBox is in sim coordinates, with the offset being
7906 // a contained point.
7907 Vector3[] offsets = World.GetCombinedBoundingBox(new List<SceneObjectGroup> { part.ParentGroup },
7908 out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
7909
7910 minX -= offsets[0].X;
7911 maxX -= offsets[0].X;
7912 minY -= offsets[0].Y;
7913 maxY -= offsets[0].Y;
7914 minZ -= offsets[0].Z;
7915 maxZ -= offsets[0].Z;
7916
7917 LSL_Vector lower;
7918 LSL_Vector upper;
7919
7920 // Adjust to the documented error offsets (see LSL Wiki)
7921 lower = new LSL_Vector(minX + 0.05f, minY + 0.05f, minZ + 0.05f);
7922 upper = new LSL_Vector(maxX - 0.05f, maxY - 0.05f, maxZ - 0.05f);
7923
7924 if (lower.x > upper.x)
7925 lower.x = upper.x;
7926 if (lower.y > upper.y)
7927 lower.y = upper.y;
7928 if (lower.z > upper.z)
7929 lower.z = upper.z;
7930
7875 result.Add(lower); 7931 result.Add(lower);
7876 result.Add(upper); 7932 result.Add(upper);
7877 return result; 7933 return result;