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;
public void LoadDefaults() {
this.RegionName = "OpenSim test\0";
this.RegionLocX = 997;
this.RegionLocY = 996;
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
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.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() {
@ -89,19 +95,25 @@ namespace Db40SimConfig
}
}
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() - Found an OpenSim.world.World object in local database, loading");
return (World)world_result.Next();
} else {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
public override World LoadWorld()
{
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
World blank = new World();
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
db.Set(blank);
db.Commit();
return blank;
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 {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
for(int i =0; i < 65536; i++) {
blank.LandMap[i] = 21.4989f; //redundant code as the landmap is already set to this in the world constructor
}
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
db.Set(blank.LandMap);
db.Commit();
}
return blank;
}
public override void LoadFromGrid() {

View File

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

View File

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

View File

@ -162,15 +162,15 @@ namespace OpenSim
public override void ShowCommands(string ShowWhat) {
switch(ShowWhat) {
case "uptime":
//this.WriteLine("OpenSim has been running since " + OpenSim_Main.startuptime.ToString());
// this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.startuptime).ToString());
this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString());
this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString());
break;
case "users":
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"));
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
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;
}