diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.Region/World/Avatar.cs | 10 | ||||
-rw-r--r-- | OpenSim/OpenSim.Region/World/Primitive.cs | 141 | ||||
-rw-r--r-- | OpenSim/OpenSim.Region/World/World.cs | 23 |
3 files changed, 82 insertions, 92 deletions
diff --git a/OpenSim/OpenSim.Region/World/Avatar.cs b/OpenSim/OpenSim.Region/World/Avatar.cs index 88a7969..65af5a6 100644 --- a/OpenSim/OpenSim.Region/World/Avatar.cs +++ b/OpenSim/OpenSim.Region/World/Avatar.cs | |||
@@ -66,7 +66,6 @@ namespace OpenSim.Region | |||
66 | Wearables = AvatarWearable.DefaultWearables; | 66 | Wearables = AvatarWearable.DefaultWearables; |
67 | 67 | ||
68 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 68 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
69 | Console.WriteLine("avatar point 4"); | ||
70 | 69 | ||
71 | //register for events | 70 | //register for events |
72 | ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance); | 71 | ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance); |
@@ -77,14 +76,7 @@ namespace OpenSim.Region | |||
77 | ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | 76 | ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); |
78 | ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 77 | ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
79 | ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 78 | ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
80 | * */ | 79 | */ |
81 | |||
82 | ControllingClient.OnParcelPropertiesRequest +=new ParcelPropertiesRequest(this.m_world.parcelManager.handleParcelPropertiesRequest); | ||
83 | ControllingClient.OnParcelDivideRequest += new ParcelDivideRequest(this.m_world.parcelManager.handleParcelDivideRequest); | ||
84 | ControllingClient.OnParcelJoinRequest += new ParcelJoinRequest(this.m_world.parcelManager.handleParcelJoinRequest); | ||
85 | ControllingClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(this.m_world.parcelManager.handleParcelPropertiesUpdateRequest); | ||
86 | |||
87 | ControllingClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(this.m_world.estateManager.handleEstateOwnerMessage); | ||
88 | } | 80 | } |
89 | 81 | ||
90 | /// <summary> | 82 | /// <summary> |
diff --git a/OpenSim/OpenSim.Region/World/Primitive.cs b/OpenSim/OpenSim.Region/World/Primitive.cs index 1f70550..d540a3b 100644 --- a/OpenSim/OpenSim.Region/World/Primitive.cs +++ b/OpenSim/OpenSim.Region/World/Primitive.cs | |||
@@ -14,12 +14,12 @@ namespace OpenSim.Region | |||
14 | public class Primitive : Entity | 14 | public class Primitive : Entity |
15 | { | 15 | { |
16 | protected PrimData primData; | 16 | protected PrimData primData; |
17 | //private ObjectUpdatePacket OurPacket; | ||
18 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 17 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
19 | private Dictionary<uint, IClientAPI> m_clientThreads; | 18 | private Dictionary<uint, IClientAPI> m_clientThreads; |
20 | private ulong m_regionHandle; | 19 | private ulong m_regionHandle; |
21 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 20 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
22 | private bool physicsEnabled = false; | 21 | private bool physicsEnabled = false; |
22 | private byte updateFlag = 0; | ||
23 | 23 | ||
24 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | 24 | private Dictionary<LLUUID, InventoryItem> inventoryItems; |
25 | 25 | ||
@@ -66,7 +66,7 @@ namespace OpenSim.Region | |||
66 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | 66 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); |
67 | } | 67 | } |
68 | 68 | ||
69 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner) | 69 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID) |
70 | { | 70 | { |
71 | m_clientThreads = clientThreads; | 71 | m_clientThreads = clientThreads; |
72 | m_regionHandle = regionHandle; | 72 | m_regionHandle = regionHandle; |
@@ -75,8 +75,34 @@ namespace OpenSim.Region | |||
75 | this.primData = new PrimData(); | 75 | this.primData = new PrimData(); |
76 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 76 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
77 | this.primData.OwnerID = owner; | 77 | this.primData.OwnerID = owner; |
78 | this.primData.FullID = this.uuid = fullID; | ||
79 | this.primData.LocalID = this.localid = localID; | ||
78 | } | 80 | } |
79 | 81 | ||
82 | /// <summary> | ||
83 | /// Constructor to create a default cube | ||
84 | /// </summary> | ||
85 | /// <param name="clientThreads"></param> | ||
86 | /// <param name="regionHandle"></param> | ||
87 | /// <param name="world"></param> | ||
88 | /// <param name="owner"></param> | ||
89 | /// <param name="localID"></param> | ||
90 | /// <param name="position"></param> | ||
91 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, uint localID, LLVector3 position) | ||
92 | { | ||
93 | m_clientThreads = clientThreads; | ||
94 | m_regionHandle = regionHandle; | ||
95 | m_world = world; | ||
96 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
97 | this.primData = PrimData.DefaultCube(); | ||
98 | this.primData.OwnerID = owner; | ||
99 | this.primData.LocalID = this.localid = localID; | ||
100 | this.Pos = this.primData.Position = position; | ||
101 | |||
102 | this.updateFlag = 1; | ||
103 | } | ||
104 | |||
105 | |||
80 | public byte[] GetByteArray() | 106 | public byte[] GetByteArray() |
81 | { | 107 | { |
82 | byte[] result = null; | 108 | byte[] result = null; |
@@ -115,7 +141,11 @@ namespace OpenSim.Region | |||
115 | 141 | ||
116 | public override void update() | 142 | public override void update() |
117 | { | 143 | { |
118 | LLVector3 pos2 = new LLVector3(0, 0, 0); | 144 | if (this.updateFlag == 1) |
145 | { | ||
146 | this.SendFullUpdateToAllClients(); | ||
147 | this.updateFlag = 0; | ||
148 | } | ||
119 | } | 149 | } |
120 | 150 | ||
121 | public override void BackUp() | 151 | public override void BackUp() |
@@ -275,17 +305,39 @@ namespace OpenSim.Region | |||
275 | 305 | ||
276 | public void SendFullUpdateToAllClients() | 306 | public void SendFullUpdateToAllClients() |
277 | { | 307 | { |
278 | 308 | List<Avatar> avatars = this.m_world.RequestAvatarList(); | |
309 | for (int i = 0; i < avatars.Count; i++) | ||
310 | { | ||
311 | this.SendFullUpdateToClient(avatars[i].ControllingClient); | ||
312 | } | ||
279 | } | 313 | } |
280 | 314 | ||
281 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) | 315 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) |
282 | { | 316 | { |
317 | LLVector3 lPos; | ||
318 | Axiom.MathLib.Quaternion lRot; | ||
319 | if (this._physActor != null && this.physicsEnabled) | ||
320 | { | ||
321 | PhysicsVector pPos = this._physActor.Position; | ||
322 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
323 | lRot = this._physActor.Orientation; | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | lPos = this.Pos; | ||
328 | lRot = this.rotation; | ||
329 | } | ||
283 | 330 | ||
331 | |||
284 | } | 332 | } |
285 | 333 | ||
286 | public void SendTerseUpdateToALLClients() | 334 | public void SendTerseUpdateToALLClients() |
287 | { | 335 | { |
288 | 336 | List<Avatar> avatars = this.m_world.RequestAvatarList(); | |
337 | for (int i = 0; i < avatars.Count; i++) | ||
338 | { | ||
339 | this.SendTerseUpdateToClient(avatars[i].ControllingClient); | ||
340 | } | ||
289 | } | 341 | } |
290 | 342 | ||
291 | #endregion | 343 | #endregion |
@@ -324,6 +376,8 @@ namespace OpenSim.Region | |||
324 | this.primData.FullID = this.uuid = LLUUID.Random(); | 376 | this.primData.FullID = this.uuid = LLUUID.Random(); |
325 | this.localid = (uint)(localID); | 377 | this.localid = (uint)(localID); |
326 | this.primData.Position = this.Pos = pos1; | 378 | this.primData.Position = this.Pos = pos1; |
379 | |||
380 | this.updateFlag = 1; | ||
327 | } | 381 | } |
328 | 382 | ||
329 | public void CreateFromBytes(byte[] data) | 383 | public void CreateFromBytes(byte[] data) |
@@ -343,82 +397,5 @@ namespace OpenSim.Region | |||
343 | 397 | ||
344 | #endregion | 398 | #endregion |
345 | 399 | ||
346 | |||
347 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
348 | { | ||
349 | uint ID = this.localid; | ||
350 | byte[] bytes = new byte[60]; | ||
351 | |||
352 | int i = 0; | ||
353 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
354 | dat.TextureEntry = new byte[0]; | ||
355 | bytes[i++] = (byte)(ID % 256); | ||
356 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
357 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
358 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
359 | bytes[i++] = 0; | ||
360 | bytes[i++] = 0; | ||
361 | |||
362 | LLVector3 lPos; | ||
363 | Axiom.MathLib.Quaternion lRot; | ||
364 | if (this._physActor != null && this.physicsEnabled) | ||
365 | { | ||
366 | PhysicsVector pPos = this._physActor.Position; | ||
367 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
368 | lRot = this._physActor.Orientation; | ||
369 | } | ||
370 | else | ||
371 | { | ||
372 | lPos = this.Pos; | ||
373 | lRot = this.rotation; | ||
374 | } | ||
375 | byte[] pb = lPos.GetBytes(); | ||
376 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
377 | i += 12; | ||
378 | ushort ac = 32767; | ||
379 | |||
380 | //vel | ||
381 | bytes[i++] = (byte)(ac % 256); | ||
382 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
383 | bytes[i++] = (byte)(ac % 256); | ||
384 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
385 | bytes[i++] = (byte)(ac % 256); | ||
386 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
387 | |||
388 | //accel | ||
389 | bytes[i++] = (byte)(ac % 256); | ||
390 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
391 | bytes[i++] = (byte)(ac % 256); | ||
392 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
393 | bytes[i++] = (byte)(ac % 256); | ||
394 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
395 | |||
396 | ushort rw, rx, ry, rz; | ||
397 | rw = (ushort)(32768 * (lRot.w + 1)); | ||
398 | rx = (ushort)(32768 * (lRot.x + 1)); | ||
399 | ry = (ushort)(32768 * (lRot.y + 1)); | ||
400 | rz = (ushort)(32768 * (lRot.z + 1)); | ||
401 | |||
402 | //rot | ||
403 | bytes[i++] = (byte)(rx % 256); | ||
404 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
405 | bytes[i++] = (byte)(ry % 256); | ||
406 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
407 | bytes[i++] = (byte)(rz % 256); | ||
408 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
409 | bytes[i++] = (byte)(rw % 256); | ||
410 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
411 | |||
412 | //rotation vel | ||
413 | bytes[i++] = (byte)(ac % 256); | ||
414 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
415 | bytes[i++] = (byte)(ac % 256); | ||
416 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
417 | bytes[i++] = (byte)(ac % 256); | ||
418 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
419 | |||
420 | dat.Data = bytes; | ||
421 | return dat; | ||
422 | } | ||
423 | } | 400 | } |
424 | } | 401 | } |
diff --git a/OpenSim/OpenSim.Region/World/World.cs b/OpenSim/OpenSim.Region/World/World.cs index c5c554d..49ba8fa 100644 --- a/OpenSim/OpenSim.Region/World/World.cs +++ b/OpenSim/OpenSim.Region/World/World.cs | |||
@@ -450,7 +450,19 @@ namespace OpenSim.Region | |||
450 | /// <param name="ownerID"></param> | 450 | /// <param name="ownerID"></param> |
451 | public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) | 451 | public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) |
452 | { | 452 | { |
453 | 453 | try | |
454 | { | ||
455 | // MainConsole.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); | ||
456 | Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
457 | prim.CreateFromPacket(addPacket, ownerID, this._primCount); | ||
458 | |||
459 | this.Entities.Add(prim.uuid, prim); | ||
460 | this._primCount++; | ||
461 | } | ||
462 | catch (Exception e) | ||
463 | { | ||
464 | // MainConsole.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | ||
465 | } | ||
454 | } | 466 | } |
455 | 467 | ||
456 | #endregion | 468 | #endregion |
@@ -469,6 +481,15 @@ namespace OpenSim.Region | |||
469 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); | 481 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); |
470 | remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); | 482 | remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); |
471 | remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); | 483 | remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); |
484 | remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); | ||
485 | |||
486 | /* | ||
487 | remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); | ||
488 | remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); | ||
489 | remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); | ||
490 | remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); | ||
491 | remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); | ||
492 | */ | ||
472 | 493 | ||
473 | Avatar newAvatar = null; | 494 | Avatar newAvatar = null; |
474 | try | 495 | try |