aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgareth2007-04-17 01:38:20 +0000
committergareth2007-04-17 01:38:20 +0000
commitbbcb20e192b61a63e0b0462de794ccbdb54d886b (patch)
tree37f05557c0f5e04849f4b0ff94752563e967220d
parentStarted to fix sandbox mode (diff)
downloadopensim-SC_OLD-bbcb20e192b61a63e0b0462de794ccbdb54d886b.zip
opensim-SC_OLD-bbcb20e192b61a63e0b0462de794ccbdb54d886b.tar.gz
opensim-SC_OLD-bbcb20e192b61a63e0b0462de794ccbdb54d886b.tar.bz2
opensim-SC_OLD-bbcb20e192b61a63e0b0462de794ccbdb54d886b.tar.xz
Sim crossing now works (except for broken co-ordinates, resets to 0,0 - to be fixed soon)
Fixed sandbox mode fully Scrapped former XML-RPC expect_user call for sim crossings Sim client thread can upgrade/downgrade between full and child agent dynamically
Diffstat (limited to '')
-rw-r--r--OpenSim.Framework/AgentCiruitData.cs1
-rw-r--r--OpenSim.Framework/SimProfile.cs4
-rw-r--r--OpenSim.Framework/UserProfileManager.cs5
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs12
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs23
-rw-r--r--OpenSim.RegionServer/SimClient.cs114
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs4
-rw-r--r--OpenSim.RegionServer/world/AvatarUpdate.cs19
8 files changed, 159 insertions, 23 deletions
diff --git a/OpenSim.Framework/AgentCiruitData.cs b/OpenSim.Framework/AgentCiruitData.cs
index 461d962..e1a79b9 100644
--- a/OpenSim.Framework/AgentCiruitData.cs
+++ b/OpenSim.Framework/AgentCiruitData.cs
@@ -11,6 +11,7 @@ namespace OpenSim.Framework.Interfaces
11 public LLUUID AgentID; 11 public LLUUID AgentID;
12 public LLUUID SessionID; 12 public LLUUID SessionID;
13 public LLUUID SecureSessionID; 13 public LLUUID SecureSessionID;
14 public LLVector3 startpos;
14 public string firstname; 15 public string firstname;
15 public string lastname; 16 public string lastname;
16 public uint circuitcode; 17 public uint circuitcode;
diff --git a/OpenSim.Framework/SimProfile.cs b/OpenSim.Framework/SimProfile.cs
index ed34863..ad3e028 100644
--- a/OpenSim.Framework/SimProfile.cs
+++ b/OpenSim.Framework/SimProfile.cs
@@ -25,7 +25,7 @@ namespace OpenSim.Framework.Sims
25 25
26 Hashtable RespData = (Hashtable)GridResp.Value; 26 Hashtable RespData = (Hashtable)GridResp.Value;
27 this.UUID = new LLUUID((string)RespData["UUID"]); 27 this.UUID = new LLUUID((string)RespData["UUID"]);
28 this.regionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); 28 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
29 this.regionname = (string)RespData["regionname"]; 29 this.regionname = (string)RespData["regionname"];
30 this.sim_ip = (string)RespData["sim_ip"]; 30 this.sim_ip = (string)RespData["sim_ip"];
31 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); 31 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Sims
57 57
58 Hashtable RespData = (Hashtable)GridResp.Value; 58 Hashtable RespData = (Hashtable)GridResp.Value;
59 this.UUID = new LLUUID((string)RespData["UUID"]); 59 this.UUID = new LLUUID((string)RespData["UUID"]);
60 this.regionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); 60 this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
61 this.regionname = (string)RespData["regionname"]; 61 this.regionname = (string)RespData["regionname"];
62 this.sim_ip = (string)RespData["sim_ip"]; 62 this.sim_ip = (string)RespData["sim_ip"];
63 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]); 63 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
index a44342c..33f2abd 100644
--- a/OpenSim.Framework/UserProfileManager.cs
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -258,7 +258,10 @@ namespace OpenSim.Framework.User
258 SimParams["firstname"] = theUser.firstname; 258 SimParams["firstname"] = theUser.firstname;
259 SimParams["lastname"] = theUser.lastname; 259 SimParams["lastname"] = theUser.lastname;
260 SimParams["agent_id"] = theUser.UUID.ToString(); 260 SimParams["agent_id"] = theUser.UUID.ToString();
261 SimParams["circuit_code"] = (Int32)circode; 261 SimParams["circuit_code"] = (Int32)circode;
262 SimParams["startpos_x"] = theUser.homepos.X.ToString();
263 SimParams["startpos_y"] = theUser.homepos.Y.ToString();
264 SimParams["startpos_z"] = theUser.homepos.Z.ToString();
262 ArrayList SendParams = new ArrayList(); 265 ArrayList SendParams = new ArrayList();
263 SendParams.Add(SimParams); 266 SendParams.Add(SimParams);
264 267
diff --git a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 62b6ffc..26b9565 100644
--- a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -109,26 +109,34 @@ namespace OpenSim.Physics.BasicPhysicsPlugin
109 {*/ 109 {*/
110 actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; 110 actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1;
111 //} 111 //}
112 if(actor.Position.X<0) 112
113
114
115 // This code needs sorting out - border crossings etc
116/* if(actor.Position.X<0)
113 { 117 {
118 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
114 actor.Position.X = 0; 119 actor.Position.X = 0;
115 actor.Velocity.X = 0; 120 actor.Velocity.X = 0;
116 } 121 }
117 if(actor.Position.Y < 0) 122 if(actor.Position.Y < 0)
118 { 123 {
124 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
119 actor.Position.Y = 0; 125 actor.Position.Y = 0;
120 actor.Velocity.Y = 0; 126 actor.Velocity.Y = 0;
121 } 127 }
122 if(actor.Position.X > 255) 128 if(actor.Position.X > 255)
123 { 129 {
130 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
124 actor.Position.X = 255; 131 actor.Position.X = 255;
125 actor.Velocity.X = 0; 132 actor.Velocity.X = 0;
126 } 133 }
127 if(actor.Position.Y > 255) 134 if(actor.Position.Y > 255)
128 { 135 {
136 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
129 actor.Position.Y = 255; 137 actor.Position.Y = 255;
130 actor.Velocity.X = 0; 138 actor.Velocity.X = 0;
131 } 139 }*/
132 } 140 }
133 } 141 }
134 142
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 2492ee2..038c7e6 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -67,7 +67,7 @@ namespace OpenSim
67 //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>(); 67 //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
68 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 68 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
69 private DateTime startuptime; 69 private DateTime startuptime;
70 private RegionInfo regionData; 70 public RegionInfo regionData;
71 71
72 public Socket Server; 72 public Socket Server;
73 private IPEndPoint ServerIncoming; 73 private IPEndPoint ServerIncoming;
@@ -206,12 +206,19 @@ namespace OpenSim
206 agent_data.firstname = (string)requestData["firstname"]; 206 agent_data.firstname = (string)requestData["firstname"];
207 agent_data.lastname = (string)requestData["lastname"]; 207 agent_data.lastname = (string)requestData["lastname"];
208 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 208 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
209 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 209 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
210 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 210 if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) {
211 { 211 agent_data.child=true;
212 agent_data.child = true; 212 } else {
213 } 213 agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),Convert.ToUInt32(requestData["startpos_y"]),Convert.ToUInt32(requestData["startpos_z"]));
214 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 214 agent_data.child=false;
215 }
216
217 if(((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) {
218 ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode]=agent_data;
219 } else {
220 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
221 }
215 222
216 return new XmlRpcResponse(); 223 return new XmlRpcResponse();
217 }); 224 });
@@ -286,7 +293,7 @@ namespace OpenSim
286 pluginAssembly = null; 293 pluginAssembly = null;
287 return config; 294 return config;
288 } 295 }
289 296
290 private void OnReceivedData(IAsyncResult result) 297 private void OnReceivedData(IAsyncResult result)
291 { 298 {
292 ipeSender = new IPEndPoint(IPAddress.Any, 0); 299 ipeSender = new IPEndPoint(IPAddress.Any, 0);
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index c478d92..083ca68 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -29,6 +29,7 @@ using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using Nwc.XmlRpc;
32using System.Net; 33using System.Net;
33using System.Net.Sockets; 34using System.Net.Sockets;
34using System.IO; 35using System.IO;
@@ -58,8 +59,9 @@ namespace OpenSim
58 public uint CircuitCode; 59 public uint CircuitCode;
59 public world.Avatar ClientAvatar; 60 public world.Avatar ClientAvatar;
60 private UseCircuitCodePacket cirpack; 61 private UseCircuitCodePacket cirpack;
61 private Thread ClientThread; 62 public Thread ClientThread;
62 public EndPoint userEP; 63 public EndPoint userEP;
64 public LLVector3 startpos;
63 private BlockingQueue<QueItem> PacketQueue; 65 private BlockingQueue<QueItem> PacketQueue;
64 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 66 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
65 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); 67 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
@@ -109,6 +111,11 @@ namespace OpenSim
109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); 111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
110 cirpack = initialcirpack; 112 cirpack = initialcirpack;
111 userEP = remoteEP; 113 userEP = remoteEP;
114 if(m_gridServer.GetName() == "Remote") {
115 this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos;
116 } else {
117 this.startpos=new LLVector3(128.0f,128.0f,60f);
118 }
112 PacketQueue = new BlockingQueue<QueItem>(); 119 PacketQueue = new BlockingQueue<QueItem>();
113 120
114 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); 121 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
@@ -130,6 +137,100 @@ namespace OpenSim
130 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 137 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
131 } 138 }
132 139
140 public void CrossSimBorder(LLVector3 avatarpos) { // VERY VERY BASIC
141 LLVector3 newpos = avatarpos;
142 uint neighbourx=((OpenSimMain)m_application).regionData.RegionLocX;
143 uint neighboury=((OpenSimMain)m_application).regionData.RegionLocY;
144
145 if(avatarpos.X<0) {
146 neighbourx-=1;
147 newpos.X=0;
148 }
149 if(avatarpos.X>255) {
150 neighbourx+=1;
151 newpos.X=255;
152 }
153 if(avatarpos.Y<0) {
154 neighboury-=1;
155 newpos.Y=0;
156 }
157 if(avatarpos.Y>255) {
158 neighbourx+=1;
159 newpos.Y=255;
160 }
161 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
162
163 Hashtable SimParams;
164 ArrayList SendParams;
165 XmlRpcRequest GridReq;
166 XmlRpcResponse GridResp;
167 foreach(Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) {
168 if(((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) {
169 CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
170 NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
171 NewSimPack.AgentData.AgentID=this.AgentID;
172 NewSimPack.AgentData.SessionID=this.SessionID;
173 NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
174 NewSimPack.Info.Position=newpos;
175 NewSimPack.Info.LookAt=new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
176 NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
177 NewSimPack.RegionData.RegionHandle=Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
178
179 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
180 byte[] byteIP = neighbourIP.GetAddressBytes();
181 NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
182 NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
183 NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
184 NewSimPack.RegionData.SimIP += (uint)byteIP[0];
185 NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
186 NewSimPack.RegionData.SeedCapability = new byte[0];
187 lock(PacketQueue) {
188 ProcessOutPacket(NewSimPack);
189 DowngradeClient();
190 }
191 }
192 }
193 }
194
195 public void UpgradeClient() {
196 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent");
197 this.m_child=false;
198 this.m_world.RemoveViewerAgent(this);
199 this.InitNewClient();
200 }
201
202 public void DowngradeClient() {
203 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child");
204 this.m_child=true;
205 this.m_world.RemoveViewerAgent(this);
206 this.m_world.AddViewerAgent(this);
207 }
208
209 public void KillClient() {
210 KillObjectPacket kill = new KillObjectPacket();
211 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
212 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
213 kill.ObjectData[0].ID = this.ClientAvatar.localid;
214 foreach (SimClient client in m_clientThreads.Values)
215 {
216 client.OutPacket(kill);
217 }
218 if (this.m_userServer != null)
219 {
220 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
221 }
222 else
223 {
224 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
225 }
226
227 m_world.RemoveViewerAgent(this);
228
229 m_clientThreads.Remove(this.CircuitCode);
230 m_application.RemoveClientCircuit(this.CircuitCode);
231 this.ClientThread.Abort();
232 }
233
133 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) 234 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
134 { 235 {
135 bool result = false; 236 bool result = false;
@@ -230,10 +331,9 @@ namespace OpenSim
230 switch (Pack.Type) 331 switch (Pack.Type)
231 { 332 {
232 case PacketType.CompleteAgentMovement: 333 case PacketType.CompleteAgentMovement:
233 if(!m_child) { 334 if(this.m_child) this.UpgradeClient();
234 ClientAvatar.CompleteMovement(m_world); 335 ClientAvatar.CompleteMovement(m_world);
235 ClientAvatar.SendInitialPosition(); 336 ClientAvatar.SendInitialPosition();
236 }
237 break; 337 break;
238 case PacketType.RegionHandshakeReply: 338 case PacketType.RegionHandshakeReply:
239 m_world.SendLayerData(this); 339 m_world.SendLayerData(this);
@@ -797,7 +897,7 @@ namespace OpenSim
797 } 897 }
798 } 898 }
799 #region Packet handlers 899 #region Packet handlers
800 900
801 protected virtual bool Logout(SimClient simClient, Packet packet) 901 protected virtual bool Logout(SimClient simClient, Packet packet)
802 { 902 {
803 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 903 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 42a2067..b6b8282 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -44,7 +44,7 @@ namespace OpenSim.world
44 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 44 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
45 ControllingClient = TheClient; 45 ControllingClient = TheClient;
46 localid = 8880000 + (this.m_world._localNumber++); 46 localid = 8880000 + (this.m_world._localNumber++);
47 Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain[(int)Pos.X, (int)Pos.Y] + 1.0f); 47 Pos = ControllingClient.startpos;
48 visualParams = new byte[218]; 48 visualParams = new byte[218];
49 for (int i = 0; i < 218; i++) 49 for (int i = 0; i < 218; i++)
50 { 50 {
@@ -131,7 +131,7 @@ namespace OpenSim.world
131 mov.Data.RegionHandle = this.m_regionHandle; 131 mov.Data.RegionHandle = this.m_regionHandle;
132 // TODO - dynamicalise this stuff 132 // TODO - dynamicalise this stuff
133 mov.Data.Timestamp = 1172750370; 133 mov.Data.Timestamp = 1172750370;
134 mov.Data.Position = new LLVector3(100f, 100f, 23f); 134 mov.Data.Position = this.ControllingClient.startpos;
135 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); 135 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
136 136
137 ControllingClient.OutPacket(mov); 137 ControllingClient.OutPacket(mov);
diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/AvatarUpdate.cs
index 453f419..c2f2456 100644
--- a/OpenSim.RegionServer/world/AvatarUpdate.cs
+++ b/OpenSim.RegionServer/world/AvatarUpdate.cs
@@ -59,7 +59,24 @@ namespace OpenSim.world
59 } 59 }
60 60
61 } 61 }
62 this.positionLastFrame = pos2; 62 this.positionLastFrame = pos2;
63
64 if(this._physActor.Position.X < 0) {
65 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z));
66 }
67
68 if(this._physActor.Position.Y < 0) {
69 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z));
70 }
71
72 if(this._physActor.Position.X > 255) {
73 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z));
74 }
75
76 if(this._physActor.Position.Y > 255) {
77 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z));
78 }
79
63 } 80 }
64 81
65 public ObjectUpdatePacket CreateUpdatePacket() 82 public ObjectUpdatePacket CreateUpdatePacket()