aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/OpenSim.Region.csproj6
-rw-r--r--OpenSim/OpenSim.Region/OpenSim.Region.dll.build1
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs71
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.cs42
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs148
-rw-r--r--OpenSim/OpenSim.Region/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs105
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs47
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs27
10 files changed, 313 insertions, 138 deletions
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
index e53a4f4..94efbed 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
@@ -86,6 +86,12 @@
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 87 <Private>False</Private>
88 </ProjectReference> 88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
90 <Name>OpenSim.Caches</Name>
91 <Project>{1938EB12-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 95 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 96 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 97 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
index 5b9ba1a..6d47576 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
@@ -39,6 +39,7 @@
39 <include name="../../bin/Db4objects.Db4o.dll" /> 39 <include name="../../bin/Db4objects.Db4o.dll" />
40 <include name="../../bin/libsecondlife.dll" /> 40 <include name="../../bin/libsecondlife.dll" />
41 <include name="../../bin/OpenGrid.Framework.Communications.dll" /> 41 <include name="../../bin/OpenGrid.Framework.Communications.dll" />
42 <include name="../../bin/OpenSim.Caches.dll" />
42 <include name="../../bin/OpenSim.Framework.dll" /> 43 <include name="../../bin/OpenSim.Framework.dll" />
43 <include name="../../bin/OpenSim.Framework.Console.dll" /> 44 <include name="../../bin/OpenSim.Framework.Console.dll" />
44 <include name="../../bin/OpenSim.GenericConfig.Xml.dll" /> 45 <include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
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
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
index 98d7564..d40e213 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Scenes
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 }
@@ -138,7 +138,34 @@ namespace OpenSim.Region.Scenes
138 138
139 } 139 }
140 } 140 }
141 141
142 /// <summary>
143 ///
144 /// </summary>
145 /// <param name="pos"></param>
146 public void UpGradeAvatar(LLVector3 pos)
147 {
148 //this.childAvatar = false;
149 this.Pos = pos;
150 }
151
152 protected void DownGradeAvatar()
153 {
154 this.Velocity = new LLVector3(0, 0, 0);
155 this.Pos = new LLVector3(128, 128, 70);
156 this.childAvatar = true;
157 }
158
159 /// <summary>
160 ///
161 /// </summary>
162 /// <param name="pos"></param>
163 public void Teleport(LLVector3 pos)
164 {
165 this.Pos = pos;
166 this.SendTerseUpdateToALLClients();
167 }
168
142 /// <summary> 169 /// <summary>
143 /// 170 ///
144 /// </summary> 171 /// </summary>
@@ -189,7 +216,16 @@ namespace OpenSim.Region.Scenes
189 /// </summary> 216 /// </summary>
190 public void CompleteMovement() 217 public void CompleteMovement()
191 { 218 {
192 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos); 219 LLVector3 look = this.Velocity;
220 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
221 {
222 look = new LLVector3(0.99f, 0.042f, 0);
223 }
224 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
225 if (this.childAvatar)
226 {
227 this.childAvatar = false;
228 }
193 } 229 }
194 230
195 /// <summary> 231 /// <summary>
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index c0eebd4..eb942c2 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -42,7 +42,7 @@ using OpenSim.Framework;
42using OpenSim.Region.Scripting; 42using OpenSim.Region.Scripting;
43using OpenSim.Terrain; 43using OpenSim.Terrain;
44using OpenGrid.Framework.Communications; 44using OpenGrid.Framework.Communications;
45 45using OpenSim.Caches;
46 46
47namespace OpenSim.Region.Scenes 47namespace OpenSim.Region.Scenes
48{ 48{
@@ -64,8 +64,9 @@ namespace OpenSim.Region.Scenes
64 private Mutex updateLock; 64 private Mutex updateLock;
65 public string m_datastore; 65 public string m_datastore;
66 protected AuthenticateSessionsBase authenticateHandler; 66 protected AuthenticateSessionsBase authenticateHandler;
67 protected RegionCommsHostBase regionCommsHost; 67 protected RegionCommsListener regionCommsHost;
68 protected CommunicationsManager commsManager; 68 protected CommunicationsManager commsManager;
69
69 70
70 public ParcelManager parcelManager; 71 public ParcelManager parcelManager;
71 public EstateManager estateManager; 72 public EstateManager estateManager;
@@ -95,13 +96,14 @@ namespace OpenSim.Region.Scenes
95 /// <param name="clientThreads">Dictionary to contain client threads</param> 96 /// <param name="clientThreads">Dictionary to contain client threads</param>
96 /// <param name="regionHandle">Region Handle for this region</param> 97 /// <param name="regionHandle">Region Handle for this region</param>
97 /// <param name="regionName">Region Name for this region</param> 98 /// <param name="regionName">Region Name for this region</param>
98 public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan) 99 public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach)
99 { 100 {
100 try 101 try
101 { 102 {
102 updateLock = new Mutex(false); 103 updateLock = new Mutex(false);
103 this.authenticateHandler = authen; 104 this.authenticateHandler = authen;
104 this.commsManager = commsMan; 105 this.commsManager = commsMan;
106 this.assetCache = assetCach;
105 m_clientThreads = clientThreads; 107 m_clientThreads = clientThreads;
106 m_regInfo = regInfo; 108 m_regInfo = regInfo;
107 m_regionHandle = m_regInfo.RegionHandle; 109 m_regionHandle = m_regInfo.RegionHandle;
@@ -507,8 +509,10 @@ namespace OpenSim.Region.Scenes
507 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); 509 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours);
508 remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); 510 remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim);
509 remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition); 511 remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition);
510 512 remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks);
511 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 513 remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation);
514
515 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
512 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 516 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
513 remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); 517 remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest);
514 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); 518 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest);
@@ -562,51 +566,7 @@ namespace OpenSim.Region.Scenes
562 return; 566 return;
563 } 567 }
564 568
565 /// <summary> 569
566 ///
567 /// </summary>
568 protected void InformClientOfNeighbours(IClientAPI remoteClient)
569 {
570 // Console.WriteLine("informing client of neighbouring regions");
571 List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo);
572
573 //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
574 if (neighbours != null)
575 {
576 for (int i = 0; i < neighbours.Count; i++)
577 {
578 // Console.WriteLine("sending neighbours data");
579 AgentCircuitData agent = remoteClient.RequestClientInfo();
580 agent.BaseFolder = LLUUID.Zero;
581 agent.InventoryFolder = LLUUID.Zero;
582 agent.startpos = new LLVector3(128, 128, 70);
583 agent.child = true;
584 this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
585 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
586 }
587 }
588 }
589
590 /// <summary>
591 ///
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 570
611 /// <summary> 571 /// <summary>
612 /// 572 ///
@@ -725,9 +685,95 @@ namespace OpenSim.Region.Scenes
725 { 685 {
726 if (this.Avatars.ContainsKey(agentID)) 686 if (this.Avatars.ContainsKey(agentID))
727 { 687 {
728 this.Avatars[agentID].Pos = position; 688 this.Avatars[agentID].UpGradeAvatar(position);
689 }
690 }
691 }
692
693 /// <summary>
694 ///
695 /// </summary>
696 protected void InformClientOfNeighbours(IClientAPI remoteClient)
697 {
698 // Console.WriteLine("informing client of neighbouring regions");
699 List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo);
700
701 //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
702 if (neighbours != null)
703 {
704 for (int i = 0; i < neighbours.Count; i++)
705 {
706 // Console.WriteLine("sending neighbours data");
707 AgentCircuitData agent = remoteClient.RequestClientInfo();
708 agent.BaseFolder = LLUUID.Zero;
709 agent.InventoryFolder = LLUUID.Zero;
710 agent.startpos = new LLVector3(128, 128, 70);
711 agent.child = true;
712 this.commsManager.InterRegion.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
713 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
714 }
715 }
716 }
717
718 /// <summary>
719 ///
720 /// </summary>
721 /// <param name="regionHandle"></param>
722 /// <returns></returns>
723 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
724 {
725 return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle);
726 }
727
728 /// <summary>
729 ///
730 /// </summary>
731 /// <param name="minX"></param>
732 /// <param name="minY"></param>
733 /// <param name="maxX"></param>
734 /// <param name="maxY"></param>
735 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
736 {
737 List<MapBlockData> mapBlocks;
738 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
739
740 remoteClient.SendMapBlock(mapBlocks);
741 }
742
743 /// <summary>
744 ///
745 /// </summary>
746 /// <param name="remoteClient"></param>
747 /// <param name="RegionHandle"></param>
748 /// <param name="position"></param>
749 /// <param name="lookAt"></param>
750 /// <param name="flags"></param>
751 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
752 {
753 if (regionHandle == this.m_regionHandle)
754 {
755 if (this.Avatars.ContainsKey(remoteClient.AgentId))
756 {
757 remoteClient.SendTeleportLocationStart();
758 remoteClient.SendLocalTeleport(position, lookAt, flags);
759 this.Avatars[remoteClient.AgentId].Teleport(position);
729 } 760 }
730 } 761 }
762 else
763 {
764 remoteClient.SendTeleportCancel();
765 }
766 }
767
768 /// <summary>
769 ///
770 /// </summary>
771 /// <param name="regionhandle"></param>
772 /// <param name="agentID"></param>
773 /// <param name="position"></param>
774 public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
775 {
776 this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
731 } 777 }
732 778
733 #endregion 779 #endregion
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
index d9d07b0..05c2aba 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
+++ b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework.Types;
39using OpenSim.Framework.Inventory; 39using OpenSim.Framework.Inventory;
40using OpenSim.Region.Scripting; 40using OpenSim.Region.Scripting;
41using OpenSim.Terrain; 41using OpenSim.Terrain;
42using OpenSim.Caches;
42 43
43namespace OpenSim.Region.Scenes 44namespace OpenSim.Region.Scenes
44{ 45{
@@ -54,6 +55,7 @@ namespace OpenSim.Region.Scenes
54 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine 55 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
55 protected object m_syncRoot = new object(); 56 protected object m_syncRoot = new object();
56 private uint m_nextLocalId = 8880000; 57 private uint m_nextLocalId = 8880000;
58 protected AssetCache assetCache;
57 59
58 #region Update Methods 60 #region Update Methods
59 /// <summary> 61 /// <summary>
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 0ace92c..80719d6 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -63,6 +63,8 @@ namespace OpenSim
63 public event GenericCall2 OnStopMovement; 63 public event GenericCall2 OnStopMovement;
64 public event NewAvatar OnNewAvatar; 64 public event NewAvatar OnNewAvatar;
65 public event GenericCall6 OnRemoveAvatar; 65 public event GenericCall6 OnRemoveAvatar;
66 public event RequestMapBlocks OnRequestMapBlocks;
67 public event TeleportLocationRequest OnTeleportLocationRequest;
66 68
67 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 69 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
68 public event ParcelDivideRequest OnParcelDivideRequest; 70 public event ParcelDivideRequest OnParcelDivideRequest;
@@ -155,7 +157,7 @@ namespace OpenSim
155 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3; 157 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3;
156 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0; 158 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0;
157 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1; 159 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1;
158 handshake.RegionInfo.TerrainDetail2 =regionInfo.estateSettings.terrainDetail2; 160 handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2;
159 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3; 161 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3;
160 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? 162 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
161 163
@@ -166,7 +168,7 @@ namespace OpenSim
166 /// 168 ///
167 /// </summary> 169 /// </summary>
168 /// <param name="regInfo"></param> 170 /// <param name="regInfo"></param>
169 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos) 171 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
170 { 172 {
171 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 173 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
172 mov.AgentData.SessionID = this.SessionID; 174 mov.AgentData.SessionID = this.SessionID;
@@ -182,16 +184,16 @@ namespace OpenSim
182 { 184 {
183 mov.Data.Position = this.startpos; 185 mov.Data.Position = this.startpos;
184 } 186 }
185 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); 187 mov.Data.LookAt = look;
186 188
187 OutPacket(mov); 189 OutPacket(mov);
188 } 190 }
189 191
190 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 192 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
191 { 193 {
192 SendChatMessage( Helpers.StringToField( message ), type, fromPos, fromName, fromAgentID); 194 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
193 } 195 }
194 196
195 /// <summary> 197 /// <summary>
196 /// 198 ///
197 /// </summary> 199 /// </summary>
@@ -216,7 +218,7 @@ namespace OpenSim
216 this.OutPacket(reply); 218 this.OutPacket(reply);
217 } 219 }
218 220
219 221
220 /// <summary> 222 /// <summary>
221 /// Send the region heightmap to the client 223 /// Send the region heightmap to the client
222 /// </summary> 224 /// </summary>
@@ -272,7 +274,7 @@ namespace OpenSim
272 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); 274 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
273 } 275 }
274 } 276 }
275 277
276 /// <summary> 278 /// <summary>
277 /// 279 ///
278 /// </summary> 280 /// </summary>
@@ -314,8 +316,8 @@ namespace OpenSim
314 316
315 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) 317 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort)
316 { 318 {
317 LLVector3 look = new LLVector3(lookAt.X *10, lookAt.Y *10, lookAt.Z *10); 319 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10);
318 320
319 CrossedRegionPacket newSimPack = new CrossedRegionPacket(); 321 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
320 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 322 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
321 newSimPack.AgentData.AgentID = this.AgentID; 323 newSimPack.AgentData.AgentID = this.AgentID;
@@ -334,7 +336,86 @@ namespace OpenSim
334 newSimPack.RegionData.SeedCapability = new byte[0]; 336 newSimPack.RegionData.SeedCapability = new byte[0];
335 337
336 this.OutPacket(newSimPack); 338 this.OutPacket(newSimPack);
337 this.DowngradeClient(); 339 //this.DowngradeClient();
340 }
341
342 public void SendMapBlock(List<MapBlockData> mapBlocks)
343 {
344 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
345
346 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
347 mapReply.AgentData.AgentID = this.AgentID;
348 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
349 mapReply.AgentData.Flags = 0;
350
351 for (int i = 0; i < mapBlocks.Count; i++)
352 {
353 mapReply.Data[i] = new MapBlockReplyPacket.DataBlock();
354 mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId;
355 mapReply.Data[i].X = mapBlocks[i].X;
356 mapReply.Data[i].Y = mapBlocks[i].Y;
357 mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight;
358 mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name);
359 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags;
360 mapReply.Data[i].Access = mapBlocks[i].Access;
361 mapReply.Data[i].Agents = mapBlocks[i].Agents;
362 }
363 this.OutPacket(mapReply);
364 }
365
366 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
367 {
368 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
369 tpLocal2.Info.AgentID = this.AgentID;
370 tpLocal2.Info.TeleportFlags = flags;
371 tpLocal2.Info.LocationID = 2;
372 tpLocal2.Info.LookAt = lookAt;
373 tpLocal2.Info.Position = position;
374 OutPacket(tpLocal2);
375 }
376
377 public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags)
378 {
379 TeleportFinishPacket Teleport = new TeleportFinishPacket();
380 Teleport.Info.AgentID = this.AgentID;
381 Teleport.Info.RegionHandle = regionHandle;
382 Teleport.Info.SimAccess = simAccess;
383 Teleport.Info.SeedCapability = new byte[0];
384
385 System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress);
386 byte[] byteIP = oIP.GetAddressBytes();
387 uint ip = (uint)byteIP[3] << 24;
388 ip += (uint)byteIP[2] << 16;
389 ip += (uint)byteIP[1] << 8;
390 ip += (uint)byteIP[0];
391
392 Teleport.Info.SimIP = ip;
393 Teleport.Info.SimPort = ipPort;
394 Teleport.Info.LocationID = 4;
395 Teleport.Info.TeleportFlags = 1 << 4;
396 OutPacket(Teleport);
397 }
398
399 /// <summary>
400 ///
401 /// </summary>
402 public void SendTeleportCancel()
403 {
404 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
405 tpCancel.Info.SessionID = this.SessionID;
406 tpCancel.Info.AgentID = this.AgentID;
407
408 OutPacket(tpCancel);
409 }
410
411 /// <summary>
412 ///
413 /// </summary>
414 public void SendTeleportLocationStart()
415 {
416 TeleportStartPacket tpStart = new TeleportStartPacket();
417 tpStart.Info.TeleportFlags = 16; // Teleport via location
418 OutPacket(tpStart);
338 } 419 }
339 420
340 #region Appearance/ Wearables Methods 421 #region Appearance/ Wearables Methods
@@ -511,7 +592,7 @@ namespace OpenSim
511 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 592 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
512 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID); 593 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID);
513 outPacket.ObjectData[0].ID = localID; 594 outPacket.ObjectData[0].ID = localID;
514 outPacket.ObjectData[0].FullID = primData.FullID; 595 outPacket.ObjectData[0].FullID = primData.FullID;
515 byte[] pb = pos.GetBytes(); 596 byte[] pb = pos.GetBytes();
516 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 597 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
517 598
@@ -570,7 +651,7 @@ namespace OpenSim
570 ushort InternVelocityY; 651 ushort InternVelocityY;
571 ushort InternVelocityZ; 652 ushort InternVelocityZ;
572 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); 653 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
573 654
574 internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z); 655 internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z);
575 656
576 internDirec = internDirec / 128.0f; 657 internDirec = internDirec / 128.0f;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
index aaac4d0..a173c47 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
@@ -191,6 +191,8 @@ namespace OpenSim
191 } 191 }
192 this.OutPacket(mbReply); 192 this.OutPacket(mbReply);
193 * */ 193 * */
194
195
194 } 196 }
195 197
196 198
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 4cf6ac2..f8425da 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -158,7 +158,6 @@ namespace OpenSim
158 } 158 }
159 break; 159 break;
160 case PacketType.CompleteAgentMovement: 160 case PacketType.CompleteAgentMovement:
161 if (this.m_child) this.UpgradeClient();
162 if (OnCompleteMovementToRegion != null) 161 if (OnCompleteMovementToRegion != null)
163 { 162 {
164 OnCompleteMovementToRegion(); 163 OnCompleteMovementToRegion();
@@ -396,8 +395,11 @@ namespace OpenSim
396 break; 395 break;
397 case PacketType.MapBlockRequest: 396 case PacketType.MapBlockRequest:
398 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; 397 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
399 398 if (OnRequestMapBlocks != null)
400 this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 399 {
400 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
401 }
402 //this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
401 break; 403 break;
402 case PacketType.TeleportLandmarkRequest: 404 case PacketType.TeleportLandmarkRequest:
403 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 405 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
@@ -449,16 +451,25 @@ namespace OpenSim
449 break; 451 break;
450 case PacketType.TeleportLocationRequest: 452 case PacketType.TeleportLocationRequest:
451 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 453 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
452 Console.WriteLine(tpLocReq.ToString()); 454 // Console.WriteLine(tpLocReq.ToString());
453 455
454 tpStart = new TeleportStartPacket(); 456 if (OnTeleportLocationRequest != null)
455 tpStart.Info.TeleportFlags = 16; // Teleport via location 457 {
456 Console.WriteLine(tpStart.ToString()); 458 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16);
457 OutPacket(tpStart); 459 }
460 else
461 {
462 //no event handler so cancel request
463 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
464 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
465 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
458 466
459 if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) 467 OutPacket(tpCancel);
468 }
469
470 /* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
460 { 471 {
461 /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */ 472 // m_gridServer.getRegion(tpLocReq.Info.RegionHandle);
462 Console.WriteLine("Inter-sim teleport not yet implemented"); 473 Console.WriteLine("Inter-sim teleport not yet implemented");
463 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 474 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
464 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 475 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
@@ -469,15 +480,15 @@ namespace OpenSim
469 else 480 else
470 { 481 {
471 Console.WriteLine("Local teleport"); 482 Console.WriteLine("Local teleport");
472 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 483 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
473 tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID; 484 tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID;
474 tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags; 485 tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags;
475 tpLocal.Info.LocationID = 2; 486 tpLocal2.Info.LocationID = 2;
476 tpLocal.Info.LookAt = tpLocReq.Info.LookAt; 487 tpLocal2.Info.LookAt = tpLocReq.Info.LookAt;
477 tpLocal.Info.Position = tpLocReq.Info.Position; 488 tpLocal2.Info.Position = tpLocReq.Info.Position;
478 OutPacket(tpLocal); 489 OutPacket(tpLocal2);
479 490
480 } 491 }*/
481 break; 492 break;
482 #endregion 493 #endregion
483 494
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 29c871e..74dbc1a 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -95,7 +95,7 @@ namespace OpenSim
95 cirpack = initialcirpack; 95 cirpack = initialcirpack;
96 userEP = remoteEP; 96 userEP = remoteEP;
97 97
98 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); 98 //this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
99 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); 99 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
100 100
101 PacketQueue = new BlockingQueue<QueItem>(); 101 PacketQueue = new BlockingQueue<QueItem>();
@@ -113,27 +113,6 @@ namespace OpenSim
113 } 113 }
114 114
115 # region Client Methods 115 # region Client Methods
116 public void UpgradeClient()
117 {
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;
120 //this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
121 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
122 if (OnChildAgentStatus != null)
123 {
124 OnChildAgentStatus(this.m_child);
125 }
126 }
127
128 public void DowngradeClient()
129 {
130 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
131 this.m_child = true;
132 if (OnChildAgentStatus != null)
133 {
134 OnChildAgentStatus(this.m_child);
135 }
136 }
137 116
138 public void KillClient() 117 public void KillClient()
139 { 118 {
@@ -147,9 +126,7 @@ namespace OpenSim
147 } 126 }
148 127
149 this.m_inventoryCache.ClientLeaving(this.AgentID, null); 128 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
150 129 m_world.RemoveAvatar(this.AgentId);
151
152 // m_world.RemoveViewerAgent(this);
153 130
154 m_clientThreads.Remove(this.CircuitCode); 131 m_clientThreads.Remove(this.CircuitCode);
155 m_networkServer.RemoveClientCircuit(this.CircuitCode); 132 m_networkServer.RemoveClientCircuit(this.CircuitCode);