aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/World
diff options
context:
space:
mode:
authorMW2007-06-12 14:46:29 +0000
committerMW2007-06-12 14:46:29 +0000
commit9f1158ba6ac5f36db5a4d374f22276294930dfd7 (patch)
tree5fd68371d72e31504e9a275f1de00eddd482c84f /OpenSim/OpenSim.Region/World
parent*Fixed sugilite (diff)
downloadopensim-SC_OLD-9f1158ba6ac5f36db5a4d374f22276294930dfd7.zip
opensim-SC_OLD-9f1158ba6ac5f36db5a4d374f22276294930dfd7.tar.gz
opensim-SC_OLD-9f1158ba6ac5f36db5a4d374f22276294930dfd7.tar.bz2
opensim-SC_OLD-9f1158ba6ac5f36db5a4d374f22276294930dfd7.tar.xz
Some Work on the Primitive class
Diffstat (limited to 'OpenSim/OpenSim.Region/World')
-rw-r--r--OpenSim/OpenSim.Region/World/Primitive.cs101
-rw-r--r--OpenSim/OpenSim.Region/World/SceneObject.cs27
-rw-r--r--OpenSim/OpenSim.Region/World/World.PacketHandlers.cs9
-rw-r--r--OpenSim/OpenSim.Region/World/World.cs6
4 files changed, 84 insertions, 59 deletions
diff --git a/OpenSim/OpenSim.Region/World/Primitive.cs b/OpenSim/OpenSim.Region/World/Primitive.cs
index dbdbdb9..0680eb3 100644
--- a/OpenSim/OpenSim.Region/World/Primitive.cs
+++ b/OpenSim/OpenSim.Region/World/Primitive.cs
@@ -41,9 +41,9 @@ namespace OpenSim.Region
41{ 41{
42 public class Primitive : Entity 42 public class Primitive : Entity
43 { 43 {
44 protected PrimData primData; 44 internal PrimData primData;
45 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 45 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
46 private Dictionary<uint, IClientAPI> m_clientThreads; 46 // private Dictionary<uint, IClientAPI> m_clientThreads;
47 private ulong m_regionHandle; 47 private ulong m_regionHandle;
48 private const uint FULL_MASK_PERMISSIONS = 2147483647; 48 private const uint FULL_MASK_PERMISSIONS = 2147483647;
49 private bool physicsEnabled = false; 49 private bool physicsEnabled = false;
@@ -95,7 +95,7 @@ namespace OpenSim.Region
95 /// <param name="world"></param> 95 /// <param name="world"></param>
96 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world) 96 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world)
97 { 97 {
98 m_clientThreads = clientThreads; 98 // m_clientThreads = clientThreads;
99 m_regionHandle = regionHandle; 99 m_regionHandle = regionHandle;
100 m_world = world; 100 m_world = world;
101 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 101 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
@@ -112,7 +112,7 @@ namespace OpenSim.Region
112 /// <param name="localID"></param> 112 /// <param name="localID"></param>
113 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID) 113 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID)
114 { 114 {
115 m_clientThreads = clientThreads; 115 // m_clientThreads = clientThreads;
116 m_regionHandle = regionHandle; 116 m_regionHandle = regionHandle;
117 m_world = world; 117 m_world = world;
118 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 118 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
@@ -134,7 +134,7 @@ namespace OpenSim.Region
134 /// <param name="position"></param> 134 /// <param name="position"></param>
135 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, uint localID, LLVector3 position) 135 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, uint localID, LLVector3 position)
136 { 136 {
137 m_clientThreads = clientThreads; 137 //m_clientThreads = clientThreads;
138 m_regionHandle = regionHandle; 138 m_regionHandle = regionHandle;
139 m_world = world; 139 m_world = world;
140 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 140 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
@@ -191,11 +191,16 @@ namespace OpenSim.Region
191 /// </summary> 191 /// </summary>
192 public override void update() 192 public override void update()
193 { 193 {
194 if (this.updateFlag == 1) 194 if (this.updateFlag == 1) // is a new prim just been created/reloaded
195 { 195 {
196 this.SendFullUpdateToAllClients(); 196 this.SendFullUpdateToAllClients();
197 this.updateFlag = 0; 197 this.updateFlag = 0;
198 } 198 }
199 if (this.updateFlag == 2) //some change has been made so update the clients
200 {
201 this.SendTerseUpdateToALLClients();
202 this.updateFlag = 0;
203 }
199 } 204 }
200 205
201 /// <summary> 206 /// <summary>
@@ -216,7 +221,8 @@ namespace OpenSim.Region
216 /// <param name="pos"></param> 221 /// <param name="pos"></param>
217 public void UpdatePosition(LLVector3 pos) 222 public void UpdatePosition(LLVector3 pos)
218 { 223 {
219 224 this.Pos = new LLVector3(pos.X, pos.Y, pos.Z);
225 this.updateFlag = 2;
220 } 226 }
221 227
222 /// <summary> 228 /// <summary>
@@ -272,58 +278,44 @@ namespace OpenSim.Region
272 278
273 } 279 }
274 280
275 /// <summary>
276 ///
277 /// </summary>
278 /// <param name="client"></param>
279 public void GetProperites(IClientAPI client)
280 {
281 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
282 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
283 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
284 proper.ObjectData[0].ItemID = LLUUID.Zero;
285 proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate;
286 proper.ObjectData[0].CreatorID = this.primData.OwnerID;
287 proper.ObjectData[0].FolderID = LLUUID.Zero;
288 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
289 proper.ObjectData[0].GroupID = LLUUID.Zero;
290 proper.ObjectData[0].InventorySerial = 0;
291 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
292 proper.ObjectData[0].ObjectID = this.uuid;
293 proper.ObjectData[0].OwnerID = primData.OwnerID;
294 proper.ObjectData[0].TouchName = new byte[0];
295 proper.ObjectData[0].TextureID = new byte[0];
296 proper.ObjectData[0].SitName = new byte[0];
297 proper.ObjectData[0].Name = new byte[0];
298 proper.ObjectData[0].Description = new byte[0];
299 proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
300 proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
301 proper.ObjectData[0].GroupMask = this.primData.GroupMask;
302 proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
303 proper.ObjectData[0].BaseMask = this.primData.BaseMask;
304
305 client.OutPacket(proper);
306 }
307
308 #endregion 281 #endregion
309 282
310 # region Inventory Methods 283 # region Inventory Methods
311 284 /// <summary>
285 ///
286 /// </summary>
287 /// <param name="item"></param>
288 /// <returns></returns>
312 public bool AddToInventory(InventoryItem item) 289 public bool AddToInventory(InventoryItem item)
313 { 290 {
314 return false; 291 return false;
315 } 292 }
316 293
294 /// <summary>
295 ///
296 /// </summary>
297 /// <param name="itemID"></param>
298 /// <returns></returns>
317 public InventoryItem RemoveFromInventory(LLUUID itemID) 299 public InventoryItem RemoveFromInventory(LLUUID itemID)
318 { 300 {
319 return null; 301 return null;
320 } 302 }
321 303
304 /// <summary>
305 ///
306 /// </summary>
307 /// <param name="simClient"></param>
308 /// <param name="packet"></param>
322 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) 309 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
323 { 310 {
324 311
325 } 312 }
326 313
314 /// <summary>
315 ///
316 /// </summary>
317 /// <param name="simClient"></param>
318 /// <param name="xferID"></param>
327 public void RequestXferInventory(IClientAPI simClient, ulong xferID) 319 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
328 { 320 {
329 //will only currently work if the total size of the inventory data array is under about 1000 bytes 321 //will only currently work if the total size of the inventory data array is under about 1000 bytes
@@ -336,6 +328,10 @@ namespace OpenSim.Region
336 simClient.OutPacket(send); 328 simClient.OutPacket(send);
337 } 329 }
338 330
331 /// <summary>
332 ///
333 /// </summary>
334 /// <returns></returns>
339 public byte[] ConvertInventoryToBytes() 335 public byte[] ConvertInventoryToBytes()
340 { 336 {
341 System.Text.Encoding enc = System.Text.Encoding.ASCII; 337 System.Text.Encoding enc = System.Text.Encoding.ASCII;
@@ -353,6 +349,10 @@ namespace OpenSim.Region
353 return result; 349 return result;
354 } 350 }
355 351
352 /// <summary>
353 ///
354 /// </summary>
355 /// <param name="data"></param>
356 public void CreateInventoryFromBytes(byte[] data) 356 public void CreateInventoryFromBytes(byte[] data)
357 { 357 {
358 358
@@ -362,7 +362,22 @@ namespace OpenSim.Region
362 362
363 #region Update viewers Methods 363 #region Update viewers Methods
364 364
365 //should change these mehtods, so that outgoing packets are sent through the avatar class? 365 /// <summary>
366 ///
367 /// </summary>
368 /// <param name="remoteClient"></param>
369 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
370 {
371 this.SendFullUpdateToClient(remoteClient);
372 for (int i = 0; i < this.children.Count; i++)
373 {
374 if (this.children[i] is Primitive)
375 {
376 ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient);
377 }
378 }
379 }
380
366 /// <summary> 381 /// <summary>
367 /// 382 ///
368 /// </summary> 383 /// </summary>
@@ -491,7 +506,7 @@ namespace OpenSim.Region
491 { 506 {
492 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); 507 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
493 } 508 }
494 509
495 /// <summary> 510 /// <summary>
496 /// 511 ///
497 /// </summary> 512 /// </summary>
diff --git a/OpenSim/OpenSim.Region/World/SceneObject.cs b/OpenSim/OpenSim.Region/World/SceneObject.cs
index 87c9bb0..6ded881 100644
--- a/OpenSim/OpenSim.Region/World/SceneObject.cs
+++ b/OpenSim/OpenSim.Region/World/SceneObject.cs
@@ -41,9 +41,10 @@ namespace OpenSim.Region
41 public class SceneObject : Entity 41 public class SceneObject : Entity
42 { 42 {
43 private LLUUID rootUUID; 43 private LLUUID rootUUID;
44 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); 44 //private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>();
45 private Dictionary<uint, IClientAPI> m_clientThreads; 45 protected Primitive rootPrimitive;
46 private World m_world; 46 private World m_world;
47 protected ulong regionHandle;
47 48
48 /// <summary> 49 /// <summary>
49 /// 50 ///
@@ -61,6 +62,8 @@ namespace OpenSim.Region
61 /// <param name="localID"></param> 62 /// <param name="localID"></param>
62 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) 63 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
63 { 64 {
65 this.rootPrimitive = new Primitive(null, this.regionHandle, this.m_world);
66 this.rootPrimitive.CreateFromPacket(addPacket, agentID, localID);
64 } 67 }
65 68
66 /// <summary> 69 /// <summary>
@@ -94,33 +97,33 @@ namespace OpenSim.Region
94 /// <param name="client"></param> 97 /// <param name="client"></param>
95 public void GetProperites(IClientAPI client) 98 public void GetProperites(IClientAPI client)
96 { 99 {
97 /* 100 //needs changing
98 ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); 101 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
99 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 102 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
100 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 103 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
101 proper.ObjectData[0].ItemID = LLUUID.Zero; 104 proper.ObjectData[0].ItemID = LLUUID.Zero;
102 proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; 105 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate;
103 proper.ObjectData[0].CreatorID = this.primData.OwnerID; 106 proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID;
104 proper.ObjectData[0].FolderID = LLUUID.Zero; 107 proper.ObjectData[0].FolderID = LLUUID.Zero;
105 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 108 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
106 proper.ObjectData[0].GroupID = LLUUID.Zero; 109 proper.ObjectData[0].GroupID = LLUUID.Zero;
107 proper.ObjectData[0].InventorySerial = 0; 110 proper.ObjectData[0].InventorySerial = 0;
108 proper.ObjectData[0].LastOwnerID = LLUUID.Zero; 111 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
109 proper.ObjectData[0].ObjectID = this.uuid; 112 proper.ObjectData[0].ObjectID = this.uuid;
110 proper.ObjectData[0].OwnerID = primData.OwnerID; 113 proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID;
111 proper.ObjectData[0].TouchName = new byte[0]; 114 proper.ObjectData[0].TouchName = new byte[0];
112 proper.ObjectData[0].TextureID = new byte[0]; 115 proper.ObjectData[0].TextureID = new byte[0];
113 proper.ObjectData[0].SitName = new byte[0]; 116 proper.ObjectData[0].SitName = new byte[0];
114 proper.ObjectData[0].Name = new byte[0]; 117 proper.ObjectData[0].Name = new byte[0];
115 proper.ObjectData[0].Description = new byte[0]; 118 proper.ObjectData[0].Description = new byte[0];
116 proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; 119 proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask;
117 proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; 120 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask;
118 proper.ObjectData[0].GroupMask = this.primData.GroupMask; 121 proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask;
119 proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; 122 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask;
120 proper.ObjectData[0].BaseMask = this.primData.BaseMask; 123 proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask;
121 124
122 client.OutPacket(proper); 125 client.OutPacket(proper);
123 * */ 126
124 } 127 }
125 128
126 } 129 }
diff --git a/OpenSim/OpenSim.Region/World/World.PacketHandlers.cs b/OpenSim/OpenSim.Region/World/World.PacketHandlers.cs
index f266d2a..85ca247 100644
--- a/OpenSim/OpenSim.Region/World/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.Region/World/World.PacketHandlers.cs
@@ -210,7 +210,14 @@ namespace OpenSim.Region
210 /// <param name="remoteClient"></param> 210 /// <param name="remoteClient"></param>
211 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) 211 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
212 { 212 {
213 213 foreach (Entity ent in Entities.Values)
214 {
215 if (ent.localid == localID)
216 {
217 ((OpenSim.Region.Primitive)ent).UpdatePosition(pos);
218 break;
219 }
220 }
214 } 221 }
215 222
216 /// <summary> 223 /// <summary>
diff --git a/OpenSim/OpenSim.Region/World/World.cs b/OpenSim/OpenSim.Region/World/World.cs
index da0da7a..8c1493e 100644
--- a/OpenSim/OpenSim.Region/World/World.cs
+++ b/OpenSim/OpenSim.Region/World/World.cs
@@ -511,9 +511,9 @@ namespace OpenSim.Region
511 remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); 511 remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
512 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); 512 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours);
513 remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); 513 remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim);
514 514 remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition);
515 /* 515
516 remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 516 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
517 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 517 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
518 remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); 518 remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest);
519 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); 519 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest);