aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
diff options
context:
space:
mode:
authorMW2007-06-17 14:10:19 +0000
committerMW2007-06-17 14:10:19 +0000
commitef0e5e913e2c22f8e2cba96d54436443b573c1ed (patch)
tree68ba282891693aa9777491ec95f9d99e9597096b /OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
parent* Added 'LogFilename' attribute to simconfig.xml - in order to specify log name (diff)
downloadopensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.zip
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.gz
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.bz2
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.xz
Very Preliminary local teleporting added (currently only can teleport within the current region).
Now need to add teleporting between regions and use of the dynamic texture for the terrain.
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs71
1 files changed, 42 insertions, 29 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
index d46bf0f..5d70bc1 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
@@ -43,36 +43,24 @@ namespace OpenSim.Region.Scenes
43 /// </summary> 43 /// </summary>
44 public override void update() 44 public override void update()
45 { 45 {
46 if (this.newForce) 46 if (this.childAvatar == false)
47 { 47 {
48 this.SendTerseUpdateToALLClients(); 48 if (this.newForce)
49 _updateCount = 0;
50 }
51 else if (movementflag != 0)
52 {
53 _updateCount++;
54 if (_updateCount > 3)
55 { 49 {
56 this.SendTerseUpdateToALLClients(); 50 this.SendTerseUpdateToALLClients();
57 _updateCount = 0; 51 _updateCount = 0;
58 } 52 }
59 } 53 else if (movementflag != 0)
60 54 {
61 LLVector3 pos2 = this.Pos; 55 _updateCount++;
62 LLVector3 vel = this.Velocity; 56 if (_updateCount > 3)
63 57 {
64 float timeStep = 0.3f; 58 this.SendTerseUpdateToALLClients();
65 pos2.X = pos2.X + (vel.X * timeStep); 59 _updateCount = 0;
66 pos2.Y = pos2.Y + (vel.Y * timeStep); 60 }
67 pos2.Z = pos2.Z + (vel.Z * timeStep); 61 }
68 if ((pos2.X < 0) || (pos2.X > 256))
69 {
70 this.CrossToNewRegion();
71 }
72 62
73 if ((pos2.Y < 0) || (pos2.Y > 256)) 63 this.CheckBorderCrossing();
74 {
75 this.CrossToNewRegion();
76 } 64 }
77 } 65 }
78 66
@@ -165,10 +153,35 @@ namespace OpenSim.Region.Scenes
165 153
166 } 154 }
167 155
168 private void CrossToNewRegion() 156 /// <summary>
157 ///
158 /// </summary>
159 protected void CheckBorderCrossing()
160 {
161 LLVector3 pos2 = this.Pos;
162 LLVector3 vel = this.Velocity;
163
164 float timeStep = 0.3f;
165 pos2.X = pos2.X + (vel.X * timeStep);
166 pos2.Y = pos2.Y + (vel.Y * timeStep);
167 pos2.Z = pos2.Z + (vel.Z * timeStep);
168
169 if ((pos2.X < 0) || (pos2.X > 256))
170 {
171 this.CrossToNewRegion();
172 }
173
174 if ((pos2.Y < 0) || (pos2.Y > 256))
175 {
176 this.CrossToNewRegion();
177 }
178 }
179
180 /// <summary>
181 ///
182 /// </summary>
183 protected void CrossToNewRegion()
169 { 184 {
170
171 // Console.WriteLine("crossing to new region from region " + this.m_regionInfo.RegionLocX + " , "+ this.m_regionInfo.RegionLocY);
172 LLVector3 pos = this.Pos; 185 LLVector3 pos = this.Pos;
173 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); 186 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
174 uint neighbourx = this.m_regionInfo.RegionLocX; 187 uint neighbourx = this.m_regionInfo.RegionLocX;
@@ -196,14 +209,14 @@ namespace OpenSim.Region.Scenes
196 } 209 }
197 210
198 LLVector3 vel = this.velocity; 211 LLVector3 vel = this.velocity;
199 // Console.WriteLine("new region should be " + neighbourx + " , " + neighboury);
200 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256)); 212 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
201 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); 213 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
202 if (neighbourRegion != null) 214 if (neighbourRegion != null)
203 { 215 {
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); 216 this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
217 this.DownGradeAvatar();
206 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort); 218 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
219
207 } 220 }
208 } 221 }
209 222