aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs40
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs21
4 files changed, 118 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 97e7974..dd8bb02 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -22,8 +22,18 @@ namespace OpenSim.Region.Environment.Scenes
22 private Dictionary<LLUUID, InventoryItem> inventoryItems; 22 private Dictionary<LLUUID, InventoryItem> inventoryItems;
23 23
24 private string description = ""; 24 private string description = "";
25
26 public string SitName = "";
27 public string TouchName = "";
28 public string Text = "";
29
30 public LLUUID CreatorID;
25 public LLUUID OwnerID; 31 public LLUUID OwnerID;
32 public LLUUID LastOwnerID;
26 public Int32 CreationDate; 33 public Int32 CreationDate;
34
35 public uint ParentID = 0;
36
27 public uint OwnerMask = FULL_MASK_PERMISSIONS; 37 public uint OwnerMask = FULL_MASK_PERMISSIONS;
28 public uint NextOwnerMask = FULL_MASK_PERMISSIONS; 38 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
29 public uint GroupMask = FULL_MASK_PERMISSIONS; 39 public uint GroupMask = FULL_MASK_PERMISSIONS;
@@ -32,9 +42,9 @@ namespace OpenSim.Region.Environment.Scenes
32 42
33 private PrimitiveBaseShape m_Shape; 43 private PrimitiveBaseShape m_Shape;
34 44
35 private SceneObject m_RootParent; 45 public SceneObject m_RootParent;
36 private bool isRootPrim; 46 public bool isRootPrim;
37 private EntityBase m_Parent; 47 public EntityBase m_Parent;
38 48
39 public override LLVector3 Pos 49 public override LLVector3 Pos
40 { 50 {
@@ -51,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
51 } 61 }
52 set 62 set
53 { 63 {
54 this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position 64 this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position
55 } 65 }
56 66
57 } 67 }
@@ -108,6 +118,8 @@ namespace OpenSim.Region.Environment.Scenes
108 { 118 {
109 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 119 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
110 this.OwnerID = ownerID; 120 this.OwnerID = ownerID;
121 this.CreatorID = this.OwnerID;
122 this.LastOwnerID = LLUUID.Zero;
111 this.Pos = addPacket.ObjectData.RayEnd; 123 this.Pos = addPacket.ObjectData.RayEnd;
112 this.uuid = LLUUID.Random(); 124 this.uuid = LLUUID.Random();
113 this.m_localId = (uint)(localID); 125 this.m_localId = (uint)(localID);
@@ -128,7 +140,6 @@ namespace OpenSim.Region.Environment.Scenes
128 pShape.Scale = addPacket.ObjectData.Scale; 140 pShape.Scale = addPacket.ObjectData.Scale;
129 pShape.PathCurve = addPacket.ObjectData.PathCurve; 141 pShape.PathCurve = addPacket.ObjectData.PathCurve;
130 pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; 142 pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
131 pShape.ParentID = 0;
132 pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; 143 pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
133 pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; 144 pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
134 pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; 145 pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
@@ -142,7 +153,37 @@ namespace OpenSim.Region.Environment.Scenes
142 153
143 public void AddToChildren(SceneObject linkObject) 154 public void AddToChildren(SceneObject linkObject)
144 { 155 {
156 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
157 //TODO check permissions
158 this.children.Add(linkObject.rootPrimitive);
159 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent);
160
161 this.m_world.DeleteEntity(linkObject.rootUUID);
162 linkObject.rootPrimitive = null;
163 }
164
165 public void SetNewParent(Primitive newParent, SceneObject rootParent)
166 {
167 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
168 //Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z);
169 this.isRootPrim = false;
170 this.m_Parent = newParent;
171 this.ParentID = newParent.LocalId;
172 this.SetRootParent(rootParent);
173 // Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z);
174 this.Pos = oldPos;
175 // Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z);
176 this.updateFlag = 1;
177
178 }
145 179
180 public void SetRootParent(SceneObject newRoot)
181 {
182 this.m_RootParent = newRoot;
183 foreach (Primitive child in children)
184 {
185 child.SetRootParent(newRoot);
186 }
146 } 187 }
147 188
148 /// <summary> 189 /// <summary>
@@ -187,7 +228,7 @@ namespace OpenSim.Region.Environment.Scenes
187 LLVector3 lPos; 228 LLVector3 lPos;
188 lPos = this.Pos; 229 lPos = this.Pos;
189 230
190 remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID); 231 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID);
191 } 232 }
192 233
193 /// <summary> 234 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index f55c118..d8533b0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -193,8 +193,41 @@ namespace OpenSim.Region.Environment.Scenes
193 /// <param name="childPrims"></param> 193 /// <param name="childPrims"></param>
194 public void LinkObjects(uint parentPrim, List<uint> childPrims) 194 public void LinkObjects(uint parentPrim, List<uint> childPrims)
195 { 195 {
196 196 SceneObject parenPrim = null;
197 foreach (EntityBase ent in Entities.Values)
198 {
199 if (ent is SceneObject)
200 {
201 if (((SceneObject)ent).rootLocalID == parentPrim)
202 {
203 parenPrim = (SceneObject)ent;
204 break;
205 }
206 }
207 }
197 208
209 List<SceneObject> children = new List<SceneObject>();
210 if (parenPrim != null)
211 {
212 for (int i = 0; i < childPrims.Count; i++)
213 {
214 foreach (EntityBase ent in Entities.Values)
215 {
216 if (ent is SceneObject)
217 {
218 if (((SceneObject)ent).rootLocalID == childPrims[i])
219 {
220 children.Add((SceneObject)ent);
221 }
222 }
223 }
224 }
225 }
226
227 foreach (SceneObject sceneObj in children)
228 {
229 parenPrim.AddNewChildPrims(sceneObj);
230 }
198 } 231 }
199 232
200 /// <summary> 233 /// <summary>
@@ -275,7 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
275 { 308 {
276 if (this.Entities.ContainsKey(objectID)) 309 if (this.Entities.ContainsKey(objectID))
277 { 310 {
278 ((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); 311 if (this.Entities[objectID] is SceneObject)
312 {
313 ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
314 }
279 } 315 }
280 } 316 }
281 317
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 08adc84..77058cc 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -461,10 +461,11 @@ namespace OpenSim.Region.Environment.Scenes
461 client.OnRequestMapBlocks += this.RequestMapBlocks; 461 client.OnRequestMapBlocks += this.RequestMapBlocks;
462 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 462 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
463 client.OnObjectSelect += this.SelectPrim; 463 client.OnObjectSelect += this.SelectPrim;
464 // client.OnGrapUpdate += this.MoveObject; 464 client.OnGrapUpdate += this.MoveObject;
465 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 465 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
466 client.OnObjectDescription += this.PrimDescription; 466 client.OnObjectDescription += this.PrimDescription;
467 client.OnObjectName += this.PrimName; 467 client.OnObjectName += this.PrimName;
468 client.OnLinkObjects += this.LinkObjects;
468 469
469 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 470 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
470 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 471 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
@@ -585,6 +586,21 @@ namespace OpenSim.Region.Environment.Scenes
585 #endregion 586 #endregion
586 587
587 588
589 /// <summary>
590 ///
591 /// </summary>
592 /// <param name="entID"></param>
593 /// <returns></returns>
594 public bool DeleteEntity(LLUUID entID)
595 {
596 if (this.Entities.ContainsKey(entID))
597 {
598 this.Entities.Remove(entID);
599 return true;
600 }
601 return false;
602 }
603
588 #region RegionCommsHost 604 #region RegionCommsHost
589 605
590 /// <summary> 606 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 00df447..2c55a7d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
41 { 41 {
42 private System.Text.Encoding enc = System.Text.Encoding.ASCII; 42 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
43 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group 43 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
44 protected Primitive rootPrimitive; 44 public Primitive rootPrimitive;
45 private Scene m_world; 45 private Scene m_world;
46 protected ulong m_regionHandle; 46 protected ulong m_regionHandle;
47 47
@@ -99,6 +99,16 @@ namespace OpenSim.Region.Environment.Scenes
99 99
100 } 100 }
101 101
102
103 /// <summary>
104 ///
105 /// </summary>
106 /// <param name="primObject"></param>
107 public void AddNewChildPrims(SceneObject primObject)
108 {
109 this.rootPrimitive.AddToChildren(primObject);
110 }
111
102 /// <summary> 112 /// <summary>
103 /// 113 ///
104 /// </summary> 114 /// </summary>
@@ -145,6 +155,7 @@ namespace OpenSim.Region.Environment.Scenes
145 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 155 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
146 { 156 {
147 this.Pos = pos; 157 this.Pos = pos;
158 this.rootPrimitive.Pos = pos;
148 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); 159 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
149 } 160 }
150 161
@@ -161,17 +172,17 @@ namespace OpenSim.Region.Environment.Scenes
161 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 172 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
162 proper.ObjectData[0].ItemID = LLUUID.Zero; 173 proper.ObjectData[0].ItemID = LLUUID.Zero;
163 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate; 174 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
164 proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID; 175 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
165 proper.ObjectData[0].FolderID = LLUUID.Zero; 176 proper.ObjectData[0].FolderID = LLUUID.Zero;
166 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 177 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
167 proper.ObjectData[0].GroupID = LLUUID.Zero; 178 proper.ObjectData[0].GroupID = LLUUID.Zero;
168 proper.ObjectData[0].InventorySerial = 0; 179 proper.ObjectData[0].InventorySerial = 0;
169 proper.ObjectData[0].LastOwnerID = LLUUID.Zero; 180 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
170 proper.ObjectData[0].ObjectID = this.rootUUID; 181 proper.ObjectData[0].ObjectID = this.rootUUID;
171 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; 182 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
172 proper.ObjectData[0].TouchName = new byte[0]; 183 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
173 proper.ObjectData[0].TextureID = new byte[0]; 184 proper.ObjectData[0].TextureID = new byte[0];
174 proper.ObjectData[0].SitName = new byte[0]; 185 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName +"\0") ;
175 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0"); 186 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0");
176 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0"); 187 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0");
177 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; 188 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;