aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs62
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.cs39
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Entity.cs35
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs34
4 files changed, 148 insertions, 22 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
index 3f87e10..d46bf0f 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
@@ -32,6 +32,7 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Physics.Manager; 33using OpenSim.Physics.Manager;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
35 36
36namespace OpenSim.Region.Scenes 37namespace OpenSim.Region.Scenes
37{ 38{
@@ -55,7 +56,24 @@ namespace OpenSim.Region.Scenes
55 this.SendTerseUpdateToALLClients(); 56 this.SendTerseUpdateToALLClients();
56 _updateCount = 0; 57 _updateCount = 0;
57 } 58 }
58 } 59 }
60
61 LLVector3 pos2 = this.Pos;
62 LLVector3 vel = this.Velocity;
63
64 float timeStep = 0.3f;
65 pos2.X = pos2.X + (vel.X * timeStep);
66 pos2.Y = pos2.Y + (vel.Y * timeStep);
67 pos2.Z = pos2.Z + (vel.Z * timeStep);
68 if ((pos2.X < 0) || (pos2.X > 256))
69 {
70 this.CrossToNewRegion();
71 }
72
73 if ((pos2.Y < 0) || (pos2.Y > 256))
74 {
75 this.CrossToNewRegion();
76 }
59 } 77 }
60 78
61 /// <summary> 79 /// <summary>
@@ -147,5 +165,47 @@ namespace OpenSim.Region.Scenes
147 165
148 } 166 }
149 167
168 private void CrossToNewRegion()
169 {
170
171 // Console.WriteLine("crossing to new region from region " + this.m_regionInfo.RegionLocX + " , "+ this.m_regionInfo.RegionLocY);
172 LLVector3 pos = this.Pos;
173 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
174 uint neighbourx = this.m_regionInfo.RegionLocX;
175 uint neighboury = this.m_regionInfo.RegionLocY;
176
177 if (pos.X < 2)
178 {
179 neighbourx -= 1;
180 newpos.X = 254;
181 }
182 if (pos.X > 253)
183 {
184 neighbourx += 1;
185 newpos.X = 1;
186 }
187 if (pos.Y < 2)
188 {
189 neighboury -= 1;
190 newpos.Y = 254;
191 }
192 if (pos.Y > 253)
193 {
194 neighboury += 1;
195 newpos.Y = 1;
196 }
197
198 LLVector3 vel = this.velocity;
199 // Console.WriteLine("new region should be " + neighbourx + " , " + neighboury);
200 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
201 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
202 if (neighbourRegion != null)
203 {
204 // Console.WriteLine("current region port is "+ this.m_regionInfo.IPListenPort + " now crossing to new region with port " + neighbourRegion.IPListenPort);
205 this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
206 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
207 }
208 }
209
150 } 210 }
151} 211}
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
index 17b2437..98d7564 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
@@ -102,10 +102,10 @@ namespace OpenSim.Region.Scenes
102 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement); 102 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
103 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition); 103 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
104 ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate); 104 ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
105 /* ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 105 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
106 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 106 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
107 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 107 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
108 */ 108
109 } 109 }
110 110
111 /// <summary> 111 /// <summary>
@@ -129,7 +129,14 @@ namespace OpenSim.Region.Scenes
129 /// <param name="status"></param> 129 /// <param name="status"></param>
130 public void ChildStatusChange(bool status) 130 public void ChildStatusChange(bool status)
131 { 131 {
132 this.childAvatar = status;
132 133
134 if (this.childAvatar == true)
135 {
136 this.Velocity = new LLVector3(0, 0, 0);
137 this.Pos = new LLVector3(128, 128, 70);
138
139 }
133 } 140 }
134 141
135 /// <summary> 142 /// <summary>
@@ -137,22 +144,17 @@ namespace OpenSim.Region.Scenes
137 /// </summary> 144 /// </summary>
138 public override void addForces() 145 public override void addForces()
139 { 146 {
147 newForce = false;
140 lock (this.forcesList) 148 lock (this.forcesList)
141 { 149 {
142 newForce = false;
143 if (this.forcesList.Count > 0) 150 if (this.forcesList.Count > 0)
144 { 151 {
145 for (int i = 0; i < this.forcesList.Count; i++) 152 for (int i = 0; i < this.forcesList.Count; i++)
146 { 153 {
147 NewForce force = this.forcesList[i]; 154 NewForce force = this.forcesList[i];
148 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); 155
149 lock (m_world.SyncRoot)
150 {
151 this._physActor.Velocity = phyVector;
152 }
153 this.updateflag = true; 156 this.updateflag = true;
154 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this 157 this.Velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
155 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
156 this.newForce = true; 158 this.newForce = true;
157 } 159 }
158 for (int i = 0; i < this.forcesList.Count; i++) 160 for (int i = 0; i < this.forcesList.Count; i++)
@@ -165,7 +167,9 @@ namespace OpenSim.Region.Scenes
165 167
166 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 168 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
167 { 169 {
168 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z), new LLVector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z)); 170 LLVector3 pos = this.Pos;
171 LLVector3 vel = this.Velocity;
172 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
169 } 173 }
170 174
171 /// <summary> 175 /// <summary>
@@ -185,7 +189,7 @@ namespace OpenSim.Region.Scenes
185 /// </summary> 189 /// </summary>
186 public void CompleteMovement() 190 public void CompleteMovement()
187 { 191 {
188 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo); 192 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos);
189 } 193 }
190 194
191 /// <summary> 195 /// <summary>
@@ -240,10 +244,6 @@ namespace OpenSim.Region.Scenes
240 } 244 }
241 else 245 else
242 { 246 {
243 if (movementflag == 16)
244 {
245 movementflag = 0;
246 }
247 if ((movementflag) != 0) 247 if ((movementflag) != 0)
248 { 248 {
249 NewForce newVelocity = new NewForce(); 249 NewForce newVelocity = new NewForce();
@@ -252,9 +252,6 @@ namespace OpenSim.Region.Scenes
252 newVelocity.Z = 0; 252 newVelocity.Z = 0;
253 this.forcesList.Add(newVelocity); 253 this.forcesList.Add(newVelocity);
254 movementflag = 0; 254 movementflag = 0;
255
256 this.movementflag = 16;
257
258 } 255 }
259 } 256 }
260 257
diff --git a/OpenSim/OpenSim.Region/Scenes/Entity.cs b/OpenSim/OpenSim.Region/Scenes/Entity.cs
index d4c981a..007bdaf 100644
--- a/OpenSim/OpenSim.Region/Scenes/Entity.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Entity.cs
@@ -93,6 +93,41 @@ namespace OpenSim.Region.Scenes
93 } 93 }
94 } 94 }
95 95
96 public virtual LLVector3 Velocity
97 {
98 get
99 {
100 if (this._physActor != null)
101 {
102 velocity.X = _physActor.Velocity.X;
103 velocity.Y = _physActor.Velocity.Y;
104 velocity.Z = _physActor.Velocity.Z;
105 }
106
107 return velocity;
108 }
109 set
110 {
111 if (this._physActor != null)
112 {
113 try
114 {
115 lock (this.m_world.SyncRoot)
116 {
117
118 this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
119 }
120 }
121 catch (Exception e)
122 {
123 Console.WriteLine(e.Message);
124 }
125 }
126
127 velocity = value;
128 }
129 }
130
96 /// <summary> 131 /// <summary>
97 /// Creates a new Entity (should not occur on it's own) 132 /// Creates a new Entity (should not occur on it's own)
98 /// </summary> 133 /// </summary>
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 98f5027..2500ee6 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -580,6 +580,7 @@ namespace OpenSim.Region.Scenes
580 agent.BaseFolder = LLUUID.Zero; 580 agent.BaseFolder = LLUUID.Zero;
581 agent.InventoryFolder = LLUUID.Zero; 581 agent.InventoryFolder = LLUUID.Zero;
582 agent.startpos = new LLVector3(128, 128, 70); 582 agent.startpos = new LLVector3(128, 128, 70);
583 agent.child = true;
583 this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); 584 this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
584 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); 585 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
585 } 586 }
@@ -589,6 +590,27 @@ namespace OpenSim.Region.Scenes
589 /// <summary> 590 /// <summary>
590 /// 591 ///
591 /// </summary> 592 /// </summary>
593 /// <param name="regionHandle"></param>
594 /// <returns></returns>
595 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
596 {
597 return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle);
598 }
599
600 /// <summary>
601 ///
602 /// </summary>
603 /// <param name="regionhandle"></param>
604 /// <param name="agentID"></param>
605 /// <param name="position"></param>
606 public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
607 {
608 this.commsManager.InterSims.ExpectAvatarCrossing(regionhandle, agentID, position);
609 }
610
611 /// <summary>
612 ///
613 /// </summary>
592 /// <param name="agentID"></param> 614 /// <param name="agentID"></param>
593 public override void RemoveAvatar(LLUUID agentID) 615 public override void RemoveAvatar(LLUUID agentID)
594 { 616 {
@@ -678,6 +700,7 @@ namespace OpenSim.Region.Scenes
678 if (this.regionCommsHost != null) 700 if (this.regionCommsHost != null)
679 { 701 {
680 this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); 702 this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection);
703 this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing);
681 } 704 }
682 } 705 }
683 706
@@ -696,6 +719,17 @@ namespace OpenSim.Region.Scenes
696 } 719 }
697 } 720 }
698 721
722 public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
723 {
724 if (regionHandle == this.m_regInfo.RegionHandle)
725 {
726 if (this.Avatars.ContainsKey(agentID))
727 {
728 this.Avatars[agentID].Pos = position;
729 }
730 }
731 }
732
699 #endregion 733 #endregion
700 734
701 /// <summary> 735 /// <summary>