aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-30 06:18:17 +0000
committerTeravus Ovares2007-12-30 06:18:17 +0000
commit32438ab1b9a5c270e0a4a2d708f8c7730dc7e617 (patch)
tree21595ce38d7a9474c1b3f3eb71c8d50a2763039a /OpenSim/Region/Environment/Scenes
parent* Applied Melanie's same instance IM fix. This will make IMs work within the... (diff)
downloadopensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.zip
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.gz
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.bz2
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.xz
* This update rolls back the packetpool and LibSL changes. Please retest and then patch these changes back in. Currently it's not quite ready for 0.5. The down side to this action, is that we loose some performance to the garbage collector for now. Given that the target date for 0.5 is *Two days* from now, I'm taking the initiative to work towards a real stable version.
* This update also fixes scripting and some weird physics reactions
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs76
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs2
5 files changed, 47 insertions, 54 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 1a77565..5b46040 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
557 557
558 if (rezAsset != null) 558 if (rezAsset != null)
559 { 559 {
560 string script = Util.FieldToString(rezAsset.Data); 560 string script = Helpers.FieldToUTF8String(rezAsset.Data);
561 EventManager.TriggerRezScript(localID, copyID, script); 561 EventManager.TriggerRezScript(localID, copyID, script);
562 rezzed = true; 562 rezzed = true;
563 } 563 }
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes
733 733
734 if (rezAsset != null) 734 if (rezAsset != null)
735 { 735 {
736 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 736 AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos);
737 //userInfo.DeleteItem(remoteClient.AgentId, item); 737 //userInfo.DeleteItem(remoteClient.AgentId, item);
738 //remoteClient.SendRemoveInventoryItem(itemID); 738 //remoteClient.SendRemoveInventoryItem(itemID);
739 } 739 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 647fbf4..af4573b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); 166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>();
167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); 167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
168 168
169 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); 169 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
170 // TODO: don't create new blocks if recycling an old packet 170 // TODO: don't create new blocks if recycling an old packet
171 171
172 AvatarPickerReplyPacket.DataBlock[] searchData = 172 AvatarPickerReplyPacket.DataBlock[] searchData =
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 89b68de..d710e49 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -931,7 +931,6 @@ namespace OpenSim.Region.Environment.Scenes
931 if (RayEndIsIntersection == (byte)1) 931 if (RayEndIsIntersection == (byte)1)
932 { 932 {
933 pos = RayEnd; 933 pos = RayEnd;
934 pos.Z += 0.25F;
935 return pos; 934 return pos;
936 } 935 }
937 if (RayTargetID != LLUUID.Zero) 936 if (RayTargetID != LLUUID.Zero)
@@ -987,14 +986,13 @@ namespace OpenSim.Region.Environment.Scenes
987 986
988 987
989 988
990 pos.Z += 0.25F; 989
991 return pos; 990 return pos;
992 } 991 }
993 else 992 else
994 { 993 {
995 // fall back to our stupid functionality 994 // fall back to our stupid functionality
996 pos = RayEnd; 995 pos = RayEnd;
997 pos.Z += 0.25F;
998 return pos; 996 return pos;
999 } 997 }
1000 } 998 }
@@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes
1002 { 1000 {
1003 // fall back to our stupid functionality 1001 // fall back to our stupid functionality
1004 pos = RayEnd; 1002 pos = RayEnd;
1005 pos.Z += 0.25F;
1006 return pos; 1003 return pos;
1007 } 1004 }
1008 1005
@@ -1012,7 +1009,12 @@ namespace OpenSim.Region.Environment.Scenes
1012 byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, 1009 byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID,
1013 byte RayEndIsIntersection) 1010 byte RayEndIsIntersection)
1014 { 1011 {
1015 1012 // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
1013 // in the direction the client supplies (the ground level that we clicked)
1014 // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go
1015 // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did.
1016 // It's wrong many times though.
1017
1016 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); 1018 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection);
1017 1019
1018 1020
@@ -1020,40 +1022,36 @@ namespace OpenSim.Region.Environment.Scenes
1020 1022
1021 if (PermissionsMngr.CanRezObject(ownerID, pos)) 1023 if (PermissionsMngr.CanRezObject(ownerID, pos))
1022 { 1024 {
1023 // rez ON the ground, not IN the ground
1024
1025
1026 1025
1027 AddNewPrim(ownerID, pos, rot, shape); 1026 // rez ON the ground, not IN the ground
1028 } 1027 pos.Z += 0.25F;
1029 } 1028
1030 1029
1031 public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) 1030 SceneObjectGroup sceneOb =
1032 { 1031 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
1033 SceneObjectGroup sceneOb = 1032 AddEntity(sceneOb);
1034 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); 1033 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
1035 AddEntity(sceneOb); 1034 // if grass or tree, make phantom
1036 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 1035 //rootPart.ApplySanePermissions();
1037 // if grass or tree, make phantom 1036 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
1038 //rootPart.ApplySanePermissions(); 1037 {
1039 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) 1038 rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
1040 { 1039 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
1041 rootPart.AddFlag(LLObject.ObjectFlags.Phantom); 1040 }
1042 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 1041 // if not phantom, add to physics
1043 } 1042 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
1044 // if not phantom, add to physics 1043 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1045 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 1044 {
1046 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 1045 rootPart.PhysActor =
1047 { 1046 PhysicsScene.AddPrimShape(
1048 rootPart.PhysActor = 1047 rootPart.Name,
1049 PhysicsScene.AddPrimShape( 1048 rootPart.Shape,
1050 rootPart.Name, 1049 new PhysicsVector(pos.X, pos.Y, pos.Z),
1051 rootPart.Shape, 1050 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
1052 new PhysicsVector(pos.X, pos.Y, pos.Z), 1051 new Quaternion(), UsePhysics);
1053 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 1052 // subscribe to physics events.
1054 new Quaternion(), UsePhysics); 1053 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1055 // subscribe to physics events. 1054 }
1056 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1057 } 1055 }
1058 } 1056 }
1059 1057
@@ -1500,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes
1500 m_innerScene.removeUserCount(true); 1498 m_innerScene.removeUserCount(true);
1501 } 1499 }
1502 // Tell a single agent to disconnect from the region. 1500 // Tell a single agent to disconnect from the region.
1503 libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); 1501 DisableSimulatorPacket disable = new DisableSimulatorPacket();
1504 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); 1502 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
1505 } 1503 }
1506 } 1504 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 0f8ce0b..3fc7aec 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes
636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) 636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags)
637 { 637 {
638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); 638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
639 ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); 639 ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
640 // TODO: don't create new blocks if recycling an old packet 640 // TODO: don't create new blocks if recycling an old packet
641 641
642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); 642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
@@ -677,32 +677,26 @@ namespace OpenSim.Region.Environment.Scenes
677 /// </summary> 677 /// </summary>
678 public override void Update() 678 public override void Update()
679 { 679 {
680 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_parts.Values);
681
682 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) 680 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
683 { 681 {
684 foreach (SceneObjectPart part in parts) 682 foreach (SceneObjectPart part in m_parts.Values)
685 { 683 {
686 if (part.UpdateFlag == 0) part.UpdateFlag = 1; 684 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
687 } 685 }
688
689 lastPhysGroupPos = AbsolutePosition; 686 lastPhysGroupPos = AbsolutePosition;
690 } 687 }
691
692 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) 688 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
693 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) 689 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
694 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) 690 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
695 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) 691 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
696 { 692 {
697 foreach (SceneObjectPart part in parts) 693 foreach (SceneObjectPart part in m_parts.Values)
698 { 694 {
699 if (part.UpdateFlag == 0) part.UpdateFlag = 1; 695 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
700 } 696 }
701
702 lastPhysGroupRot = GroupRotation; 697 lastPhysGroupRot = GroupRotation;
703 } 698 }
704 699 foreach (SceneObjectPart part in m_parts.Values)
705 foreach (SceneObjectPart part in parts)
706 { 700 {
707 part.SendScheduledUpdates(); 701 part.SendScheduledUpdates();
708 } 702 }
@@ -1051,7 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
1051 /// <param name="client"></param> 1045 /// <param name="client"></param>
1052 public void GetProperites(IClientAPI client) 1046 public void GetProperites(IClientAPI client)
1053 { 1047 {
1054 ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 1048 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
1055 // TODO: don't create new blocks if recycling an old packet 1049 // TODO: don't create new blocks if recycling an old packet
1056 1050
1057 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 1051 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
@@ -1086,6 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes
1086 /// <param name="name"></param> 1080 /// <param name="name"></param>
1087 public void SetPartName(string name, uint localID) 1081 public void SetPartName(string name, uint localID)
1088 { 1082 {
1083 name = name.Remove(name.Length - 1, 1);
1089 SceneObjectPart part = GetChildPart(localID); 1084 SceneObjectPart part = GetChildPart(localID);
1090 if (part != null) 1085 if (part != null)
1091 { 1086 {
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 5033965..d955fe7 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes
83 private void statsHeartBeat(object sender, EventArgs e) 83 private void statsHeartBeat(object sender, EventArgs e)
84 { 84 {
85 m_report.Enabled = false; 85 m_report.Enabled = false;
86 SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats); 86 SimStatsPacket statpack = new SimStatsPacket();
87 // TODO: don't create new blocks if recycling an old packet 87 // TODO: don't create new blocks if recycling an old packet
88 88
89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; 89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11];