Imported Gareth's Sim Config changes.

ConvertToPlugins
MW 2007-03-06 22:22:37 +00:00
parent 087965ba1b
commit 065b15f593
4 changed files with 47 additions and 34 deletions

View File

@ -46,16 +46,22 @@ namespace Db40SimConfig
private IObjectContainer db; private IObjectContainer db;
public void LoadDefaults() { public void LoadDefaults() {
this.RegionName = "OpenSim test\0"; ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
this.RegionLocX = 997;
this.RegionLocY = 996; this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
if(!OpenSim_Main.sim.sandbox)
{
this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: ");
this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: ");
this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: ");
this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server key: ");
}
this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
this.IPListenPort = 9000;
this.IPListenAddr = "127.0.0.1";
this.AssetURL = "http://www.osgrid.org/ogs/assetserver/";
this.AssetSendKey = "1234";
this.GridURL = "http://www.osgrid.org/ogs/gridserver/";
this.GridSendKey = "1234";
} }
public override void InitConfig() { public override void InitConfig() {
@ -89,19 +95,25 @@ namespace Db40SimConfig
} }
} }
public override World LoadWorld() { public override World LoadWorld()
IObjectSet world_result = db.Get(typeof(OpenSim.world.World)); {
if(world_result.Count==1) { ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading"); World blank = new World();
return (World)world_result.Next(); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
IObjectSet world_result = db.Get(new float[65536]);
if(world_result.Count>0) {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
blank.LandMap=(float[])world_result.Next();
} else { } else {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one"); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
World blank = new World(); for(int i =0; i < 65536; i++) {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk"); blank.LandMap[i] = 21.4989f; //redundant code as the landmap is already set to this in the world constructor
db.Set(blank); }
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
db.Set(blank.LandMap);
db.Commit(); db.Commit();
return blank;
} }
return blank;
} }
public override void LoadFromGrid() { public override void LoadFromGrid() {

View File

@ -56,9 +56,7 @@ namespace OpenSim
public static SimConfig cfg; public static SimConfig cfg;
public static World local_world; public static World local_world;
public static Grid gridServers; public static Grid gridServers;
public static AssetCache assetCache;
//private static Thread MainListener;
//private static Thread PingRespponder;
public static Socket Server; public static Socket Server;
private static IPEndPoint ServerIncoming; private static IPEndPoint ServerIncoming;
private static byte[] RecvBuffer = new byte[4096]; private static byte[] RecvBuffer = new byte[4096];
@ -67,10 +65,14 @@ namespace OpenSim
private static EndPoint epSender; private static EndPoint epSender;
private static AsyncCallback ReceivedData; private static AsyncCallback ReceivedData;
public AssetCache assetCache;
public DateTime startuptime;
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>(); public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
private PhysicsManager physManager; private PhysicsManager physManager;
private System.Timers.Timer timer1 = new System.Timers.Timer(); private System.Timers.Timer timer1 = new System.Timers.Timer();
private string ConfigDll = "SimConfig.dll"; private string ConfigDll = "SimConfig.dll";
public bool sandbox = false;
public bool loginserver = false;
[STAThread] [STAThread]
public static void Main( string[] args ) public static void Main( string[] args )
@ -81,22 +83,20 @@ namespace OpenSim
sim = new OpenSim_Main(); sim = new OpenSim_Main();
bool sandbox = false;
bool loginserver = false;
for (int i = 0; i < args.Length; i++) for (int i = 0; i < args.Length; i++)
{ {
if(args[i] == "-sandbox") if(args[i] == "-sandbox")
{ {
sandbox = true; sim.sandbox = true;
} }
if(args[i] == "-loginserver") if(args[i] == "-loginserver")
{ {
loginserver = true; sim.loginserver = true;
} }
} }
OpenSim_Main.gridServers = new Grid(); OpenSim_Main.gridServers = new Grid();
if(sandbox) if(sim.sandbox)
{ {
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
@ -111,12 +111,12 @@ namespace OpenSim
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
} }
if(loginserver && sandbox) if(sim.loginserver && sim.sandbox)
{ {
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
loginServer.Startup(); loginServer.Startup();
} }
assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
sim.Startup(); sim.Startup();
@ -129,6 +129,7 @@ namespace OpenSim
} }
private void Startup() { private void Startup() {
startuptime=DateTime.Now;
timer1.Enabled = true; timer1.Enabled = true;
timer1.Interval = 100; timer1.Interval = 100;
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );

View File

@ -50,7 +50,7 @@ namespace OpenSim
public world.Avatar ClientAvatar; public world.Avatar ClientAvatar;
private UseCircuitCodePacket cirpack; private UseCircuitCodePacket cirpack;
private Thread ClientThread; private Thread ClientThread;
private EndPoint userEP; public EndPoint userEP;
private BlockingQueue<QueItem> PacketQueue; private BlockingQueue<QueItem> PacketQueue;
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
@ -94,7 +94,7 @@ namespace OpenSim
case PacketType.TransferRequest: case PacketType.TransferRequest:
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
TransferRequestPacket transfer = (TransferRequestPacket)Pack; TransferRequestPacket transfer = (TransferRequestPacket)Pack;
OpenSim_Main.assetCache.AddAssetRequest(this, transfer); OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer);
break; break;
case PacketType.AgentUpdate: case PacketType.AgentUpdate:
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);

View File

@ -162,15 +162,15 @@ namespace OpenSim
public override void ShowCommands(string ShowWhat) { public override void ShowCommands(string ShowWhat) {
switch(ShowWhat) { switch(ShowWhat) {
case "uptime": case "uptime":
//this.WriteLine("OpenSim has been running since " + OpenSim_Main.startuptime.ToString()); this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString());
// this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.startuptime).ToString()); this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString());
break; break;
case "users": case "users":
OpenSim.world.Avatar TempAv; OpenSim.world.Avatar TempAv;
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
//this.WriteLine(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())); this.WriteLine(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()));
} }
break; break;
} }