aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-06-15 16:03:02 +0000
committerMW2007-06-15 16:03:02 +0000
commit17b4818b8e9a141b54540b342542bcb2ad21b4db (patch)
tree5abca9ede1e82d4a2e01301cc19eed25ad88702a /OpenSim
parentPreliminary movement added to sugilite, forwards walking only and no animations. (diff)
downloadopensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.zip
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.gz
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.bz2
opensim-SC_OLD-17b4818b8e9a141b54540b342542bcb2ad21b4db.tar.xz
Very Preliminary border crossing added to sugilite. (Note: Sugilite doesn't have any backend ogs communication support yet so everything is Sandbox mode only )
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs16
-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
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs34
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs1
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs13
8 files changed, 197 insertions, 37 deletions
diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 5636b13..341ffbb 100644
--- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -120,22 +120,22 @@ namespace OpenSim.Physics.BasicPhysicsPlugin
120 } 120 }
121 else 121 else
122 { 122 {
123 if (actor.Position.Y < -1) 123 if (actor.Position.Y < 0)
124 { 124 {
125 actor.Position.Y = -1; 125 actor.Position.Y = 0;
126 } 126 }
127 else if (actor.Position.Y > 257) 127 else if (actor.Position.Y > 256)
128 { 128 {
129 actor.Position.Y = 257; 129 actor.Position.Y = 256;
130 } 130 }
131 131
132 if (actor.Position.X < -1) 132 if (actor.Position.X < 0)
133 { 133 {
134 actor.Position.X = -1; 134 actor.Position.X = 0;
135 } 135 }
136 if (actor.Position.X > 257) 136 if (actor.Position.X > 256)
137 { 137 {
138 actor.Position.X = 257; 138 actor.Position.X = 256;
139 } 139 }
140 } 140 }
141 //} 141 //}
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>
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 33727c4..b126004 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -166,7 +166,7 @@ namespace OpenSim
166 /// 166 ///
167 /// </summary> 167 /// </summary>
168 /// <param name="regInfo"></param> 168 /// <param name="regInfo"></param>
169 public void MoveAgentIntoRegion(RegionInfo regInfo) 169 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos)
170 { 170 {
171 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 171 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
172 mov.AgentData.SessionID = this.SessionID; 172 mov.AgentData.SessionID = this.SessionID;
@@ -174,7 +174,14 @@ namespace OpenSim
174 mov.Data.RegionHandle = regInfo.RegionHandle; 174 mov.Data.RegionHandle = regInfo.RegionHandle;
175 // TODO - dynamicalise this stuff 175 // TODO - dynamicalise this stuff
176 mov.Data.Timestamp = 1172750370; 176 mov.Data.Timestamp = 1172750370;
177 mov.Data.Position = this.startpos; 177 if (pos != null)
178 {
179 mov.Data.Position = pos;
180 }
181 else
182 {
183 mov.Data.Position = this.startpos;
184 }
178 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); 185 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
179 186
180 OutPacket(mov); 187 OutPacket(mov);
@@ -305,6 +312,29 @@ namespace OpenSim
305 return agentData; 312 return agentData;
306 } 313 }
307 314
315 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort)
316 {
317 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
318 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
319 newSimPack.AgentData.AgentID = this.AgentID;
320 newSimPack.AgentData.SessionID = this.SessionID;
321 newSimPack.Info = new CrossedRegionPacket.InfoBlock();
322 newSimPack.Info.Position = pos;
323 newSimPack.Info.LookAt = lookAt; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
324 newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
325 newSimPack.RegionData.RegionHandle = newRegionHandle;
326 byte[] byteIP = newRegionIP.GetAddressBytes();
327 newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
328 newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
329 newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
330 newSimPack.RegionData.SimIP += (uint)byteIP[0];
331 newSimPack.RegionData.SimPort = newRegionPort;
332 newSimPack.RegionData.SeedCapability = new byte[0];
333
334 this.OutPacket(newSimPack);
335 this.DowngradeClient();
336 }
337
308 #region Appearance/ Wearables Methods 338 #region Appearance/ Wearables Methods
309 339
310 /// <summary> 340 /// <summary>
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index f8c7cdb..4cf6ac2 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -163,7 +163,6 @@ namespace OpenSim
163 { 163 {
164 OnCompleteMovementToRegion(); 164 OnCompleteMovementToRegion();
165 } 165 }
166 // this.EnableNeighbours();
167 break; 166 break;
168 case PacketType.AgentUpdate: 167 case PacketType.AgentUpdate:
169 if (OnAgentUpdate != null) 168 if (OnAgentUpdate != null)
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 0943c0d..29c871e 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -117,17 +117,22 @@ namespace OpenSim
117 { 117 {
118 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); 118 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
119 this.m_child = false; 119 this.m_child = false;
120 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); 120 //this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
121 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); 121 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
122 OnChildAgentStatus(this.m_child); 122 if (OnChildAgentStatus != null)
123 {
124 OnChildAgentStatus(this.m_child);
125 }
123 } 126 }
124 127
125 public void DowngradeClient() 128 public void DowngradeClient()
126 { 129 {
127 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child"); 130 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
128 this.m_child = true; 131 this.m_child = true;
129 OnChildAgentStatus(this.m_child); 132 if (OnChildAgentStatus != null)
130 133 {
134 OnChildAgentStatus(this.m_child);
135 }
131 } 136 }
132 137
133 public void KillClient() 138 public void KillClient()