diff options
Diffstat (limited to 'OpenSim.RegionServer/world')
-rw-r--r-- | OpenSim.RegionServer/world/Primitive2.cs | 133 |
1 files changed, 65 insertions, 68 deletions
diff --git a/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim.RegionServer/world/Primitive2.cs index c0d6295..edb9380 100644 --- a/OpenSim.RegionServer/world/Primitive2.cs +++ b/OpenSim.RegionServer/world/Primitive2.cs | |||
@@ -11,10 +11,10 @@ using OpenSim.Framework.Inventory; | |||
11 | 11 | ||
12 | namespace OpenSim.world | 12 | namespace OpenSim.world |
13 | { | 13 | { |
14 | public class Primitive2 :Entity | 14 | public class Primitive2 : Entity |
15 | { | 15 | { |
16 | protected PrimData primData; | 16 | protected PrimData primData; |
17 | private ObjectUpdatePacket OurPacket; | 17 | //private ObjectUpdatePacket OurPacket; |
18 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 18 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
19 | private Dictionary<uint, SimClient> m_clientThreads; | 19 | private Dictionary<uint, SimClient> m_clientThreads; |
20 | private ulong m_regionHandle; | 20 | private ulong m_regionHandle; |
@@ -130,7 +130,6 @@ namespace OpenSim.world | |||
130 | 130 | ||
131 | public void UpdateTexture(byte[] tex) | 131 | public void UpdateTexture(byte[] tex) |
132 | { | 132 | { |
133 | this.OurPacket.ObjectData[0].TextureEntry = tex; | ||
134 | this.primData.Texture = tex; | 133 | this.primData.Texture = tex; |
135 | //this.dirtyFlag = true; | 134 | //this.dirtyFlag = true; |
136 | } | 135 | } |
@@ -243,11 +242,14 @@ namespace OpenSim.world | |||
243 | { | 242 | { |
244 | lPos = this.Pos; | 243 | lPos = this.Pos; |
245 | } | 244 | } |
245 | |||
246 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | ||
247 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
248 | outPacket.ObjectData[0] = this.CreateUpdateBlock(); | ||
246 | byte[] pb = lPos.GetBytes(); | 249 | byte[] pb = lPos.GetBytes(); |
247 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | 250 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
248 | 251 | ||
249 | this.UpdatePacketShapeData(); | 252 | remoteClient.OutPacket(outPacket); |
250 | remoteClient.OutPacket(OurPacket); | ||
251 | } | 253 | } |
252 | 254 | ||
253 | public void SendTerseUpdateToClient(SimClient RemoteClient) | 255 | public void SendTerseUpdateToClient(SimClient RemoteClient) |
@@ -266,51 +268,36 @@ namespace OpenSim.world | |||
266 | 268 | ||
267 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) | 269 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) |
268 | { | 270 | { |
269 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
270 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
271 | objupdate.RegionData.TimeDilation = 64096; | ||
272 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
273 | PrimData PData = new PrimData(); | 271 | PrimData PData = new PrimData(); |
274 | this.primData = PData; | 272 | this.primData = PData; |
275 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 273 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
276 | 274 | ||
277 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | 275 | PData.OwnerID = agentID; |
278 | this.SetDefaultPacketValues(objupdate.ObjectData[0]); | 276 | PData.PCode = addPacket.ObjectData.PCode; |
279 | 277 | PData.PathBegin = addPacket.ObjectData.PathBegin; | |
280 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | 278 | PData.PathEnd = addPacket.ObjectData.PathEnd; |
281 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; | 279 | PData.PathScaleX = addPacket.ObjectData.PathScaleX; |
282 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | 280 | PData.PathScaleY = addPacket.ObjectData.PathScaleY; |
283 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | 281 | PData.PathShearX = addPacket.ObjectData.PathShearX; |
284 | PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; | 282 | PData.PathShearY = addPacket.ObjectData.PathShearY; |
285 | PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; | 283 | PData.PathSkew = addPacket.ObjectData.PathSkew; |
286 | PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; | 284 | PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; |
287 | PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; | 285 | PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; |
288 | PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; | 286 | PData.Scale = addPacket.ObjectData.Scale; |
289 | PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; | 287 | PData.PathCurve = addPacket.ObjectData.PathCurve; |
290 | PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; | 288 | PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; |
291 | PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; | 289 | PData.ParentID = 0; |
292 | PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; | 290 | PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; |
293 | PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; | 291 | PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; |
294 | PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; | 292 | PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; |
295 | PData.ParentID = objupdate.ObjectData[0].ParentID = 0; | 293 | PData.PathTaperX = addPacket.ObjectData.PathTaperX; |
296 | PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | 294 | PData.PathTaperY = addPacket.ObjectData.PathTaperY; |
297 | PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | 295 | PData.PathTwist = addPacket.ObjectData.PathTwist; |
298 | PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; | 296 | PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; |
299 | PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; | ||
300 | PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; | ||
301 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | ||
302 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
303 | objupdate.ObjectData[0].ID = (uint)(localID); | ||
304 | objupdate.ObjectData[0].FullID = LLUUID.Random(); | ||
305 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | 297 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; |
306 | //update position | 298 | this.primData.FullID = this.uuid = LLUUID.Random(); |
307 | byte[] pb = pos1.GetBytes(); | 299 | this.localid = (uint)(localID); |
308 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
309 | //this.newPrimFlag = true; | ||
310 | this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID; | ||
311 | this.localid = objupdate.ObjectData[0].ID; | ||
312 | this.primData.Position = this.Pos = pos1; | 300 | this.primData.Position = this.Pos = pos1; |
313 | this.OurPacket = objupdate; | ||
314 | } | 301 | } |
315 | 302 | ||
316 | public void CreateFromBytes(byte[] data) | 303 | public void CreateFromBytes(byte[] data) |
@@ -354,33 +341,43 @@ namespace OpenSim.world | |||
354 | objdata.ObjectData[47] = 63; | 341 | objdata.ObjectData[47] = 63; |
355 | } | 342 | } |
356 | 343 | ||
357 | protected void UpdatePacketShapeData() | 344 | protected void UpdatePacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) |
358 | { | 345 | { |
359 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | 346 | objectData.OwnerID = this.primData.OwnerID; |
360 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | 347 | objectData.PCode = this.primData.PCode; |
361 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | 348 | objectData.PathBegin = this.primData.PathBegin; |
362 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | 349 | objectData.PathEnd = this.primData.PathEnd; |
363 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | 350 | objectData.PathScaleX = this.primData.PathScaleX; |
364 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | 351 | objectData.PathScaleY = this.primData.PathScaleY; |
365 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | 352 | objectData.PathShearX = this.primData.PathShearX; |
366 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | 353 | objectData.PathShearY = this.primData.PathShearY; |
367 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | 354 | objectData.PathSkew = this.primData.PathSkew; |
368 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | 355 | objectData.ProfileBegin = this.primData.ProfileBegin; |
369 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | 356 | objectData.ProfileEnd = this.primData.ProfileEnd; |
370 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | 357 | objectData.Scale = this.primData.Scale; |
371 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | 358 | objectData.PathCurve = this.primData.PathCurve; |
372 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | 359 | objectData.ProfileCurve = this.primData.ProfileCurve; |
373 | OurPacket.ObjectData[0].ParentID = this.primData.ParentID; | 360 | objectData.ParentID = this.primData.ParentID; |
374 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | 361 | objectData.ProfileHollow = this.primData.ProfileHollow; |
375 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | 362 | objectData.PathRadiusOffset = this.primData.PathRadiusOffset; |
376 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | 363 | objectData.PathRevolutions = this.primData.PathRevolutions; |
377 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | 364 | objectData.PathTaperX = this.primData.PathTaperX; |
378 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | 365 | objectData.PathTaperY = this.primData.PathTaperY; |
379 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | 366 | objectData.PathTwist = this.primData.PathTwist; |
380 | OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | 367 | objectData.PathTwistBegin = this.primData.PathTwistBegin; |
381 | } | 368 | } |
382 | 369 | ||
383 | #endregion | 370 | #endregion |
371 | protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock() | ||
372 | { | ||
373 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | ||
374 | this.SetDefaultPacketValues(objupdate); | ||
375 | objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
376 | this.UpdatePacketShapeData(objupdate); | ||
377 | byte[] pb = this.Pos.GetBytes(); | ||
378 | Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); | ||
379 | return objupdate; | ||
380 | } | ||
384 | 381 | ||
385 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | 382 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() |
386 | { | 383 | { |