aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-05-27 18:52:42 +0000
committerMW2007-05-27 18:52:42 +0000
commitc746a2f9f4f0b1e7eea564effdae63472f79ab22 (patch)
tree54d23af3d168958bfec995cf2987cf5af79ac149 /OpenSim
parentGoodbye World (diff)
downloadopensim-SC-c746a2f9f4f0b1e7eea564effdae63472f79ab22.zip
opensim-SC-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.gz
opensim-SC-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.bz2
opensim-SC-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.xz
Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs43
-rw-r--r--OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs96
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.Grid.cs1
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs18
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs17
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs97
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientViewBase.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/CommsManager.cs10
-rw-r--r--OpenSim/OpenSim.RegionServer/Grid.cs14
-rw-r--r--OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs91
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj127
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSimMain.cs531
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs5
-rw-r--r--OpenSim/OpenSim.RegionServer/PacketServer.cs40
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionInfo.cs70
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionInfoBase.cs32
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionServerBase.cs13
-rw-r--r--OpenSim/OpenSim.RegionServer/UDPServer.cs34
-rw-r--r--OpenSim/OpenSim.RegionServer/UserConfigUtility.cs10
-rw-r--r--OpenSim/OpenSim.RegionServer/VersionInfo.cs2
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs1
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs2
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs2
-rw-r--r--OpenSim/OpenSim.World/Avatar.Update.cs7
-rw-r--r--OpenSim/OpenSim.World/Avatar.cs18
-rw-r--r--OpenSim/OpenSim.World/OpenSim.World.csproj52
-rw-r--r--OpenSim/OpenSim.World/Primitive.cs476
-rw-r--r--OpenSim/OpenSim.World/SceneObject.cs6
-rw-r--r--OpenSim/OpenSim.World/World.PacketHandlers.cs175
-rw-r--r--OpenSim/OpenSim.World/World.Scripting.cs2
-rw-r--r--OpenSim/OpenSim.World/World.cs110
-rw-r--r--OpenSim/OpenSim.World/WorldBase.cs45
-rw-r--r--OpenSim/OpenSim.World/scripting/IScriptHandler.cs2
-rw-r--r--OpenSim/OpenSim/OpenSim.csproj55
-rw-r--r--OpenSim/OpenSim/OpenSimMain.cs225
36 files changed, 1068 insertions, 1365 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
index ccebb24..f82418d 100644
--- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
+++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Reflection;
31using libsecondlife; 32using libsecondlife;
32using libsecondlife.Packets; 33using libsecondlife.Packets;
33using OpenSim; 34using OpenSim;
@@ -71,6 +72,20 @@ namespace OpenSim.Assets
71 72
72 } 73 }
73 74
75 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
76 {
77 Console.WriteLine("Creating Asset cache");
78 _assetServer = this.LoadAssetDll(assetServerDLLName);
79 _assetServer.SetServerInfo(assetServerURL, assetServerKey);
80 _assetServer.SetReceiver(this);
81 Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
82 Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
83 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
84 this._assetCacheThread.IsBackground = true;
85 this._assetCacheThread.Start();
86
87 }
88
74 /// <summary> 89 /// <summary>
75 /// 90 ///
76 /// </summary> 91 /// </summary>
@@ -513,6 +528,34 @@ namespace OpenSim.Assets
513 } 528 }
514 #endregion 529 #endregion
515 530
531 private IAssetServer LoadAssetDll(string dllName)
532 {
533 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
534 IAssetServer server = null;
535
536 foreach (Type pluginType in pluginAssembly.GetTypes())
537 {
538 if (pluginType.IsPublic)
539 {
540 if (!pluginType.IsAbstract)
541 {
542 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
543
544 if (typeInterface != null)
545 {
546 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
547 server = plug.GetAssetServer();
548 break;
549 }
550
551 typeInterface = null;
552 }
553 }
554 }
555 pluginAssembly = null;
556 return server;
557 }
558
516 } 559 }
517 560
518 public class AssetRequest 561 public class AssetRequest
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 1f508ce..c5d5dc2 100644
--- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -2,13 +2,11 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using OpenSim.world;
6using OpenSim.UserServer; 5using OpenSim.UserServer;
7using OpenSim.Servers; 6using OpenSim.Servers;
8using OpenSim.Assets; 7using OpenSim.Assets;
9using OpenSim.Framework.Inventory; 8using OpenSim.Framework.Inventory;
10using libsecondlife; 9using libsecondlife;
11using OpenSim.RegionServer.world.scripting;
12using Avatar=libsecondlife.Avatar; 10using Avatar=libsecondlife.Avatar;
13 11
14namespace OpenSim.CAPS 12namespace OpenSim.CAPS
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
new file mode 100644
index 0000000..579928c
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -0,0 +1,96 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5using OpenSim.Framework.Inventory;
6using libsecondlife;
7using libsecondlife.Packets;
8
9namespace OpenSim
10{
11 partial class ClientView
12 {
13 public event ChatFromViewer OnChatFromViewer;
14 public event RezObject OnRezObject;
15 public event GenericCall4 OnDeRezObject;
16 public event ModifyTerrain OnModifyTerrain;
17 public event GenericCall OnRegionHandShakeReply;
18 public event GenericCall OnRequestWearables;
19 public event SetAppearance OnSetAppearance;
20 public event GenericCall2 OnCompleteMovementToRegion;
21 public event GenericCall3 OnAgentUpdate;
22 public event StartAnim OnStartAnim;
23 public event GenericCall OnRequestAvatarsData;
24 public event LinkObjects OnLinkObjects;
25 public event GenericCall4 OnAddPrim;
26 public event UpdateShape OnUpdatePrimShape;
27 public event ObjectSelect OnObjectSelect;
28 public event UpdatePrimFlags OnUpdatePrimFlags;
29 public event UpdatePrimTexture OnUpdatePrimTexture;
30 public event UpdatePrimVector OnUpdatePrimPosition;
31 public event UpdatePrimRotation OnUpdatePrimRotation;
32 public event UpdatePrimVector OnUpdatePrimScale;
33 public event StatusChange OnChildAgentStatus;
34 public event GenericCall2 OnStopMovement;
35
36 public LLVector3 StartPos
37 {
38 get
39 {
40 return startpos;
41 }
42 set
43 {
44 startpos = value;
45 }
46 }
47
48 public LLUUID AgentId
49 {
50 get
51 {
52 return this.AgentID;
53 }
54 }
55
56 #region World/Avatar to Client
57 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
58 {
59 System.Text.Encoding enc = System.Text.Encoding.ASCII;
60 libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
61 reply.ChatData.Audible = 1;
62 reply.ChatData.Message = message;
63 reply.ChatData.ChatType = type;
64 reply.ChatData.SourceType = 1;
65 reply.ChatData.Position = fromPos;
66 reply.ChatData.FromName = enc.GetBytes(fromName + "\0");
67 reply.ChatData.OwnerID = fromAgentID;
68 reply.ChatData.SourceID = fromAgentID;
69
70 this.OutPacket(reply);
71 }
72
73 public void SendAppearance(AvatarWearable[] wearables)
74 {
75 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
76 aw.AgentData.AgentID = this.AgentID;
77 aw.AgentData.SerialNum = 0;
78 aw.AgentData.SessionID = this.SessionID;
79
80 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
81 AgentWearablesUpdatePacket.WearableDataBlock awb;
82 for (int i = 0; i < wearables.Length; i++)
83 {
84 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
85 awb.WearableType = (byte)i;
86 awb.AssetID = wearables[i].AssetID;
87 awb.ItemID = wearables[i].ItemID;
88 aw.WearableData[i] = awb;
89 }
90
91 this.OutPacket(aw);
92 }
93 #endregion
94
95 }
96}
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
index b4e4b5f..9545db8 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
@@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
index 75fcf18..3c39781 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
@@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
@@ -42,26 +41,21 @@ namespace OpenSim
42 KillObjectPacket kill = new KillObjectPacket(); 41 KillObjectPacket kill = new KillObjectPacket();
43 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 42 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
44 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 43 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
45 kill.ObjectData[0].ID = this.ClientAvatar.localid; 44 // kill.ObjectData[0].ID = this.ClientAvatar.localid;
46 foreach (ClientView client in m_clientThreads.Values) 45 foreach (ClientView client in m_clientThreads.Values)
47 { 46 {
48 client.OutPacket(kill); 47 client.OutPacket(kill);
49 } 48 }
50 if (this.m_userServer != null) 49
51 { 50 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
52 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); 51
53 }
54 else
55 {
56 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
57 }
58 52
59 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); 53 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
60 /*lock (m_world.Entities) 54 /*lock (m_world.Entities)
61 { 55 {
62 m_world.Entities.Remove(this.AgentID); 56 m_world.Entities.Remove(this.AgentID);
63 }*/ 57 }*/
64 m_world.RemoveViewerAgent(this); 58 // m_world.RemoveViewerAgent(this);
65 //need to do other cleaning up here too 59 //need to do other cleaning up here too
66 m_clientThreads.Remove(this.CircuitCode); 60 m_clientThreads.Remove(this.CircuitCode);
67 m_networkServer.RemoveClientCircuit(this.CircuitCode); 61 m_networkServer.RemoveClientCircuit(this.CircuitCode);
@@ -109,7 +103,7 @@ namespace OpenSim
109 else if (multipleupdate.ObjectData[i].Type == 13)//scale 103 else if (multipleupdate.ObjectData[i].Type == 13)//scale
110 { 104 {
111 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 105 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
112 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 106 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
113 } 107 }
114 } 108 }
115 return true; 109 return true;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 6a33432..54cb662 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -13,15 +13,12 @@ using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory; 14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities; 15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets; 16using OpenSim.Assets;
18 17
19namespace OpenSim 18namespace OpenSim
20{ 19{
21 public partial class ClientView 20 public partial class ClientView
22 { 21 {
23
24
25 protected override void ProcessInPacket(Packet Pack) 22 protected override void ProcessInPacket(Packet Pack)
26 { 23 {
27 ack_pack(Pack); 24 ack_pack(Pack);
@@ -65,10 +62,10 @@ namespace OpenSim
65 //empty message so don't bother with it 62 //empty message so don't bother with it
66 break; 63 break;
67 } 64 }
68 string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname; 65 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
69 byte[] message = inchatpack.ChatData.Message; 66 byte[] message = inchatpack.ChatData.Message;
70 byte type = inchatpack.ChatData.Type; 67 byte type = inchatpack.ChatData.Type;
71 LLVector3 fromPos = ClientAvatar.Pos; 68 LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
72 LLUUID fromAgentID = AgentID; 69 LLUUID fromAgentID = AgentID;
73 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); 70 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
74 break; 71 break;
@@ -151,7 +148,7 @@ namespace OpenSim
151 OnLinkObjects(parentprimid, childrenprims); 148 OnLinkObjects(parentprimid, childrenprims);
152 break; 149 break;
153 case PacketType.ObjectAdd: 150 case PacketType.ObjectAdd:
154 m_world.AddNewPrim((ObjectAddPacket)Pack, this); 151 // m_world.AddNewPrim((ObjectAddPacket)Pack, this);
155 OnAddPrim(Pack, this); 152 OnAddPrim(Pack, this);
156 break; 153 break;
157 case PacketType.ObjectShape: 154 case PacketType.ObjectShape:
@@ -270,7 +267,7 @@ namespace OpenSim
270 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 267 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
271 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); 268 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
272 bool foundent = false; 269 bool foundent = false;
273 foreach (Entity ent in m_world.Entities.Values) 270 /* foreach (Entity ent in m_world.Entities.Values)
274 { 271 {
275 if (ent.localid == requesttask.InventoryData.LocalID) 272 if (ent.localid == requesttask.InventoryData.LocalID)
276 { 273 {
@@ -283,13 +280,13 @@ namespace OpenSim
283 if (foundent) 280 if (foundent)
284 { 281 {
285 this.OutPacket(replytask); 282 this.OutPacket(replytask);
286 } 283 }*/
287 break; 284 break;
288 case PacketType.UpdateTaskInventory: 285 case PacketType.UpdateTaskInventory:
289 // Console.WriteLine(Pack.ToString()); 286 // Console.WriteLine(Pack.ToString());
290 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 287 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
291 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); 288 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
292 if (myinventory != null) 289 /*if (myinventory != null)
293 { 290 {
294 if (updatetask.UpdateData.Key == 0) 291 if (updatetask.UpdateData.Key == 0)
295 { 292 {
@@ -315,7 +312,7 @@ namespace OpenSim
315 } 312 }
316 } 313 }
317 } 314 }
318 } 315 }*/
319 break; 316 break;
320 case PacketType.MapLayerRequest: 317 case PacketType.MapLayerRequest:
321 this.RequestMapLayer(); 318 this.RequestMapLayer();
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index a422102..0419b7a 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -35,11 +35,11 @@ using System.Net.Sockets;
35using System.IO; 35using System.IO;
36using System.Threading; 36using System.Threading;
37using System.Timers; 37using System.Timers;
38using OpenSim.Framework;
38using OpenSim.Framework.Interfaces; 39using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Types; 40using OpenSim.Framework.Types;
40using OpenSim.Framework.Inventory; 41using OpenSim.Framework.Inventory;
41using OpenSim.Framework.Utilities; 42using OpenSim.Framework.Utilities;
42using OpenSim.world;
43using OpenSim.Assets; 43using OpenSim.Assets;
44 44
45namespace OpenSim 45namespace OpenSim
@@ -58,73 +58,40 @@ namespace OpenSim
58 public LLUUID AgentID; 58 public LLUUID AgentID;
59 public LLUUID SessionID; 59 public LLUUID SessionID;
60 public LLUUID SecureSessionID = LLUUID.Zero; 60 public LLUUID SecureSessionID = LLUUID.Zero;
61 public bool m_child; 61 public bool m_child = false;
62 public world.Avatar ClientAvatar;
63 private UseCircuitCodePacket cirpack; 62 private UseCircuitCodePacket cirpack;
64 public Thread ClientThread; 63 public Thread ClientThread;
65 public LLVector3 startpos; 64 public LLVector3 startpos;
66 65
67 private AgentAssetUpload UploadAssets; 66 private AgentAssetUpload UploadAssets;
68 private LLUUID newAssetFolder = LLUUID.Zero; 67 private LLUUID newAssetFolder = LLUUID.Zero;
69 private bool debug = false; 68 private bool debug = false;
70 private World m_world; 69 private IWorld m_world;
71 private Dictionary<uint, ClientView> m_clientThreads; 70 private Dictionary<uint, ClientView> m_clientThreads;
72 private AssetCache m_assetCache; 71 private AssetCache m_assetCache;
73 private IGridServer m_gridServer; 72 private IGridServer m_gridServer;
74 private IUserServer m_userServer = null;
75 private InventoryCache m_inventoryCache; 73 private InventoryCache m_inventoryCache;
76 public bool m_sandboxMode;
77 private int cachedtextureserial = 0; 74 private int cachedtextureserial = 0;
78 private RegionInfo m_regionData; 75 private RegionInfo m_regionData;
79 protected AuthenticateSessionsBase m_authenticateSessionsHandler; 76 protected AuthenticateSessionsBase m_authenticateSessionsHandler;
80 77
81 public IUserServer UserServer
82 {
83 set
84 {
85 this.m_userServer = value;
86 }
87 }
88 78
89 public LLVector3 StartPos 79 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
90 { 80 {
91 get
92 {
93 return startpos;
94 }
95 set
96 {
97 startpos = value;
98 }
99 }
100 81
101 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions)
102 {
103 m_world = world;
104 m_clientThreads = clientThreads; 82 m_clientThreads = clientThreads;
105 m_assetCache = assetCache; 83 m_assetCache = assetCache;
106 m_gridServer = gridServer; 84
107 m_networkServer = application; 85 m_networkServer = packServer;
108 m_inventoryCache = inventoryCache; 86 m_inventoryCache = inventoryCache;
109 m_sandboxMode = sandboxMode;
110 m_child = child;
111 m_regionData = regionDat;
112 m_authenticateSessionsHandler = authenSessions; 87 m_authenticateSessionsHandler = authenSessions;
113 88
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); 89 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request");
115 cirpack = initialcirpack; 90 cirpack = initialcirpack;
116 userEP = remoteEP; 91 userEP = remoteEP;
117 92
118 if (m_gridServer.GetName() == "Remote") 93 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
119 { 94 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
120 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
121 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
122 //Console.WriteLine("start pos is " + this.startpos.X + " , " + this.startpos.Y + " , " + this.startpos.Z);
123 }
124 else
125 {
126 this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f);
127 }
128 95
129 PacketQueue = new BlockingQueue<QueItem>(); 96 PacketQueue = new BlockingQueue<QueItem>();
130 97
@@ -146,11 +113,10 @@ namespace OpenSim
146 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); 113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
147 this.m_child = false; 114 this.m_child = false;
148 //this.m_world.RemoveViewerAgent(this); 115 //this.m_world.RemoveViewerAgent(this);
149 if (!this.m_sandboxMode) 116
150 { 117 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
151 this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); 118 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
152 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); 119
153 }
154 OnChildAgentStatus(this.m_child); 120 OnChildAgentStatus(this.m_child);
155 //this.InitNewClient(); 121 //this.InitNewClient();
156 } 122 }
@@ -169,21 +135,16 @@ namespace OpenSim
169 KillObjectPacket kill = new KillObjectPacket(); 135 KillObjectPacket kill = new KillObjectPacket();
170 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 136 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
171 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 137 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
172 kill.ObjectData[0].ID = this.ClientAvatar.localid; 138 //kill.ObjectData[0].ID = this.ClientAvatar.localid;
173 foreach (ClientView client in m_clientThreads.Values) 139 foreach (ClientView client in m_clientThreads.Values)
174 { 140 {
175 client.OutPacket(kill); 141 client.OutPacket(kill);
176 } 142 }
177 if (this.m_userServer != null)
178 {
179 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
180 }
181 else
182 {
183 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
184 }
185 143
186 m_world.RemoveViewerAgent(this); 144 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
145
146
147 // m_world.RemoveViewerAgent(this);
187 148
188 m_clientThreads.Remove(this.CircuitCode); 149 m_clientThreads.Remove(this.CircuitCode);
189 m_networkServer.RemoveClientCircuit(this.CircuitCode); 150 m_networkServer.RemoveClientCircuit(this.CircuitCode);
@@ -270,13 +231,13 @@ namespace OpenSim
270 protected virtual void InitNewClient() 231 protected virtual void InitNewClient()
271 { 232 {
272 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 233 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
273 this.ClientAvatar = m_world.AddViewerAgent(this); 234 // this.ClientAvatar = m_world.AddViewerAgent(this);
274 } 235 }
275 236
276 protected virtual void AuthUser() 237 protected virtual void AuthUser()
277 { 238 {
278 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 239 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
279 AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 240 AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
280 if (!sessionInfo.Authorised) 241 if (!sessionInfo.Authorised)
281 { 242 {
282 //session/circuit not authorised 243 //session/circuit not authorised
@@ -290,20 +251,14 @@ namespace OpenSim
290 this.AgentID = cirpack.CircuitCode.ID; 251 this.AgentID = cirpack.CircuitCode.ID;
291 this.SessionID = cirpack.CircuitCode.SessionID; 252 this.SessionID = cirpack.CircuitCode.SessionID;
292 this.CircuitCode = cirpack.CircuitCode.Code; 253 this.CircuitCode = cirpack.CircuitCode.Code;
293 InitNewClient(); 254 InitNewClient();
294 this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; 255 //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
295 this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; 256 // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
296 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) 257 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
297 { 258 {
298 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; 259 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
299 } 260 }
300 261
301 // Create Inventory, currently only works for sandbox mode
302 if (m_sandboxMode)
303 {
304 this.SetupInventory(sessionInfo);
305 }
306
307 ClientLoop(); 262 ClientLoop();
308 } 263 }
309 } 264 }
@@ -318,18 +273,18 @@ namespace OpenSim
318 #region Inventory Creation 273 #region Inventory Creation
319 private void SetupInventory(AuthenticateResponse sessionInfo) 274 private void SetupInventory(AuthenticateResponse sessionInfo)
320 { 275 {
321 276
322 } 277 }
323 private AgentInventory CreateInventory(LLUUID baseFolder) 278 private AgentInventory CreateInventory(LLUUID baseFolder)
324 { 279 {
325 AgentInventory inventory = null; 280 AgentInventory inventory = null;
326 281
327 return inventory; 282 return inventory;
328 } 283 }
329 284
330 private void CreateInventoryItem(CreateInventoryItemPacket packet) 285 private void CreateInventoryItem(CreateInventoryItemPacket packet)
331 { 286 {
332 287
333 } 288 }
334 #endregion 289 #endregion
335 290
diff --git a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
index 572dbce..eb21b80 100644
--- a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29 public uint CircuitCode; 29 public uint CircuitCode;
30 public EndPoint userEP; 30 public EndPoint userEP;
31 31
32 protected OpenSimNetworkHandler m_networkServer; 32 protected PacketServer m_networkServer;
33 33
34 public ClientViewBase() 34 public ClientViewBase()
35 { 35 {
diff --git a/OpenSim/OpenSim.RegionServer/CommsManager.cs b/OpenSim/OpenSim.RegionServer/CommsManager.cs
new file mode 100644
index 0000000..5cd9a9b
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/CommsManager.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim
6{
7 public class CommsManager
8 {
9 }
10}
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs
deleted file mode 100644
index 0b8db4d..0000000
--- a/OpenSim/OpenSim.RegionServer/Grid.cs
+++ /dev/null
@@ -1,14 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5using OpenSim.Framework.Interfaces;
6using OpenSim.UserServer;
7
8namespace OpenSim
9{
10 public class Grid
11 {
12
13 }
14}
diff --git a/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs
new file mode 100644
index 0000000..a607909
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5
6namespace OpenSim
7{
8 public class NetworkServersInfo
9 {
10 public string AssetURL = "http://127.0.0.1:8003/";
11 public string AssetSendKey = "";
12
13 public string GridURL = "";
14 public string GridSendKey = "";
15 public string GridRecvKey = "";
16 public string UserURL = "";
17 public string UserSendKey = "";
18 public string UserRecvKey = "";
19 public bool isSandbox;
20
21 public void InitConfig(bool sandboxMode, IGenericConfig configData)
22 {
23 this.isSandbox = sandboxMode;
24
25 try
26 {
27 if (!isSandbox)
28 {
29 string attri = "";
30 //Grid Server URL
31 attri = "";
32 attri = configData.GetAttribute("GridServerURL");
33 if (attri == "")
34 {
35 this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
36 configData.SetAttribute("GridServerURL", this.GridURL);
37 }
38 else
39 {
40 this.GridURL = attri;
41 }
42
43 //Grid Send Key
44 attri = "";
45 attri = configData.GetAttribute("GridSendKey");
46 if (attri == "")
47 {
48 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server", "null");
49 configData.SetAttribute("GridSendKey", this.GridSendKey);
50 }
51 else
52 {
53 this.GridSendKey = attri;
54 }
55
56 //Grid Receive Key
57 attri = "";
58 attri = configData.GetAttribute("GridRecvKey");
59 if (attri == "")
60 {
61 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server", "null");
62 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
63 }
64 else
65 {
66 this.GridRecvKey = attri;
67 }
68
69 attri = "";
70 attri = configData.GetAttribute("AssetServerURL");
71 if (attri == "")
72 {
73 this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
74 configData.SetAttribute("AssetServerURL", this.GridURL);
75 }
76 else
77 {
78 this.AssetURL = attri;
79 }
80
81 }
82 configData.Commit();
83 }
84 catch (Exception e)
85 {
86 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Config.cs:InitConfig() - Exception occured");
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString());
88 }
89 }
90 }
91}
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index a6bc5ae..73116ee 100644
--- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,28 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 75 <Private>False</Private>
68 </Reference> 76 </Reference>
69 <Reference Include="libsecondlife.dll" > 77 <Reference Include="libsecondlife.dll">
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 78 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 79 <Private>False</Private>
72 </Reference> 80 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 81 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> 82 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 83 <Private>False</Private>
76 </Reference> 84 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 85 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> 86 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 87 <Private>False</Private>
80 </Reference> 88 </Reference>
@@ -84,43 +92,43 @@
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 92 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 93 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 95 <Private>False</Private>
88 </ProjectReference> 96 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 97 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 98 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 99 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 101 <Private>False</Private>
94 </ProjectReference> 102 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 103 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name> 104 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 105 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 107 <Private>False</Private>
100 </ProjectReference> 108 </ProjectReference>
101 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 109 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
102 <Name>OpenSim.GenericConfig.Xml</Name> 110 <Name>OpenSim.GenericConfig.Xml</Name>
103 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 111 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 113 <Private>False</Private>
106 </ProjectReference> 114 </ProjectReference>
107 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 115 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
108 <Name>OpenSim.Physics.Manager</Name> 116 <Name>OpenSim.Physics.Manager</Name>
109 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 117 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 118 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 119 <Private>False</Private>
112 </ProjectReference> 120 </ProjectReference>
113 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> 121 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
114 <Name>OpenSim.Servers</Name> 122 <Name>OpenSim.Servers</Name>
115 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 123 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 124 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private> 125 <Private>False</Private>
118 </ProjectReference> 126 </ProjectReference>
119 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> 127 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
120 <Name>XMLRPC</Name> 128 <Name>XMLRPC</Name>
121 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 129 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 130 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private> 131 <Private>False</Private>
124 </ProjectReference> 132 </ProjectReference>
125 </ItemGroup> 133 </ItemGroup>
126 <ItemGroup> 134 <ItemGroup>
@@ -157,30 +165,17 @@
157 <Compile Include="CommsManager.cs"> 165 <Compile Include="CommsManager.cs">
158 <SubType>Code</SubType> 166 <SubType>Code</SubType>
159 </Compile> 167 </Compile>
160 <Compile Include="Grid.cs"> 168 <Compile Include="OpenSimNetworkHandler.cs" />
161 <SubType>Code</SubType>
162 </Compile>
163 <Compile Include="OpenSimMain.cs">
164 <SubType>Code</SubType>
165 </Compile>
166 <Compile Include="OpenSimNetworkHandler.cs">
167 <SubType>Code</SubType>
168 </Compile>
169 <Compile Include="PacketServer.cs"> 169 <Compile Include="PacketServer.cs">
170 <SubType>Code</SubType> 170 <SubType>Code</SubType>
171 </Compile> 171 </Compile>
172 <Compile Include="RegionInfo.cs">
173 <SubType>Code</SubType>
174 </Compile>
175 <Compile Include="RegionInfoBase.cs">
176 <SubType>Code</SubType>
177 </Compile>
178 <Compile Include="RegionServerBase.cs"> 172 <Compile Include="RegionServerBase.cs">
179 <SubType>Code</SubType> 173 <SubType>Code</SubType>
180 </Compile> 174 </Compile>
181 <Compile Include="UDPServer.cs"> 175 <Compile Include="UDPServer.cs">
182 <SubType>Code</SubType> 176 <SubType>Code</SubType>
183 </Compile> 177 </Compile>
178 <Compile Include="UserConfigUtility.cs" />
184 <Compile Include="VersionInfo.cs"> 179 <Compile Include="VersionInfo.cs">
185 <SubType>Code</SubType> 180 <SubType>Code</SubType>
186 </Compile> 181 </Compile>
@@ -193,66 +188,6 @@
193 <Compile Include="CAPS\AdminWebFront.cs"> 188 <Compile Include="CAPS\AdminWebFront.cs">
194 <SubType>Code</SubType> 189 <SubType>Code</SubType>
195 </Compile> 190 </Compile>
196 <Compile Include="types\Mesh.cs">
197 <SubType>Code</SubType>
198 </Compile>
199 <Compile Include="types\Triangle.cs">
200 <SubType>Code</SubType>
201 </Compile>
202 <Compile Include="world\Avatar.Client.cs">
203 <SubType>Code</SubType>
204 </Compile>
205 <Compile Include="world\Avatar.cs">
206 <SubType>Code</SubType>
207 </Compile>
208 <Compile Include="world\Avatar.Update.cs">
209 <SubType>Code</SubType>
210 </Compile>
211 <Compile Include="world\AvatarAnimations.cs">
212 <SubType>Code</SubType>
213 </Compile>
214 <Compile Include="world\Entity.cs">
215 <SubType>Code</SubType>
216 </Compile>
217 <Compile Include="world\Primitive.cs">
218 <SubType>Code</SubType>
219 </Compile>
220 <Compile Include="world\Primitive2.cs">
221 <SubType>Code</SubType>
222 </Compile>
223 <Compile Include="world\SceneObject.cs">
224 <SubType>Code</SubType>
225 </Compile>
226 <Compile Include="world\World.cs">
227 <SubType>Code</SubType>
228 </Compile>
229 <Compile Include="world\World.PacketHandlers.cs">
230 <SubType>Code</SubType>
231 </Compile>
232 <Compile Include="world\World.Scripting.cs">
233 <SubType>Code</SubType>
234 </Compile>
235 <Compile Include="world\WorldBase.cs">
236 <SubType>Code</SubType>
237 </Compile>
238 <Compile Include="world\scripting\IScriptContext.cs">
239 <SubType>Code</SubType>
240 </Compile>
241 <Compile Include="world\scripting\IScriptEntity.cs">
242 <SubType>Code</SubType>
243 </Compile>
244 <Compile Include="world\scripting\IScriptHandler.cs">
245 <SubType>Code</SubType>
246 </Compile>
247 <Compile Include="world\scripting\Script.cs">
248 <SubType>Code</SubType>
249 </Compile>
250 <Compile Include="world\scripting\ScriptFactory.cs">
251 <SubType>Code</SubType>
252 </Compile>
253 <Compile Include="world\scripting\Scripts\FollowRandomAvatar.cs">
254 <SubType>Code</SubType>
255 </Compile>
256 </ItemGroup> 191 </ItemGroup>
257 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 192 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
258 <PropertyGroup> 193 <PropertyGroup>
@@ -261,4 +196,4 @@
261 <PostBuildEvent> 196 <PostBuildEvent>
262 </PostBuildEvent> 197 </PostBuildEvent>
263 </PropertyGroup> 198 </PropertyGroup>
264</Project> 199</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs
deleted file mode 100644
index 003412d..0000000
--- a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs
+++ /dev/null
@@ -1,531 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the <organization> nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29using System;
30using System.Text;
31using System.IO;
32using System.Threading;
33using System.Net;
34using System.Net.Sockets;
35using System.Timers;
36using System.Reflection;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using libsecondlife.Packets;
41using OpenSim.world;
42using OpenSim.Terrain;
43using OpenSim.Framework.Interfaces;
44using OpenSim.Framework.Types;
45using OpenSim.UserServer;
46using OpenSim.Assets;
47using OpenSim.CAPS;
48using OpenSim.Framework.Console;
49using OpenSim.Physics.Manager;
50using Nwc.XmlRpc;
51using OpenSim.Servers;
52using OpenSim.GenericConfig;
53
54namespace OpenSim
55{
56 //moved to the opensim main application project (do we want it there or here?)
57/*
58 public class OpenSimMain : OpenSimApplicationBase , conscmd_callback
59 {
60
61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
62 {
63 this.configFileSetup = useConfigFile;
64 m_sandbox = sandBoxMode;
65 m_loginserver = startLoginServer;
66 m_physicsEngine = physicsEngine;
67 m_config = configFile;
68
69 m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent);
70 OpenSim.Framework.Console.MainConsole.Instance = m_console;
71 }
72
73 /// <summary>
74 /// Performs initialisation of the world, such as loading configuration from disk.
75 /// </summary>
76 public override void StartUp()
77 {
78 this.regionData = new RegionInfo();
79 try
80 {
81 this.localConfig = new XmlConfig(m_config);
82 this.localConfig.LoadData();
83 }
84 catch (Exception e)
85 {
86 Console.WriteLine(e.Message);
87 }
88 if (this.configFileSetup)
89 {
90 this.SetupFromConfigFile(this.localConfig);
91 }
92 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
93 this.regionData.InitConfig(this.m_sandbox, this.localConfig);
94 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
95
96 GridServers = new Grid();
97 if (m_sandbox)
98 {
99 this.SetupLocalGridServers();
100 //Authenticate Session Handler
101 AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal();
102 this.AuthenticateSessionsHandler = authen;
103 }
104 else
105 {
106 this.SetupRemoteGridServers();
107 //Authenticate Session Handler
108 AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote();
109 this.AuthenticateSessionsHandler = authen;
110 }
111
112 startuptime = DateTime.Now;
113
114 try
115 {
116 AssetCache = new AssetCache(GridServers.AssetServer);
117 InventoryCache = new InventoryCache();
118 }
119 catch (Exception e)
120 {
121 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache");
122 Environment.Exit(1);
123 }
124
125 m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler);
126
127 //should be passing a IGenericConfig object to these so they can read the config data they want from it
128 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
129 IGridServer gridServer = GridServers.GridServer;
130 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
131
132 if (!m_sandbox)
133 {
134 this.ConnectToRemoteGridServer();
135 }
136
137 this.SetupLocalWorld();
138
139 if (m_sandbox)
140 {
141 AssetCache.LoadDefaultTextureSet();
142 }
143
144 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server");
145
146 this.SetupHttpListener();
147
148 LoginServer loginServer = null;
149 LoginServer adminLoginServer = null;
150
151 bool sandBoxWithLoginServer = m_loginserver && m_sandbox;
152 if (sandBoxWithLoginServer)
153 {
154 loginServer = new LoginServer( regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts);
155 loginServer.Startup();
156 loginServer.SetSessionHandler(((AuthenticateSessionsLocal) this.AuthenticateSessionsHandler).AddNewSession);
157
158 if (user_accounts)
159 {
160 //sandbox mode with loginserver using accounts
161 this.GridServers.UserServer = loginServer;
162 adminLoginServer = loginServer;
163
164 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
165 }
166 else
167 {
168 //sandbox mode with loginserver not using accounts
169 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
170 }
171 }
172
173 AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer);
174 adminWebFront.LoadMethods(httpServer);
175
176 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP server");
177 httpServer.Start();
178
179 //MainServerListener();
180 this.m_udpServer.ServerListener();
181
182 m_heartbeatTimer.Enabled = true;
183 m_heartbeatTimer.Interval = 100;
184 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
185 }
186
187 # region Setup methods
188 protected virtual void SetupLocalGridServers()
189 {
190 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
191 GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
192
193 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode");
194
195 try
196 {
197 GridServers.Initialise();
198 }
199 catch (Exception e)
200 {
201 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface");
202 Environment.Exit(1);
203 }
204 }
205
206 protected virtual void SetupRemoteGridServers()
207 {
208 if (this.gridLocalAsset)
209 {
210 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
211 }
212 else
213 {
214 GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
215 }
216 GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
217
218 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode");
219
220 try
221 {
222 GridServers.Initialise();
223 }
224 catch (Exception e)
225 {
226 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface");
227 Environment.Exit(1);
228 }
229 }
230
231 protected virtual void SetupLocalWorld()
232 {
233 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString());
234 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world");
235 m_console.componentname = "Region " + regionData.RegionName;
236
237 m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName);
238 LocalWorld.InventoryCache = InventoryCache;
239 LocalWorld.AssetCache = AssetCache;
240
241 this.m_udpServer.LocalWorld = LocalWorld;
242 this.m_udpServer.PacketServer.RegisterClientPacketHandlers();
243
244 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
245 this.physManager.LoadPlugins();
246
247 LocalWorld.m_datastore = this.regionData.DataStore;
248
249 LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
250 LocalWorld.LoadWorldMap();
251
252 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system");
253 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
254 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
255 LocalWorld.LoadPrimsFromStorage();
256 }
257
258 protected virtual void SetupHttpListener()
259 {
260 httpServer = new BaseHttpServer(regionData.IPListenPort);
261
262 if (this.GridServers.GridServer.GetName() == "Remote")
263 {
264
265 // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
266 httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser );
267
268 httpServer.AddXmlRPCHandler("agent_crossing",
269 delegate(XmlRpcRequest request)
270 {
271 Hashtable requestData = (Hashtable)request.Params[0];
272 AgentCircuitData agent_data = new AgentCircuitData();
273 agent_data.firstname = (string)requestData["firstname"];
274 agent_data.lastname = (string)requestData["lastname"];
275 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
276 agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"]));
277
278 if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode))
279 {
280 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname;
281 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname;
282 ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos;
283 }
284
285 return new XmlRpcResponse();
286 });
287
288 httpServer.AddRestHandler("GET", "/simstatus/",
289 delegate(string request, string path, string param)
290 {
291 return "OK";
292 });
293 }
294 }
295
296 protected virtual void ConnectToRemoteGridServer()
297 {
298 if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort))
299 {
300 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!");
301 }
302 else
303 {
304 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down.");
305 Shutdown();
306 }
307
308 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
309
310 // If we are being told to load a file, load it.
311 string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"];
312
313 if (!String.IsNullOrEmpty(dataUri))
314 {
315 this.LocalWorld.m_datastore = dataUri;
316 }
317
318 if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "")
319 {
320 // The grid server has told us who we are
321 // We must obey the grid server.
322 try
323 {
324 regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
325 regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
326 regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
327 }
328 catch (Exception e)
329 {
330 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!");
331 Environment.Exit(1);
332 }
333 }
334 }
335
336 #endregion
337
338 private void SetupFromConfigFile(IGenericConfig configData)
339 {
340 try
341 {
342 // SandBoxMode
343 string attri = "";
344 attri = configData.GetAttribute("SandBox");
345 if ((attri == "") || ((attri != "false") && (attri != "true")))
346 {
347 this.m_sandbox = false;
348 configData.SetAttribute("SandBox", "false");
349 }
350 else
351 {
352 this.m_sandbox = Convert.ToBoolean(attri);
353 }
354
355 // LoginServer
356 attri = "";
357 attri = configData.GetAttribute("LoginServer");
358 if ((attri == "") || ((attri != "false") && (attri != "true")))
359 {
360 this.m_loginserver = false;
361 configData.SetAttribute("LoginServer", "false");
362 }
363 else
364 {
365 this.m_loginserver = Convert.ToBoolean(attri);
366 }
367
368 // Sandbox User accounts
369 attri = "";
370 attri = configData.GetAttribute("UserAccount");
371 if ((attri == "") || ((attri != "false") && (attri != "true")))
372 {
373 this.user_accounts = false;
374 configData.SetAttribute("UserAccounts", "false");
375 }
376 else if (attri == "true")
377 {
378 this.user_accounts = Convert.ToBoolean(attri);
379 }
380
381 // Grid mode hack to use local asset server
382 attri = "";
383 attri = configData.GetAttribute("LocalAssets");
384 if ((attri == "") || ((attri != "false") && (attri != "true")))
385 {
386 this.gridLocalAsset = false;
387 configData.SetAttribute("LocalAssets", "false");
388 }
389 else if (attri == "true")
390 {
391 this.gridLocalAsset = Convert.ToBoolean(attri);
392 }
393
394
395 attri = "";
396 attri = configData.GetAttribute("PhysicsEngine");
397 switch (attri)
398 {
399 default:
400 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
401 Environment.Exit(1);
402 break;
403
404 case "":
405 this.m_physicsEngine = "basicphysics";
406 configData.SetAttribute("PhysicsEngine", "basicphysics");
407 OpenSim.world.Avatar.PhysicsEngineFlying = false;
408 break;
409
410 case "basicphysics":
411 this.m_physicsEngine = "basicphysics";
412 configData.SetAttribute("PhysicsEngine", "basicphysics");
413 OpenSim.world.Avatar.PhysicsEngineFlying = false;
414 break;
415
416 case "RealPhysX":
417 this.m_physicsEngine = "RealPhysX";
418 OpenSim.world.Avatar.PhysicsEngineFlying = true;
419 break;
420
421 case "OpenDynamicsEngine":
422 this.m_physicsEngine = "OpenDynamicsEngine";
423 OpenSim.world.Avatar.PhysicsEngineFlying = true;
424 break;
425 }
426
427 configData.Commit();
428 }
429 catch (Exception e)
430 {
431 Console.WriteLine(e.Message);
432 Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data");
433 Console.WriteLine("Can not continue starting up");
434 Environment.Exit(1);
435 }
436 }
437
438 /// <summary>
439 /// Performs any last-minute sanity checking and shuts down the region server
440 /// </summary>
441 public virtual void Shutdown()
442 {
443 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing all threads");
444 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing listener thread");
445 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients");
446 // IMPLEMENT THIS
447 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating");
448 LocalWorld.Close();
449 GridServers.Close();
450 m_console.Close();
451 Environment.Exit(0);
452 }
453
454 /// <summary>
455 /// Performs per-frame updates regularly
456 /// </summary>
457 /// <param name="sender"></param>
458 /// <param name="e"></param>
459 void Heartbeat(object sender, System.EventArgs e)
460 {
461 LocalWorld.Update();
462 }
463
464 #region Console Commands
465 /// <summary>
466 /// Runs commands issued by the server console from the operator
467 /// </summary>
468 /// <param name="command">The first argument of the parameter (the command)</param>
469 /// <param name="cmdparams">Additional arguments passed to the command</param>
470 public void RunCmd(string command, string[] cmdparams)
471 {
472 switch (command)
473 {
474 case "help":
475 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "show users - show info about connected users");
476 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - disconnect all clients and shutdown");
477 break;
478
479 case "show":
480 Show(cmdparams[0]);
481 break;
482
483 case "terrain":
484 string result = "";
485 if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result))
486 {
487 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result);
488 }
489 break;
490
491 case "shutdown":
492 Shutdown();
493 break;
494
495 default:
496 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "Unknown command");
497 break;
498 }
499 }
500
501 /// <summary>
502 /// Outputs to the console information about the region
503 /// </summary>
504 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param>
505 public void Show(string ShowWhat)
506 {
507 switch (ShowWhat)
508 {
509 case "uptime":
510 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "OpenSim has been running since " + startuptime.ToString());
511 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "That is " + (DateTime.Now - startuptime).ToString());
512 break;
513 case "users":
514 OpenSim.world.Avatar TempAv;
515 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
516 foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys)
517 {
518 if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
519 {
520 TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID];
521 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, 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()));
522 }
523 }
524 break;
525 }
526 }
527 #endregion
528 }
529
530 */
531}
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
index 15ee740..202b7f7 100644
--- a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
+++ b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs
@@ -4,15 +4,16 @@ using System.Text;
4using System.Net; 4using System.Net;
5using System.Net.Sockets; 5using System.Net.Sockets;
6using libsecondlife; 6using libsecondlife;
7using OpenSim.Framework.Interfaces; 7
8 8
9namespace OpenSim 9namespace OpenSim
10{ 10{
11
11 public interface OpenSimNetworkHandler 12 public interface OpenSimNetworkHandler
12 { 13 {
13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 14 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 void RemoveClientCircuit(uint circuitcode); 15 void RemoveClientCircuit(uint circuitcode);
15 void RegisterPacketServer(PacketServer server); 16 void RegisterPacketServer(PacketServer server);
16 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
17 } 17 }
18
18} 19}
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs
index 6c6f4ca..dd8de4c 100644
--- a/OpenSim/OpenSim.RegionServer/PacketServer.cs
+++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs
@@ -1,16 +1,20 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.world;
5using libsecondlife.Packets; 4using libsecondlife.Packets;
5using OpenSim.Framework.Interfaces;
6using System.Net;
7using System.Net.Sockets;
8using OpenSim.Assets;
6 9
7namespace OpenSim 10namespace OpenSim
8{ 11{
9 public class PacketServer 12 public class PacketServer
10 { 13 {
11 private OpenSimNetworkHandler _networkHandler; 14 private OpenSimNetworkHandler _networkHandler;
12 private World _localWorld; 15 private IWorld _localWorld;
13 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); 16 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>();
17 public Dictionary<uint, IClientAPI> ClientAPIs = new Dictionary<uint, IClientAPI>();
14 18
15 public PacketServer(OpenSimNetworkHandler networkHandler) 19 public PacketServer(OpenSimNetworkHandler networkHandler)
16 { 20 {
@@ -18,7 +22,7 @@ namespace OpenSim
18 _networkHandler.RegisterPacketServer(this); 22 _networkHandler.RegisterPacketServer(this);
19 } 23 }
20 24
21 public World LocalWorld 25 public IWorld LocalWorld
22 { 26 {
23 set 27 set
24 { 28 {
@@ -59,27 +63,23 @@ namespace OpenSim
59 63
60 } 64 }
61 65
62 #region Client Packet Handlers 66 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass)
63
64 public bool RequestUUIDName(ClientView simClient, Packet packet)
65 { 67 {
66 System.Text.Encoding enc = System.Text.Encoding.ASCII; 68 ClientView newuser = new ClientView(epSender, useCircuit, this.ClientThreads, assetCache, this, inventoryCache, authenticateSessionsClass);
67 Console.WriteLine(packet.ToString()); 69 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
68 UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet; 70 this.ClientAPIs.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser);
69 UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
70 nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
71 71
72 for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
73 {
74 nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
75 nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
76 nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name
77 nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up
78 }
79 simClient.OutPacket(nameReply);
80 return true; 72 return true;
81 } 73 }
82 74
83 #endregion 75 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
76 {
77 this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
78 }
79
80 public virtual void RemoveClientCircuit(uint circuitcode)
81 {
82 this._networkHandler.RemoveClientCircuit(circuitcode);
83 }
84 } 84 }
85} 85}
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
index 76f05b6..d148d0f 100644
--- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
@@ -7,22 +7,13 @@ using System.IO;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities; 8using OpenSim.Framework.Utilities;
9using libsecondlife; 9using libsecondlife;
10using OpenSim.Framework.Types;
10 11
11namespace OpenSim 12namespace OpenSim
12{ 13{
13 public class RegionInfo : RegionInfoBase 14 public class RegionInfo : RegionInfoBase
14 { 15 {
15 //following should be removed and the GenericConfig object passed around, 16
16 //so each class (AssetServer, GridServer etc) can access what config data they want
17 public string AssetURL = "http://127.0.0.1:8003/";
18 public string AssetSendKey = "";
19
20 public string GridURL = "";
21 public string GridSendKey = "";
22 public string GridRecvKey = "";
23 public string UserURL = "";
24 public string UserSendKey = "";
25 public string UserRecvKey = "";
26 private bool isSandbox; 17 private bool isSandbox;
27 18
28 public string DataStore; 19 public string DataStore;
@@ -129,62 +120,7 @@ namespace OpenSim
129 this.IPListenAddr = attri; 120 this.IPListenAddr = attri;
130 } 121 }
131 122
132 if (!isSandbox) 123
133 {
134 //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object
135
136 //Grid Server URL
137 attri = "";
138 attri = configData.GetAttribute("GridServerURL");
139 if (attri == "")
140 {
141 this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
142 configData.SetAttribute("GridServerURL", this.GridURL);
143 }
144 else
145 {
146 this.GridURL = attri;
147 }
148
149 //Grid Send Key
150 attri = "";
151 attri = configData.GetAttribute("GridSendKey");
152 if (attri == "")
153 {
154 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null");
155 configData.SetAttribute("GridSendKey", this.GridSendKey);
156 }
157 else
158 {
159 this.GridSendKey = attri;
160 }
161
162 //Grid Receive Key
163 attri = "";
164 attri = configData.GetAttribute("GridRecvKey");
165 if (attri == "")
166 {
167 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null");
168 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
169 }
170 else
171 {
172 this.GridRecvKey = attri;
173 }
174
175 attri = "";
176 attri = configData.GetAttribute("AssetServerURL");
177 if (attri == "")
178 {
179 this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
180 configData.SetAttribute("AssetServerURL", this.GridURL);
181 }
182 else
183 {
184 this.AssetURL = attri;
185 }
186
187 }
188 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 124 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
189 125
190 configData.Commit(); 126 configData.Commit();
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs
deleted file mode 100644
index 42d3030..0000000
--- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs
+++ /dev/null
@@ -1,32 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.Web;
6using System.IO;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities;
9using libsecondlife;
10
11namespace OpenSim
12{
13 public class RegionInfoBase
14 {
15 public LLUUID SimUUID;
16 public string RegionName;
17 public uint RegionLocX;
18 public uint RegionLocY;
19 public ulong RegionHandle;
20 public ushort RegionWaterHeight = 20;
21 public bool RegionTerraform = true;
22
23 public int IPListenPort;
24 public string IPListenAddr;
25
26 public RegionInfoBase()
27 {
28
29 }
30 }
31
32}
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
index 69a8748..7f18d34 100644
--- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs
@@ -10,7 +10,6 @@ using System.Collections;
10using System.Collections.Generic; 10using System.Collections.Generic;
11using libsecondlife; 11using libsecondlife;
12using libsecondlife.Packets; 12using libsecondlife.Packets;
13using OpenSim.world;
14using OpenSim.Terrain; 13using OpenSim.Terrain;
15using OpenSim.Framework.Interfaces; 14using OpenSim.Framework.Interfaces;
16using OpenSim.Framework.Types; 15using OpenSim.Framework.Types;
@@ -29,14 +28,12 @@ namespace OpenSim
29 { 28 {
30 protected IGenericConfig localConfig; 29 protected IGenericConfig localConfig;
31 protected PhysicsManager physManager; 30 protected PhysicsManager physManager;
32 protected Grid GridServers;
33 protected AssetCache AssetCache; 31 protected AssetCache AssetCache;
34 protected InventoryCache InventoryCache; 32 protected InventoryCache InventoryCache;
35 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 33 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
36 protected DateTime startuptime; 34 protected DateTime startuptime;
37 protected RegionInfo regionData; 35 protected NetworkServersInfo serversData;
38 36
39 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
40 public string m_physicsEngine; 37 public string m_physicsEngine;
41 public bool m_sandbox = false; 38 public bool m_sandbox = false;
42 public bool m_loginserver; 39 public bool m_loginserver;
@@ -45,7 +42,9 @@ namespace OpenSim
45 protected bool configFileSetup = false; 42 protected bool configFileSetup = false;
46 public string m_config; 43 public string m_config;
47 44
48 protected UDPServer m_udpServer; 45 protected List<UDPServer> m_udpServer = new List<UDPServer>();
46 protected List<RegionInfo> regionData = new List<RegionInfo>();
47 protected List<IWorld> m_localWorld = new List<IWorld>();
49 protected BaseHttpServer httpServer; 48 protected BaseHttpServer httpServer;
50 protected AuthenticateSessionsBase AuthenticateSessionsHandler; 49 protected AuthenticateSessionsBase AuthenticateSessionsHandler;
51 50
@@ -65,11 +64,11 @@ namespace OpenSim
65 m_config = configFile; 64 m_config = configFile;
66 } 65 }
67 66
68 protected World m_localWorld; 67 /*protected World m_localWorld;
69 public World LocalWorld 68 public World LocalWorld
70 { 69 {
71 get { return m_localWorld; } 70 get { return m_localWorld; }
72 } 71 }*/
73 72
74 /// <summary> 73 /// <summary>
75 /// Performs initialisation of the world, such as loading configuration from disk. 74 /// Performs initialisation of the world, such as loading configuration from disk.
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs
index 3a93e66..8ec5af1 100644
--- a/OpenSim/OpenSim.RegionServer/UDPServer.cs
+++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs
@@ -10,7 +10,6 @@ using System.Collections;
10using System.Collections.Generic; 10using System.Collections.Generic;
11using libsecondlife; 11using libsecondlife;
12using libsecondlife.Packets; 12using libsecondlife.Packets;
13using OpenSim.world;
14using OpenSim.Terrain; 13using OpenSim.Terrain;
15using OpenSim.Framework.Interfaces; 14using OpenSim.Framework.Interfaces;
16using OpenSim.Framework.Types; 15using OpenSim.Framework.Types;
@@ -24,7 +23,6 @@ using OpenSim.GenericConfig;
24 23
25namespace OpenSim 24namespace OpenSim
26{ 25{
27 public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode);
28 26
29 public class UDPServer : OpenSimNetworkHandler 27 public class UDPServer : OpenSimNetworkHandler
30 { 28 {
@@ -39,18 +37,12 @@ namespace OpenSim
39 protected PacketServer _packetServer; 37 protected PacketServer _packetServer;
40 38
41 protected int listenPort; 39 protected int listenPort;
42 protected Grid m_gridServers; 40 protected IWorld m_localWorld;
43 protected World m_localWorld;
44 protected AssetCache m_assetCache; 41 protected AssetCache m_assetCache;
45 protected InventoryCache m_inventoryCache; 42 protected InventoryCache m_inventoryCache;
46 protected RegionInfo m_regionData;
47 protected bool m_sandbox = false;
48 protected bool user_accounts = false;
49 protected ConsoleBase m_console; 43 protected ConsoleBase m_console;
50 protected AuthenticateSessionsBase m_authenticateSessionsClass; 44 protected AuthenticateSessionsBase m_authenticateSessionsClass;
51 45
52 public AuthenticateSessionHandler AuthenticateHandler;
53
54 public PacketServer PacketServer 46 public PacketServer PacketServer
55 { 47 {
56 get 48 get
@@ -63,7 +55,7 @@ namespace OpenSim
63 } 55 }
64 } 56 }
65 57
66 public World LocalWorld 58 public IWorld LocalWorld
67 { 59 {
68 set 60 set
69 { 61 {
@@ -76,21 +68,15 @@ namespace OpenSim
76 { 68 {
77 } 69 }
78 70
79 public UDPServer(int port, Grid gridServers, AssetCache assetCache, InventoryCache inventoryCache, RegionInfo _regionData, bool sandbox, bool accounts, ConsoleBase console, AuthenticateSessionsBase authenticateClass) 71 public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, ConsoleBase console, AuthenticateSessionsBase authenticateClass)
80 { 72 {
81 listenPort = port; 73 listenPort = port;
82 this.m_gridServers = gridServers;
83 this.m_assetCache = assetCache; 74 this.m_assetCache = assetCache;
84 this.m_inventoryCache = inventoryCache; 75 this.m_inventoryCache = inventoryCache;
85 this.m_regionData = _regionData;
86 this.m_sandbox = sandbox;
87 this.user_accounts = accounts;
88 this.m_console = console; 76 this.m_console = console;
89 this.m_authenticateSessionsClass = authenticateClass; 77 this.m_authenticateSessionsClass = authenticateClass;
90 this.CreatePacketServer(); 78 this.CreatePacketServer();
91 79
92 //set up delegate for authenticate sessions
93 this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_authenticateSessionsClass.AuthenticateSession);
94 } 80 }
95 81
96 protected virtual void CreatePacketServer() 82 protected virtual void CreatePacketServer()
@@ -131,15 +117,8 @@ namespace OpenSim
131 { 117 {
132 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 118 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
133 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 119 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
134 bool isChildAgent = false;
135 120
136 ClientView newuser = new ClientView(epSender, useCircuit, m_localWorld, _packetServer.ClientThreads, m_assetCache, m_gridServers.GridServer, this, m_inventoryCache, m_sandbox, isChildAgent, this.m_regionData, m_authenticateSessionsClass); 121 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass);
137 if ((this.m_gridServers.UserServer != null) && (user_accounts))
138 {
139 newuser.UserServer = this.m_gridServers.UserServer;
140 }
141 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
142 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
143 } 122 }
144 123
145 public void ServerListener() 124 public void ServerListener()
@@ -197,9 +176,6 @@ namespace OpenSim
197 } 176 }
198 } 177 }
199 178
200 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) 179
201 {
202 return this.AuthenticateHandler(sessionID, agentID, circuitCode);
203 }
204 } 180 }
205} \ No newline at end of file 181} \ No newline at end of file
diff --git a/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs
new file mode 100644
index 0000000..9f6abe9
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim
6{
7 public class UserConfigUtility
8 {
9 }
10}
diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
index 49cc6a5..38b6685 100644
--- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs
@@ -32,6 +32,6 @@ namespace OpenSim
32 /// </summary> 32 /// </summary>
33 public class VersionInfo 33 public class VersionInfo
34 { 34 {
35 public static string Version = "0.2, SVN build - please use releng if you desire any form of support"; 35 public static string Version = "0.2, SVN build ";
36 } 36 }
37} 37}
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
index d4db8c0..30abd84 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
@@ -34,7 +34,6 @@ using System.Data;
34using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Terrain;
38using BerkeleyDb; 37using BerkeleyDb;
39using Kds.Serialization; 38using Kds.Serialization;
40using Kds.Serialization.Buffer; 39using Kds.Serialization.Buffer;
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index 5dceb7f..a50795a 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -31,7 +31,7 @@ using Db4objects.Db4o.Query;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Terrain; 34
35 35
36namespace OpenSim.Storage.LocalStorageDb4o 36namespace OpenSim.Storage.LocalStorageDb4o
37{ 37{
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
index 368405b..11eca0f 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -35,7 +35,7 @@ using System.Data.SQLite;
35using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
38using OpenSim.Framework.Terrain; 38
39 39
40namespace OpenSim.Storage.LocalStorageSQLite 40namespace OpenSim.Storage.LocalStorageSQLite
41{ 41{
diff --git a/OpenSim/OpenSim.World/Avatar.Update.cs b/OpenSim/OpenSim.World/Avatar.Update.cs
index 33132cf..13a480a 100644
--- a/OpenSim/OpenSim.World/Avatar.Update.cs
+++ b/OpenSim/OpenSim.World/Avatar.Update.cs
@@ -4,6 +4,7 @@ using System.Text;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Physics.Manager; 6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces;
7 8
8namespace OpenSim.world 9namespace OpenSim.world
9{ 10{
@@ -22,7 +23,7 @@ namespace OpenSim.world
22 23
23 public ObjectUpdatePacket CreateUpdatePacket() 24 public ObjectUpdatePacket CreateUpdatePacket()
24 { 25 {
25 26 return null;
26 } 27 }
27 28
28 public void SendInitialPosition() 29 public void SendInitialPosition()
@@ -35,7 +36,7 @@ namespace OpenSim.world
35 36
36 } 37 }
37 38
38 public void SendOurAppearance(ClientView OurClient) 39 public void SendOurAppearance(IClientAPI OurClient)
39 { 40 {
40 41
41 } 42 }
@@ -57,7 +58,7 @@ namespace OpenSim.world
57 58
58 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() 59 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
59 { 60 {
60 61 return null;
61 } 62 }
62 63
63 // Sends animation update 64 // Sends animation update
diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs
index cca266b..551283a 100644
--- a/OpenSim/OpenSim.World/Avatar.cs
+++ b/OpenSim/OpenSim.World/Avatar.cs
@@ -17,7 +17,7 @@ namespace OpenSim.world
17 public static AvatarAnimations Animations; 17 public static AvatarAnimations Animations;
18 public string firstname; 18 public string firstname;
19 public string lastname; 19 public string lastname;
20 public ClientView ControllingClient; 20 public IClientAPI ControllingClient;
21 public LLUUID current_anim; 21 public LLUUID current_anim;
22 public int anim_seq; 22 public int anim_seq;
23 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; 23 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
@@ -37,7 +37,7 @@ namespace OpenSim.world
37 private bool m_regionTerraform; 37 private bool m_regionTerraform;
38 private bool childAvatar = false; 38 private bool childAvatar = false;
39 39
40 public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) 40 public Avatar(IClientAPI TheClient, World world, string regionName, Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater)
41 { 41 {
42 m_world = world; 42 m_world = world;
43 // m_clientThreads = clientThreads; 43 // m_clientThreads = clientThreads;
@@ -49,7 +49,7 @@ namespace OpenSim.world
49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs - Loading details from grid (DUMMY)"); 49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs - Loading details from grid (DUMMY)");
50 ControllingClient = TheClient; 50 ControllingClient = TheClient;
51 localid = 8880000 + (this.m_world._localNumber++); 51 localid = 8880000 + (this.m_world._localNumber++);
52 Pos = ControllingClient.startpos; 52 Pos = ControllingClient.StartPos;
53 visualParams = new byte[218]; 53 visualParams = new byte[218];
54 for (int i = 0; i < 218; i++) 54 for (int i = 0; i < 218; i++)
55 { 55 {
@@ -66,14 +66,14 @@ namespace OpenSim.world
66 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 66 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
67 67
68 //register for events 68 //register for events
69 ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance); 69 ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance);
70 ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 70 ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
71 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement); 71 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
72 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); 72 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
73 ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); 73 ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate);
74 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 74 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
75 ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange); 75 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
76 ControllingClient.OnStopMovement += new ClientView.GenericCall2(this.StopMovement); 76 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
77 } 77 }
78 78
79 public PhysicsActor PhysActor 79 public PhysicsActor PhysActor
diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj b/OpenSim/OpenSim.World/OpenSim.World.csproj
index 471f148..37293e1 100644
--- a/OpenSim/OpenSim.World/OpenSim.World.csproj
+++ b/OpenSim/OpenSim.World/OpenSim.World.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{642A14A8-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{642A14A8-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.World</AssemblyName> 13 <AssemblyName>OpenSim.World</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.World</RootNamespace> 21 <RootNamespace>OpenSim.World</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,27 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="libsecondlife.dll" > 76 <Reference Include="libsecondlife.dll">
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 77 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 80 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> 81 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 84 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> 85 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 86 <Private>False</Private>
80 </Reference> 87 </Reference>
@@ -84,43 +91,43 @@
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 91 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 92 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 93 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 94 <Private>False</Private>
88 </ProjectReference> 95 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 96 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 97 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 98 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 99 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 100 <Private>False</Private>
94 </ProjectReference> 101 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 102 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name> 103 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 104 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 105 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 106 <Private>False</Private>
100 </ProjectReference> 107 </ProjectReference>
101 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 108 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
102 <Name>OpenSim.GenericConfig.Xml</Name> 109 <Name>OpenSim.GenericConfig.Xml</Name>
103 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 110 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 111 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 112 <Private>False</Private>
106 </ProjectReference> 113 </ProjectReference>
107 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 114 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
108 <Name>OpenSim.Physics.Manager</Name> 115 <Name>OpenSim.Physics.Manager</Name>
109 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 116 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 117 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 118 <Private>False</Private>
112 </ProjectReference> 119 </ProjectReference>
113 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> 120 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
114 <Name>OpenSim.Servers</Name> 121 <Name>OpenSim.Servers</Name>
115 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 122 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 123 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private> 124 <Private>False</Private>
118 </ProjectReference> 125 </ProjectReference>
119 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> 126 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
120 <Name>XMLRPC</Name> 127 <Name>XMLRPC</Name>
121 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 128 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 129 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private> 130 <Private>False</Private>
124 </ProjectReference> 131 </ProjectReference>
125 </ItemGroup> 132 </ItemGroup>
126 <ItemGroup> 133 <ItemGroup>
@@ -142,9 +149,6 @@
142 <Compile Include="Primitive.cs"> 149 <Compile Include="Primitive.cs">
143 <SubType>Code</SubType> 150 <SubType>Code</SubType>
144 </Compile> 151 </Compile>
145 <Compile Include="Primitive2.cs">
146 <SubType>Code</SubType>
147 </Compile>
148 <Compile Include="SceneObject.cs"> 152 <Compile Include="SceneObject.cs">
149 <SubType>Code</SubType> 153 <SubType>Code</SubType>
150 </Compile> 154 </Compile>
@@ -192,4 +196,4 @@
192 <PostBuildEvent> 196 <PostBuildEvent>
193 </PostBuildEvent> 197 </PostBuildEvent>
194 </PropertyGroup> 198 </PropertyGroup>
195</Project> 199</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.World/Primitive.cs b/OpenSim/OpenSim.World/Primitive.cs
index 433ea9e..492341a 100644
--- a/OpenSim/OpenSim.World/Primitive.cs
+++ b/OpenSim/OpenSim.World/Primitive.cs
@@ -7,11 +7,485 @@ using libsecondlife.Packets;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Physics.Manager; 8using OpenSim.Physics.Manager;
9using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
10using OpenSim.Framework.Inventory;
10 11
11namespace OpenSim.world 12namespace OpenSim.world
12{ 13{
13 public class Primitive : Entity 14 public class Primitive : Entity
14 { 15 {
15 16 protected PrimData primData;
17 //private ObjectUpdatePacket OurPacket;
18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
19 private Dictionary<uint, IClientAPI> m_clientThreads;
20 private ulong m_regionHandle;
21 private const uint FULL_MASK_PERMISSIONS = 2147483647;
22 private bool physicsEnabled = false;
23
24 private Dictionary<LLUUID, InventoryItem> inventoryItems;
25
26 #region Properties
27
28 public LLVector3 Scale
29 {
30 set
31 {
32 this.primData.Scale = value;
33 //this.dirtyFlag = true;
34 }
35 get
36 {
37 return this.primData.Scale;
38 }
39 }
40
41 public PhysicsActor PhysActor
42 {
43 set
44 {
45 this._physActor = value;
46 }
47 }
48 public override LLVector3 Pos
49 {
50 get
51 {
52 return base.Pos;
53 }
54 set
55 {
56 base.Pos = value;
57 }
58 }
59 #endregion
60
61 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world)
62 {
63 m_clientThreads = clientThreads;
64 m_regionHandle = regionHandle;
65 m_world = world;
66 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
67 }
68
69 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner)
70 {
71 m_clientThreads = clientThreads;
72 m_regionHandle = regionHandle;
73 m_world = world;
74 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
75 this.primData = new PrimData();
76 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
77 this.primData.OwnerID = owner;
78 }
79
80 public byte[] GetByteArray()
81 {
82 byte[] result = null;
83 List<byte[]> dataArrays = new List<byte[]>();
84 dataArrays.Add(primData.ToBytes());
85 foreach (Entity child in children)
86 {
87 if (child is OpenSim.world.Primitive)
88 {
89 dataArrays.Add(((OpenSim.world.Primitive)child).GetByteArray());
90 }
91 }
92 byte[] primstart = Helpers.StringToField("<Prim>");
93 byte[] primend = Helpers.StringToField("</Prim>");
94 int totalLength = primstart.Length + primend.Length;
95 for (int i = 0; i < dataArrays.Count; i++)
96 {
97 totalLength += dataArrays[i].Length;
98 }
99
100 result = new byte[totalLength];
101 int arraypos = 0;
102 Array.Copy(primstart, 0, result, 0, primstart.Length);
103 arraypos += primstart.Length;
104 for (int i = 0; i < dataArrays.Count; i++)
105 {
106 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
107 arraypos += dataArrays[i].Length;
108 }
109 Array.Copy(primend, 0, result, arraypos, primend.Length);
110
111 return result;
112 }
113
114 #region Overridden Methods
115
116 public override void update()
117 {
118 LLVector3 pos2 = new LLVector3(0, 0, 0);
119 }
120
121 public override void BackUp()
122 {
123
124 }
125
126 #endregion
127
128 #region Packet handlers
129
130 public void UpdatePosition(LLVector3 pos)
131 {
132
133 }
134
135 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
136 {
137 this.primData.PathBegin = addPacket.PathBegin;
138 this.primData.PathEnd = addPacket.PathEnd;
139 this.primData.PathScaleX = addPacket.PathScaleX;
140 this.primData.PathScaleY = addPacket.PathScaleY;
141 this.primData.PathShearX = addPacket.PathShearX;
142 this.primData.PathShearY = addPacket.PathShearY;
143 this.primData.PathSkew = addPacket.PathSkew;
144 this.primData.ProfileBegin = addPacket.ProfileBegin;
145 this.primData.ProfileEnd = addPacket.ProfileEnd;
146 this.primData.PathCurve = addPacket.PathCurve;
147 this.primData.ProfileCurve = addPacket.ProfileCurve;
148 this.primData.ProfileHollow = addPacket.ProfileHollow;
149 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
150 this.primData.PathRevolutions = addPacket.PathRevolutions;
151 this.primData.PathTaperX = addPacket.PathTaperX;
152 this.primData.PathTaperY = addPacket.PathTaperY;
153 this.primData.PathTwist = addPacket.PathTwist;
154 this.primData.PathTwistBegin = addPacket.PathTwistBegin;
155 }
156
157 public void UpdateTexture(byte[] tex)
158 {
159 this.primData.Texture = tex;
160 //this.dirtyFlag = true;
161 }
162
163 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
164 {
165
166 }
167
168 public void AssignToParent(Primitive prim)
169 {
170
171 }
172
173 public void GetProperites(IClientAPI client)
174 {
175 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
176 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
177 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
178 proper.ObjectData[0].ItemID = LLUUID.Zero;
179 proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate;
180 proper.ObjectData[0].CreatorID = this.primData.OwnerID;
181 proper.ObjectData[0].FolderID = LLUUID.Zero;
182 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
183 proper.ObjectData[0].GroupID = LLUUID.Zero;
184 proper.ObjectData[0].InventorySerial = 0;
185 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
186 proper.ObjectData[0].ObjectID = this.uuid;
187 proper.ObjectData[0].OwnerID = primData.OwnerID;
188 proper.ObjectData[0].TouchName = new byte[0];
189 proper.ObjectData[0].TextureID = new byte[0];
190 proper.ObjectData[0].SitName = new byte[0];
191 proper.ObjectData[0].Name = new byte[0];
192 proper.ObjectData[0].Description = new byte[0];
193 proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
194 proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
195 proper.ObjectData[0].GroupMask = this.primData.GroupMask;
196 proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
197 proper.ObjectData[0].BaseMask = this.primData.BaseMask;
198
199 client.OutPacket(proper);
200 }
201
202 #endregion
203
204 # region Inventory Methods
205
206 public bool AddToInventory(InventoryItem item)
207 {
208 return false;
209 }
210
211 public InventoryItem RemoveFromInventory(LLUUID itemID)
212 {
213 return null;
214 }
215
216 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
217 {
218
219 }
220
221 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
222 {
223 //will only currently work if the total size of the inventory data array is under about 1000 bytes
224 SendXferPacketPacket send = new SendXferPacketPacket();
225
226 send.XferID.ID = xferID;
227 send.XferID.Packet = 1 + 2147483648;
228 send.DataPacket.Data = this.ConvertInventoryToBytes();
229
230 simClient.OutPacket(send);
231 }
232
233 public byte[] ConvertInventoryToBytes()
234 {
235 System.Text.Encoding enc = System.Text.Encoding.ASCII;
236 byte[] result = new byte[0];
237 List<byte[]> inventoryData = new List<byte[]>();
238 int totallength = 0;
239 foreach (InventoryItem invItem in inventoryItems.Values)
240 {
241 byte[] data = enc.GetBytes(invItem.ExportString());
242 inventoryData.Add(data);
243 totallength += data.Length;
244 }
245 //TODO: copy arrays into the single result array
246
247 return result;
248 }
249
250 public void CreateInventoryFromBytes(byte[] data)
251 {
252
253 }
254
255 #endregion
256
257 #region Update viewers Methods
258
259 //should change these mehtods, so that outgoing packets are sent through the avatar class
260 public void SendFullUpdateToClient(IClientAPI remoteClient)
261 {
262 LLVector3 lPos;
263 if (this._physActor != null && this.physicsEnabled)
264 {
265 PhysicsVector pPos = this._physActor.Position;
266 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
267 }
268 else
269 {
270 lPos = this.Pos;
271 }
272
273 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
274 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
275 outPacket.ObjectData[0] = this.CreateUpdateBlock();
276 byte[] pb = lPos.GetBytes();
277 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
278
279 remoteClient.OutPacket(outPacket);
280 }
281
282 public void SendFullUpdateToAllClients()
283 {
284
285 }
286
287 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
288 {
289
290 }
291
292 public void SendTerseUpdateToALLClients()
293 {
294
295 }
296
297 #endregion
298
299 #region Create Methods
300
301 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
302 {
303 PrimData PData = new PrimData();
304 this.primData = PData;
305 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
306
307 PData.OwnerID = ownerID;
308 PData.PCode = addPacket.ObjectData.PCode;
309 PData.PathBegin = addPacket.ObjectData.PathBegin;
310 PData.PathEnd = addPacket.ObjectData.PathEnd;
311 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
312 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
313 PData.PathShearX = addPacket.ObjectData.PathShearX;
314 PData.PathShearY = addPacket.ObjectData.PathShearY;
315 PData.PathSkew = addPacket.ObjectData.PathSkew;
316 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
317 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
318 PData.Scale = addPacket.ObjectData.Scale;
319 PData.PathCurve = addPacket.ObjectData.PathCurve;
320 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
321 PData.ParentID = 0;
322 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
323 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
324 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
325 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
326 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
327 PData.PathTwist = addPacket.ObjectData.PathTwist;
328 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
329 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
330 this.primData.FullID = this.uuid = LLUUID.Random();
331 this.localid = (uint)(localID);
332 this.primData.Position = this.Pos = pos1;
333 }
334
335 public void CreateFromBytes(byte[] data)
336 {
337
338 }
339
340 public void CreateFromPrimData(PrimData primData)
341 {
342 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
343 }
344
345 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
346 {
347
348 }
349
350 #endregion
351
352 #region Packet Update Methods
353 protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
354 {
355 objdata.PSBlock = new byte[0];
356 objdata.ExtraParams = new byte[1];
357 objdata.MediaURL = new byte[0];
358 objdata.NameValue = new byte[0];
359 objdata.Text = new byte[0];
360 objdata.TextColor = new byte[4];
361 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
362 objdata.JointPivot = new LLVector3(0, 0, 0);
363 objdata.Material = 3;
364 objdata.TextureAnim = new byte[0];
365 objdata.Sound = LLUUID.Zero;
366 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
367 this.primData.Texture = objdata.TextureEntry = ntex.ToBytes();
368 objdata.State = 0;
369 objdata.Data = new byte[0];
370
371 objdata.ObjectData = new byte[60];
372 objdata.ObjectData[46] = 128;
373 objdata.ObjectData[47] = 63;
374 }
375
376 protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData)
377 {
378 objectData.OwnerID = this.primData.OwnerID;
379 objectData.PCode = this.primData.PCode;
380 objectData.PathBegin = this.primData.PathBegin;
381 objectData.PathEnd = this.primData.PathEnd;
382 objectData.PathScaleX = this.primData.PathScaleX;
383 objectData.PathScaleY = this.primData.PathScaleY;
384 objectData.PathShearX = this.primData.PathShearX;
385 objectData.PathShearY = this.primData.PathShearY;
386 objectData.PathSkew = this.primData.PathSkew;
387 objectData.ProfileBegin = this.primData.ProfileBegin;
388 objectData.ProfileEnd = this.primData.ProfileEnd;
389 objectData.Scale = this.primData.Scale;
390 objectData.PathCurve = this.primData.PathCurve;
391 objectData.ProfileCurve = this.primData.ProfileCurve;
392 objectData.ParentID = this.primData.ParentID;
393 objectData.ProfileHollow = this.primData.ProfileHollow;
394 objectData.PathRadiusOffset = this.primData.PathRadiusOffset;
395 objectData.PathRevolutions = this.primData.PathRevolutions;
396 objectData.PathTaperX = this.primData.PathTaperX;
397 objectData.PathTaperY = this.primData.PathTaperY;
398 objectData.PathTwist = this.primData.PathTwist;
399 objectData.PathTwistBegin = this.primData.PathTwistBegin;
400 }
401
402 #endregion
403 protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock()
404 {
405 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
406 this.SetDefaultPacketValues(objupdate);
407 objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
408 this.SetPacketShapeData(objupdate);
409 byte[] pb = this.Pos.GetBytes();
410 Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length);
411 return objupdate;
412 }
413
414 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
415 {
416 uint ID = this.localid;
417 byte[] bytes = new byte[60];
418
419 int i = 0;
420 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
421 dat.TextureEntry = new byte[0];
422 bytes[i++] = (byte)(ID % 256);
423 bytes[i++] = (byte)((ID >> 8) % 256);
424 bytes[i++] = (byte)((ID >> 16) % 256);
425 bytes[i++] = (byte)((ID >> 24) % 256);
426 bytes[i++] = 0;
427 bytes[i++] = 0;
428
429 LLVector3 lPos;
430 Axiom.MathLib.Quaternion lRot;
431 if (this._physActor != null && this.physicsEnabled)
432 {
433 PhysicsVector pPos = this._physActor.Position;
434 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
435 lRot = this._physActor.Orientation;
436 }
437 else
438 {
439 lPos = this.Pos;
440 lRot = this.rotation;
441 }
442 byte[] pb = lPos.GetBytes();
443 Array.Copy(pb, 0, bytes, i, pb.Length);
444 i += 12;
445 ushort ac = 32767;
446
447 //vel
448 bytes[i++] = (byte)(ac % 256);
449 bytes[i++] = (byte)((ac >> 8) % 256);
450 bytes[i++] = (byte)(ac % 256);
451 bytes[i++] = (byte)((ac >> 8) % 256);
452 bytes[i++] = (byte)(ac % 256);
453 bytes[i++] = (byte)((ac >> 8) % 256);
454
455 //accel
456 bytes[i++] = (byte)(ac % 256);
457 bytes[i++] = (byte)((ac >> 8) % 256);
458 bytes[i++] = (byte)(ac % 256);
459 bytes[i++] = (byte)((ac >> 8) % 256);
460 bytes[i++] = (byte)(ac % 256);
461 bytes[i++] = (byte)((ac >> 8) % 256);
462
463 ushort rw, rx, ry, rz;
464 rw = (ushort)(32768 * (lRot.w + 1));
465 rx = (ushort)(32768 * (lRot.x + 1));
466 ry = (ushort)(32768 * (lRot.y + 1));
467 rz = (ushort)(32768 * (lRot.z + 1));
468
469 //rot
470 bytes[i++] = (byte)(rx % 256);
471 bytes[i++] = (byte)((rx >> 8) % 256);
472 bytes[i++] = (byte)(ry % 256);
473 bytes[i++] = (byte)((ry >> 8) % 256);
474 bytes[i++] = (byte)(rz % 256);
475 bytes[i++] = (byte)((rz >> 8) % 256);
476 bytes[i++] = (byte)(rw % 256);
477 bytes[i++] = (byte)((rw >> 8) % 256);
478
479 //rotation vel
480 bytes[i++] = (byte)(ac % 256);
481 bytes[i++] = (byte)((ac >> 8) % 256);
482 bytes[i++] = (byte)(ac % 256);
483 bytes[i++] = (byte)((ac >> 8) % 256);
484 bytes[i++] = (byte)(ac % 256);
485 bytes[i++] = (byte)((ac >> 8) % 256);
486
487 dat.Data = bytes;
488 return dat;
489 }
16 } 490 }
17} 491}
diff --git a/OpenSim/OpenSim.World/SceneObject.cs b/OpenSim/OpenSim.World/SceneObject.cs
index a846fb5..d78c7a2 100644
--- a/OpenSim/OpenSim.World/SceneObject.cs
+++ b/OpenSim/OpenSim.World/SceneObject.cs
@@ -14,8 +14,8 @@ namespace OpenSim.world
14 public class SceneObject : Entity 14 public class SceneObject : Entity
15 { 15 {
16 private LLUUID rootUUID; 16 private LLUUID rootUUID;
17 private Dictionary<LLUUID, Primitive2> ChildPrimitives = new Dictionary<LLUUID, Primitive2>(); 17 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>();
18 private Dictionary<uint, ClientView> m_clientThreads; 18 private Dictionary<uint, IClientAPI> m_clientThreads;
19 private World m_world; 19 private World m_world;
20 20
21 public SceneObject() 21 public SceneObject()
@@ -42,7 +42,7 @@ namespace OpenSim.world
42 42
43 } 43 }
44 44
45 public void GetProperites(ClientView client) 45 public void GetProperites(IClientAPI client)
46 { 46 {
47 /* 47 /*
48 ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); 48 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs
index ee5a23a..3357536 100644
--- a/OpenSim/OpenSim.World/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.World/World.PacketHandlers.cs
@@ -6,10 +6,8 @@ using libsecondlife.Packets;
6using OpenSim.Physics.Manager; 6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types; 8using OpenSim.Framework.Types;
9using OpenSim.Framework.Terrain;
10using OpenSim.Framework.Inventory; 9using OpenSim.Framework.Inventory;
11using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
12using OpenSim.Assets;
13 11
14namespace OpenSim.world 12namespace OpenSim.world
15{ 13{
@@ -35,10 +33,10 @@ namespace OpenSim.world
35 33
36 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 34 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
37 { 35 {
38 foreach (ClientView client in m_clientThreads.Values) 36 foreach (IClientAPI client in m_clientThreads.Values)
39 { 37 {
40 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); 38 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
41 int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); 39 int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos);
42 40
43 switch (type) 41 switch (type)
44 { 42 {
@@ -72,190 +70,57 @@ namespace OpenSim.world
72 70
73 public void RezObject(AssetBase primAsset, LLVector3 pos) 71 public void RezObject(AssetBase primAsset, LLVector3 pos)
74 { 72 {
75 PrimData primd = new PrimData(primAsset.Data); 73
76 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
77 nPrim.CreateFromStorage(primd, pos, this._primCount, true);
78 this.Entities.Add(nPrim.uuid, nPrim);
79 this._primCount++;
80 } 74 }
81 75
82 public void DeRezObject(Packet packet, ClientView simClient) 76 public void DeRezObject(Packet packet, IClientAPI simClient)
83 { 77 {
84 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 78
85
86 //Needs to delete object from physics at a later date
87 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
88 {
89 //currently following code not used (or don't know of any case of destination being zero
90
91 }
92 else
93 {
94 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
95 {
96 Entity selectedEnt = null;
97 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
98 foreach (Entity ent in this.Entities.Values)
99 {
100 if (ent.localid == Data.ObjectLocalID)
101 {
102 AssetBase primAsset = new AssetBase();
103 primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid
104 primAsset.InvType = 6;
105 primAsset.Type = 6;
106 primAsset.Name = "Prim";
107 primAsset.Description = "";
108 primAsset.Data = ((Primitive)ent).GetByteArray();
109 this._assetCache.AddAsset(primAsset);
110 this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset);
111 selectedEnt = ent;
112 break;
113 }
114 }
115 if (selectedEnt != null)
116 {
117 this.localStorage.RemovePrim(selectedEnt.uuid);
118 KillObjectPacket kill = new KillObjectPacket();
119 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
120 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
121 kill.ObjectData[0].ID = selectedEnt.localid;
122 foreach (ClientView client in m_clientThreads.Values)
123 {
124 client.OutPacket(kill);
125 }
126 lock (Entities)
127 {
128 Entities.Remove(selectedEnt.uuid);
129 }
130 }
131 }
132 }
133
134 } 79 }
135 80
136 public void SendAvatarsToClient(ClientView remoteClient) 81 public void SendAvatarsToClient(IClientAPI remoteClient)
137 { 82 {
138 foreach (ClientView client in m_clientThreads.Values) 83
139 {
140 if (client.AgentID != remoteClient.AgentID)
141 {
142 // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
143 // RemoteClient.OutPacket(objupdate);
144 client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar);
145 client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar);
146 }
147 }
148 } 84 }
149 85
150 public void LinkObjects(uint parentPrim, List<uint> childPrims) 86 public void LinkObjects(uint parentPrim, List<uint> childPrims)
151 { 87 {
152 Primitive parentprim = null; 88
153 foreach (Entity ent in Entities.Values)
154 {
155 if (ent.localid == parentPrim)
156 {
157 parentprim = (OpenSim.world.Primitive)ent;
158
159 }
160 }
161
162 for (int i = 0; i < childPrims.Count; i++)
163 {
164 uint childId = childPrims[i];
165 foreach (Entity ent in Entities.Values)
166 {
167 if (ent.localid == childId)
168 {
169 ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
170 }
171 }
172 }
173 89
174 } 90 }
175 91
176 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) 92 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
177 { 93 {
178 foreach (Entity ent in Entities.Values) 94
179 {
180 if (ent.localid == primLocalID)
181 {
182 ((OpenSim.world.Primitive)ent).UpdateShape(shapeBlock);
183 break;
184 }
185 }
186 } 95 }
187 96
188 public void SelectPrim(uint primLocalID, ClientView remoteClient) 97 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
189 { 98 {
190 foreach (Entity ent in Entities.Values) 99
191 {
192 if (ent.localid == primLocalID)
193 {
194 ((OpenSim.world.Primitive)ent).GetProperites(remoteClient);
195 break;
196 }
197 }
198 } 100 }
199 101
200 public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) 102 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
201 { 103 {
202 foreach (Entity ent in Entities.Values) 104
203 {
204 if (ent.localid == localID)
205 {
206 ((OpenSim.world.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet);
207 break;
208 }
209 }
210 } 105 }
211 106
212 public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) 107 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
213 { 108 {
214 foreach (Entity ent in Entities.Values) 109
215 {
216 if (ent.localid == localID)
217 {
218 ((OpenSim.world.Primitive)ent).UpdateTexture(texture);
219 break;
220 }
221 }
222 } 110 }
223 111
224 public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) 112 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
225 { 113 {
226 foreach (Entity ent in Entities.Values) 114
227 {
228 if (ent.localid == localID)
229 {
230 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
231 break;
232 }
233 }
234 } 115 }
235 116
236 public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) 117 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
237 { 118 {
238 foreach (Entity ent in Entities.Values) 119
239 {
240 if (ent.localid == localID)
241 {
242 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
243 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
244 break;
245 }
246 }
247 } 120 }
248 121
249 public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) 122 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
250 { 123 {
251 foreach (Entity ent in Entities.Values)
252 {
253 if (ent.localid == localID)
254 {
255 ((OpenSim.world.Primitive)ent).Scale = scale;
256 break;
257 }
258 }
259 } 124 }
260 } 125 }
261} 126}
diff --git a/OpenSim/OpenSim.World/World.Scripting.cs b/OpenSim/OpenSim.World/World.Scripting.cs
index 44ef05a..24d887c 100644
--- a/OpenSim/OpenSim.World/World.Scripting.cs
+++ b/OpenSim/OpenSim.World/World.Scripting.cs
@@ -96,7 +96,7 @@ namespace OpenSim.world
96 pos.Y = y; 96 pos.Y = y;
97 Primitive prim = entity as Primitive; 97 Primitive prim = entity as Primitive;
98 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. 98 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
99 prim.UpdatePosition(pos); 99 //prim.UpdatePosition(pos);
100 // Console.WriteLine("script- setting entity " + localID + " positon"); 100 // Console.WriteLine("script- setting entity " + localID + " positon");
101 } 101 }
102 } 102 }
diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs
index d840d10..2580761 100644
--- a/OpenSim/OpenSim.World/World.cs
+++ b/OpenSim/OpenSim.World/World.cs
@@ -6,13 +6,11 @@ using System.Text;
6using System.Reflection; 6using System.Reflection;
7using System.IO; 7using System.IO;
8using System.Threading; 8using System.Threading;
9using System.Timers;
9using OpenSim.Physics.Manager; 10using OpenSim.Physics.Manager;
10using OpenSim.Framework.Interfaces; 11using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 12using OpenSim.Framework.Types;
12using OpenSim.Framework.Terrain;
13using OpenSim.Framework.Inventory; 13using OpenSim.Framework.Inventory;
14using OpenSim.Assets;
15//using OpenSim.world.scripting;
16using OpenSim.RegionServer.world.scripting; 14using OpenSim.RegionServer.world.scripting;
17using OpenSim.Terrain; 15using OpenSim.Terrain;
18 16
@@ -20,6 +18,7 @@ namespace OpenSim.world
20{ 18{
21 public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI 19 public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI
22 { 20 {
21 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
23 public object LockPhysicsEngine = new object(); 22 public object LockPhysicsEngine = new object();
24 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; 23 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars;
25 public Dictionary<libsecondlife.LLUUID, Primitive> Prims; 24 public Dictionary<libsecondlife.LLUUID, Primitive> Prims;
@@ -57,15 +56,16 @@ namespace OpenSim.world
57 /// <param name="clientThreads">Dictionary to contain client threads</param> 56 /// <param name="clientThreads">Dictionary to contain client threads</param>
58 /// <param name="regionHandle">Region Handle for this region</param> 57 /// <param name="regionHandle">Region Handle for this region</param>
59 /// <param name="regionName">Region Name for this region</param> 58 /// <param name="regionName">Region Name for this region</param>
60 public World(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) 59 public World(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo)
61 { 60 {
62 try 61 try
63 { 62 {
64 updateLock = new Mutex(false); 63 updateLock = new Mutex(false);
65 m_clientThreads = clientThreads; 64 m_clientThreads = clientThreads;
66 m_regionHandle = regionHandle;
67 m_regionName = regionName;
68 m_regInfo = regInfo; 65 m_regInfo = regInfo;
66 m_regionHandle = m_regInfo.RegionHandle;
67 m_regionName = m_regInfo.RegionName;
68 this.m_datastore = m_regInfo.DataStore;
69 69
70 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); 70 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
71 m_scripts = new Dictionary<string, ScriptFactory>(); 71 m_scripts = new Dictionary<string, ScriptFactory>();
@@ -85,6 +85,8 @@ namespace OpenSim.world
85 Avatar.LoadAnims(); 85 Avatar.LoadAnims();
86 this.SetDefaultScripts(); 86 this.SetDefaultScripts();
87 this.LoadScriptEngines(); 87 this.LoadScriptEngines();
88
89
88 } 90 }
89 catch (Exception e) 91 catch (Exception e)
90 { 92 {
@@ -93,6 +95,13 @@ namespace OpenSim.world
93 } 95 }
94 #endregion 96 #endregion
95 97
98 public void StartTimer()
99 {
100 m_heartbeatTimer.Enabled = true;
101 m_heartbeatTimer.Interval = 100;
102 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
103 }
104
96 #region Script Methods 105 #region Script Methods
97 /// <summary> 106 /// <summary>
98 /// Loads a new script into the specified entity 107 /// Loads a new script into the specified entity
@@ -167,6 +176,18 @@ namespace OpenSim.world
167 #endregion 176 #endregion
168 177
169 #region Update Methods 178 #region Update Methods
179
180
181 /// <summary>
182 /// Performs per-frame updates regularly
183 /// </summary>
184 /// <param name="sender"></param>
185 /// <param name="e"></param>
186 void Heartbeat(object sender, System.EventArgs e)
187 {
188 this.Update();
189 }
190
170 /// <summary> 191 /// <summary>
171 /// Performs per-frame updates on the world, this should be the central world loop 192 /// Performs per-frame updates on the world, this should be the central world loop
172 /// </summary> 193 /// </summary>
@@ -327,7 +348,7 @@ namespace OpenSim.world
327 } 348 }
328 this.localStorage.SaveMap(this.Terrain.getHeights1D()); 349 this.localStorage.SaveMap(this.Terrain.getHeights1D());
329 350
330 foreach (ClientView client in m_clientThreads.Values) 351 foreach (IClientAPI client in m_clientThreads.Values)
331 { 352 {
332 this.SendLayerData(client); 353 this.SendLayerData(client);
333 } 354 }
@@ -358,7 +379,7 @@ namespace OpenSim.world
358 } 379 }
359 this.localStorage.SaveMap(this.Terrain.getHeights1D()); 380 this.localStorage.SaveMap(this.Terrain.getHeights1D());
360 381
361 foreach (ClientView client in m_clientThreads.Values) 382 foreach (IClientAPI client in m_clientThreads.Values)
362 { 383 {
363 this.SendLayerData(client); 384 this.SendLayerData(client);
364 } 385 }
@@ -388,7 +409,7 @@ namespace OpenSim.world
388 { 409 {
389 /* Dont save here, rely on tainting system instead */ 410 /* Dont save here, rely on tainting system instead */
390 411
391 foreach (ClientView client in m_clientThreads.Values) 412 foreach (IClientAPI client in m_clientThreads.Values)
392 { 413 {
393 this.SendLayerData(pointx, pointy, client); 414 this.SendLayerData(pointx, pointy, client);
394 } 415 }
@@ -436,23 +457,9 @@ namespace OpenSim.world
436 /// Sends prims to a client 457 /// Sends prims to a client
437 /// </summary> 458 /// </summary>
438 /// <param name="RemoteClient">Client to send to</param> 459 /// <param name="RemoteClient">Client to send to</param>
439 public void GetInitialPrims(ClientView RemoteClient) 460 public void GetInitialPrims(IClientAPI RemoteClient)
440 { 461 {
441 try 462
442 {
443 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
444 {
445 if (Entities[UUID] is Primitive)
446 {
447 Primitive primitive = Entities[UUID] as Primitive;
448 primitive.UpdateClient(RemoteClient);
449 }
450 }
451 }
452 catch (Exception e)
453 {
454 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: GetInitialPrims() - Failed with exception " + e.ToString());
455 }
456 } 463 }
457 464
458 /// <summary> 465 /// <summary>
@@ -477,67 +484,32 @@ namespace OpenSim.world
477 /// <param name="prim">The object to load</param> 484 /// <param name="prim">The object to load</param>
478 public void PrimFromStorage(PrimData prim) 485 public void PrimFromStorage(PrimData prim)
479 { 486 {
480 try 487
481 {
482 if (prim.LocalID >= this._primCount)
483 {
484 _primCount = prim.LocalID + 1;
485 }
486 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage");
487 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
488 nPrim.CreateFromStorage(prim);
489 this.Entities.Add(nPrim.uuid, nPrim);
490 }
491 catch (Exception e)
492 {
493 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: PrimFromStorage() - Failed with exception " + e.ToString());
494 }
495 } 488 }
496 489
497 public void AddNewPrim(Packet addPacket, ClientView agentClient) 490 public void AddNewPrim(Packet addPacket, IClientAPI agentClient)
498 { 491 {
499 AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentID); 492 AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId);
500 } 493 }
501 494
502 public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) 495 public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
503 { 496 {
504 try 497
505 {
506 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim");
507 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
508 prim.CreateFromPacket(addPacket, ownerID, this._primCount);
509 PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z);
510 PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f);
511 if (OpenSim.world.Avatar.PhysicsEngineFlying)
512 {
513 lock (this.LockPhysicsEngine)
514 {
515 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize);
516 }
517 }
518
519 this.Entities.Add(prim.uuid, prim);
520 this._primCount++;
521 }
522 catch (Exception e)
523 {
524 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddNewPrim() - Failed with exception " + e.ToString());
525 }
526 } 498 }
527 499
528 #endregion 500 #endregion
529 501
530 #region Add/Remove Avatar Methods 502 #region Add/Remove Avatar Methods
531 503
532 public override Avatar AddViewerAgent(ClientView agentClient) 504 public override bool AddNewAvatar(IClientAPI agentClient, bool child)
533 { 505 {
534 Avatar newAvatar = null; 506
535 return newAvatar; 507 return false;
536 } 508 }
537 509
538 public override void RemoveViewerAgent(ClientView agentClient) 510 public override bool RemoveAvatar(LLUUID agentID)
539 { 511 {
540 512 return false;
541 } 513 }
542 #endregion 514 #endregion
543 515
diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs
index 8fe98d3..33952bf 100644
--- a/OpenSim/OpenSim.World/WorldBase.cs
+++ b/OpenSim/OpenSim.World/WorldBase.cs
@@ -9,28 +9,27 @@ using System.Threading;
9using OpenSim.Physics.Manager; 9using OpenSim.Physics.Manager;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Framework.Terrain;
13using OpenSim.Framework.Inventory; 12using OpenSim.Framework.Inventory;
14using OpenSim.Assets;
15using OpenSim.RegionServer.world.scripting; 13using OpenSim.RegionServer.world.scripting;
16using OpenSim.Terrain; 14using OpenSim.Terrain;
17 15
18namespace OpenSim.world 16namespace OpenSim.world
19{ 17{
20 public class WorldBase 18 public class WorldBase : IWorld
21 { 19 {
22 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 20 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
23 protected Dictionary<uint, IClientAPI> m_clientThreads; 21 protected Dictionary<uint, IClientAPI> m_clientThreads;
24 protected ulong m_regionHandle; 22 protected ulong m_regionHandle;
25 protected string m_regionName; 23 protected string m_regionName;
26 protected InventoryCache _inventoryCache; 24 // protected InventoryCache _inventoryCache;
27 protected AssetCache _assetCache; 25 // protected AssetCache _assetCache;
28 protected RegionInfo m_regInfo; 26 protected RegionInfo m_regInfo;
29 27
30 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. 28 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
31 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine 29 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
32 30
33 #region Properties 31 #region Properties
32 /*
34 public InventoryCache InventoryCache 33 public InventoryCache InventoryCache
35 { 34 {
36 set 35 set
@@ -46,6 +45,7 @@ namespace OpenSim.world
46 this._assetCache = value; 45 this._assetCache = value;
47 } 46 }
48 } 47 }
48 */
49 #endregion 49 #endregion
50 50
51 #region Constructors 51 #region Constructors
@@ -56,14 +56,7 @@ namespace OpenSim.world
56 #endregion 56 #endregion
57 57
58 #region Setup Methods 58 #region Setup Methods
59 /// <summary> 59
60 /// Register Packet handler Methods with the packet server (which will register them with the SimClient)
61 /// </summary>
62 /// <param name="packetServer"></param>
63 public virtual void RegisterPacketHandlers(PacketServer packetServer)
64 {
65
66 }
67 #endregion 60 #endregion
68 61
69 #region Update Methods 62 #region Update Methods
@@ -90,7 +83,7 @@ namespace OpenSim.world
90 /// Send the region heightmap to the client 83 /// Send the region heightmap to the client
91 /// </summary> 84 /// </summary>
92 /// <param name="RemoteClient">Client to send to</param> 85 /// <param name="RemoteClient">Client to send to</param>
93 public virtual void SendLayerData(ClientView RemoteClient) 86 public virtual void SendLayerData(IClientAPI RemoteClient)
94 { 87 {
95 try 88 try
96 { 89 {
@@ -122,7 +115,7 @@ namespace OpenSim.world
122 /// <param name="px">Patch coordinate (x) 0..16</param> 115 /// <param name="px">Patch coordinate (x) 0..16</param>
123 /// <param name="py">Patch coordinate (y) 0..16</param> 116 /// <param name="py">Patch coordinate (y) 0..16</param>
124 /// <param name="RemoteClient">The client to send to</param> 117 /// <param name="RemoteClient">The client to send to</param>
125 public void SendLayerData(int px, int py, ClientView RemoteClient) 118 public void SendLayerData(int px, int py, IClientAPI RemoteClient)
126 { 119 {
127 try 120 try
128 { 121 {
@@ -144,25 +137,23 @@ namespace OpenSim.world
144 #endregion 137 #endregion
145 138
146 #region Add/Remove Agent/Avatar 139 #region Add/Remove Agent/Avatar
147 /// <summary> 140 public virtual bool AddNewAvatar(IClientAPI remoteClient, bool child)
148 /// Add a new Agent's avatar
149 /// </summary>
150 /// <param name="agentClient"></param>
151 public virtual Avatar AddViewerAgent(ClientView agentClient)
152 { 141 {
153 return null; 142 return false;
154 } 143 }
155 144
156 /// <summary> 145 public virtual bool RemoveAvatar(LLUUID agentID)
157 /// Remove a Agent's avatar
158 /// </summary>
159 /// <param name="agentClient"></param>
160 public virtual void RemoveViewerAgent(ClientView agentClient)
161 { 146 {
162 147 return false;
163 } 148 }
149
164 #endregion 150 #endregion
165 151
152 public virtual RegionInfo GetRegionInfo()
153 {
154 return null;
155 }
156
166 #region Shutdown 157 #region Shutdown
167 /// <summary> 158 /// <summary>
168 /// Tidy before shutdown 159 /// Tidy before shutdown
diff --git a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs b/OpenSim/OpenSim.World/scripting/IScriptHandler.cs
index 15efc49..efd67b1 100644
--- a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs
+++ b/OpenSim/OpenSim.World/scripting/IScriptHandler.cs
@@ -87,7 +87,7 @@ namespace OpenSim.RegionServer.world.scripting
87 { 87 {
88 Primitive prim = m_entity as Primitive; 88 Primitive prim = m_entity as Primitive;
89 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. 89 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
90 prim.UpdatePosition( value ); 90 // prim.UpdatePosition( value );
91 } 91 }
92 } 92 }
93 } 93 }
diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj
index 069c5c6..79abd9e 100644
--- a/OpenSim/OpenSim/OpenSim.csproj
+++ b/OpenSim/OpenSim/OpenSim.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{438A9556-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{438A9556-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim</AssemblyName> 13 <AssemblyName>OpenSim</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType> 18 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim</RootNamespace> 21 <RootNamespace>OpenSim</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,27 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="libsecondlife.dll" > 76 <Reference Include="libsecondlife.dll">
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 77 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 80 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> 81 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 84 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> 85 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 86 <Private>False</Private>
80 </Reference> 87 </Reference>
@@ -84,49 +91,53 @@
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 91 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 92 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 93 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 94 <Private>False</Private>
88 </ProjectReference> 95 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 96 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 97 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 98 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 99 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 100 <Private>False</Private>
94 </ProjectReference> 101 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 102 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name> 103 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 104 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 105 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 106 <Private>False</Private>
100 </ProjectReference> 107 </ProjectReference>
101 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 108 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
102 <Name>OpenSim.Physics.Manager</Name> 109 <Name>OpenSim.Physics.Manager</Name>
103 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 110 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 111 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 112 <Private>False</Private>
106 </ProjectReference> 113 </ProjectReference>
107 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> 114 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
108 <Name>OpenSim.Servers</Name> 115 <Name>OpenSim.Servers</Name>
109 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 116 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 117 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 118 <Private>False</Private>
112 </ProjectReference> 119 </ProjectReference>
113 <ProjectReference Include="..\OpenSim.RegionServer\OpenSim.RegionServer.csproj"> 120 <ProjectReference Include="..\OpenSim.RegionServer\OpenSim.RegionServer.csproj">
114 <Name>OpenSim.RegionServer</Name> 121 <Name>OpenSim.RegionServer</Name>
115 <Project>{632E1BFD-0000-0000-0000-000000000000}</Project> 122 <Project>{632E1BFD-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 123 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private> 124 <Private>False</Private>
118 </ProjectReference> 125 </ProjectReference>
119 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 126 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
120 <Name>OpenSim.GenericConfig.Xml</Name> 127 <Name>OpenSim.GenericConfig.Xml</Name>
121 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 128 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 129 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private> 130 <Private>False</Private>
124 </ProjectReference> 131 </ProjectReference>
125 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> 132 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
126 <Name>XMLRPC</Name> 133 <Name>XMLRPC</Name>
127 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 134 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
128 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 135 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
129 <Private>False</Private> 136 <Private>False</Private>
137 </ProjectReference>
138 <ProjectReference Include="..\OpenSim.World\OpenSim.World.csproj">
139 <Project>{642A14A8-0000-0000-0000-000000000000}</Project>
140 <Name>OpenSim.World</Name>
130 </ProjectReference> 141 </ProjectReference>
131 </ItemGroup> 142 </ItemGroup>
132 <ItemGroup> 143 <ItemGroup>
@@ -144,4 +155,4 @@
144 <PostBuildEvent> 155 <PostBuildEvent>
145 </PostBuildEvent> 156 </PostBuildEvent>
146 </PropertyGroup> 157 </PropertyGroup>
147</Project> 158</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs
index 9025316..aa41aeb 100644
--- a/OpenSim/OpenSim/OpenSimMain.cs
+++ b/OpenSim/OpenSim/OpenSimMain.cs
@@ -75,7 +75,7 @@ namespace OpenSim
75 /// </summary> 75 /// </summary>
76 public override void StartUp() 76 public override void StartUp()
77 { 77 {
78 this.regionData = new RegionInfo(); 78 this.serversData = new NetworkServersInfo();
79 try 79 try
80 { 80 {
81 this.localConfig = new XmlConfig(m_config); 81 this.localConfig = new XmlConfig(m_config);
@@ -90,10 +90,9 @@ namespace OpenSim
90 this.SetupFromConfigFile(this.localConfig); 90 this.SetupFromConfigFile(this.localConfig);
91 } 91 }
92 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); 92 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
93 this.regionData.InitConfig(this.m_sandbox, this.localConfig); 93 this.serversData.InitConfig(this.m_sandbox, this.localConfig);
94 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change 94 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
95 95
96 GridServers = new Grid();
97 if (m_sandbox) 96 if (m_sandbox)
98 { 97 {
99 this.SetupLocalGridServers(); 98 this.SetupLocalGridServers();
@@ -113,36 +112,11 @@ namespace OpenSim
113 112
114 startuptime = DateTime.Now; 113 startuptime = DateTime.Now;
115 114
116 try 115 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
117 { 116 this.physManager.LoadPlugins();
118 AssetCache = new AssetCache(GridServers.AssetServer);
119 InventoryCache = new InventoryCache();
120 }
121 catch (Exception e)
122 {
123 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache");
124 Environment.Exit(1);
125 }
126
127 m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler);
128
129 //should be passing a IGenericConfig object to these so they can read the config data they want from it
130 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
131 IGridServer gridServer = GridServers.GridServer;
132 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
133
134 if (!m_sandbox)
135 {
136 this.ConnectToRemoteGridServer();
137 }
138 117
139 this.SetupLocalWorld(); 118 this.SetupLocalWorld();
140 119
141 if (m_sandbox)
142 {
143 AssetCache.LoadDefaultTextureSet();
144 }
145
146 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server"); 120 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server");
147 121
148 this.SetupHttpListener(); 122 this.SetupHttpListener();
@@ -151,30 +125,18 @@ namespace OpenSim
151 LoginServer loginServer = null; 125 LoginServer loginServer = null;
152 LoginServer adminLoginServer = null; 126 LoginServer adminLoginServer = null;
153 127
154 bool sandBoxWithLoginServer = m_loginserver && m_sandbox; 128 if (m_sandbox)
155 if (sandBoxWithLoginServer)
156 { 129 {
157 loginServer = new LoginServer(regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); 130 loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, this.user_accounts);
158 loginServer.Startup(); 131 loginServer.Startup();
159 loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler).AddNewSession); 132 loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler).AddNewSession);
160 133
161 if (user_accounts) 134 //sandbox mode with loginserver not using accounts
162 { 135 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
163 //sandbox mode with loginserver using accounts
164 this.GridServers.UserServer = loginServer;
165 adminLoginServer = loginServer;
166
167 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
168 }
169 else
170 {
171 //sandbox mode with loginserver not using accounts
172 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
173 }
174 } 136 }
175 137
176 //Web front end setup 138 //Web front end setup
177 AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); 139 AdminWebFront adminWebFront = new AdminWebFront("Admin");
178 adminWebFront.LoadMethods(httpServer); 140 adminWebFront.LoadMethods(httpServer);
179 141
180 //Start http server 142 //Start http server
@@ -182,89 +144,93 @@ namespace OpenSim
182 httpServer.Start(); 144 httpServer.Start();
183 145
184 // Start UDP server 146 // Start UDP server
185 this.m_udpServer.ServerListener(); 147 for (int i = 0; i < m_udpServer.Count; i++)
148 {
149 this.m_udpServer[i].ServerListener();
150 }
186 151
187 m_heartbeatTimer.Enabled = true;
188 m_heartbeatTimer.Interval = 100;
189 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
190 } 152 }
191 153
192 # region Setup methods 154 # region Setup methods
193 protected override void SetupLocalGridServers() 155 protected override void SetupLocalGridServers()
194 { 156 {
195 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
196 GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
197
198 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode");
199
200 try 157 try
201 { 158 {
202 GridServers.Initialise(); 159 AssetCache = new AssetCache("OpenSim.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
160 InventoryCache = new InventoryCache();
203 } 161 }
204 catch (Exception e) 162 catch (Exception e)
205 { 163 {
206 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); 164 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache");
207 Environment.Exit(1); 165 Environment.Exit(1);
208 } 166 }
167
209 } 168 }
210 169
211 protected override void SetupRemoteGridServers() 170 protected override void SetupRemoteGridServers()
212 { 171 {
213 if (this.gridLocalAsset)
214 {
215 GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
216 }
217 else
218 {
219 GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
220 }
221 GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
222
223 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode");
224
225 try 172 try
226 { 173 {
227 GridServers.Initialise(); 174 AssetCache = new AssetCache("OpenSim.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
175 InventoryCache = new InventoryCache();
228 } 176 }
229 catch (Exception e) 177 catch (Exception e)
230 { 178 {
231 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); 179 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup remote cache");
232 Environment.Exit(1); 180 Environment.Exit(1);
233 } 181 }
234 } 182 }
235 183
236 protected override void SetupLocalWorld() 184 protected override void SetupLocalWorld()
237 { 185 {
238 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); 186 IGenericConfig regionConfig;
239 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); 187 World LocalWorld;
240 m_console.componentname = "Region " + regionData.RegionName; 188 UDPServer udpServer;
189 RegionInfo regionDat = new RegionInfo();
190
191 string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions");
192 string[] pluginFiles = Directory.GetFiles(path, "*.xml");
241 193
242 m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); 194 for (int i = 0; i < pluginFiles.Length; i++)
243 LocalWorld.InventoryCache = InventoryCache; 195 {
244 LocalWorld.AssetCache = AssetCache; 196 regionConfig = new XmlConfig(pluginFiles[i]);
197 regionConfig.LoadData();
198 regionDat.InitConfig(this.m_sandbox, regionConfig);
199 regionConfig.Close();
245 200
246 this.m_udpServer.LocalWorld = LocalWorld; 201 udpServer = new UDPServer(regionDat.IPListenPort, this.AssetCache, this.InventoryCache, this.m_console, this.AuthenticateSessionsHandler);
247 this.m_udpServer.PacketServer.RegisterClientPacketHandlers();
248 202
249 this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); 203 m_udpServer.Add(udpServer);
250 this.physManager.LoadPlugins(); 204 this.regionData.Add(regionDat);
205
206 /*
207 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString());
208 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world");
209 m_console.componentname = "Region " + regionData.RegionName;
210 */
211
212 LocalWorld = new World(udpServer.PacketServer.ClientAPIs, regionDat);
213 this.m_localWorld.Add(LocalWorld);
214 //LocalWorld.InventoryCache = InventoryCache;
215 //LocalWorld.AssetCache = AssetCache;
251 216
252 LocalWorld.m_datastore = this.regionData.DataStore; 217 udpServer.LocalWorld = LocalWorld;
253 218
254 LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. 219 LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
255 LocalWorld.LoadWorldMap(); 220 LocalWorld.LoadWorldMap();
256 221
257 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); 222 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system");
258 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); 223 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
259 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); 224 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
260 LocalWorld.LoadPrimsFromStorage(); 225 LocalWorld.LoadPrimsFromStorage();
226 }
261 } 227 }
262 228
263 protected override void SetupHttpListener() 229 protected override void SetupHttpListener()
264 { 230 {
265 httpServer = new BaseHttpServer(regionData.IPListenPort); 231 httpServer = new BaseHttpServer(regionData[0].IPListenPort);
266 232
267 if (this.GridServers.GridServer.GetName() == "Remote") 233 if (!this.m_sandbox)
268 { 234 {
269 235
270 // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server 236 // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
@@ -275,7 +241,7 @@ namespace OpenSim
275 { 241 {
276 Hashtable requestData = (Hashtable)request.Params[0]; 242 Hashtable requestData = (Hashtable)request.Params[0];
277 uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 243 uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
278 244
279 AgentCircuitData agent_data = new AgentCircuitData(); 245 AgentCircuitData agent_data = new AgentCircuitData();
280 agent_data.firstname = (string)requestData["firstname"]; 246 agent_data.firstname = (string)requestData["firstname"];
281 agent_data.lastname = (string)requestData["lastname"]; 247 agent_data.lastname = (string)requestData["lastname"];
@@ -297,42 +263,7 @@ namespace OpenSim
297 263
298 protected override void ConnectToRemoteGridServer() 264 protected override void ConnectToRemoteGridServer()
299 { 265 {
300 if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort))
301 {
302 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!");
303 }
304 else
305 {
306 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down.");
307 Shutdown();
308 }
309
310 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
311
312 // If we are being told to load a file, load it.
313 string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"];
314 266
315 if (!String.IsNullOrEmpty(dataUri))
316 {
317 this.LocalWorld.m_datastore = dataUri;
318 }
319
320 if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "")
321 {
322 // The grid server has told us who we are
323 // We must obey the grid server.
324 try
325 {
326 regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
327 regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
328 regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
329 }
330 catch (Exception e)
331 {
332 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!");
333 Environment.Exit(1);
334 }
335 }
336 } 267 }
337 268
338 #endregion 269 #endregion
@@ -447,22 +378,14 @@ namespace OpenSim
447 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients"); 378 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients");
448 // IMPLEMENT THIS 379 // IMPLEMENT THIS
449 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating"); 380 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating");
450 LocalWorld.Close(); 381 for (int i = 0; i < m_localWorld.Count; i++)
451 GridServers.Close(); 382 {
383 ((World)m_localWorld[i]).Close();
384 }
452 m_console.Close(); 385 m_console.Close();
453 Environment.Exit(0); 386 Environment.Exit(0);
454 } 387 }
455 388
456 /// <summary>
457 /// Performs per-frame updates regularly
458 /// </summary>
459 /// <param name="sender"></param>
460 /// <param name="e"></param>
461 void Heartbeat(object sender, System.EventArgs e)
462 {
463 LocalWorld.Update();
464 }
465
466 #region Console Commands 389 #region Console Commands
467 /// <summary> 390 /// <summary>
468 /// Runs commands issued by the server console from the operator 391 /// Runs commands issued by the server console from the operator
@@ -484,10 +407,10 @@ namespace OpenSim
484 407
485 case "terrain": 408 case "terrain":
486 string result = ""; 409 string result = "";
487 if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) 410 /* if (!((World)m_localWorld).Terrain.RunTerrainCmd(cmdparams, ref result))
488 { 411 {
489 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); 412 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result);
490 } 413 }*/
491 break; 414 break;
492 415
493 case "shutdown": 416 case "shutdown":
@@ -515,14 +438,14 @@ namespace OpenSim
515 case "users": 438 case "users":
516 OpenSim.world.Avatar TempAv; 439 OpenSim.world.Avatar TempAv;
517 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); 440 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
518 foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) 441 /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys)
519 { 442 {
520 if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") 443 if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
521 { 444 {
522 TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; 445 TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID];
523 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, 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())); 446 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, 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()));
524 } 447 }
525 } 448 }*/
526 break; 449 break;
527 } 450 }
528 } 451 }