aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs10
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs2
-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
7 files changed, 53 insertions, 60 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 5c99ffd..bd26fdf 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.LandManagement
111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, 111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
112 IClientAPI remote_client) 112 IClientAPI remote_client)
113 { 113 {
114 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); 114 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
115 // TODO: don't create new blocks if recycling an old packet 115 // TODO: don't create new blocks if recycling an old packet
116 116
117 updatePacket.ParcelData.AABBMax = landData.AABBMax; 117 updatePacket.ParcelData.AABBMax = landData.AABBMax;
@@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement
337 337
338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) 338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
339 { 339 {
340 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 340 replyPacket = new ParcelAccessListReplyPacket();
341 replyPacket.Data.AgentID = agentID; 341 replyPacket.Data.AgentID = agentID;
342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; 342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
343 replyPacket.Data.LocalID = landData.localID; 343 replyPacket.Data.LocalID = landData.localID;
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement
349 349
350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) 350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
351 { 351 {
352 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 352 replyPacket = new ParcelAccessListReplyPacket();
353 replyPacket.Data.AgentID = agentID; 353 replyPacket.Data.AgentID = agentID;
354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; 354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
355 replyPacket.Data.LocalID = landData.localID; 355 replyPacket.Data.LocalID = landData.localID;
@@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement
660 660
661 bool firstCall = true; 661 bool firstCall = true;
662 int MAX_OBJECTS_PER_PACKET = 251; 662 int MAX_OBJECTS_PER_PACKET = 251;
663 ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); 663 ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
664 // TODO: don't create new blocks if recycling an old packet 664 // TODO: don't create new blocks if recycling an old packet
665 ForceObjectSelectPacket.DataBlock[] data; 665 ForceObjectSelectPacket.DataBlock[] data;
666 while (resultLocalIDs.Count > 0) 666 while (resultLocalIDs.Count > 0)
@@ -699,7 +699,7 @@ namespace OpenSim.Region.Environment.LandManagement
699 public void sendLandObjectOwners(IClientAPI remote_client) 699 public void sendLandObjectOwners(IClientAPI remote_client)
700 { 700 {
701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); 701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
702 ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); 702 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
703 // TODO: don't create new blocks if recycling an old packet 703 // TODO: don't create new blocks if recycling an old packet
704 704
705 foreach (SceneObjectGroup obj in primsOverMe) 705 foreach (SceneObjectGroup obj in primsOverMe)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 22e7fc9..d463964 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -494,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement
494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) 494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
495 { 495 {
496 byteArrayCount = 0; 496 byteArrayCount = 0;
497 packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); 497 packet = new ParcelOverlayPacket();
498 packet.ParcelData.Data = byteArray; 498 packet.ParcelData.Data = byteArray;
499 packet.ParcelData.SequenceID = sequenceID; 499 packet.ParcelData.SequenceID = sequenceID;
500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); 500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
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];