aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/world
diff options
context:
space:
mode:
authorMW2007-05-25 19:09:19 +0000
committerMW2007-05-25 19:09:19 +0000
commit64741b55a6d68eb2853ca2f33047e6a2f459b513 (patch)
tree01ebe1336f9e2e0391bea8baf8618bd81f69ec12 /OpenSim/OpenSim.RegionServer/world
parentPossible my last ever OpenSim/OGS contribution (if I continue to feel like th... (diff)
downloadopensim-SC-64741b55a6d68eb2853ca2f33047e6a2f459b513.zip
opensim-SC-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.gz
opensim-SC-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.bz2
opensim-SC-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.xz
First part of border crossing fix.
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/world')
-rw-r--r--OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs130
-rw-r--r--OpenSim/OpenSim.RegionServer/world/Avatar.cs32
-rw-r--r--OpenSim/OpenSim.RegionServer/world/World.cs16
-rw-r--r--OpenSim/OpenSim.RegionServer/world/WorldBase.cs4
4 files changed, 109 insertions, 73 deletions
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
index e49fab3..ed1ffc0 100644
--- a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
+++ b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
@@ -10,89 +10,93 @@ namespace OpenSim.world
10 { 10 {
11 public override void update() 11 public override void update()
12 { 12 {
13 if (this._physActor == null) 13 if (!this.childAvatar)
14 { 14 {
15 //HACKHACK: Note to work out why this entity does not have a physics actor 15 if (this._physActor == null)
16 // and prehaps create one.
17 return;
18 }
19 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
20 if (this.updateflag)
21 {
22 //need to send movement info
23 //so create the improvedterseobjectupdate packet
24 //use CreateTerseBlock()
25 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
26 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
27 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
28 terse.RegionData.TimeDilation = 64096;
29 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
30 terse.ObjectData[0] = terseBlock;
31 List<Avatar> avList = this.m_world.RequestAvatarList();
32 foreach (Avatar client in avList)
33 { 16 {
34 client.SendPacketToViewer(terse); 17 //HACKHACK: Note to work out why this entity does not have a physics actor
18 // and prehaps create one.
19 return;
35 } 20 }
21 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
22 if (this.updateflag)
23 {
24 //need to send movement info
25 //so create the improvedterseobjectupdate packet
26 //use CreateTerseBlock()
27 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
28 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
29 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
30 terse.RegionData.TimeDilation = 64096;
31 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
32 terse.ObjectData[0] = terseBlock;
33 List<Avatar> avList = this.m_world.RequestAvatarList();
34 foreach (Avatar client in avList)
35 {
36 client.SendPacketToViewer(terse);
37 }
36 38
37 updateflag = false; 39 updateflag = false;
38 //this._updateCount = 0; 40 //this._updateCount = 0;
39 } 41 }
40 else 42 else
41 {
42
43 if ((pos2 != this.positionLastFrame) || (this.movementflag == 16))
44 { 43 {
45 _updateCount++; 44
46 if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) 45 if ((pos2 != this.positionLastFrame) || (this.movementflag == 16))
47 { 46 {
48 //It has been a while since last update was sent so lets send one. 47 _updateCount++;
49 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 48 if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0))
50 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
51 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
52 terse.RegionData.TimeDilation = 64096;
53 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
54 terse.ObjectData[0] = terseBlock;
55 List<Avatar> avList = this.m_world.RequestAvatarList();
56 foreach (Avatar client in avList)
57 { 49 {
58 client.SendPacketToViewer(terse); 50 //It has been a while since last update was sent so lets send one.
51 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
52 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
53 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
54 terse.RegionData.TimeDilation = 64096;
55 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
56 terse.ObjectData[0] = terseBlock;
57 List<Avatar> avList = this.m_world.RequestAvatarList();
58 foreach (Avatar client in avList)
59 {
60 client.SendPacketToViewer(terse);
61 }
62 _updateCount = 0;
59 } 63 }
60 _updateCount = 0;
61 }
62 64
63 if (this.movementflag == 16) 65 if (this.movementflag == 16)
64 { 66 {
65 movementflag = 0; 67 movementflag = 0;
68 }
66 } 69 }
67 }
68
69 }
70 this.positionLastFrame = pos2;
71 70
72 if (!this.ControllingClient.m_sandboxMode)
73 {
74 if (pos2.X < 0)
75 {
76 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
77 } 71 }
72 this.positionLastFrame = pos2;
78 73
79 if (pos2.Y < 0) 74 if (!this.ControllingClient.m_sandboxMode)
80 { 75 {
81 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 76 if (pos2.X < 0)
82 } 77 {
78 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
79 }
83 80
84 if (pos2.X > 255) 81 if (pos2.Y < 0)
85 { 82 {
86 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 83 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
87 } 84 }
88 85
89 if (pos2.Y > 255) 86 if (pos2.X > 255)
90 { 87 {
91 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 88 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
89 }
90
91 if (pos2.Y > 255)
92 {
93 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
94 }
92 } 95 }
93 } 96 }
94 97
95 } 98 }
99
96 public void SendUpdateToOtherClient(Avatar remoteAvatar) 100 public void SendUpdateToOtherClient(Avatar remoteAvatar)
97 { 101 {
98 ObjectUpdatePacket objupdate = CreateUpdatePacket(); 102 ObjectUpdatePacket objupdate = CreateUpdatePacket();
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.cs
index 680d059..2c1ccdf 100644
--- a/OpenSim/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim/OpenSim.RegionServer/world/Avatar.cs
@@ -35,7 +35,7 @@ namespace OpenSim.world
35 private string m_regionName; 35 private string m_regionName;
36 private ushort m_regionWaterHeight; 36 private ushort m_regionWaterHeight;
37 private bool m_regionTerraform; 37 private bool m_regionTerraform;
38 //private bool childShadowAvatar = false; 38 private bool childAvatar = false;
39 39
40 public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) 40 public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater)
41 { 41 {
@@ -72,6 +72,7 @@ namespace OpenSim.world
72 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); 72 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition);
73 ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); 73 ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate);
74 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 74 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
75 ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange);
75 76
76 } 77 }
77 78
@@ -87,6 +88,35 @@ namespace OpenSim.world
87 } 88 }
88 } 89 }
89 90
91 public void ChildStatusChange(bool status)
92 {
93 this.childAvatar = status;
94
95 if (this.childAvatar == true)
96 {
97 this._physActor.Velocity = new PhysicsVector(0, 0, 0);
98 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
99 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
100 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
101 terse.RegionData.TimeDilation = 64096;
102 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
103 terse.ObjectData[0] = terseBlock;
104 List<Avatar> avList = this.m_world.RequestAvatarList();
105 foreach (Avatar client in avList)
106 {
107 client.SendPacketToViewer(terse);
108 }
109 }
110 else
111 {
112 LLVector3 startp = ControllingClient.StartPos;
113 lock (m_world.LockPhysicsEngine)
114 {
115 this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z);
116 }
117 }
118 }
119
90 public override void addForces() 120 public override void addForces()
91 { 121 {
92 lock (this.forcesList) 122 lock (this.forcesList)
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs
index 921da3c..2edb8e7 100644
--- a/OpenSim/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim/OpenSim.RegionServer/world/World.cs
@@ -530,7 +530,7 @@ namespace OpenSim.world
530 530
531 #region Add/Remove Avatar Methods 531 #region Add/Remove Avatar Methods
532 532
533 public override void AddViewerAgent(ClientView agentClient) 533 public override Avatar AddViewerAgent(ClientView agentClient)
534 { 534 {
535 //register for events 535 //register for events
536 agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); 536 agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
@@ -549,22 +549,23 @@ namespace OpenSim.world
549 agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); 549 agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation);
550 agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); 550 agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale);
551 agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); 551 agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject);
552 552 Avatar newAvatar = null;
553 try 553 try
554 { 554 {
555 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 555 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
556 Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); 556 newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20);
557 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); 557 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
558 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); 558 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
559 newAvatar.SendRegionHandshake(this); 559 newAvatar.SendRegionHandshake(this);
560 if (!agentClient.m_child) 560 //if (!agentClient.m_child)
561 { 561 //{
562
562 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 563 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
563 lock (this.LockPhysicsEngine) 564 lock (this.LockPhysicsEngine)
564 { 565 {
565 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 566 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
566 } 567 }
567 } 568 // }
568 lock (Entities) 569 lock (Entities)
569 { 570 {
570 if (!Entities.ContainsKey(agentClient.AgentID)) 571 if (!Entities.ContainsKey(agentClient.AgentID))
@@ -592,6 +593,7 @@ namespace OpenSim.world
592 { 593 {
593 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); 594 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString());
594 } 595 }
596 return newAvatar;
595 } 597 }
596 598
597 public override void RemoveViewerAgent(ClientView agentClient) 599 public override void RemoveViewerAgent(ClientView agentClient)
@@ -608,7 +610,7 @@ namespace OpenSim.world
608 } 610 }
609 if (agentClient.ClientAvatar.PhysActor != null) 611 if (agentClient.ClientAvatar.PhysActor != null)
610 { 612 {
611 //this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); 613 this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor);
612 } 614 }
613 } 615 }
614 catch (Exception e) 616 catch (Exception e)
diff --git a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs b/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
index edc5518..ea71411 100644
--- a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
+++ b/OpenSim/OpenSim.RegionServer/world/WorldBase.cs
@@ -148,9 +148,9 @@ namespace OpenSim.world
148 /// Add a new Agent's avatar 148 /// Add a new Agent's avatar
149 /// </summary> 149 /// </summary>
150 /// <param name="agentClient"></param> 150 /// <param name="agentClient"></param>
151 public virtual void AddViewerAgent(ClientView agentClient) 151 public virtual Avatar AddViewerAgent(ClientView agentClient)
152 { 152 {
153 153 return null;
154 } 154 }
155 155
156 /// <summary> 156 /// <summary>