diff options
Diffstat (limited to 'OpenSim/OpenSim.Region/World/Primitive.cs')
-rw-r--r-- | OpenSim/OpenSim.Region/World/Primitive.cs | 101 |
1 files changed, 58 insertions, 43 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> |