* Continued refactoring away OpenSimRoot - now it's down to the final 2.
parent
893a1824d0
commit
ccfddd1775
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using OpenSim.world;
|
||||||
|
|
||||||
namespace OpenSim.CAPS
|
namespace OpenSim.CAPS
|
||||||
{
|
{
|
||||||
|
@ -11,9 +12,11 @@ namespace OpenSim.CAPS
|
||||||
private string NewAccountForm;
|
private string NewAccountForm;
|
||||||
private string LoginForm;
|
private string LoginForm;
|
||||||
private string passWord = "Admin";
|
private string passWord = "Admin";
|
||||||
|
private World m_world;
|
||||||
|
|
||||||
public AdminWebFront(string password)
|
public AdminWebFront(string password, World world)
|
||||||
{
|
{
|
||||||
|
m_world = world;
|
||||||
passWord = password;
|
passWord = password;
|
||||||
LoadAdminPage();
|
LoadAdminPage();
|
||||||
}
|
}
|
||||||
|
@ -45,11 +48,11 @@ namespace OpenSim.CAPS
|
||||||
{
|
{
|
||||||
responseString = " <p> Listing connected Clients </p>";
|
responseString = " <p> Listing connected Clients </p>";
|
||||||
OpenSim.world.Avatar TempAv;
|
OpenSim.world.Avatar TempAv;
|
||||||
foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
|
foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
|
||||||
{
|
{
|
||||||
if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
||||||
{
|
{
|
||||||
TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
|
TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
|
||||||
responseString += "<p>";
|
responseString += "<p>";
|
||||||
responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
|
responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
|
||||||
responseString += "</p>";
|
responseString += "</p>";
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace OpenSim
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
|
||||||
OpenSimRoot.Instance.LocalWorld = new World();
|
OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg);
|
||||||
OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
|
OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
|
||||||
|
|
||||||
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||||
|
@ -114,7 +114,7 @@ namespace OpenSim
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
||||||
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
|
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||||
OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin"));
|
OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld));
|
||||||
|
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
timer1.Interval = 100;
|
timer1.Interval = 100;
|
||||||
|
|
|
@ -12,11 +12,15 @@ namespace OpenSim.UserServer
|
||||||
{
|
{
|
||||||
class LocalUserProfileManager : UserProfileManager
|
class LocalUserProfileManager : UserProfileManager
|
||||||
{
|
{
|
||||||
private IGridServer _gridServer;
|
private IGridServer m_gridServer;
|
||||||
|
private int m_port;
|
||||||
|
private string m_ipAddr;
|
||||||
|
|
||||||
public LocalUserProfileManager(IGridServer gridServer)
|
public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr)
|
||||||
{
|
{
|
||||||
_gridServer = gridServer;
|
m_gridServer = gridServer;
|
||||||
|
m_port = simPort;
|
||||||
|
m_ipAddr = ipAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitUserProfiles()
|
public override void InitUserProfiles()
|
||||||
|
@ -29,8 +33,8 @@ namespace OpenSim.UserServer
|
||||||
uint circode = (uint)response["circuit_code"];
|
uint circode = (uint)response["circuit_code"];
|
||||||
theUser.AddSimCircuit(circode, LLUUID.Random());
|
theUser.AddSimCircuit(circode, LLUUID.Random());
|
||||||
response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
|
response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
|
||||||
response["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
|
response["sim_port"] = m_port;
|
||||||
response["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
response["sim_ip"] = m_ipAddr;
|
||||||
response["region_y"] = (Int32)996 * 256;
|
response["region_y"] = (Int32)996 * 256;
|
||||||
response["region_x"] = (Int32)997* 256;
|
response["region_x"] = (Int32)997* 256;
|
||||||
|
|
||||||
|
@ -67,9 +71,9 @@ namespace OpenSim.UserServer
|
||||||
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
|
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
|
||||||
|
|
||||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||||
if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
|
if (m_gridServer.GetName() == "Local")
|
||||||
{
|
{
|
||||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
((LocalGridBase)this.m_gridServer).AddNewSession(_login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.UserServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoginServer : LoginService , IUserServer
|
public class LoginServer : LoginService , IUserServer
|
||||||
{
|
{
|
||||||
private IGridServer _gridServer;
|
private IGridServer m_gridServer;
|
||||||
private ushort _loginPort = 8080;
|
private ushort _loginPort = 8080;
|
||||||
public IPAddress clientAddress = IPAddress.Loopback;
|
public IPAddress clientAddress = IPAddress.Loopback;
|
||||||
public IPAddress remoteAddress = IPAddress.Any;
|
public IPAddress remoteAddress = IPAddress.Any;
|
||||||
|
@ -63,10 +63,14 @@ namespace OpenSim.UserServer
|
||||||
private string _mpasswd;
|
private string _mpasswd;
|
||||||
private bool _needPasswd = false;
|
private bool _needPasswd = false;
|
||||||
private LocalUserProfileManager userManager;
|
private LocalUserProfileManager userManager;
|
||||||
|
private int m_simPort;
|
||||||
|
private string m_simAddr;
|
||||||
|
|
||||||
public LoginServer(IGridServer gridServer)
|
public LoginServer(IGridServer gridServer, string simAddr, int simPort)
|
||||||
{
|
{
|
||||||
_gridServer = gridServer;
|
m_gridServer = gridServer;
|
||||||
|
m_simPort = simPort;
|
||||||
|
m_simAddr = simAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitializeLogin: initialize the login
|
// InitializeLogin: initialize the login
|
||||||
|
@ -89,7 +93,7 @@ namespace OpenSim.UserServer
|
||||||
SR.Close();
|
SR.Close();
|
||||||
this._mpasswd = EncodePassword("testpass");
|
this._mpasswd = EncodePassword("testpass");
|
||||||
|
|
||||||
userManager = new LocalUserProfileManager(this._gridServer);
|
userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr );
|
||||||
userManager.InitUserProfiles();
|
userManager.InitUserProfiles();
|
||||||
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
||||||
|
|
||||||
|
@ -289,8 +293,8 @@ namespace OpenSim.UserServer
|
||||||
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
||||||
Hashtable responseData = (Hashtable)response.Value;
|
Hashtable responseData = (Hashtable)response.Value;
|
||||||
|
|
||||||
responseData["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
|
responseData["sim_port"] = m_simPort;
|
||||||
responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
responseData["sim_ip"] = m_simAddr;
|
||||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||||
responseData["session_id"] = Session.ToStringHyphenated();
|
responseData["session_id"] = Session.ToStringHyphenated();
|
||||||
responseData["secure_session_id"]= secureSess.ToStringHyphenated();
|
responseData["secure_session_id"]= secureSess.ToStringHyphenated();
|
||||||
|
@ -327,9 +331,9 @@ namespace OpenSim.UserServer
|
||||||
_login.InventoryFolder = InventoryFolderID;
|
_login.InventoryFolder = InventoryFolderID;
|
||||||
|
|
||||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||||
if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
|
if (m_gridServer.GetName() == "Local")
|
||||||
{
|
{
|
||||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
((LocalGridBase)m_gridServer).AddNewSession(_login);
|
||||||
}
|
}
|
||||||
|
|
||||||
// forward the XML-RPC response to the client
|
// forward the XML-RPC response to the client
|
||||||
|
|
|
@ -30,14 +30,23 @@ namespace OpenSim.world
|
||||||
private byte[] visualParams;
|
private byte[] visualParams;
|
||||||
private AvatarWearable[] Wearables;
|
private AvatarWearable[] Wearables;
|
||||||
private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
|
private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
|
||||||
|
private World m_world;
|
||||||
|
private ulong m_regionHandle;
|
||||||
|
private Dictionary<uint, SimClient> m_clientThreads;
|
||||||
|
private string m_regionName;
|
||||||
|
|
||||||
public Avatar(SimClient TheClient)
|
public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle)
|
||||||
{
|
{
|
||||||
|
m_world = world;
|
||||||
|
m_clientThreads = clientThreads;
|
||||||
|
m_regionName = regionName;
|
||||||
|
m_regionHandle = regionHandle;
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
||||||
ControllingClient = TheClient;
|
ControllingClient = TheClient;
|
||||||
localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++);
|
localid = 8880000 + (m_world._localNumber++);
|
||||||
position = new LLVector3(100.0f, 100.0f, 30.0f);
|
position = new LLVector3(100.0f, 100.0f, 30.0f);
|
||||||
position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
|
position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
|
||||||
visualParams = new byte[218];
|
visualParams = new byte[218];
|
||||||
for (int i = 0; i < 218; i++)
|
for (int i = 0; i < 218; i++)
|
||||||
{
|
{
|
||||||
|
@ -96,11 +105,11 @@ namespace OpenSim.world
|
||||||
//use CreateTerseBlock()
|
//use CreateTerseBlock()
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
|
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||||
terse.RegionData.TimeDilation = 64096;
|
terse.RegionData.TimeDilation = 64096;
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = terseBlock;
|
terse.ObjectData[0] = terseBlock;
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(terse);
|
client.OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
@ -119,11 +128,11 @@ namespace OpenSim.world
|
||||||
//It has been a while since last update was sent so lets send one.
|
//It has been a while since last update was sent so lets send one.
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
|
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||||
terse.RegionData.TimeDilation = 64096;
|
terse.RegionData.TimeDilation = 64096;
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = terseBlock;
|
terse.ObjectData[0] = terseBlock;
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(terse);
|
client.OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +181,7 @@ namespace OpenSim.world
|
||||||
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||||
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
||||||
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
||||||
mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
|
mov.Data.RegionHandle = m_regionHandle;
|
||||||
// TODO - dynamicalise this stuff
|
// TODO - dynamicalise this stuff
|
||||||
mov.Data.Timestamp = 1172750370;
|
mov.Data.Timestamp = 1172750370;
|
||||||
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
||||||
|
@ -187,7 +196,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 = OpenSimRoot.Instance.Cfg.RegionHandle;
|
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
@ -202,9 +211,9 @@ namespace OpenSim.world
|
||||||
byte[] pb = pos2.GetBytes();
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
||||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||||
OpenSimRoot.Instance.LocalWorld._localNumber++;
|
m_world._localNumber++;
|
||||||
|
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(objupdate);
|
client.OutPacket(objupdate);
|
||||||
if (client.AgentID != ControllingClient.AgentID)
|
if (client.AgentID != ControllingClient.AgentID)
|
||||||
|
@ -241,7 +250,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 = OpenSimRoot.Instance.Cfg.RegionHandle;
|
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
@ -293,7 +302,7 @@ namespace OpenSim.world
|
||||||
this.visualParams[i] = appear.VisualParam[i].ParamValue;
|
this.visualParams[i] = appear.VisualParam[i].ParamValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
if (client.AgentID != ControllingClient.AgentID)
|
if (client.AgentID != ControllingClient.AgentID)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +499,7 @@ namespace OpenSim.world
|
||||||
handshake.RegionInfo.SimAccess = 13;
|
handshake.RegionInfo.SimAccess = 13;
|
||||||
handshake.RegionInfo.WaterHeight = 20;
|
handshake.RegionInfo.WaterHeight = 20;
|
||||||
handshake.RegionInfo.RegionFlags = 72458694;
|
handshake.RegionInfo.RegionFlags = 72458694;
|
||||||
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0");
|
handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0");
|
||||||
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||||
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||||
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||||
|
|
|
@ -22,6 +22,9 @@ namespace OpenSim.world
|
||||||
private PhysicsActor _physActor;
|
private PhysicsActor _physActor;
|
||||||
private bool physicsEnabled = false;
|
private bool physicsEnabled = false;
|
||||||
private bool physicstest = false; //just added for testing
|
private bool physicstest = false; //just added for testing
|
||||||
|
private Dictionary<uint, SimClient> m_clientThreads;
|
||||||
|
private ulong m_regionHandle;
|
||||||
|
private World m_world;
|
||||||
|
|
||||||
public bool PhysicsEnabled
|
public bool PhysicsEnabled
|
||||||
{
|
{
|
||||||
|
@ -65,10 +68,14 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Primitive()
|
public Primitive(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world)
|
||||||
{
|
{
|
||||||
mesh_cutbegin = 0.0f;
|
mesh_cutbegin = 0.0f;
|
||||||
mesh_cutend = 1.0f;
|
mesh_cutend = 1.0f;
|
||||||
|
|
||||||
|
m_clientThreads = clientThreads;
|
||||||
|
m_regionHandle = regionHandle;
|
||||||
|
m_world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Mesh getMesh()
|
public override Mesh getMesh()
|
||||||
|
@ -99,7 +106,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
if (this.newPrimFlag)
|
if (this.newPrimFlag)
|
||||||
{
|
{
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(OurPacket);
|
client.OutPacket(OurPacket);
|
||||||
}
|
}
|
||||||
|
@ -108,11 +115,11 @@ namespace OpenSim.world
|
||||||
else if (this.updateFlag)
|
else if (this.updateFlag)
|
||||||
{
|
{
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
|
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||||
terse.RegionData.TimeDilation = 64096;
|
terse.RegionData.TimeDilation = 64096;
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(terse);
|
client.OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +127,7 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
else if (this.dirtyFlag)
|
else if (this.dirtyFlag)
|
||||||
{
|
{
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
UpdateClient(client);
|
UpdateClient(client);
|
||||||
}
|
}
|
||||||
|
@ -131,11 +138,11 @@ namespace OpenSim.world
|
||||||
if (this._physActor != null && this.physicsEnabled)
|
if (this._physActor != null && this.physicsEnabled)
|
||||||
{
|
{
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
|
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||||
terse.RegionData.TimeDilation = 64096;
|
terse.RegionData.TimeDilation = 64096;
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(terse);
|
client.OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +262,7 @@ namespace OpenSim.world
|
||||||
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
||||||
{
|
{
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
|
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
@ -323,7 +330,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
//need to clean this up as it shares a lot of code with CreateFromPacket()
|
//need to clean this up as it shares a lot of code with CreateFromPacket()
|
||||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
|
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||||
objupdate.RegionData.TimeDilation = 64096;
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
@ -480,7 +487,7 @@ namespace OpenSim.world
|
||||||
this.primData.LocalID = this.localid;
|
this.primData.LocalID = this.localid;
|
||||||
this.primData.Position = this.position;
|
this.primData.Position = this.position;
|
||||||
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
|
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
|
||||||
OpenSimRoot.Instance.LocalWorld.localStorage.StorePrim(this.primData);
|
m_world.localStorage.StorePrim(this.primData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,20 @@ namespace OpenSim.world
|
||||||
private Random Rand = new Random();
|
private Random Rand = new Random();
|
||||||
private uint _primCount = 702000;
|
private uint _primCount = 702000;
|
||||||
private int storageCount;
|
private int storageCount;
|
||||||
|
private Dictionary<uint, SimClient> m_clientThreads;
|
||||||
|
private ulong m_regionHandle;
|
||||||
|
private World m_world;
|
||||||
|
private string m_regionName;
|
||||||
|
private SimConfig m_cfg;
|
||||||
|
|
||||||
public World()
|
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world, string regionName, SimConfig cfg)
|
||||||
{
|
{
|
||||||
|
m_clientThreads = clientThreads;
|
||||||
|
m_regionHandle = regionHandle;
|
||||||
|
m_world = world;
|
||||||
|
m_regionName = regionName;
|
||||||
|
m_cfg = cfg;
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
|
||||||
Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
|
Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
|
||||||
|
|
||||||
|
@ -115,9 +126,9 @@ namespace OpenSim.world
|
||||||
HeightmapGenHills hills = new HeightmapGenHills();
|
HeightmapGenHills hills = new HeightmapGenHills();
|
||||||
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||||
this.phyScene.SetTerrain(this.LandMap);
|
this.phyScene.SetTerrain(this.LandMap);
|
||||||
OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap);
|
m_cfg.SaveMap(this.LandMap);
|
||||||
|
|
||||||
foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) {
|
foreach(SimClient client in m_clientThreads.Values) {
|
||||||
this.SendLayerData(client);
|
this.SendLayerData(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +145,7 @@ namespace OpenSim.world
|
||||||
_primCount = prim.LocalID + 1;
|
_primCount = prim.LocalID + 1;
|
||||||
}
|
}
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
|
||||||
Primitive nPrim = new Primitive();
|
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, m_world);
|
||||||
nPrim.CreateFromStorage(prim);
|
nPrim.CreateFromStorage(prim);
|
||||||
this.Entities.Add(nPrim.uuid, nPrim);
|
this.Entities.Add(nPrim.uuid, nPrim);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +186,7 @@ namespace OpenSim.world
|
||||||
|
|
||||||
public void AddViewerAgent(SimClient AgentClient) {
|
public void AddViewerAgent(SimClient AgentClient) {
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
||||||
Avatar NewAvatar = new Avatar(AgentClient);
|
Avatar NewAvatar = new Avatar(AgentClient, m_world, m_regionName, m_clientThreads, m_regionHandle );
|
||||||
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);
|
||||||
|
@ -187,7 +198,7 @@ namespace OpenSim.world
|
||||||
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
|
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||||
Primitive prim = new Primitive();
|
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, m_world );
|
||||||
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
|
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
|
||||||
PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
|
PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
|
||||||
PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
|
PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
|
||||||
|
@ -210,7 +221,7 @@ namespace OpenSim.world
|
||||||
foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData )
|
foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData )
|
||||||
{
|
{
|
||||||
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
|
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
|
||||||
foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
|
foreach (Entity ent in m_world.Entities.Values)
|
||||||
{
|
{
|
||||||
if (ent.localid == Data.ObjectLocalID)
|
if (ent.localid == Data.ObjectLocalID)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +231,7 @@ namespace OpenSim.world
|
||||||
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
||||||
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
||||||
kill.ObjectData[0].ID = ent.localid;
|
kill.ObjectData[0].ID = ent.localid;
|
||||||
foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
|
foreach (SimClient client in m_clientThreads.Values)
|
||||||
{
|
{
|
||||||
client.OutPacket(kill);
|
client.OutPacket(kill);
|
||||||
}
|
}
|
||||||
|
@ -234,9 +245,9 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
foreach( libsecondlife.LLUUID uuid in DeRezEnts )
|
foreach( libsecondlife.LLUUID uuid in DeRezEnts )
|
||||||
{
|
{
|
||||||
lock (OpenSimRoot.Instance.LocalWorld.Entities)
|
lock (m_world.Entities)
|
||||||
{
|
{
|
||||||
OpenSimRoot.Instance.LocalWorld.Entities.Remove(uuid);
|
m_world.Entities.Remove(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim
|
||||||
|
|
||||||
if (sim.loginserver && sim.sandbox)
|
if (sim.loginserver && sim.sandbox)
|
||||||
{
|
{
|
||||||
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer);
|
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenAddr, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||||
loginServer.Startup();
|
loginServer.Startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue