W00t! multiple sims!
Misc bugfixes Child agents!!!!!! General sexy stuff0.1-prestable
parent
ba7aeb1479
commit
f9b7cc53de
|
@ -158,13 +158,15 @@ namespace OpenGridServices.GridServer
|
||||||
if (GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)) != null)
|
if (GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)) != null)
|
||||||
{
|
{
|
||||||
neighbour = GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256));
|
neighbour = GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256));
|
||||||
|
|
||||||
NeighbourBlock = new Hashtable();
|
NeighbourBlock = new Hashtable();
|
||||||
NeighbourBlock["sim_ip"] = neighbour.sim_ip;
|
NeighbourBlock["sim_ip"] = neighbour.sim_ip;
|
||||||
NeighbourBlock["sim_port"] = neighbour.sim_port.ToString();
|
NeighbourBlock["sim_port"] = neighbour.sim_port.ToString();
|
||||||
NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString();
|
NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString();
|
||||||
NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString();
|
NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString();
|
||||||
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
||||||
SimNeighboursData.Add(NeighbourBlock);
|
|
||||||
|
if(neighbour.UUID!=TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
@ -21,5 +22,14 @@ namespace OpenSim.Framework.Interfaces
|
||||||
public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
|
public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
|
||||||
public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
|
||||||
public abstract void Close();
|
public abstract void Close();
|
||||||
|
public abstract Hashtable GridData {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract ArrayList neighbours {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
//we need to add support for the asset server not knowing about a requested asset
|
//we need to add support for the asset server not knowing about a requested asset
|
||||||
ARequest req = this._assetRequests.Dequeue();
|
ARequest req = this._assetRequests.Dequeue();
|
||||||
LLUUID assetID = req.AssetID;
|
LLUUID assetID = req.AssetID;
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
|
||||||
WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
|
WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
|
||||||
WebResponse AssetResponse = AssetLoad.GetResponse();
|
WebResponse AssetResponse = AssetLoad.GetResponse();
|
||||||
byte[] idata = new byte[(int)AssetResponse.ContentLength];
|
byte[] idata = new byte[(int)AssetResponse.ContentLength];
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
private string GridSendKey;
|
private string GridSendKey;
|
||||||
private string GridRecvKey;
|
private string GridRecvKey;
|
||||||
private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
|
private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
|
||||||
|
private ArrayList simneighbours = new ArrayList();
|
||||||
|
private Hashtable griddatahash;
|
||||||
|
|
||||||
public override Dictionary<uint, AgentCircuitData> agentcircuits
|
public override Dictionary<uint, AgentCircuitData> agentcircuits
|
||||||
{
|
{
|
||||||
|
@ -51,6 +53,19 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
set { AgentCircuits = value; }
|
set { AgentCircuits = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ArrayList neighbours
|
||||||
|
{
|
||||||
|
get { return simneighbours; }
|
||||||
|
set { simneighbours = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Hashtable GridData
|
||||||
|
{
|
||||||
|
get { return griddatahash; }
|
||||||
|
set { griddatahash = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public RemoteGridServer()
|
public RemoteGridServer()
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Grid Server class created");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Grid Server class created");
|
||||||
|
@ -69,6 +84,7 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
|
||||||
XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000);
|
XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000);
|
||||||
Hashtable GridRespData = (Hashtable)GridResp.Value;
|
Hashtable GridRespData = (Hashtable)GridResp.Value;
|
||||||
|
this.griddatahash=GridRespData;
|
||||||
|
|
||||||
if(GridRespData.ContainsKey("error")) {
|
if(GridRespData.ContainsKey("error")) {
|
||||||
string errorstring = (string)GridRespData["error"];
|
string errorstring = (string)GridRespData["error"];
|
||||||
|
@ -76,6 +92,8 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(errorstring);
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(errorstring);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.neighbours = (ArrayList)GridRespData["neighbours"];
|
||||||
|
Console.WriteLine(simneighbours.Count);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,18 @@ namespace OpenSim
|
||||||
IGridServer gridServer = GridServers.GridServer;
|
IGridServer gridServer = GridServers.GridServer;
|
||||||
gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
|
gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
|
||||||
|
|
||||||
|
if(!m_sandbox) {
|
||||||
|
if(GridServers.GridServer.RequestConnection(regionData.SimUUID,regionData.IPListenAddr,(uint)regionData.IPListenPort)) {
|
||||||
|
m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!");
|
||||||
|
} else {
|
||||||
|
m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!");
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
|
||||||
|
|
||||||
LocalWorld.LoadPrimsFromStorage();
|
LocalWorld.LoadPrimsFromStorage();
|
||||||
|
|
||||||
if (m_sandbox)
|
if (m_sandbox)
|
||||||
|
@ -191,7 +203,9 @@ namespace OpenSim
|
||||||
agent_data.lastname = (string)requestData["lastname"];
|
agent_data.lastname = (string)requestData["lastname"];
|
||||||
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
||||||
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||||
|
if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) {
|
||||||
|
agent_data.child=true;
|
||||||
|
}
|
||||||
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||||
|
|
||||||
return new XmlRpcResponse();
|
return new XmlRpcResponse();
|
||||||
|
@ -288,15 +302,52 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else if (packet.Type == PacketType.UseCircuitCode)
|
else if (packet.Type == PacketType.UseCircuitCode)
|
||||||
{ // new client
|
{ // new client
|
||||||
|
|
||||||
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
|
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
|
||||||
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
|
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
|
||||||
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
|
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox,((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child);
|
||||||
if ((this.GridServers.UserServer != null) && (user_accounts))
|
if ((this.GridServers.UserServer != null) && (user_accounts))
|
||||||
{
|
{
|
||||||
newuser.UserServer = this.GridServers.UserServer;
|
newuser.UserServer = this.GridServers.UserServer;
|
||||||
}
|
}
|
||||||
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
|
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
|
||||||
this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
|
this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
|
||||||
|
|
||||||
|
if(!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) {
|
||||||
|
Hashtable SimParams;
|
||||||
|
ArrayList SendParams;
|
||||||
|
XmlRpcRequest GridReq;
|
||||||
|
XmlRpcResponse GridResp;
|
||||||
|
foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours) {
|
||||||
|
m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
|
||||||
|
SimParams = new Hashtable();
|
||||||
|
SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
|
||||||
|
SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
|
||||||
|
SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
|
||||||
|
SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
|
||||||
|
SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
|
||||||
|
SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
|
||||||
|
SimParams["child_agent"]="1";
|
||||||
|
SendParams = new ArrayList();
|
||||||
|
SendParams.Add(SimParams);
|
||||||
|
|
||||||
|
GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||||
|
GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
|
||||||
|
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
|
||||||
|
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
|
||||||
|
enablesimpacket.SimulatorInfo.Handle=Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
|
||||||
|
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
|
||||||
|
byte[] byteIP = neighbourIP.GetAddressBytes();
|
||||||
|
enablesimpacket.SimulatorInfo.IP=(uint)byteIP[3]<<24;
|
||||||
|
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[2]<<16;
|
||||||
|
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[1]<<8;
|
||||||
|
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[0];
|
||||||
|
enablesimpacket.SimulatorInfo.Port=(ushort)Convert.ToInt32(neighbour["sim_port"]);
|
||||||
|
Thread.Sleep(3000);
|
||||||
|
_packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // invalid client
|
{ // invalid client
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
public LLUUID SessionID;
|
public LLUUID SessionID;
|
||||||
public LLUUID SecureSessionID = LLUUID.Zero;
|
public LLUUID SecureSessionID = LLUUID.Zero;
|
||||||
|
public bool m_child;
|
||||||
public uint CircuitCode;
|
public uint CircuitCode;
|
||||||
public world.Avatar ClientAvatar;
|
public world.Avatar ClientAvatar;
|
||||||
private UseCircuitCodePacket cirpack;
|
private UseCircuitCodePacket cirpack;
|
||||||
|
@ -94,7 +95,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode)
|
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child)
|
||||||
{
|
{
|
||||||
m_world = world;
|
m_world = world;
|
||||||
m_clientThreads = clientThreads;
|
m_clientThreads = clientThreads;
|
||||||
|
@ -103,6 +104,7 @@ namespace OpenSim
|
||||||
m_application = application;
|
m_application = application;
|
||||||
m_inventoryCache = inventoryCache;
|
m_inventoryCache = inventoryCache;
|
||||||
m_sandboxMode = sandboxMode;
|
m_sandboxMode = sandboxMode;
|
||||||
|
m_child=child;
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
|
||||||
cirpack = initialcirpack;
|
cirpack = initialcirpack;
|
||||||
|
@ -228,8 +230,10 @@ namespace OpenSim
|
||||||
switch (Pack.Type)
|
switch (Pack.Type)
|
||||||
{
|
{
|
||||||
case PacketType.CompleteAgentMovement:
|
case PacketType.CompleteAgentMovement:
|
||||||
|
if(!m_child) {
|
||||||
ClientAvatar.CompleteMovement(m_world);
|
ClientAvatar.CompleteMovement(m_world);
|
||||||
ClientAvatar.SendInitialPosition();
|
ClientAvatar.SendInitialPosition();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.RegionHandshakeReply:
|
case PacketType.RegionHandshakeReply:
|
||||||
m_world.SendLayerData(this);
|
m_world.SendLayerData(this);
|
||||||
|
@ -476,6 +480,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.AgentAnimation:
|
case PacketType.AgentAnimation:
|
||||||
|
if(!m_child) {
|
||||||
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
||||||
for (int i = 0; i < AgentAni.AnimationList.Length; i++)
|
for (int i = 0; i < AgentAni.AnimationList.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -486,6 +491,7 @@ namespace OpenSim
|
||||||
ClientAvatar.SendAnimPack();
|
ClientAvatar.SendAnimPack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.ObjectSelect:
|
case PacketType.ObjectSelect:
|
||||||
ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
|
ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
|
||||||
|
|
|
@ -89,6 +89,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
//send a objectupdate packet with information about the clients avatar
|
//send a objectupdate packet with information about the clients avatar
|
||||||
|
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle = m_regionHandle;
|
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
|
|
@ -371,11 +371,13 @@ namespace OpenSim.world
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
|
||||||
newAvatar.SendRegionHandshake(this);
|
newAvatar.SendRegionHandshake(this);
|
||||||
|
if(!agentClient.m_child) {
|
||||||
PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
|
PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
|
||||||
lock (this.LockPhysicsEngine)
|
lock (this.LockPhysicsEngine)
|
||||||
{
|
{
|
||||||
newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
|
newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lock (Entities)
|
lock (Entities)
|
||||||
{
|
{
|
||||||
this.Entities.Add(agentClient.AgentID, newAvatar);
|
this.Entities.Add(agentClient.AgentID, newAvatar);
|
||||||
|
@ -384,6 +386,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
this.Avatars.Add(agentClient.AgentID, newAvatar);
|
this.Avatars.Add(agentClient.AgentID, newAvatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveViewerAgent(SimClient agentClient)
|
public void RemoveViewerAgent(SimClient agentClient)
|
||||||
|
|
Loading…
Reference in New Issue