diff options
author | MW | 2007-04-17 12:03:52 +0000 |
---|---|---|
committer | MW | 2007-04-17 12:03:52 +0000 |
commit | d5406fe77309770234524f6afa38ae1502f01eab (patch) | |
tree | 1eacbc4c4f803087b7a2df77c43e8de65d91dbf2 /OpenSim.RegionServer | |
parent | Created skeleton SimComms.cs for sim<->sim UDP circuits (diff) | |
download | opensim-SC-d5406fe77309770234524f6afa38ae1502f01eab.zip opensim-SC-d5406fe77309770234524f6afa38ae1502f01eab.tar.gz opensim-SC-d5406fe77309770234524f6afa38ae1502f01eab.tar.bz2 opensim-SC-d5406fe77309770234524f6afa38ae1502f01eab.tar.xz |
A few fixes and stopped sim crossing being attempted in sandbox mode
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 59 | ||||
-rw-r--r-- | OpenSim.RegionServer/RegionInfo.cs | 12 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 293 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 6 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/AvatarUpdate.cs | 47 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 6 |
6 files changed, 228 insertions, 195 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index 7f2032d..ea6088b 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 | public RegionInfo regionData; | 70 | private RegionInfo regionData; |
71 | 71 | ||
72 | public Socket Server; | 72 | public Socket Server; |
73 | private IPEndPoint ServerIncoming; | 73 | private IPEndPoint ServerIncoming; |
@@ -206,23 +206,29 @@ 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 | agent_data.child=true; | 211 | { |
212 | } else { | 212 | agent_data.child = true; |
213 | agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),Convert.ToUInt32(requestData["startpos_y"]),Convert.ToUInt32(requestData["startpos_z"])); | 213 | } |
214 | agent_data.child=false; | 214 | else |
215 | } | 215 | { |
216 | 216 | agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); | |
217 | if(((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) { | 217 | agent_data.child = false; |
218 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode]=agent_data; | 218 | } |
219 | } else { | 219 | |
220 | ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | 220 | if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) |
221 | } | 221 | { |
222 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data; | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | ||
227 | } | ||
222 | 228 | ||
223 | return new XmlRpcResponse(); | 229 | return new XmlRpcResponse(); |
224 | }); | 230 | }); |
225 | 231 | ||
226 | httpServer.AddXmlRPCHandler("agent_crossing", | 232 | httpServer.AddXmlRPCHandler("agent_crossing", |
227 | delegate(XmlRpcRequest request) | 233 | delegate(XmlRpcRequest request) |
228 | { | 234 | { |
@@ -230,18 +236,19 @@ namespace OpenSim | |||
230 | AgentCircuitData agent_data = new AgentCircuitData(); | 236 | AgentCircuitData agent_data = new AgentCircuitData(); |
231 | agent_data.firstname = (string)requestData["firstname"]; | 237 | agent_data.firstname = (string)requestData["firstname"]; |
232 | agent_data.lastname = (string)requestData["lastname"]; | 238 | agent_data.lastname = (string)requestData["lastname"]; |
233 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 239 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
234 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]),Single.Parse((string)requestData["pos_y"]),Single.Parse((string)requestData["pos_z"])); | 240 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); |
235 | 241 | ||
236 | if(((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) { | 242 | if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) |
237 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; | 243 | { |
238 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; | 244 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; |
239 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; | 245 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; |
240 | } | 246 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; |
247 | } | ||
241 | 248 | ||
242 | return new XmlRpcResponse(); | 249 | return new XmlRpcResponse(); |
243 | }); | 250 | }); |
244 | 251 | ||
245 | httpServer.AddRestHandler("GET", "/simstatus/", | 252 | httpServer.AddRestHandler("GET", "/simstatus/", |
246 | delegate(string request, string path, string param) | 253 | delegate(string request, string path, string param) |
247 | { | 254 | { |
@@ -313,7 +320,7 @@ namespace OpenSim | |||
313 | pluginAssembly = null; | 320 | pluginAssembly = null; |
314 | return config; | 321 | return config; |
315 | } | 322 | } |
316 | 323 | ||
317 | private void OnReceivedData(IAsyncResult result) | 324 | private void OnReceivedData(IAsyncResult result) |
318 | { | 325 | { |
319 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 326 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |
@@ -342,7 +349,7 @@ namespace OpenSim | |||
342 | { | 349 | { |
343 | isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child; | 350 | isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child; |
344 | } | 351 | } |
345 | SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent); | 352 | SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent, this.regionData); |
346 | if ((this.GridServers.UserServer != null) && (user_accounts)) | 353 | if ((this.GridServers.UserServer != null) && (user_accounts)) |
347 | { | 354 | { |
348 | newuser.UserServer = this.GridServers.UserServer; | 355 | newuser.UserServer = this.GridServers.UserServer; |
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index abc674f..0d5e980 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim | |||
44 | //we really want to keep any server connection code out of here and out of the code code | 44 | //we really want to keep any server connection code out of here and out of the code code |
45 | // and put it in the server connection classes (those inheriting from IGridServer etc) | 45 | // and put it in the server connection classes (those inheriting from IGridServer etc) |
46 | string reqtext; | 46 | string reqtext; |
47 | reqtext = "<Root>"; | 47 | reqtext = "<Root>"; |
48 | reqtext += "<authkey>" + this.GridSendKey + "</authkey>"; | 48 | reqtext += "<authkey>" + this.GridSendKey + "</authkey>"; |
49 | reqtext += "<sim>"; | 49 | reqtext += "<sim>"; |
50 | reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>"; | 50 | reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>"; |
@@ -55,9 +55,9 @@ namespace OpenSim | |||
55 | reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; | 55 | reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; |
56 | reqtext += "<estate_id>1</estate_id>"; | 56 | reqtext += "<estate_id>1</estate_id>"; |
57 | reqtext += "</sim>"; | 57 | reqtext += "</sim>"; |
58 | reqtext += "</Root>"; | 58 | reqtext += "</Root>"; |
59 | 59 | ||
60 | byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext); | 60 | byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext); |
61 | 61 | ||
62 | WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); | 62 | WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); |
63 | GridSaveReq.Method = "POST"; | 63 | GridSaveReq.Method = "POST"; |
@@ -68,11 +68,11 @@ namespace OpenSim | |||
68 | stOut.Write(reqdata,0,reqdata.Length); | 68 | stOut.Write(reqdata,0,reqdata.Length); |
69 | stOut.Close(); | 69 | stOut.Close(); |
70 | 70 | ||
71 | WebResponse gridresp = GridSaveReq.GetResponse(); | 71 | WebResponse gridresp = GridSaveReq.GetResponse(); |
72 | StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII); | 72 | StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII); |
73 | string GridResponse = stIn.ReadToEnd(); | 73 | string GridResponse = stIn.ReadToEnd(); |
74 | stIn.Close(); | 74 | stIn.Close(); |
75 | gridresp.Close(); | 75 | gridresp.Close(); |
76 | 76 | ||
77 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); | 77 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); |
78 | } | 78 | } |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 52074b5..b729c6c 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -29,7 +29,7 @@ using System.Collections; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Net.Sockets; | 34 | using System.Net.Sockets; |
35 | using System.IO; | 35 | using System.IO; |
@@ -55,13 +55,13 @@ namespace OpenSim | |||
55 | public LLUUID AgentID; | 55 | public LLUUID AgentID; |
56 | public LLUUID SessionID; | 56 | public LLUUID SessionID; |
57 | public LLUUID SecureSessionID = LLUUID.Zero; | 57 | public LLUUID SecureSessionID = LLUUID.Zero; |
58 | public bool m_child; | 58 | public bool m_child; |
59 | public uint CircuitCode; | 59 | public uint CircuitCode; |
60 | public world.Avatar ClientAvatar; | 60 | public world.Avatar ClientAvatar; |
61 | private UseCircuitCodePacket cirpack; | 61 | private UseCircuitCodePacket cirpack; |
62 | public Thread ClientThread; | 62 | public Thread ClientThread; |
63 | public EndPoint userEP; | 63 | public EndPoint userEP; |
64 | public LLVector3 startpos; | 64 | public LLVector3 startpos; |
65 | private BlockingQueue<QueItem> PacketQueue; | 65 | private BlockingQueue<QueItem> PacketQueue; |
66 | private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | 66 | private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); |
67 | private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); | 67 | private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); |
@@ -82,8 +82,9 @@ namespace OpenSim | |||
82 | private IUserServer m_userServer = null; | 82 | private IUserServer m_userServer = null; |
83 | private OpenSimNetworkHandler m_application; | 83 | private OpenSimNetworkHandler m_application; |
84 | private InventoryCache m_inventoryCache; | 84 | private InventoryCache m_inventoryCache; |
85 | private bool m_sandboxMode; | 85 | public bool m_sandboxMode; |
86 | private int cachedtextureserial = 0; | 86 | private int cachedtextureserial = 0; |
87 | private RegionInfo m_regionData; | ||
87 | 88 | ||
88 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 89 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
89 | 90 | ||
@@ -97,7 +98,7 @@ namespace OpenSim | |||
97 | } | 98 | } |
98 | } | 99 | } |
99 | 100 | ||
100 | public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child) | 101 | public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat) |
101 | { | 102 | { |
102 | m_world = world; | 103 | m_world = world; |
103 | m_clientThreads = clientThreads; | 104 | m_clientThreads = clientThreads; |
@@ -106,16 +107,20 @@ namespace OpenSim | |||
106 | m_application = application; | 107 | m_application = application; |
107 | m_inventoryCache = inventoryCache; | 108 | m_inventoryCache = inventoryCache; |
108 | m_sandboxMode = sandboxMode; | 109 | m_sandboxMode = sandboxMode; |
109 | m_child=child; | 110 | m_child = child; |
111 | m_regionData = regionDat; | ||
110 | 112 | ||
111 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); | 113 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); |
112 | cirpack = initialcirpack; | 114 | cirpack = initialcirpack; |
113 | userEP = remoteEP; | 115 | userEP = remoteEP; |
114 | if(m_gridServer.GetName() == "Remote") { | 116 | if (m_gridServer.GetName() == "Remote") |
115 | this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos; | 117 | { |
116 | } else { | 118 | this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos; |
117 | this.startpos=new LLVector3(128.0f,128.0f,60f); | 119 | } |
118 | } | 120 | else |
121 | { | ||
122 | this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 1.0f); // new LLVector3(128.0f, 128.0f, 60f); | ||
123 | } | ||
119 | PacketQueue = new BlockingQueue<QueItem>(); | 124 | PacketQueue = new BlockingQueue<QueItem>(); |
120 | 125 | ||
121 | this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | 126 | this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); |
@@ -137,115 +142,128 @@ namespace OpenSim | |||
137 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); | 142 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); |
138 | } | 143 | } |
139 | 144 | ||
140 | public void CrossSimBorder(LLVector3 avatarpos) { // VERY VERY BASIC | 145 | public void CrossSimBorder(LLVector3 avatarpos) |
141 | LLVector3 newpos = avatarpos; | 146 | { // VERY VERY BASIC |
142 | uint neighbourx=((OpenSimMain)m_application).regionData.RegionLocX; | 147 | LLVector3 newpos = this.m_regionData.RegionLocX; |
143 | uint neighboury=((OpenSimMain)m_application).regionData.RegionLocY; | 148 | uint neighboury = this.m_regionData.RegionLocY; |
144 | 149 | ||
145 | if(avatarpos.X<0) { | 150 | if (avatarpos.X < 0) |
146 | neighbourx-=1; | 151 | { |
147 | newpos.X=254; | 152 | neighbourx -= 1; |
148 | } | 153 | newpos.X = 254; |
149 | if(avatarpos.X>255) { | 154 | } |
150 | neighbourx+=1; | 155 | if (avatarpos.X > 255) |
151 | newpos.X=1; | 156 | { |
152 | } | 157 | neighbourx += 1; |
153 | if(avatarpos.Y<0) { | 158 | newpos.X = 1; |
154 | neighboury-=1; | 159 | } |
155 | newpos.Y=254; | 160 | if (avatarpos.Y < 0) |
156 | } | 161 | { |
157 | if(avatarpos.Y>255) { | 162 | neighboury -= 1; |
158 | neighbourx+=1; | 163 | newpos.Y = 254; |
159 | newpos.Y=1; | 164 | } |
160 | } | 165 | if (avatarpos.Y > 255) |
161 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); | 166 | { |
162 | 167 | neighbourx += 1; | |
163 | Hashtable SimParams; | 168 | newpos.Y = 1; |
164 | ArrayList SendParams; | 169 | } |
165 | XmlRpcRequest GridReq; | 170 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); |
166 | XmlRpcResponse GridResp; | 171 | |
167 | foreach(Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) { | 172 | Hashtable SimParams; |
168 | if(((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) { | 173 | ArrayList SendParams; |
169 | SimParams = new Hashtable(); | 174 | XmlRpcRequest GridReq; |
170 | SimParams["firstname"] = this.ClientAvatar.firstname; | 175 | XmlRpcResponse GridResp; |
171 | SimParams["lastname"] = this.ClientAvatar.lastname; | 176 | foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) |
172 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | 177 | { |
173 | SimParams["pos_x"] = newpos.X.ToString(); | 178 | if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) |
174 | SimParams["pos_y"] = newpos.Y.ToString(); | 179 | { |
175 | SimParams["pos_z"] = newpos.Z.ToString(); | 180 | SimParams = new Hashtable(); |
176 | SendParams = new ArrayList(); | 181 | SimParams["firstname"] = this.ClientAvatar.firstname; |
177 | SendParams.Add(SimParams); | 182 | SimParams["lastname"] = this.ClientAvatar.lastname; |
178 | 183 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | |
179 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); | 184 | SimParams["pos_x"] = newpos.X.ToString(); |
180 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); | 185 | SimParams["pos_y"] = newpos.Y.ToString(); |
181 | 186 | SimParams["pos_z"] = newpos.Z.ToString(); | |
182 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); | 187 | SendParams = new ArrayList(); |
183 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | 188 | SendParams.Add(SimParams); |
184 | NewSimPack.AgentData.AgentID=this.AgentID; | 189 | |
185 | NewSimPack.AgentData.SessionID=this.SessionID; | 190 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); |
186 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); | 191 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); |
187 | NewSimPack.Info.Position=newpos; | 192 | |
188 | NewSimPack.Info.LookAt=new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | 193 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); |
189 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); | 194 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); |
190 | NewSimPack.RegionData.RegionHandle=Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); | 195 | NewSimPack.AgentData.AgentID = this.AgentID; |
191 | 196 | NewSimPack.AgentData.SessionID = this.SessionID; | |
192 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); | 197 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); |
193 | byte[] byteIP = neighbourIP.GetAddressBytes(); | 198 | NewSimPack.Info.Position = newpos; |
194 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | 199 | NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! |
195 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | 200 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); |
196 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | 201 | NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); |
197 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; | 202 | |
198 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); | 203 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); |
199 | NewSimPack.RegionData.SeedCapability = new byte[0]; | 204 | byte[] byteIP = neighbourIP.GetAddressBytes(); |
200 | lock(PacketQueue) { | 205 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; |
201 | ProcessOutPacket(NewSimPack); | 206 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; |
202 | DowngradeClient(); | 207 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; |
203 | } | 208 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; |
204 | } | 209 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); |
205 | } | 210 | NewSimPack.RegionData.SeedCapability = new byte[0]; |
206 | } | 211 | lock (PacketQueue) |
207 | 212 | { | |
208 | public void UpgradeClient() { | 213 | ProcessOutPacket(NewSimPack); |
209 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent"); | 214 | DowngradeClient(); |
210 | this.m_child=false; | 215 | } |
211 | this.m_world.RemoveViewerAgent(this); | 216 | } |
212 | this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; | 217 | } |
213 | ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child=false; | 218 | } |
214 | this.InitNewClient(); | 219 | |
215 | } | 220 | public void UpgradeClient() |
216 | 221 | { | |
217 | public void DowngradeClient() { | 222 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent"); |
218 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child"); | 223 | this.m_child = false; |
219 | this.m_child=true; | 224 | this.m_world.RemoveViewerAgent(this); |
220 | this.m_world.RemoveViewerAgent(this); | 225 | if (!this.m_sandboxMode) |
221 | this.m_world.AddViewerAgent(this); | 226 | { |
222 | } | 227 | this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; |
223 | 228 | ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child = false; | |
224 | public void KillClient() { | 229 | } |
225 | KillObjectPacket kill = new KillObjectPacket(); | 230 | this.InitNewClient(); |
226 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 231 | } |
227 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 232 | |
228 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | 233 | public void DowngradeClient() |
229 | foreach (SimClient client in m_clientThreads.Values) | 234 | { |
230 | { | 235 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child"); |
231 | client.OutPacket(kill); | 236 | this.m_child = true; |
232 | } | 237 | this.m_world.RemoveViewerAgent(this); |
233 | if (this.m_userServer != null) | 238 | this.m_world.AddViewerAgent(this); |
234 | { | 239 | } |
235 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | 240 | |
236 | } | 241 | public void KillClient() |
237 | else | 242 | { |
238 | { | 243 | KillObjectPacket kill = new KillObjectPacket(); |
239 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | 244 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
240 | } | 245 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); |
241 | 246 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | |
242 | m_world.RemoveViewerAgent(this); | 247 | foreach (SimClient client in m_clientThreads.Values) |
243 | 248 | { | |
244 | m_clientThreads.Remove(this.CircuitCode); | 249 | client.OutPacket(kill); |
245 | m_application.RemoveClientCircuit(this.CircuitCode); | 250 | } |
246 | this.ClientThread.Abort(); | 251 | if (this.m_userServer != null) |
247 | } | 252 | { |
248 | 253 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | |
254 | } | ||
255 | else | ||
256 | { | ||
257 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
258 | } | ||
259 | |||
260 | m_world.RemoveViewerAgent(this); | ||
261 | |||
262 | m_clientThreads.Remove(this.CircuitCode); | ||
263 | m_application.RemoveClientCircuit(this.CircuitCode); | ||
264 | this.ClientThread.Abort(); | ||
265 | } | ||
266 | |||
249 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | 267 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) |
250 | { | 268 | { |
251 | bool result = false; | 269 | bool result = false; |
@@ -346,9 +364,9 @@ namespace OpenSim | |||
346 | switch (Pack.Type) | 364 | switch (Pack.Type) |
347 | { | 365 | { |
348 | case PacketType.CompleteAgentMovement: | 366 | case PacketType.CompleteAgentMovement: |
349 | if(this.m_child) this.UpgradeClient(); | 367 | if (this.m_child) this.UpgradeClient(); |
350 | ClientAvatar.CompleteMovement(m_world); | 368 | ClientAvatar.CompleteMovement(m_world); |
351 | ClientAvatar.SendInitialPosition(); | 369 | ClientAvatar.SendInitialPosition(); |
352 | break; | 370 | break; |
353 | case PacketType.RegionHandshakeReply: | 371 | case PacketType.RegionHandshakeReply: |
354 | m_world.SendLayerData(this); | 372 | m_world.SendLayerData(this); |
@@ -595,18 +613,19 @@ namespace OpenSim | |||
595 | } | 613 | } |
596 | break; | 614 | break; |
597 | case PacketType.AgentAnimation: | 615 | case PacketType.AgentAnimation: |
598 | if(!m_child) { | 616 | if (!m_child) |
599 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | 617 | { |
600 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | 618 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; |
601 | { | 619 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) |
602 | if (AgentAni.AnimationList[i].StartAnim) | 620 | { |
603 | { | 621 | if (AgentAni.AnimationList[i].StartAnim) |
604 | ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID; | 622 | { |
605 | ClientAvatar.anim_seq = 1; | 623 | ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID; |
606 | ClientAvatar.SendAnimPack(); | 624 | ClientAvatar.anim_seq = 1; |
607 | } | 625 | ClientAvatar.SendAnimPack(); |
608 | } | 626 | } |
609 | } | 627 | } |
628 | } | ||
610 | break; | 629 | break; |
611 | case PacketType.ObjectSelect: | 630 | case PacketType.ObjectSelect: |
612 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 631 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; |
@@ -912,7 +931,7 @@ namespace OpenSim | |||
912 | } | 931 | } |
913 | } | 932 | } |
914 | #region Packet handlers | 933 | #region Packet handlers |
915 | 934 | ||
916 | protected virtual bool Logout(SimClient simClient, Packet packet) | 935 | protected virtual bool Logout(SimClient simClient, Packet packet) |
917 | { | 936 | { |
918 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | 937 | 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 b6b8282..54043fc 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 = ControllingClient.startpos; | 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 | { |
@@ -59,7 +59,7 @@ namespace OpenSim.world | |||
59 | this.Wearables[0].ItemID = LLUUID.Random(); | 59 | this.Wearables[0].ItemID = LLUUID.Random(); |
60 | 60 | ||
61 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 61 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
62 | 62 | ||
63 | } | 63 | } |
64 | 64 | ||
65 | public PhysicsActor PhysActor | 65 | public PhysicsActor PhysActor |
@@ -307,7 +307,7 @@ namespace OpenSim.world | |||
307 | handshake.RegionInfo.TerrainStartHeight11 = 10; | 307 | handshake.RegionInfo.TerrainStartHeight11 = 10; |
308 | handshake.RegionInfo.SimAccess = 13; | 308 | handshake.RegionInfo.SimAccess = 13; |
309 | handshake.RegionInfo.WaterHeight = 20; | 309 | handshake.RegionInfo.WaterHeight = 20; |
310 | handshake.RegionInfo.RegionFlags = 72458694 -32; | 310 | handshake.RegionInfo.RegionFlags = 72458694 - 32; |
311 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); | 311 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); |
312 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | 312 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); |
313 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 313 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); |
diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/AvatarUpdate.cs index c2f2456..6c0ace7 100644 --- a/OpenSim.RegionServer/world/AvatarUpdate.cs +++ b/OpenSim.RegionServer/world/AvatarUpdate.cs | |||
@@ -59,24 +59,31 @@ namespace OpenSim.world | |||
59 | } | 59 | } |
60 | 60 | ||
61 | } | 61 | } |
62 | this.positionLastFrame = pos2; | 62 | this.positionLastFrame = pos2; |
63 | 63 | ||
64 | if(this._physActor.Position.X < 0) { | 64 | if (!this.ControllingClient.m_sandboxMode) |
65 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); | 65 | { |
66 | } | 66 | if (pos2.X < 0) |
67 | 67 | { | |
68 | if(this._physActor.Position.Y < 0) { | 68 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); |
69 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); | 69 | } |
70 | } | 70 | |
71 | 71 | if (pos2.Y < 0) | |
72 | if(this._physActor.Position.X > 255) { | 72 | { |
73 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); | 73 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); |
74 | } | 74 | } |
75 | 75 | ||
76 | if(this._physActor.Position.Y > 255) { | 76 | if (pos2.X > 255) |
77 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); | 77 | { |
78 | } | 78 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); |
79 | 79 | } | |
80 | |||
81 | if (pos2.Y > 255) | ||
82 | { | ||
83 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
84 | } | ||
85 | } | ||
86 | |||
80 | } | 87 | } |
81 | 88 | ||
82 | public ObjectUpdatePacket CreateUpdatePacket() | 89 | public ObjectUpdatePacket CreateUpdatePacket() |
@@ -106,8 +113,8 @@ namespace OpenSim.world | |||
106 | { | 113 | { |
107 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | 114 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
108 | //send a objectupdate packet with information about the clients avatar | 115 | //send a objectupdate packet with information about the clients avatar |
109 | 116 | ||
110 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 117 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
111 | objupdate.RegionData.RegionHandle = m_regionHandle; | 118 | objupdate.RegionData.RegionHandle = m_regionHandle; |
112 | objupdate.RegionData.TimeDilation = 64096; | 119 | objupdate.RegionData.TimeDilation = 64096; |
113 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 120 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 425a135..749305f 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -371,13 +371,13 @@ namespace OpenSim.world | |||
371 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | 371 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); |
372 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | 372 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); |
373 | newAvatar.SendRegionHandshake(this); | 373 | newAvatar.SendRegionHandshake(this); |
374 | if(!agentClient.m_child) { | 374 | if(!agentClient.m_child) { |
375 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); | 375 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); |
376 | lock (this.LockPhysicsEngine) | 376 | lock (this.LockPhysicsEngine) |
377 | { | 377 | { |
378 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | 378 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | lock (Entities) | 381 | lock (Entities) |
382 | { | 382 | { |
383 | this.Entities.Add(agentClient.AgentID, newAvatar); | 383 | this.Entities.Add(agentClient.AgentID, newAvatar); |
@@ -385,7 +385,7 @@ namespace OpenSim.world | |||
385 | lock (Avatars) | 385 | lock (Avatars) |
386 | { | 386 | { |
387 | this.Avatars.Add(agentClient.AgentID, newAvatar); | 387 | this.Avatars.Add(agentClient.AgentID, newAvatar); |
388 | } | 388 | } |
389 | 389 | ||
390 | } | 390 | } |
391 | 391 | ||