aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgareth2007-03-06 15:57:36 +0000
committergareth2007-03-06 15:57:36 +0000
commitd828af7036fd11a4a1f678b2b7e51bdb6380087a (patch)
tree99544eb8c363afeccd0da17ba67970b8cc505d14
parentAdded sandbox mode and setup facility (diff)
downloadopensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.zip
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.gz
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.bz2
opensim-SC_OLD-d828af7036fd11a4a1f678b2b7e51bdb6380087a.tar.xz
Implemented local console and VERY rough skeleton for TCP/Worldchat console
Implemented seperate logging (but no packetlog or chat yet)
Diffstat (limited to '')
-rw-r--r--opensim.build1
-rw-r--r--src/Config.cs107
-rw-r--r--src/Main.cs49
-rw-r--r--src/OpenSimClient.cs45
-rw-r--r--src/ServerConsole.cs190
-rw-r--r--src/world/Avatar.cs15
-rw-r--r--src/world/PhysicsEngine.cs2
-rw-r--r--src/world/World.cs12
8 files changed, 293 insertions, 128 deletions
diff --git a/opensim.build b/opensim.build
index e2bf633..2fdf1cb 100644
--- a/opensim.build
+++ b/opensim.build
@@ -49,6 +49,7 @@
49 </references> 49 </references>
50 <sources basedir="src/"> 50 <sources basedir="src/">
51 <include name="AssemblyInfo.cs" /> 51 <include name="AssemblyInfo.cs" />
52 <include name="ServerConsole.cs" />
52 <include name="Config.cs" /> 53 <include name="Config.cs" />
53 <include name="VersionInfo.cs" /> 54 <include name="VersionInfo.cs" />
54 <include name="Util.cs" /> 55 <include name="Util.cs" />
diff --git a/src/Config.cs b/src/Config.cs
index dc01df9..55bcdfe 100644
--- a/src/Config.cs
+++ b/src/Config.cs
@@ -64,68 +64,27 @@ namespace OpenSim
64 64
65 public void LoadDefaults() { 65 public void LoadDefaults() {
66 string tempstring; 66 string tempstring;
67 Console.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 67 OpenSim_Main.localcons.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
68 Console.Write("Name [OpenSim test]:"); 68
69 tempstring=Console.ReadLine(); 69 this.RegionName=OpenSim_Main.localcons.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
70 if(tempstring=="") { 70 this.RegionLocX=(uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location X [997]: ","997"));
71 this.RegionName = "OpenSim test"; 71 this.RegionLocY=(uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location Y [996]: ","996"));
72 } else { 72 this.IPListenPort=Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("UDP port for client connections [9000]: ","9000"));
73 this.RegionName = tempstring; 73 this.IPListenAddr=OpenSim_Main.localcons.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
74 }
75
76 Console.Write("Grid location X [997]:");
77 tempstring=Console.ReadLine();
78 if(tempstring=="") {
79 this.RegionLocX = 997;
80 } else {
81 this.RegionLocX = (uint)Convert.ToInt32(tempstring);
82 }
83
84 Console.Write("Grid location Y [996]:");
85 tempstring=Console.ReadLine();
86 if(tempstring=="") {
87 this.RegionLocY = 996;
88 } else {
89 this.RegionLocY = (uint)Convert.ToInt32(tempstring);
90 }
91
92 Console.Write("Listen on UDP port for client connections [9000]:");
93 tempstring=Console.ReadLine();
94 if(tempstring=="") {
95 this.IPListenPort = 9000;
96 } else {
97 this.IPListenPort = Convert.ToInt32(tempstring);
98 }
99
100 Console.Write("Listen on IP address for client connections [127.0.0.1]:");
101 tempstring=Console.ReadLine();
102 if(tempstring=="") {
103 this.IPListenAddr = "127.0.0.1";
104 } else {
105 this.IPListenAddr = tempstring;
106 }
107 74
108 75
109 Console.Write("Run in sandbox or grid mode? [sandbox]:"); 76 tempstring=OpenSim_Main.localcons.CmdPrompt("Run in sandbox or grid mode? [sandbox]: ","sandbox", "sandbox", "grid");
110 tempstring=Console.ReadLine(); 77 if(tempstring=="grid"){
111 if(tempstring=="") {
112 this.sandbox = true;
113 } else if(tempstring=="grid"){
114 this.sandbox = false; 78 this.sandbox = false;
115 } else if(tempstring=="sandbox"){ 79 } else if(tempstring=="sandbox"){
116 this.sandbox=true; 80 this.sandbox=true;
117 } 81 }
118 82
119 if(!this.sandbox) { 83 if(!this.sandbox) {
120 Console.Write("Asset server URL:"); 84 this.AssetURL=OpenSim_Main.localcons.CmdPrompt("Asset server URL: ");
121 this.AssetURL=Console.ReadLine(); 85 this.AssetSendKey=OpenSim_Main.localcons.CmdPrompt("Asset server key: ");
122 Console.Write("Key to send to asset server:"); 86 this.GridURL=OpenSim_Main.localcons.CmdPrompt("Grid server URL: ");
123 this.AssetSendKey=Console.ReadLine(); 87 this.GridSendKey=OpenSim_Main.localcons.CmdPrompt("Grid server key: ");
124 Console.Write("Grid server URL:");
125 this.GridURL=Console.ReadLine();
126 Console.Write("Key to send to gridserver:");
127 this.GridSendKey=Console.ReadLine();
128
129 } 88 }
130 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256)); 89 this.RegionHandle = Helpers.UIntsToLong((RegionLocX*256), (RegionLocY*256));
131 } 90 }
@@ -135,7 +94,7 @@ namespace OpenSim
135 db = Db4oFactory.OpenFile("opensim.yap"); 94 db = Db4oFactory.OpenFile("opensim.yap");
136 IObjectSet result = db.Get(typeof(SimConfig)); 95 IObjectSet result = db.Get(typeof(SimConfig));
137 if(result.Count==1) { 96 if(result.Count==1) {
138 Console.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); 97 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
139 foreach (SimConfig cfg in result) { 98 foreach (SimConfig cfg in result) {
140 this.RegionName = cfg.RegionName; 99 this.RegionName = cfg.RegionName;
141 this.RegionLocX = cfg.RegionLocX; 100 this.RegionLocX = cfg.RegionLocX;
@@ -149,38 +108,38 @@ namespace OpenSim
149 this.GridSendKey = cfg.GridSendKey; 108 this.GridSendKey = cfg.GridSendKey;
150 } 109 }
151 } else { 110 } else {
152 Console.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 111 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
153 LoadDefaults(); 112 LoadDefaults();
154 Console.WriteLine("Writing out default settings to local database"); 113 OpenSim_Main.localcons.WriteLine("Writing out default settings to local database");
155 db.Set(this); 114 db.Set(this);
156 } 115 }
157 } catch(Exception e) { 116 } catch(Exception e) {
158 db.Close(); 117 db.Close();
159 Console.WriteLine("Config.cs:InitConfig() - Exception occured"); 118 OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Exception occured");
160 Console.WriteLine(e.ToString()); 119 OpenSim_Main.localcons.WriteLine(e.ToString());
161 } 120 }
162 Console.WriteLine("Sim settings loaded:"); 121 OpenSim_Main.localcons.WriteLine("Sim settings loaded:");
163 Console.WriteLine("Name: " + this.RegionName); 122 OpenSim_Main.localcons.WriteLine("Name: " + this.RegionName);
164 Console.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); 123 OpenSim_Main.localcons.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
165 Console.WriteLine("Region Handle: " + this.RegionHandle.ToString()); 124 OpenSim_Main.localcons.WriteLine("Region Handle: " + this.RegionHandle.ToString());
166 Console.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); 125 OpenSim_Main.localcons.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
167 Console.WriteLine("Sandbox Mode? " + this.sandbox.ToString()); 126 OpenSim_Main.localcons.WriteLine("Sandbox Mode? " + this.sandbox.ToString());
168 Console.WriteLine("Asset URL: " + this.AssetURL); 127 OpenSim_Main.localcons.WriteLine("Asset URL: " + this.AssetURL);
169 Console.WriteLine("Asset key: " + this.AssetSendKey); 128 OpenSim_Main.localcons.WriteLine("Asset key: " + this.AssetSendKey);
170 Console.WriteLine("Grid URL: " + this.GridURL); 129 OpenSim_Main.localcons.WriteLine("Grid URL: " + this.GridURL);
171 Console.WriteLine("Grid key: " + this.GridSendKey); 130 OpenSim_Main.localcons.WriteLine("Grid key: " + this.GridSendKey);
172 } 131 }
173 132
174 public World LoadWorld() { 133 public World LoadWorld() {
175 Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB"); 134 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB");
176 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World)); 135 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
177 // if(world_result.Count==1) { 136 // if(world_result.Count==1) {
178 // Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading"); 137 // OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
179 //return (World)world_result.Next(); 138 //return (World)world_result.Next();
180 // } else { 139 // } else {
181 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one"); 140 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
182 World blank = new World(); 141 World blank = new World();
183 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk"); 142 OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
184 //db.Set(blank); 143 //db.Set(blank);
185 //db.Commit(); 144 //db.Commit();
186 return blank; 145 return blank;
@@ -188,7 +147,7 @@ namespace OpenSim
188 } 147 }
189 148
190 public void LoadFromGrid() { 149 public void LoadFromGrid() {
191 Console.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); 150 OpenSim_Main.localcons.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
192 // TODO: Make this crap work 151 // TODO: Make this crap work
193 } 152 }
194 153
diff --git a/src/Main.cs b/src/Main.cs
index fe2183b..f3fa609 100644
--- a/src/Main.cs
+++ b/src/Main.cs
@@ -46,9 +46,11 @@ namespace OpenSim
46 /// </summary> 46 /// </summary>
47 public class OpenSim_Main 47 public class OpenSim_Main
48 { 48 {
49 public static DateTime startuptime;
49 public static OpenSim_Main sim; 50 public static OpenSim_Main sim;
50 public static SimConfig cfg; 51 public static SimConfig cfg;
51 public static World local_world; 52 public static World local_world;
53 public static ServerConsole localcons;
52 private static Thread MainListener; 54 private static Thread MainListener;
53 public static Socket Server; 55 public static Socket Server;
54 private static IPEndPoint ServerIncoming; 56 private static IPEndPoint ServerIncoming;
@@ -67,32 +69,49 @@ namespace OpenSim
67 sim = new OpenSim_Main(); 69 sim = new OpenSim_Main();
68 sim.Startup(); 70 sim.Startup();
69 while(true) { 71 while(true) {
70 local_world.DoStuff(); 72 localcons.MainConsolePrompt();
71 Thread.Sleep(100);
72 } 73 }
73 } 74 }
74 75
75 private OpenSim_Main() { 76 private OpenSim_Main() {
76 } 77 }
77 78
79 public static void Shutdown() {
80 localcons.WriteLine("Main.cs:Shutdown() - Closing all threads");
81 localcons.WriteLine("Main.cs:Shutdown() - Killing listener thread");
82 MainListener.Abort();
83 localcons.WriteLine("Main.cs:Shutdown() - Killing clients");
84 // IMPLEMENT THIS
85 localcons.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
86 localcons.Close();
87 Environment.Exit(0);
88 }
89
78 private void Startup() { 90 private void Startup() {
91 startuptime=DateTime.Now;
92 localcons=new ServerConsole(ServerConsole.ConsoleType.Local,"",0);
79 // We check our local database first, then the grid for config options 93 // We check our local database first, then the grid for config options
80 Console.WriteLine("Main.cs:Startup() - Loading configuration"); 94 localcons.WriteLine("Main.cs:Startup() - Loading configuration");
81 cfg = new SimConfig(); 95 cfg = new SimConfig();
82 cfg.InitConfig(); 96 cfg.InitConfig();
83 Console.WriteLine("Main.cs:Startup() - Contacting gridserver"); 97 localcons.WriteLine("Main.cs:Startup() - Contacting gridserver");
84 cfg.LoadFromGrid(); 98 cfg.LoadFromGrid();
85 99
86 Console.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); 100 localcons.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
87 Console.WriteLine("Initialising world"); 101 localcons.WriteLine("Initialising world");
88 local_world = cfg.LoadWorld(); 102 local_world = cfg.LoadWorld();
89 103
90 Console.WriteLine("Main.cs:Startup() - Starting up messaging system"); 104 localcons.WriteLine("Main.cs:Startup() - Starting up main world loop");
105 local_world.InitLoop();
106
107 localcons.WriteLine("Main.cs:Startup() - Starting up messaging system");
91 MainListener = new Thread(new ThreadStart(MainServerListener)); 108 MainListener = new Thread(new ThreadStart(MainServerListener));
92 MainListener.Start(); 109 MainListener.Start();
93 110
94 Console.WriteLine("Main.cs:Startup() - Starting up main world loop"); 111 Thread.Sleep(500); // give other threads a chance to catch up
95 local_world.InitLoop(); 112 string[] noparams = new string[1];
113 noparams[0]="";
114 localcons.WriteLine("\nOpenSim ready\nType help for list of commands");
96 } 115 }
97 116
98 private void OnReceivedData(IAsyncResult result) { 117 private void OnReceivedData(IAsyncResult result) {
@@ -102,7 +121,6 @@ namespace OpenSim
102 int numBytes = Server.EndReceiveFrom(result, ref epSender); 121 int numBytes = Server.EndReceiveFrom(result, ref epSender);
103 int packetEnd = numBytes - 1; 122 int packetEnd = numBytes - 1;
104 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 123 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
105 Console.Error.WriteLine(packet.ToString());
106 124
107 // This is either a new client or a packet to send to an old one 125 // This is either a new client or a packet to send to an old one
108 if(ClientThreads.ContainsKey(epSender)) { 126 if(ClientThreads.ContainsKey(epSender)) {
@@ -117,23 +135,24 @@ namespace OpenSim
117 } 135 }
118 136
119 private void MainServerListener() { 137 private void MainServerListener() {
120 Console.WriteLine("Main.cs:MainServerListener() - New thread started"); 138 localcons.WriteLine("Main.cs:MainServerListener() - New thread started");
121 Console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); 139 localcons.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
122 140
123 ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); 141 ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
124 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 142 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
125 Server.Bind(ServerIncoming); 143 Server.Bind(ServerIncoming);
126 144
127 Console.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); 145 localcons.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
128 146
129 ipeSender = new IPEndPoint(IPAddress.Any, 0); 147 ipeSender = new IPEndPoint(IPAddress.Any, 0);
130 epSender = (EndPoint) ipeSender; 148 epSender = (EndPoint) ipeSender;
131 ReceivedData = new AsyncCallback(this.OnReceivedData); 149 ReceivedData = new AsyncCallback(this.OnReceivedData);
132 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 150 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
133 151
134 Console.WriteLine("Main.cs:MainServerListener() - Listening..."); 152 localcons.WriteLine("Main.cs:MainServerListener() - Listening...");
135 while(true) { 153 while(true) {
136 Thread.Sleep(1000); 154 Thread.Sleep(100);
155 local_world.DoStuff();
137 } 156 }
138 } 157 }
139 } 158 }
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index 6b00a0f..0e956c3 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -49,7 +49,7 @@ namespace OpenSim
49 public world.Avatar ClientAvatar; 49 public world.Avatar ClientAvatar;
50 private UseCircuitCodePacket cirpack; 50 private UseCircuitCodePacket cirpack;
51 private Thread ClientThread; 51 private Thread ClientThread;
52 private EndPoint userEP; 52 public EndPoint userEP;
53 private BlockingQueue<QueItem> PacketQueue; 53 private BlockingQueue<QueItem> PacketQueue;
54 private BlockingQueue<TransferRequestPacket> AssetRequests; 54 private BlockingQueue<TransferRequestPacket> AssetRequests;
55 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 55 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
@@ -81,9 +81,9 @@ namespace OpenSim
81 81
82 public void AssetLoader() { 82 public void AssetLoader() {
83 if(OpenSim_Main.cfg.sandbox==false) { 83 if(OpenSim_Main.cfg.sandbox==false) {
84 Console.WriteLine("OpenSimClient.cs:AssetLoader() - Starting new thread"); 84 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Starting new thread");
85 TransferRequestPacket reqPacket = AssetRequests.Dequeue(); 85 TransferRequestPacket reqPacket = AssetRequests.Dequeue();
86 Console.WriteLine("OpenSimClient.cs:AssetLoader() - Got a request, processing it"); 86 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Got a request, processing it");
87 LLUUID AssetID = new LLUUID(reqPacket.TransferInfo.Params, 0); 87 LLUUID AssetID = new LLUUID(reqPacket.TransferInfo.Params, 0);
88 WebRequest AssetLoad = WebRequest.Create(OpenSim_Main.cfg.AssetURL + "getasset/" + OpenSim_Main.cfg.AssetSendKey + "/" + AssetID + "/data"); 88 WebRequest AssetLoad = WebRequest.Create(OpenSim_Main.cfg.AssetURL + "getasset/" + OpenSim_Main.cfg.AssetSendKey + "/" + AssetID + "/data");
89 WebResponse AssetResponse = AssetLoad.GetResponse(); 89 WebResponse AssetResponse = AssetLoad.GetResponse();
@@ -131,7 +131,12 @@ namespace OpenSim
131 AssetResponse.Close(); 131 AssetResponse.Close();
132 } 132 }
133 } 133 }
134 134
135 public void Logout() {
136 // TODO - kill any AssetLoaders
137 ClientThread.Abort();
138 }
139
135 public void ProcessInPacket(Packet Pack) { 140 public void ProcessInPacket(Packet Pack) {
136 ack_pack(Pack); 141 ack_pack(Pack);
137 switch(Pack.Type) { 142 switch(Pack.Type) {
@@ -146,7 +151,7 @@ namespace OpenSim
146 ClientAvatar.SendInitialAppearance(); 151 ClientAvatar.SendInitialAppearance();
147 break; 152 break;
148 case PacketType.TransferRequest: 153 case PacketType.TransferRequest:
149 Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 154 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
150 // We put transfer requests into a big queue and then spawn a thread for each new one 155 // We put transfer requests into a big queue and then spawn a thread for each new one
151 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 156 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
152 AssetRequests.Enqueue(transfer); 157 AssetRequests.Enqueue(transfer);
@@ -154,7 +159,7 @@ namespace OpenSim
154 AssetLoaderThread.Start(); 159 AssetLoaderThread.Start();
155 break; 160 break;
156 case PacketType.LogoutRequest: 161 case PacketType.LogoutRequest:
157 Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 162 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
158 lock(OpenSim_Main.local_world.Entities) { 163 lock(OpenSim_Main.local_world.Entities) {
159 OpenSim_Main.local_world.Entities.Remove(this.AgentID); 164 OpenSim_Main.local_world.Entities.Remove(this.AgentID);
160 } 165 }
@@ -166,7 +171,7 @@ namespace OpenSim
166 String grTest = sr.ReadLine(); 171 String grTest = sr.ReadLine();
167 sr.Close(); 172 sr.Close();
168 GridResponse.Close(); 173 GridResponse.Close();
169 Console.WriteLine("DEBUG: " + grTest); 174 OpenSim_Main.localcons.WriteLine("DEBUG: " + grTest);
170 } 175 }
171 this.ClientThread.Abort(); 176 this.ClientThread.Abort();
172 break; 177 break;
@@ -207,8 +212,6 @@ namespace OpenSim
207 { 212 {
208 if (now - packet.TickCount > RESEND_TIMEOUT) 213 if (now - packet.TickCount > RESEND_TIMEOUT)
209 { 214 {
210 Console.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
211 (now - packet.TickCount) + "ms have passed", Helpers.LogLevel.Info);
212 215
213 packet.Header.Resent = true; 216 packet.Header.Resent = true;
214 OutPacket(packet); 217 OutPacket(packet);
@@ -225,12 +228,10 @@ namespace OpenSim
225 { 228 {
226 if (PendingAcks.Count > 250) 229 if (PendingAcks.Count > 250)
227 { 230 {
228 // FIXME: Handle the odd case where we have too many pending ACKs queued up
229 Console.WriteLine("Too many ACKs queued up!", Helpers.LogLevel.Error);
230 return; 231 return;
231 } 232 }
232 233
233 Console.WriteLine("Sending PacketAck"); 234 OpenSim_Main.localcons.WriteLine("Sending PacketAck");
234 235
235 236
236 int i = 0; 237 int i = 0;
@@ -319,7 +320,6 @@ namespace OpenSim
319 } 320 }
320 } 321 }
321 322
322 Console.WriteLine("OUT: \n" + Pack.ToString());
323 323
324 byte[] ZeroOutBuffer = new byte[4096]; 324 byte[] ZeroOutBuffer = new byte[4096];
325 byte[] sendbuffer; 325 byte[] sendbuffer;
@@ -333,7 +333,7 @@ namespace OpenSim
333 OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP); 333 OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP);
334 } 334 }
335 } catch (Exception) { 335 } catch (Exception) {
336 Console.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); 336 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
337 ClientThread.Abort(); 337 ClientThread.Abort();
338 } 338 }
339 339
@@ -347,7 +347,7 @@ namespace OpenSim
347 { 347 {
348 foreach (uint ack in NewPack.Header.AckList) 348 foreach (uint ack in NewPack.Header.AckList)
349 { 349 {
350 Console.WriteLine("Got appended ack: "+ack); 350 OpenSim_Main.localcons.WriteLine("Got appended ack: "+ack);
351 NeedAck.Remove(ack); 351 NeedAck.Remove(ack);
352 } 352 }
353 } 353 }
@@ -362,7 +362,6 @@ namespace OpenSim
362 { 362 {
363 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) 363 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
364 { 364 {
365 Console.WriteLine("Got PacketAck: "+block.ID);
366 NeedAck.Remove(block.ID); 365 NeedAck.Remove(block.ID);
367 } 366 }
368 } 367 }
@@ -391,7 +390,7 @@ namespace OpenSim
391 } 390 }
392 391
393 public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) { 392 public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) {
394 Console.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); 393 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
395 cirpack = initialcirpack; 394 cirpack = initialcirpack;
396 userEP = remoteEP; 395 userEP = remoteEP;
397 PacketQueue = new BlockingQueue<QueItem>(); 396 PacketQueue = new BlockingQueue<QueItem>();
@@ -406,7 +405,7 @@ namespace OpenSim
406 } 405 }
407 406
408 private void ClientLoop() { 407 private void ClientLoop() {
409 Console.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop"); 408 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
410 while(true) { 409 while(true) {
411 QueItem nextPacket = PacketQueue.Dequeue(); 410 QueItem nextPacket = PacketQueue.Dequeue();
412 if(nextPacket.Incoming) 411 if(nextPacket.Incoming)
@@ -423,7 +422,7 @@ namespace OpenSim
423 } 422 }
424 423
425 private void InitNewClient() { 424 private void InitNewClient() {
426 Console.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 425 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
427 OpenSim_Main.local_world.AddViewerAgent(this); 426 OpenSim_Main.local_world.AddViewerAgent(this);
428 world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID]; 427 world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID];
429 this.ClientAvatar=(world.Avatar)tempent; 428 this.ClientAvatar=(world.Avatar)tempent;
@@ -431,23 +430,23 @@ namespace OpenSim
431 430
432 private void AuthUser() { 431 private void AuthUser() {
433 if(OpenSim_Main.cfg.sandbox==false) { 432 if(OpenSim_Main.cfg.sandbox==false) {
434 Console.WriteLine("OpenSimClient.cs:AuthUser() - Authenticating new user request with grid"); 433 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Authenticating new user request with grid");
435 WebRequest CheckSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + cirpack.CircuitCode.ID.ToString() + "/" + cirpack.CircuitCode.Code.ToString() + "/exists"); 434 WebRequest CheckSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + cirpack.CircuitCode.ID.ToString() + "/" + cirpack.CircuitCode.Code.ToString() + "/exists");
436 Console.WriteLine(OpenSim_Main.cfg.GridURL); 435 OpenSim_Main.localcons.WriteLine(OpenSim_Main.cfg.GridURL);
437 WebResponse GridResponse = CheckSession.GetResponse(); 436 WebResponse GridResponse = CheckSession.GetResponse();
438 StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); 437 StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
439 String grTest = sr.ReadLine(); 438 String grTest = sr.ReadLine();
440 sr.Close(); 439 sr.Close();
441 GridResponse.Close(); 440 GridResponse.Close();
442 if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) { // YAY! Valid login 441 if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) { // YAY! Valid login
443 Console.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); 442 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
444 this.AgentID=cirpack.CircuitCode.ID; 443 this.AgentID=cirpack.CircuitCode.ID;
445 this.SessionID=cirpack.CircuitCode.SessionID; 444 this.SessionID=cirpack.CircuitCode.SessionID;
446 this.CircuitCode=cirpack.CircuitCode.Code; 445 this.CircuitCode=cirpack.CircuitCode.Code;
447 InitNewClient(); 446 InitNewClient();
448 ClientLoop(); 447 ClientLoop();
449 } else { // Invalid 448 } else { // Invalid
450 Console.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); 449 OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
451 ClientThread.Abort(); 450 ClientThread.Abort();
452 } 451 }
453 } else { 452 } else {
diff --git a/src/ServerConsole.cs b/src/ServerConsole.cs
new file mode 100644
index 0000000..690e8ee
--- /dev/null
+++ b/src/ServerConsole.cs
@@ -0,0 +1,190 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.Threading;
34using System.IO;
35using System.Net;
36using libsecondlife;
37using libsecondlife.Packets;
38
39namespace OpenSim
40{
41 public class ServerConsole {
42 private ConsoleType ConsType;
43 StreamWriter Log;
44
45 public enum ConsoleType {
46 Local, // Use stdio
47 TCP, // Use TCP/telnet
48 SimChat // Use in-world chat (for gods)
49 }
50
51
52 // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!!
53 // constype - the type of console to use (see enum ConsoleType)
54 // sparam - depending on the console type:
55 // TCP - the IP to bind to (127.0.0.1 if blank)
56 // Local - param ignored
57 // SimChat - the AgentID of this sim's admin
58 // and for the iparam:
59 // TCP - the port to bind to
60 // Local - param ignored
61 // SimChat - the chat channel to accept commands from
62 public ServerConsole(ConsoleType constype, string sparam, int iparam) {
63 ConsType = constype;
64 switch(constype) {
65 case ConsoleType.Local:
66 Console.WriteLine("ServerConsole.cs - creating new local console");
67 Console.WriteLine("Logs will be saved to current directory in opensim-console.log");
68 Log=File.AppendText("opensim-console.log");
69 Log.WriteLine("========================================================================");
70 Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString());
71 break;
72 case ConsoleType.TCP:
73 break;
74 case ConsoleType.SimChat:
75 break;
76
77 default:
78 Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!");
79 break;
80 }
81 }
82
83 public void Close() {
84 Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString());
85 Log.Close();
86 }
87
88 // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here
89 public void WriteLine(string Line) {
90 Log.WriteLine(Line);
91 Console.WriteLine(Line);
92 return;
93 }
94
95 public string ReadLine() {
96 string TempStr=Console.ReadLine();
97 Log.WriteLine(TempStr);
98 return TempStr;
99 }
100
101 public int Read() {
102 int TempInt= Console.Read();
103 Log.Write((char)TempInt);
104 return TempInt;
105 }
106
107 public void Write(string Line) {
108 Console.Write(Line);
109 Log.Write(Line);
110 return;
111 }
112
113 // Displays a command prompt and waits for the user to enter a string, then returns that string
114 public string CmdPrompt(string prompt) {
115 this.Write(prompt);
116 return this.ReadLine();
117 }
118
119 // Displays a command prompt and returns a default value if the user simply presses enter
120 public string CmdPrompt(string prompt, string defaultresponse) {
121 string temp=CmdPrompt(prompt);
122 if(temp=="") {
123 return defaultresponse;
124 } else {
125 return temp;
126 }
127 }
128
129 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
130 public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) {
131 bool itisdone=false;
132 string temp=CmdPrompt(prompt,defaultresponse);
133 while(itisdone==false) {
134 if((temp==OptionA) || (temp==OptionB)) {
135 itisdone=true;
136 } else {
137 this.WriteLine("Valid options are " + OptionA + " or " + OptionB);
138 temp=CmdPrompt(prompt,defaultresponse);
139 }
140 }
141 return temp;
142 }
143
144 // Runs a command with a number of parameters
145 public Object RunCmd(string Cmd, string[] cmdparams) {
146 switch(Cmd) {
147 case "show":
148 ShowCommands(cmdparams[0]);
149 break;
150
151 case "shutdown":
152 OpenSim_Main.Shutdown();
153 break;
154 }
155 return null;
156 }
157
158 // Shows data about something
159 public void ShowCommands(string ShowWhat) {
160 switch(ShowWhat) {
161 case "uptime":
162 this.WriteLine("OpenSim has been running since " + OpenSim_Main.startuptime.ToString());
163 this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.startuptime).ToString());
164 break;
165 case "users":
166 OpenSim.world.Avatar TempAv;
167 this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
168 foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
169 TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
170 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()));
171 }
172 break;
173 }
174 }
175
176 // Displays a prompt to the user and then runs the command they entered
177 public void MainConsolePrompt() {
178 string[] tempstrarray;
179 string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # ");
180 tempstrarray = tempstr.Split(' ');
181 string cmd=tempstrarray[0];
182 Array.Reverse(tempstrarray);
183 Array.Resize<string>(ref tempstrarray,tempstrarray.Length-1);
184 Array.Reverse(tempstrarray);
185 string[] cmdparams=(string[])tempstrarray;
186 RunCmd(cmd,cmdparams);
187 }
188 }
189
190}
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index 6dcc1dd..26b2002 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -21,7 +21,7 @@ namespace OpenSim.world
21 private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; 21 private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
22 22
23 public Avatar(OpenSimClient TheClient) { 23 public Avatar(OpenSimClient TheClient) {
24 Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 24 OpenSim_Main.localcons.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
25 ControllingClient=TheClient; 25 ControllingClient=TheClient;
26 SetupTemplate("avatar-template.dat"); 26 SetupTemplate("avatar-template.dat");
27 27
@@ -32,8 +32,6 @@ namespace OpenSim.world
32 lock(this) { 32 lock(this) {
33 base.update(); 33 base.update();
34 34
35 Console.WriteLine("KeyMask: " + this.CurrentKeyMask);
36
37 oldvel=this.velocity; 35 oldvel=this.velocity;
38 oldpos=this.position; 36 oldpos=this.position;
39 if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { 37 if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) {
@@ -42,7 +40,6 @@ namespace OpenSim.world
42 this.velocity.X = tmpVelocity.x; 40 this.velocity.X = tmpVelocity.x;
43 this.velocity.Y = tmpVelocity.y; 41 this.velocity.Y = tmpVelocity.y;
44 this.velocity.Z = tmpVelocity.z; 42 this.velocity.Z = tmpVelocity.z;
45 Console.WriteLine("Walking at "+ this.velocity.ToString());
46 this.walking=true; 43 this.walking=true;
47 } else { 44 } else {
48 this.velocity.X=0; 45 this.velocity.X=0;
@@ -82,7 +79,7 @@ namespace OpenSim.world
82 } 79 }
83 80
84 public void CompleteMovement(World RegionInfo) { 81 public void CompleteMovement(World RegionInfo) {
85 Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); 82 OpenSim_Main.localcons.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
86 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 83 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
87 mov.AgentData.SessionID = this.ControllingClient.SessionID; 84 mov.AgentData.SessionID = this.ControllingClient.SessionID;
88 mov.AgentData.AgentID = this.ControllingClient.AgentID; 85 mov.AgentData.AgentID = this.ControllingClient.AgentID;
@@ -92,7 +89,7 @@ namespace OpenSim.world
92 mov.Data.Position = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); 89 mov.Data.Position = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z);
93 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); 90 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
94 91
95 Console.WriteLine("Sending AgentMovementComplete packet"); 92 OpenSim_Main.localcons.WriteLine("Sending AgentMovementComplete packet");
96 ControllingClient.OutPacket(mov); 93 ControllingClient.OutPacket(mov);
97 } 94 }
98 95
@@ -213,11 +210,11 @@ namespace OpenSim.world
213 } 210 }
214 211
215 public void SendRegionHandshake(World RegionInfo) { 212 public void SendRegionHandshake(World RegionInfo) {
216 Console.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); 213 OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
217 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 214 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
218 RegionHandshakePacket handshake = new RegionHandshakePacket(); 215 RegionHandshakePacket handshake = new RegionHandshakePacket();
219 216
220 Console.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); 217 OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
221 handshake.RegionInfo.BillableFactor = 0; 218 handshake.RegionInfo.BillableFactor = 0;
222 handshake.RegionInfo.IsEstateManager = false; 219 handshake.RegionInfo.IsEstateManager = false;
223 handshake.RegionInfo.TerrainHeightRange00 = 60; 220 handshake.RegionInfo.TerrainHeightRange00 = 60;
@@ -243,7 +240,7 @@ namespace OpenSim.world
243 handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); 240 handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
244 handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); 241 handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
245 242
246 Console.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); 243 OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
247 this.ControllingClient.OutPacket(handshake); 244 this.ControllingClient.OutPacket(handshake);
248 } 245 }
249 246
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs
index 4abf1f2..b237f5e 100644
--- a/src/world/PhysicsEngine.cs
+++ b/src/world/PhysicsEngine.cs
@@ -14,7 +14,7 @@ namespace OpenSim.world
14 } 14 }
15 15
16 public void Startup() { 16 public void Startup() {
17 Console.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!"); 17 OpenSim_Main.localcons.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!");
18 } 18 }
19 19
20 public void DoStuff(World simworld) { 20 public void DoStuff(World simworld) {
diff --git a/src/world/World.cs b/src/world/World.cs
index f32f9ef..2f73bd5 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -20,10 +20,10 @@ namespace OpenSim.world
20 20
21 public World() 21 public World()
22 { 22 {
23 Console.WriteLine("World.cs - creating new entitities instance"); 23 OpenSim_Main.localcons.WriteLine("World.cs - creating new entitities instance");
24 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 24 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
25 25
26 Console.WriteLine("World.cs - creating LandMap"); 26 OpenSim_Main.localcons.WriteLine("World.cs - creating LandMap");
27 terrainengine = new TerrainDecode(); 27 terrainengine = new TerrainDecode();
28 LandMap = new float[65536]; 28 LandMap = new float[65536];
29 for(int i =0; i < 65536; i++) { 29 for(int i =0; i < 65536; i++) {
@@ -33,7 +33,7 @@ namespace OpenSim.world
33 } 33 }
34 34
35 public void InitLoop() { 35 public void InitLoop() {
36 Console.WriteLine("World.cs:StartLoop() - Initialising physics"); 36 OpenSim_Main.localcons.WriteLine("World.cs:StartLoop() - Initialising physics");
37 this.physics = new PhysicsEngine(); 37 this.physics = new PhysicsEngine();
38 physics.Startup(); 38 physics.Startup();
39 } 39 }
@@ -76,11 +76,11 @@ namespace OpenSim.world
76 } 76 }
77 77
78 public void AddViewerAgent(OpenSimClient AgentClient) { 78 public void AddViewerAgent(OpenSimClient AgentClient) {
79 Console.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 79 OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
80 Avatar NewAvatar = new Avatar(AgentClient); 80 Avatar NewAvatar = new Avatar(AgentClient);
81 Console.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 81 OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
82 this.Entities.Add(AgentClient.AgentID, NewAvatar); 82 this.Entities.Add(AgentClient.AgentID, NewAvatar);
83 Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 83 OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
84 NewAvatar.SendRegionHandshake(this); 84 NewAvatar.SendRegionHandshake(this);
85 this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user 85 this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
86 } 86 }