aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-10 13:11:09 +0000
committerTeravus Ovares2008-05-10 13:11:09 +0000
commit1ba51dd2fdd658947cc94af2d788f0cc4da03a3f (patch)
tree80a7d6cdedebc5ba6ec07cdbe997e686d32a90ff /OpenSim/Region
parent* Two more OutPacket refactors. TextureSender. (diff)
downloadopensim-SC_OLD-1ba51dd2fdd658947cc94af2d788f0cc4da03a3f.zip
opensim-SC_OLD-1ba51dd2fdd658947cc94af2d788f0cc4da03a3f.tar.gz
opensim-SC_OLD-1ba51dd2fdd658947cc94af2d788f0cc4da03a3f.tar.bz2
opensim-SC_OLD-1ba51dd2fdd658947cc94af2d788f0cc4da03a3f.tar.xz
* More OutPacket refactors.
* Added back a sleep to the kick routine so users get a 'you have been logged off message' when they get kicked from the simulator for various reasons (like 'the simulator is going down')
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs152
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs8
4 files changed, 26 insertions, 157 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 8721356..aff43d5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -436,6 +436,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
436 kupack.TargetBlock.TargetPort = (ushort)0; 436 kupack.TargetBlock.TargetPort = (ushort)0;
437 kupack.UserInfo.Reason = Helpers.StringToField(message); 437 kupack.UserInfo.Reason = Helpers.StringToField(message);
438 OutPacket(kupack, ThrottleOutPacketType.Task); 438 OutPacket(kupack, ThrottleOutPacketType.Task);
439 // You must sleep here or users get no message!
440 Thread.Sleep(500);
439 } 441 }
440 } 442 }
441 443
@@ -2244,6 +2246,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2244 im.Header.Zerocoded = true; 2246 im.Header.Zerocoded = true;
2245 OutPacket(im, ThrottleOutPacketType.Texture); 2247 OutPacket(im, ThrottleOutPacketType.Texture);
2246 } 2248 }
2249 public void SendShutdownConnectionNotice()
2250 {
2251 OutPacket(PacketPool.Instance.GetPacket(PacketType.DisableSimulator), ThrottleOutPacketType.Unknown);
2252 }
2253
2254 public void SendSimStats(Packet pack)
2255 {
2256 pack.Header.Reliable = false;
2257 OutPacket(pack, ThrottleOutPacketType.Task);
2258 }
2259
2247 #endregion 2260 #endregion
2248 2261
2249 #region Estate Data Sending Methods 2262 #region Estate Data Sending Methods
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 2c8c323..9dba398 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -447,157 +447,7 @@ namespace OpenSim.Region.Environment.Scenes
447 } 447 }
448 448
449 } 449 }
450 // Use the above method. 450
451 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot,
452 bool deadMethod)
453 {
454 Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt);
455 SceneObjectPart p = GetSceneObjectPart(objectLocalID);
456 if (p != null)
457 {
458 ScenePresence av = null;
459 if (TryGetAvatar(remoteClient.AgentId, out av))
460 {
461 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
462 objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle;
463 objupdate.RegionData.TimeDilation = ushort.MaxValue;
464 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2];
465 // avatar stuff - horrible group copypaste
466
467 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
468 objupdate.ObjectData[0].PSBlock = new byte[0];
469 objupdate.ObjectData[0].ExtraParams = new byte[1];
470 objupdate.ObjectData[0].MediaURL = new byte[0];
471 objupdate.ObjectData[0].NameValue = new byte[0];
472 objupdate.ObjectData[0].Text = new byte[0];
473 objupdate.ObjectData[0].TextColor = new byte[4];
474 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
475 objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
476 objupdate.ObjectData[0].Material = 4;
477 objupdate.ObjectData[0].TextureAnim = new byte[0];
478 objupdate.ObjectData[0].Sound = LLUUID.Zero;
479
480 objupdate.ObjectData[0].State = 0;
481 objupdate.ObjectData[0].Data = new byte[0];
482
483 objupdate.ObjectData[0].ObjectData = new byte[76];
484 objupdate.ObjectData[0].ObjectData[15] = 128;
485 objupdate.ObjectData[0].ObjectData[16] = 63;
486 objupdate.ObjectData[0].ObjectData[56] = 128;
487 objupdate.ObjectData[0].ObjectData[61] = 102;
488 objupdate.ObjectData[0].ObjectData[62] = 40;
489 objupdate.ObjectData[0].ObjectData[63] = 61;
490 objupdate.ObjectData[0].ObjectData[64] = 189;
491
492
493 objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
494 objupdate.ObjectData[0].PathCurve = 16;
495 objupdate.ObjectData[0].ProfileCurve = 1;
496 objupdate.ObjectData[0].PathScaleX = 100;
497 objupdate.ObjectData[0].PathScaleY = 100;
498 objupdate.ObjectData[0].ParentID = 0;
499 objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
500 objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
501 objupdate.ObjectData[0].PCode = (byte)PCode.Avatar;
502 objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
503
504 objupdate.ObjectData[0].ID = av.LocalId;
505 objupdate.ObjectData[0].FullID = remoteClient.AgentId;
506 objupdate.ObjectData[0].ParentID = 0;
507 objupdate.ObjectData[0].NameValue =
508 Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname);
509 LLVector3 pos2 = av.AbsolutePosition;
510 // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
511 byte[] pb = pos2.GetBytes();
512 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
513
514
515 // primitive part
516 objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock();
517 // SetDefaultPrimPacketValues
518 objupdate.ObjectData[1].PSBlock = new byte[0];
519 objupdate.ObjectData[1].ExtraParams = new byte[1];
520 objupdate.ObjectData[1].MediaURL = new byte[0];
521 objupdate.ObjectData[1].NameValue = new byte[0];
522 objupdate.ObjectData[1].Text = new byte[0];
523 objupdate.ObjectData[1].TextColor = new byte[4];
524 objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0);
525 objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0);
526 objupdate.ObjectData[1].Material = 3;
527 objupdate.ObjectData[1].TextureAnim = new byte[0];
528 objupdate.ObjectData[1].Sound = LLUUID.Zero;
529 objupdate.ObjectData[1].State = 0;
530 objupdate.ObjectData[1].Data = new byte[0];
531
532 objupdate.ObjectData[1].ObjectData = new byte[60];
533 objupdate.ObjectData[1].ObjectData[46] = 128;
534 objupdate.ObjectData[1].ObjectData[47] = 63;
535
536 // SetPrimPacketShapeData
537 PrimitiveBaseShape primData = p.Shape;
538
539 objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
540 objupdate.ObjectData[1].PCode = primData.PCode;
541 objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4);
542 objupdate.ObjectData[1].PathBegin = primData.PathBegin;
543 objupdate.ObjectData[1].PathEnd = primData.PathEnd;
544 objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
545 objupdate.ObjectData[1].PathScaleY = primData.PathScaleY;
546 objupdate.ObjectData[1].PathShearX = primData.PathShearX;
547 objupdate.ObjectData[1].PathShearY = primData.PathShearY;
548 objupdate.ObjectData[1].PathSkew = primData.PathSkew;
549 objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin;
550 objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd;
551 objupdate.ObjectData[1].Scale = primData.Scale;
552 objupdate.ObjectData[1].PathCurve = primData.PathCurve;
553 objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve;
554 objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow;
555 objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset;
556 objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions;
557 objupdate.ObjectData[1].PathTaperX = primData.PathTaperX;
558 objupdate.ObjectData[1].PathTaperY = primData.PathTaperY;
559 objupdate.ObjectData[1].PathTwist = primData.PathTwist;
560 objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin;
561 objupdate.ObjectData[1].ExtraParams = primData.ExtraParams;
562
563
564 objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ??
565 objupdate.ObjectData[1].ID = p.LocalId;
566 objupdate.ObjectData[1].FullID = p.UUID;
567 objupdate.ObjectData[1].OwnerID = p.OwnerID;
568 objupdate.ObjectData[1].Text = Helpers.StringToField(p.Text);
569 objupdate.ObjectData[1].TextColor[0] = 255;
570 objupdate.ObjectData[1].TextColor[1] = 255;
571 objupdate.ObjectData[1].TextColor[2] = 255;
572 objupdate.ObjectData[1].TextColor[3] = 128;
573 objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID;
574 //objupdate.ObjectData[1].PSBlock = particleSystem;
575 //objupdate.ObjectData[1].ClickAction = clickAction;
576 objupdate.ObjectData[1].Radius = 20;
577 objupdate.ObjectData[1].NameValue =
578 Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
579 LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
580
581 pb = pos.GetBytes();
582 Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
583
584 byte[] brot = rot.GetBytes();
585 Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length);
586
587 remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
588 }
589 else
590 {
591 m_log.Info("[SCENE]: Avatar " + remoteClient.AgentId + " not found");
592 }
593 }
594 else
595 {
596 m_log.Info("[SCENE]: Attempting to attach object; Object " + objectLocalID + "(localID) not found");
597 }
598 }
599
600
601 public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) 451 public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
602 { 452 {
603 ScenePresence newAvatar = null; 453 ScenePresence newAvatar = null;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1f66744..2e1116b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -570,8 +570,7 @@ namespace OpenSim.Region.Environment.Scenes
570 if (!avatar.IsChildAgent) 570 if (!avatar.IsChildAgent)
571 avatar.ControllingClient.Kick("The simulator is going down."); 571 avatar.ControllingClient.Kick("The simulator is going down.");
572 572
573 avatar.ControllingClient.OutPacket(PacketPool.Instance.GetPacket(PacketType.DisableSimulator), 573 avatar.ControllingClient.SendShutdownConnectionNotice();
574 ThrottleOutPacketType.Task);
575 }); 574 });
576 575
577 // Wait here, or the kick messages won't actually get to the agents before the scene terminates. 576 // Wait here, or the kick messages won't actually get to the agents before the scene terminates.
@@ -790,8 +789,7 @@ namespace OpenSim.Region.Environment.Scenes
790 { 789 {
791 if (!agent.IsChildAgent) 790 if (!agent.IsChildAgent)
792 { 791 {
793 pack.Header.Reliable = false; 792 agent.ControllingClient.SendSimStats(pack);
794 agent.ControllingClient.OutPacket(pack, ThrottleOutPacketType.Task);
795 } 793 }
796 } 794 }
797 } 795 }
@@ -2140,8 +2138,8 @@ namespace OpenSim.Region.Environment.Scenes
2140 m_innerScene.removeUserCount(true); 2138 m_innerScene.removeUserCount(true);
2141 } 2139 }
2142 // Tell a single agent to disconnect from the region. 2140 // Tell a single agent to disconnect from the region.
2143 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 2141 presence.ControllingClient.SendShutdownConnectionNotice();
2144 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Unknown); 2142
2145 presence.ControllingClient.Close(true); 2143 presence.ControllingClient.Close(true);
2146 } 2144 }
2147 } 2145 }
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index d14089b..05f963a 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -535,6 +535,14 @@ namespace OpenSim.Region.Examples.SimpleModule
535 { 535 {
536 } 536 }
537 537
538 public void SendShutdownConnectionNotice()
539 {
540 }
541
542 public void SendSimStats(Packet pack)
543 {
544 }
545
538 private void Update() 546 private void Update()
539 { 547 {
540 frame++; 548 frame++;