aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorlbsa712007-03-27 21:42:14 +0000
committerlbsa712007-03-27 21:42:14 +0000
commitf42d1fc825b7b9d22ae05836992531d9abd2a26d (patch)
treec316d0d2ec56a34c6c7f2099977bcc6f14e5eb24 /OpenSim.RegionServer
parent* Reverting todays work. It was worth a try. (diff)
downloadopensim-SC_OLD-f42d1fc825b7b9d22ae05836992531d9abd2a26d.zip
opensim-SC_OLD-f42d1fc825b7b9d22ae05836992531d9abd2a26d.tar.gz
opensim-SC_OLD-f42d1fc825b7b9d22ae05836992531d9abd2a26d.tar.bz2
opensim-SC_OLD-f42d1fc825b7b9d22ae05836992531d9abd2a26d.tar.xz
* revert the revert - begin the beguine
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/AgentAssetUpload.cs17
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs11
-rw-r--r--OpenSim.RegionServer/CAPS/SimHttp.cs41
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj68
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build7
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs8
-rw-r--r--OpenSim.RegionServer/SimClient.cs99
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs18
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs20
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs39
-rw-r--r--OpenSim.RegionServer/world/Primitive.cs27
-rw-r--r--OpenSim.RegionServer/world/World.cs31
12 files changed, 226 insertions, 160 deletions
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs
index a482e80..9f85598 100644
--- a/OpenSim.RegionServer/AgentAssetUpload.cs
+++ b/OpenSim.RegionServer/AgentAssetUpload.cs
@@ -1,6 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Assets;
4using OpenSim.Framework.Assets; 5using OpenSim.Framework.Assets;
5using OpenSim.Framework.Utilities; 6using OpenSim.Framework.Utilities;
6using libsecondlife; 7using libsecondlife;
@@ -12,10 +13,14 @@ namespace OpenSim
12 { 13 {
13 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>(); 14 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
14 private SimClient ourClient; 15 private SimClient ourClient;
16 private AssetCache m_assetCache;
17 private InventoryCache m_inventoryCache;
15 18
16 public AgentAssetUpload(SimClient client) 19 public AgentAssetUpload(SimClient client, AssetCache assetCache, InventoryCache inventoryCache)
17 { 20 {
18 this.ourClient = client; 21 this.ourClient = client;
22 m_assetCache = assetCache;
23 m_inventoryCache = inventoryCache;
19 } 24 }
20 25
21 public void AddUpload(LLUUID transactionID, AssetBase asset) 26 public void AddUpload(LLUUID transactionID, AssetBase asset)
@@ -148,8 +153,8 @@ namespace OpenSim
148 //check if we should add it to inventory 153 //check if we should add it to inventory
149 if (trans.AddToInventory) 154 if (trans.AddToInventory)
150 { 155 {
151 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 156 m_assetCache.AddAsset(trans.Asset);
152 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); 157 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
153 } 158 }
154 159
155 160
@@ -176,7 +181,7 @@ namespace OpenSim
176 AssetTransaction trans = this.transactions[transactionID]; 181 AssetTransaction trans = this.transactions[transactionID];
177 if (trans.UploadComplete) 182 if (trans.UploadComplete)
178 { 183 {
179 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 184 m_assetCache.AddAsset(trans.Asset);
180 asset = trans.Asset; 185 asset = trans.Asset;
181 } 186 }
182 } 187 }
@@ -195,8 +200,8 @@ namespace OpenSim
195 if (trans.UploadComplete) 200 if (trans.UploadComplete)
196 { 201 {
197 //already complete so we can add it to the inventory 202 //already complete so we can add it to the inventory
198 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 203 m_assetCache.AddAsset(trans.Asset);
199 Console.WriteLine( "ITem created is " +OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); 204 Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated());
200 } 205 }
201 else 206 else
202 { 207 {
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index ea32589..03f8692 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -2,6 +2,7 @@ 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;
5 6
6namespace OpenSim.CAPS 7namespace OpenSim.CAPS
7{ 8{
@@ -11,9 +12,11 @@ namespace OpenSim.CAPS
11 private string NewAccountForm; 12 private string NewAccountForm;
12 private string LoginForm; 13 private string LoginForm;
13 private string passWord = "Admin"; 14 private string passWord = "Admin";
15 private World m_world;
14 16
15 public AdminWebFront(string password) 17 public AdminWebFront(string password, World world)
16 { 18 {
19 m_world = world;
17 passWord = password; 20 passWord = password;
18 LoadAdminPage(); 21 LoadAdminPage();
19 } 22 }
@@ -45,11 +48,11 @@ namespace OpenSim.CAPS
45 { 48 {
46 responseString = " <p> Listing connected Clients </p>"; 49 responseString = " <p> Listing connected Clients </p>";
47 OpenSim.world.Avatar TempAv; 50 OpenSim.world.Avatar TempAv;
48 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) 51 foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
49 { 52 {
50 if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") 53 if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
51 { 54 {
52 TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; 55 TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
53 responseString += "<p>"; 56 responseString += "<p>";
54 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); 57 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
55 responseString += "</p>"; 58 responseString += "</p>";
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index a1073f0..92bbc6f 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -39,22 +39,27 @@ using System.Collections.Generic;
39using libsecondlife; 39using libsecondlife;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Interfaces; 41using OpenSim.Framework.Interfaces;
42using OpenSim.Servers;
42 43
43namespace OpenSim.CAPS 44namespace OpenSim.CAPS
44{ 45{
45 // Dummy HTTP server, does nothing useful for now 46 // Dummy HTTP server, does nothing useful for now
46 47
47 public class SimCAPSHTTPServer 48 public class SimCAPSHTTPServer : BaseHttpServer
48 { 49 {
49 public Thread HTTPD; 50 private Thread m_workerThread;
50 public HttpListener Listener; 51 private HttpListener m_httpListener;
51 private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>(); 52 private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>();
53 private IGridServer m_gridServer;
54 private int m_port;
52 55
53 public SimCAPSHTTPServer() 56 public SimCAPSHTTPServer(IGridServer gridServer, int port)
54 { 57 {
55 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); 58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
56 HTTPD = new Thread(new ThreadStart(StartHTTP)); 59 m_workerThread = new Thread(new ThreadStart(StartHTTP));
57 HTTPD.Start(); 60 m_workerThread.Start();
61 m_gridServer = gridServer;
62 m_port = port;
58 } 63 }
59 64
60 public void StartHTTP() 65 public void StartHTTP()
@@ -62,15 +67,15 @@ namespace OpenSim.CAPS
62 try 67 try
63 { 68 {
64 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); 69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
65 Listener = new HttpListener(); 70 m_httpListener = new HttpListener();
66 71
67 Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/"); 72 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
68 Listener.Start(); 73 m_httpListener.Start();
69 74
70 HttpListenerContext context; 75 HttpListenerContext context;
71 while (true) 76 while (true)
72 { 77 {
73 context = Listener.GetContext(); 78 context = m_httpListener.GetContext();
74 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); 79 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
75 } 80 }
76 } 81 }
@@ -82,9 +87,9 @@ namespace OpenSim.CAPS
82 87
83 public bool AddRestHandler(string path, IRestHandler handler) 88 public bool AddRestHandler(string path, IRestHandler handler)
84 { 89 {
85 if (!this.restHandlers.ContainsKey(path)) 90 if (!this.m_restHandlers.ContainsKey(path))
86 { 91 {
87 this.restHandlers.Add(path, handler); 92 this.m_restHandlers.Add(path, handler);
88 return true; 93 return true;
89 } 94 }
90 95
@@ -108,12 +113,12 @@ namespace OpenSim.CAPS
108 agent_data.lastname = (string)requestData["lastname"]; 113 agent_data.lastname = (string)requestData["lastname"];
109 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 114 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
110 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 115 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
111 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote") 116 if (m_gridServer.GetName() == "Remote")
112 { 117 {
113 ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 118
119 ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
114 } 120 }
115 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; 121 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
116 break;
117 } 122 }
118 } 123 }
119 catch (Exception e) 124 catch (Exception e)
@@ -135,9 +140,9 @@ namespace OpenSim.CAPS
135 //path[0] should be empty so we are interested in path[1] 140 //path[0] should be empty so we are interested in path[1]
136 if (path.Length > 1) 141 if (path.Length > 1)
137 { 142 {
138 if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1]))) 143 if ((path[1] != "") && (this.m_restHandlers.ContainsKey(path[1])))
139 { 144 {
140 responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); 145 responseString = this.m_restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod);
141 } 146 }
142 } 147 }
143 148
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index f376e04..1ce2837 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,13 +1,12 @@
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>
5 <SchemaVersion>2.0</SchemaVersion> 5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{4171D545-81F5-4C64-AD29-6D7414C38181}</ProjectGuid> 6 <ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</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> 9 <ApplicationIcon></ApplicationIcon>
10 </ApplicationIcon>
11 <AssemblyKeyContainerName> 10 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName> 11 </AssemblyKeyContainerName>
13 <AssemblyName>OpenSim.RegionServer</AssemblyName> 12 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -16,11 +15,9 @@
16 <DefaultTargetSchema>IE50</DefaultTargetSchema> 15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign> 16 <DelaySign>false</DelaySign>
18 <OutputType>Library</OutputType> 17 <OutputType>Library</OutputType>
19 <AppDesignerFolder> 18 <AppDesignerFolder></AppDesignerFolder>
20 </AppDesignerFolder>
21 <RootNamespace>OpenSim.RegionServer</RootNamespace> 19 <RootNamespace>OpenSim.RegionServer</RootNamespace>
22 <StartupObject> 20 <StartupObject></StartupObject>
23 </StartupObject>
24 <FileUpgradeFlags> 21 <FileUpgradeFlags>
25 </FileUpgradeFlags> 22 </FileUpgradeFlags>
26 </PropertyGroup> 23 </PropertyGroup>
@@ -31,8 +28,7 @@
31 <ConfigurationOverrideFile> 28 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile> 29 </ConfigurationOverrideFile>
33 <DefineConstants>TRACE;DEBUG</DefineConstants> 30 <DefineConstants>TRACE;DEBUG</DefineConstants>
34 <DocumentationFile> 31 <DocumentationFile></DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols> 32 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment> 33 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize> 34 <Optimize>False</Optimize>
@@ -41,8 +37,7 @@
41 <RemoveIntegerChecks>False</RemoveIntegerChecks> 37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel> 39 <WarningLevel>4</WarningLevel>
44 <NoWarn> 40 <NoWarn></NoWarn>
45 </NoWarn>
46 </PropertyGroup> 41 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -51,8 +46,7 @@
51 <ConfigurationOverrideFile> 46 <ConfigurationOverrideFile>
52 </ConfigurationOverrideFile> 47 </ConfigurationOverrideFile>
53 <DefineConstants>TRACE</DefineConstants> 48 <DefineConstants>TRACE</DefineConstants>
54 <DocumentationFile> 49 <DocumentationFile></DocumentationFile>
55 </DocumentationFile>
56 <DebugSymbols>False</DebugSymbols> 50 <DebugSymbols>False</DebugSymbols>
57 <FileAlignment>4096</FileAlignment> 51 <FileAlignment>4096</FileAlignment>
58 <Optimize>True</Optimize> 52 <Optimize>True</Optimize>
@@ -61,58 +55,60 @@
61 <RemoveIntegerChecks>False</RemoveIntegerChecks> 55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
63 <WarningLevel>4</WarningLevel> 57 <WarningLevel>4</WarningLevel>
64 <NoWarn> 58 <NoWarn></NoWarn>
65 </NoWarn>
66 </PropertyGroup> 59 </PropertyGroup>
67 <ItemGroup> 60 <ItemGroup>
68 <Reference Include="System"> 61 <Reference Include="System" >
69 <HintPath>System.dll</HintPath> 62 <HintPath>System.dll</HintPath>
70 <Private>False</Private> 63 <Private>False</Private>
71 </Reference> 64 </Reference>
72 <Reference Include="System.Data" /> 65 <Reference Include="System.Xml" >
73 <Reference Include="System.Xml">
74 <HintPath>System.Xml.dll</HintPath> 66 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private> 67 <Private>False</Private>
76 </Reference> 68 </Reference>
77 <Reference Include="libsecondlife.dll"> 69 <Reference Include="libsecondlife.dll" >
78 <HintPath>..\bin\libsecondlife.dll</HintPath> 70 <HintPath>..\bin\libsecondlife.dll</HintPath>
79 <Private>False</Private> 71 <Private>False</Private>
80 </Reference> 72 </Reference>
81 <Reference Include="Axiom.MathLib.dll"> 73 <Reference Include="Axiom.MathLib.dll" >
82 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
83 <Private>False</Private> 75 <Private>False</Private>
84 </Reference> 76 </Reference>
85 <Reference Include="Db4objects.Db4o.dll"> 77 <Reference Include="Db4objects.Db4o.dll" >
86 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
87 <Private>False</Private> 79 <Private>False</Private>
88 </Reference> 80 </Reference>
89 </ItemGroup> 81 </ItemGroup>
90 <ItemGroup> 82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
91 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
92 <Name>OpenSim.Framework.Console</Name> 90 <Name>OpenSim.Framework.Console</Name>
93 <Project>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</Project> 91 <Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project>
94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
95 <Private>False</Private> 93 <Private>False</Private>
96 </ProjectReference> 94 </ProjectReference>
97 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 95 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
98 <Name>OpenSim.Physics.Manager</Name> 96 <Name>OpenSim.Physics.Manager</Name>
99 <Project>{0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}</Project> 97 <Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project>
100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
101 <Private>False</Private> 99 <Private>False</Private>
102 </ProjectReference> 100 </ProjectReference>
103 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> 101 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
104 <Name>OpenSim.Framework</Name> 102 <Name>OpenSim.Servers</Name>
105 <Project>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</Project> 103 <Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project>
106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
107 <Private>False</Private> 105 <Private>False</Private>
108 </ProjectReference> 106 </ProjectReference>
109 </ItemGroup> 107 </ItemGroup>
110 <ItemGroup> 108 <ItemGroup>
111 <Compile Include="AgentAssetUpload.cs"> 109 <Compile Include="AgentAssetUpload.cs">
112 <SubType>Code</SubType> 110 <SubType>Code</SubType>
113 </Compile> 111 </Compile>
114 <Compile Include="CAPS\AdminWebFront.cs" />
115 <Compile Include="CAPS\IRestHandler.cs" />
116 <Compile Include="ConsoleCmds.cs"> 112 <Compile Include="ConsoleCmds.cs">
117 <SubType>Code</SubType> 113 <SubType>Code</SubType>
118 </Compile> 114 </Compile>
@@ -146,6 +142,12 @@
146 <Compile Include="Assets\InventoryCache.cs"> 142 <Compile Include="Assets\InventoryCache.cs">
147 <SubType>Code</SubType> 143 <SubType>Code</SubType>
148 </Compile> 144 </Compile>
145 <Compile Include="CAPS\AdminWebFront.cs">
146 <SubType>Code</SubType>
147 </Compile>
148 <Compile Include="CAPS\IRestHandler.cs">
149 <SubType>Code</SubType>
150 </Compile>
149 <Compile Include="CAPS\SimHttp.cs"> 151 <Compile Include="CAPS\SimHttp.cs">
150 <SubType>Code</SubType> 152 <SubType>Code</SubType>
151 </Compile> 153 </Compile>
@@ -193,4 +195,4 @@
193 <PostBuildEvent> 195 <PostBuildEvent>
194 </PostBuildEvent> 196 </PostBuildEvent>
195 </PropertyGroup> 197 </PropertyGroup>
196</Project> \ No newline at end of file 198</Project>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index 4e44c4b..04e86bc 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -49,9 +49,10 @@
49 <include name="../bin/libsecondlife.dll" /> 49 <include name="../bin/libsecondlife.dll" />
50 <include name="../bin/Axiom.MathLib.dll" /> 50 <include name="../bin/Axiom.MathLib.dll" />
51 <include name="../bin/Db4objects.Db4o.dll" /> 51 <include name="../bin/Db4objects.Db4o.dll" />
52 <include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" /> 52 <include name="../bin/OpenSim.Framework.dll" />
53 <include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" /> 53 <include name="../bin/OpenSim.Framework.Console.dll" />
54 <include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" /> 54 <include name="../bin/OpenSim.Physics.Manager.dll" />
55 <include name="../bin/OpenSim.Servers.dll" />
55 </references> 56 </references>
56 </csc> 57 </csc>
57 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> 58 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 7425fca..d6453e2 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -91,7 +91,7 @@ namespace OpenSim
91 91
92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString()); 92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world"); 93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
94 OpenSimRoot.Instance.LocalWorld = new World(); 94 OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg);
95 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); 95 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
96 96
97 this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); 97 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
@@ -113,8 +113,8 @@ namespace OpenSim
113 } 113 }
114 114
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); 115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(); 116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin")); 117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld));
118 118
119 timer1.Enabled = true; 119 timer1.Enabled = true;
120 timer1.Interval = 100; 120 timer1.Interval = 100;
@@ -172,7 +172,7 @@ namespace OpenSim
172 { // new client 172 { // new client
173 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 173 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
174 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 174 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
175 SimClient newuser = new SimClient(epSender, useCircuit); 175 SimClient newuser = new SimClient(epSender, useCircuit, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.AssetCache, OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Application, OpenSimRoot.Instance.InventoryCache, OpenSimRoot.Instance.Sandbox);
176 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 176 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
177 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 177 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
178 } 178 }
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index d463c75..698053d 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -71,6 +71,13 @@ namespace OpenSim
71 private AgentAssetUpload UploadAssets; 71 private AgentAssetUpload UploadAssets;
72 private LLUUID newAssetFolder = LLUUID.Zero; 72 private LLUUID newAssetFolder = LLUUID.Zero;
73 private bool debug = false; 73 private bool debug = false;
74 private World m_world;
75 private Dictionary<uint, SimClient> m_clientThreads;
76 private AssetCache m_assetCache;
77 private IGridServer m_gridServer;
78 private OpenSimApplication m_application;
79 private InventoryCache m_inventoryCache;
80 private bool m_sandboxMode;
74 81
75 private void ack_pack(Packet Pack) 82 private void ack_pack(Packet Pack)
76 { 83 {
@@ -105,15 +112,15 @@ namespace OpenSim
105 switch (Pack.Type) 112 switch (Pack.Type)
106 { 113 {
107 case PacketType.CompleteAgentMovement: 114 case PacketType.CompleteAgentMovement:
108 ClientAvatar.CompleteMovement(OpenSimRoot.Instance.LocalWorld); 115 ClientAvatar.CompleteMovement(m_world);
109 ClientAvatar.SendInitialPosition(); 116 ClientAvatar.SendInitialPosition();
110 break; 117 break;
111 case PacketType.RegionHandshakeReply: 118 case PacketType.RegionHandshakeReply:
112 OpenSimRoot.Instance.LocalWorld.SendLayerData(this); 119 m_world.SendLayerData(this);
113 break; 120 break;
114 case PacketType.AgentWearablesRequest: 121 case PacketType.AgentWearablesRequest:
115 ClientAvatar.SendInitialAppearance(); 122 ClientAvatar.SendInitialAppearance();
116 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 123 foreach (SimClient client in m_clientThreads.Values)
117 { 124 {
118 if (client.AgentID != this.AgentID) 125 if (client.AgentID != this.AgentID)
119 { 126 {
@@ -122,7 +129,7 @@ namespace OpenSim
122 client.ClientAvatar.SendAppearanceToOtherAgent(this); 129 client.ClientAvatar.SendAppearanceToOtherAgent(this);
123 } 130 }
124 } 131 }
125 OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this); 132 m_world.GetInitialPrims(this);
126 break; 133 break;
127 case PacketType.AgentIsNowWearing: 134 case PacketType.AgentIsNowWearing:
128 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 135 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
@@ -134,7 +141,7 @@ namespace OpenSim
134 this.ClientAvatar.SetAppearance(appear); 141 this.ClientAvatar.SetAppearance(appear);
135 break; 142 break;
136 case PacketType.ObjectAdd: 143 case PacketType.ObjectAdd:
137 OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this); 144 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
138 break; 145 break;
139 case PacketType.ObjectLink: 146 case PacketType.ObjectLink:
140 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); 147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
@@ -146,7 +153,7 @@ namespace OpenSim
146 ObjectShapePacket shape = (ObjectShapePacket)Pack; 153 ObjectShapePacket shape = (ObjectShapePacket)Pack;
147 for (int i = 0; i < shape.ObjectData.Length; i++) 154 for (int i = 0; i < shape.ObjectData.Length; i++)
148 { 155 {
149 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 156 foreach (Entity ent in m_world.Entities.Values)
150 { 157 {
151 if (ent.localid == shape.ObjectData[i].ObjectLocalID) 158 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
152 { 159 {
@@ -163,7 +170,7 @@ namespace OpenSim
163 if (multipleupdate.ObjectData[i].Type == 9) //change position 170 if (multipleupdate.ObjectData[i].Type == 9) //change position
164 { 171 {
165 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 172 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
166 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 173 foreach (Entity ent in m_world.Entities.Values)
167 { 174 {
168 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 175 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
169 { 176 {
@@ -177,7 +184,7 @@ namespace OpenSim
177 else if (multipleupdate.ObjectData[i].Type == 10)//rotation 184 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
178 { 185 {
179 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 186 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
180 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 187 foreach (Entity ent in m_world.Entities.Values)
181 { 188 {
182 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 189 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
183 { 190 {
@@ -190,7 +197,7 @@ namespace OpenSim
190 { 197 {
191 198
192 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 199 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
193 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 200 foreach (Entity ent in m_world.Entities.Values)
194 { 201 {
195 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 202 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
196 { 203 {
@@ -204,13 +211,13 @@ namespace OpenSim
204 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 211 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
205 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 212 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
206 { 213 {
207 OpenSimRoot.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); 214 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
208 } 215 }
209 break; 216 break;
210 case PacketType.TransferRequest: 217 case PacketType.TransferRequest:
211 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 218 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
212 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 219 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
213 OpenSimRoot.Instance.AssetCache.AddAssetRequest(this, transfer); 220 m_assetCache.AddAssetRequest(this, transfer);
214 break; 221 break;
215 case PacketType.AgentUpdate: 222 case PacketType.AgentUpdate:
216 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); 223 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
@@ -230,18 +237,18 @@ namespace OpenSim
230 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 237 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
231 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 238 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
232 kill.ObjectData[0].ID = this.ClientAvatar.localid; 239 kill.ObjectData[0].ID = this.ClientAvatar.localid;
233 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 240 foreach (SimClient client in m_clientThreads.Values)
234 { 241 {
235 client.OutPacket(kill); 242 client.OutPacket(kill);
236 } 243 }
237 OpenSimRoot.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); 244 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
238 lock (OpenSimRoot.Instance.LocalWorld.Entities) 245 lock (m_world.Entities)
239 { 246 {
240 OpenSimRoot.Instance.LocalWorld.Entities.Remove(this.AgentID); 247 m_world.Entities.Remove(this.AgentID);
241 } 248 }
242 //need to do other cleaning up here too 249 //need to do other cleaning up here too
243 OpenSimRoot.Instance.ClientThreads.Remove(this.CircuitCode); //this.userEP); 250 m_clientThreads.Remove(this.CircuitCode); //this.userEP);
244 OpenSimRoot.Instance.Application.RemoveClientCircuit(this.CircuitCode); 251 m_application.RemoveClientCircuit(this.CircuitCode);
245 this.ClientThread.Abort(); 252 this.ClientThread.Abort();
246 break; 253 break;
247 case PacketType.ChatFromViewer: 254 case PacketType.ChatFromViewer:
@@ -258,7 +265,7 @@ namespace OpenSim
258 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); 265 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
259 reply.ChatData.OwnerID = this.AgentID; 266 reply.ChatData.OwnerID = this.AgentID;
260 reply.ChatData.SourceID = this.AgentID; 267 reply.ChatData.SourceID = this.AgentID;
261 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 268 foreach (SimClient client in m_clientThreads.Values)
262 { 269 {
263 client.OutPacket(reply); 270 client.OutPacket(reply);
264 } 271 }
@@ -267,7 +274,7 @@ namespace OpenSim
267 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 274 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
268 for (int i = 0; i < imagePack.ObjectData.Length; i++) 275 for (int i = 0; i < imagePack.ObjectData.Length; i++)
269 { 276 {
270 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 277 foreach (Entity ent in m_world.Entities.Values)
271 { 278 {
272 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID) 279 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
273 { 280 {
@@ -278,7 +285,7 @@ namespace OpenSim
278 break; 285 break;
279 case PacketType.ObjectFlagUpdate: 286 case PacketType.ObjectFlagUpdate:
280 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 287 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
281 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 288 foreach (Entity ent in m_world.Entities.Values)
282 { 289 {
283 if (ent.localid == flags.AgentData.ObjectLocalID) 290 if (ent.localid == flags.AgentData.ObjectLocalID)
284 { 291 {
@@ -306,7 +313,7 @@ namespace OpenSim
306 break; 313 break;
307 case PacketType.CreateInventoryFolder: 314 case PacketType.CreateInventoryFolder:
308 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 315 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
309 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type); 316 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type);
310 Console.WriteLine(Pack.ToString()); 317 Console.WriteLine(Pack.ToString());
311 break; 318 break;
312 case PacketType.CreateInventoryItem: 319 case PacketType.CreateInventoryItem:
@@ -320,11 +327,11 @@ namespace OpenSim
320 case PacketType.FetchInventory: 327 case PacketType.FetchInventory:
321 //Console.WriteLine("fetch item packet"); 328 //Console.WriteLine("fetch item packet");
322 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 329 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
323 OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory); 330 m_inventoryCache.FetchInventory(this, FetchInventory);
324 break; 331 break;
325 case PacketType.FetchInventoryDescendents: 332 case PacketType.FetchInventoryDescendents:
326 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 333 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
327 OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); 334 m_inventoryCache.FetchInventoryDescendents(this, Fetch);
328 break; 335 break;
329 case PacketType.UpdateInventoryItem: 336 case PacketType.UpdateInventoryItem:
330 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 337 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
@@ -332,17 +339,17 @@ namespace OpenSim
332 { 339 {
333 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 340 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
334 { 341 {
335 AssetBase asset = OpenSimRoot.Instance.AssetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); 342 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
336 if (asset != null) 343 if (asset != null)
337 { 344 {
338 OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); 345 m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
339 } 346 }
340 else 347 else
341 { 348 {
342 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); 349 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
343 if (asset != null) 350 if (asset != null)
344 { 351 {
345 OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); 352 m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
346 } 353 }
347 } 354 }
348 } 355 }
@@ -350,7 +357,7 @@ namespace OpenSim
350 break; 357 break;
351 case PacketType.ViewerEffect: 358 case PacketType.ViewerEffect:
352 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 359 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
353 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 360 foreach (SimClient client in m_clientThreads.Values)
354 { 361 {
355 if (client.AgentID != this.AgentID) 362 if (client.AgentID != this.AgentID)
356 { 363 {
@@ -362,7 +369,7 @@ namespace OpenSim
362 break; 369 break;
363 case PacketType.DeRezObject: 370 case PacketType.DeRezObject:
364 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); 371 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
365 OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this); 372 m_world.DeRezObject((DeRezObjectPacket)Pack, this);
366 break; 373 break;
367 } 374 }
368 } 375 }
@@ -501,11 +508,11 @@ namespace OpenSim
501 if (Pack.Header.Zerocoded) 508 if (Pack.Header.Zerocoded)
502 { 509 {
503 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 510 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
504 OpenSimRoot.Instance.Application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); 511 m_application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
505 } 512 }
506 else 513 else
507 { 514 {
508 OpenSimRoot.Instance.Application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); 515 m_application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
509 } 516 }
510 } 517 }
511 catch (Exception) 518 catch (Exception)
@@ -569,14 +576,22 @@ namespace OpenSim
569 this.PacketQueue.Enqueue(item); 576 this.PacketQueue.Enqueue(item);
570 } 577 }
571 578
572 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) 579 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimApplication application, InventoryCache inventoryCache, bool sandboxMode)
573 { 580 {
581 m_world = world;
582 m_clientThreads = clientThreads;
583 m_assetCache = assetCache;
584 m_gridServer = gridServer;
585 m_application = application;
586 m_inventoryCache = inventoryCache;
587 m_sandboxMode = sandboxMode;
588
574 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); 589 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
575 cirpack = initialcirpack; 590 cirpack = initialcirpack;
576 userEP = remoteEP; 591 userEP = remoteEP;
577 PacketQueue = new BlockingQueue<QueItem>(); 592 PacketQueue = new BlockingQueue<QueItem>();
578 593
579 this.UploadAssets = new AgentAssetUpload(this); 594 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache );
580 AckTimer = new System.Timers.Timer(500); 595 AckTimer = new System.Timers.Timer(500);
581 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 596 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
582 AckTimer.Start(); 597 AckTimer.Start();
@@ -608,14 +623,16 @@ namespace OpenSim
608 protected virtual void InitNewClient() 623 protected virtual void InitNewClient()
609 { 624 {
610 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 625 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
611 OpenSimRoot.Instance.LocalWorld.AddViewerAgent(this); 626
612 world.Entity tempent = OpenSimRoot.Instance.LocalWorld.Entities[this.AgentID]; 627 m_world.AddViewerAgent(this);
628 world.Entity tempent = m_world.Entities[this.AgentID];
629
613 this.ClientAvatar = (world.Avatar)tempent; 630 this.ClientAvatar = (world.Avatar)tempent;
614 } 631 }
615 632
616 protected virtual void AuthUser() 633 protected virtual void AuthUser()
617 { 634 {
618 AuthenticateResponse sessionInfo = OpenSimRoot.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 635 AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
619 if (!sessionInfo.Authorised) 636 if (!sessionInfo.Authorised)
620 { 637 {
621 //session/circuit not authorised 638 //session/circuit not authorised
@@ -638,23 +655,23 @@ namespace OpenSim
638 } 655 }
639 656
640 // Create Inventory, currently only works for sandbox mode 657 // Create Inventory, currently only works for sandbox mode
641 if (OpenSimRoot.Instance.Sandbox) 658 if (m_sandboxMode)
642 { 659 {
643 if (sessionInfo.LoginInfo.InventoryFolder != null) 660 if (sessionInfo.LoginInfo.InventoryFolder != null)
644 { 661 {
645 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); 662 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
646 if (sessionInfo.LoginInfo.BaseFolder != null) 663 if (sessionInfo.LoginInfo.BaseFolder != null)
647 { 664 {
648 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); 665 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
649 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; 666 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
650 AssetBase[] inventorySet = OpenSimRoot.Instance.AssetCache.CreateNewInventorySet(this.AgentID); 667 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
651 if (inventorySet != null) 668 if (inventorySet != null)
652 { 669 {
653 for (int i = 0; i < inventorySet.Length; i++) 670 for (int i = 0; i < inventorySet.Length; i++)
654 { 671 {
655 if (inventorySet[i] != null) 672 if (inventorySet[i] != null)
656 { 673 {
657 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]); 674 m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
658 } 675 }
659 } 676 }
660 } 677 }
@@ -670,8 +687,8 @@ namespace OpenSim
670 { 687 {
671 AgentInventory inventory = new AgentInventory(); 688 AgentInventory inventory = new AgentInventory();
672 inventory.AgentID = this.AgentID; 689 inventory.AgentID = this.AgentID;
673 OpenSimRoot.Instance.InventoryCache.AddNewAgentsInventory(inventory); 690 m_inventoryCache.AddNewAgentsInventory(inventory);
674 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder); 691 m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
675 } 692 }
676 } 693 }
677} 694}
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
index 83e340b..eee1c3a 100644
--- a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -12,11 +12,15 @@ namespace OpenSim.UserServer
12{ 12{
13 class LocalUserProfileManager : UserProfileManager 13 class LocalUserProfileManager : UserProfileManager
14 { 14 {
15 private IGridServer _gridServer; 15 private IGridServer m_gridServer;
16 private int m_port;
17 private string m_ipAddr;
16 18
17 public LocalUserProfileManager(IGridServer gridServer) 19 public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr)
18 { 20 {
19 _gridServer = gridServer; 21 m_gridServer = gridServer;
22 m_port = simPort;
23 m_ipAddr = ipAddr;
20 } 24 }
21 25
22 public override void InitUserProfiles() 26 public override void InitUserProfiles()
@@ -29,8 +33,8 @@ namespace OpenSim.UserServer
29 uint circode = (uint)response["circuit_code"]; 33 uint circode = (uint)response["circuit_code"];
30 theUser.AddSimCircuit(circode, LLUUID.Random()); 34 theUser.AddSimCircuit(circode, LLUUID.Random());
31 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; 35 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
32 response["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort; 36 response["sim_port"] = m_port;
33 response["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr; 37 response["sim_ip"] = m_ipAddr;
34 response["region_y"] = (Int32)996 * 256; 38 response["region_y"] = (Int32)996 * 256;
35 response["region_x"] = (Int32)997* 256; 39 response["region_x"] = (Int32)997* 256;
36 40
@@ -67,9 +71,9 @@ namespace OpenSim.UserServer
67 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); 71 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
68 72
69 //working on local computer if so lets add to the gridserver's list of sessions? 73 //working on local computer if so lets add to the gridserver's list of sessions?
70 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local") 74 if (m_gridServer.GetName() == "Local")
71 { 75 {
72 ((LocalGridBase)this._gridServer).AddNewSession(_login); 76 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
73 } 77 }
74 } 78 }
75 } 79 }
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index 86b098a..47af8a8 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -52,7 +52,7 @@ namespace OpenSim.UserServer
52 /// </summary> 52 /// </summary>
53 public class LoginServer : LoginService , IUserServer 53 public class LoginServer : LoginService , IUserServer
54 { 54 {
55 private IGridServer _gridServer; 55 private IGridServer m_gridServer;
56 private ushort _loginPort = 8080; 56 private ushort _loginPort = 8080;
57 public IPAddress clientAddress = IPAddress.Loopback; 57 public IPAddress clientAddress = IPAddress.Loopback;
58 public IPAddress remoteAddress = IPAddress.Any; 58 public IPAddress remoteAddress = IPAddress.Any;
@@ -63,10 +63,14 @@ namespace OpenSim.UserServer
63 private string _mpasswd; 63 private string _mpasswd;
64 private bool _needPasswd = false; 64 private bool _needPasswd = false;
65 private LocalUserProfileManager userManager; 65 private LocalUserProfileManager userManager;
66 private int m_simPort;
67 private string m_simAddr;
66 68
67 public LoginServer(IGridServer gridServer) 69 public LoginServer(IGridServer gridServer, string simAddr, int simPort)
68 { 70 {
69 _gridServer = gridServer; 71 m_gridServer = gridServer;
72 m_simPort = simPort;
73 m_simAddr = simAddr;
70 } 74 }
71 75
72 // InitializeLogin: initialize the login 76 // InitializeLogin: initialize the login
@@ -89,7 +93,7 @@ namespace OpenSim.UserServer
89 SR.Close(); 93 SR.Close();
90 this._mpasswd = EncodePassword("testpass"); 94 this._mpasswd = EncodePassword("testpass");
91 95
92 userManager = new LocalUserProfileManager(this._gridServer); 96 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr );
93 userManager.InitUserProfiles(); 97 userManager.InitUserProfiles();
94 userManager.SetKeys("", "", "", "Welcome to OpenSim"); 98 userManager.SetKeys("", "", "", "Welcome to OpenSim");
95 99
@@ -289,8 +293,8 @@ namespace OpenSim.UserServer
289 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); 293 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
290 Hashtable responseData = (Hashtable)response.Value; 294 Hashtable responseData = (Hashtable)response.Value;
291 295
292 responseData["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort; 296 responseData["sim_port"] = m_simPort;
293 responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr; 297 responseData["sim_ip"] = m_simAddr;
294 responseData["agent_id"] = Agent.ToStringHyphenated(); 298 responseData["agent_id"] = Agent.ToStringHyphenated();
295 responseData["session_id"] = Session.ToStringHyphenated(); 299 responseData["session_id"] = Session.ToStringHyphenated();
296 responseData["secure_session_id"]= secureSess.ToStringHyphenated(); 300 responseData["secure_session_id"]= secureSess.ToStringHyphenated();
@@ -327,9 +331,9 @@ namespace OpenSim.UserServer
327 _login.InventoryFolder = InventoryFolderID; 331 _login.InventoryFolder = InventoryFolderID;
328 332
329 //working on local computer if so lets add to the gridserver's list of sessions? 333 //working on local computer if so lets add to the gridserver's list of sessions?
330 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local") 334 if (m_gridServer.GetName() == "Local")
331 { 335 {
332 ((LocalGridBase)this._gridServer).AddNewSession(_login); 336 ((LocalGridBase)m_gridServer).AddNewSession(_login);
333 } 337 }
334 338
335 // forward the XML-RPC response to the client 339 // forward the XML-RPC response to the client
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 75f2cff..2ae9992 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -30,14 +30,23 @@ namespace OpenSim.world
30 private byte[] visualParams; 30 private byte[] visualParams;
31 private AvatarWearable[] Wearables; 31 private AvatarWearable[] Wearables;
32 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 32 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
33 private World m_world;
34 private ulong m_regionHandle;
35 private Dictionary<uint, SimClient> m_clientThreads;
36 private string m_regionName;
33 37
34 public Avatar(SimClient TheClient) 38 public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle)
35 { 39 {
40 m_world = world;
41 m_clientThreads = clientThreads;
42 m_regionName = regionName;
43 m_regionHandle = regionHandle;
44
36 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
37 ControllingClient = TheClient; 46 ControllingClient = TheClient;
38 localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); 47 localid = 8880000 + (m_world._localNumber++);
39 position = new LLVector3(100.0f, 100.0f, 30.0f); 48 position = new LLVector3(100.0f, 100.0f, 30.0f);
40 position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; 49 position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
41 visualParams = new byte[218]; 50 visualParams = new byte[218];
42 for (int i = 0; i < 218; i++) 51 for (int i = 0; i < 218; i++)
43 { 52 {
@@ -52,7 +61,7 @@ namespace OpenSim.world
52 this.Wearables[0].ItemID = LLUUID.Random(); 61 this.Wearables[0].ItemID = LLUUID.Random();
53 62
54 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 63 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
55 64
56 } 65 }
57 66
58 public PhysicsActor PhysActor 67 public PhysicsActor PhysActor
@@ -96,11 +105,11 @@ namespace OpenSim.world
96 //use CreateTerseBlock() 105 //use CreateTerseBlock()
97 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 106 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
98 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 107 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
99 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 108 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
100 terse.RegionData.TimeDilation = 64096; 109 terse.RegionData.TimeDilation = 64096;
101 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 110 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
102 terse.ObjectData[0] = terseBlock; 111 terse.ObjectData[0] = terseBlock;
103 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 112 foreach (SimClient client in m_clientThreads.Values)
104 { 113 {
105 client.OutPacket(terse); 114 client.OutPacket(terse);
106 } 115 }
@@ -119,11 +128,11 @@ namespace OpenSim.world
119 //It has been a while since last update was sent so lets send one. 128 //It has been a while since last update was sent so lets send one.
120 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 129 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
121 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 130 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
122 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 131 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
123 terse.RegionData.TimeDilation = 64096; 132 terse.RegionData.TimeDilation = 64096;
124 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 133 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
125 terse.ObjectData[0] = terseBlock; 134 terse.ObjectData[0] = terseBlock;
126 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 135 foreach (SimClient client in m_clientThreads.Values)
127 { 136 {
128 client.OutPacket(terse); 137 client.OutPacket(terse);
129 } 138 }
@@ -172,7 +181,7 @@ namespace OpenSim.world
172 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 181 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
173 mov.AgentData.SessionID = this.ControllingClient.SessionID; 182 mov.AgentData.SessionID = this.ControllingClient.SessionID;
174 mov.AgentData.AgentID = this.ControllingClient.AgentID; 183 mov.AgentData.AgentID = this.ControllingClient.AgentID;
175 mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 184 mov.Data.RegionHandle = m_regionHandle;
176 // TODO - dynamicalise this stuff 185 // TODO - dynamicalise this stuff
177 mov.Data.Timestamp = 1172750370; 186 mov.Data.Timestamp = 1172750370;
178 mov.Data.Position = new LLVector3(100f, 100f, 23f); 187 mov.Data.Position = new LLVector3(100f, 100f, 23f);
@@ -187,7 +196,7 @@ namespace OpenSim.world
187 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 196 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
188 //send a objectupdate packet with information about the clients avatar 197 //send a objectupdate packet with information about the clients avatar
189 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 198 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
190 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 199 objupdate.RegionData.RegionHandle = m_regionHandle;
191 objupdate.RegionData.TimeDilation = 64096; 200 objupdate.RegionData.TimeDilation = 64096;
192 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 201 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
193 202
@@ -202,9 +211,9 @@ namespace OpenSim.world
202 byte[] pb = pos2.GetBytes(); 211 byte[] pb = pos2.GetBytes();
203 212
204 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 213 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
205 OpenSimRoot.Instance.LocalWorld._localNumber++; 214 m_world._localNumber++;
206 215
207 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 216 foreach (SimClient client in m_clientThreads.Values)
208 { 217 {
209 client.OutPacket(objupdate); 218 client.OutPacket(objupdate);
210 if (client.AgentID != ControllingClient.AgentID) 219 if (client.AgentID != ControllingClient.AgentID)
@@ -241,7 +250,7 @@ namespace OpenSim.world
241 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 250 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
242 //send a objectupdate packet with information about the clients avatar 251 //send a objectupdate packet with information about the clients avatar
243 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 252 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
244 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 253 objupdate.RegionData.RegionHandle = m_regionHandle;
245 objupdate.RegionData.TimeDilation = 64096; 254 objupdate.RegionData.TimeDilation = 64096;
246 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 255 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
247 256
@@ -293,7 +302,7 @@ namespace OpenSim.world
293 this.visualParams[i] = appear.VisualParam[i].ParamValue; 302 this.visualParams[i] = appear.VisualParam[i].ParamValue;
294 } 303 }
295 304
296 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 305 foreach (SimClient client in m_clientThreads.Values)
297 { 306 {
298 if (client.AgentID != ControllingClient.AgentID) 307 if (client.AgentID != ControllingClient.AgentID)
299 { 308 {
@@ -490,7 +499,7 @@ namespace OpenSim.world
490 handshake.RegionInfo.SimAccess = 13; 499 handshake.RegionInfo.SimAccess = 13;
491 handshake.RegionInfo.WaterHeight = 20; 500 handshake.RegionInfo.WaterHeight = 20;
492 handshake.RegionInfo.RegionFlags = 72458694; 501 handshake.RegionInfo.RegionFlags = 72458694;
493 handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0"); 502 handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0");
494 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); 503 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
495 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); 504 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
496 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); 505 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs
index 6ff66a3..a185f0b 100644
--- a/OpenSim.RegionServer/world/Primitive.cs
+++ b/OpenSim.RegionServer/world/Primitive.cs
@@ -22,6 +22,9 @@ namespace OpenSim.world
22 private PhysicsActor _physActor; 22 private PhysicsActor _physActor;
23 private bool physicsEnabled = false; 23 private bool physicsEnabled = false;
24 private bool physicstest = false; //just added for testing 24 private bool physicstest = false; //just added for testing
25 private Dictionary<uint, SimClient> m_clientThreads;
26 private ulong m_regionHandle;
27 private World m_world;
25 28
26 public bool PhysicsEnabled 29 public bool PhysicsEnabled
27 { 30 {
@@ -65,10 +68,14 @@ namespace OpenSim.world
65 } 68 }
66 } 69 }
67 70
68 public Primitive() 71 public Primitive(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world)
69 { 72 {
70 mesh_cutbegin = 0.0f; 73 mesh_cutbegin = 0.0f;
71 mesh_cutend = 1.0f; 74 mesh_cutend = 1.0f;
75
76 m_clientThreads = clientThreads;
77 m_regionHandle = regionHandle;
78 m_world = world;
72 } 79 }
73 80
74 public override Mesh getMesh() 81 public override Mesh getMesh()
@@ -99,7 +106,7 @@ namespace OpenSim.world
99 { 106 {
100 if (this.newPrimFlag) 107 if (this.newPrimFlag)
101 { 108 {
102 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 109 foreach (SimClient client in m_clientThreads.Values)
103 { 110 {
104 client.OutPacket(OurPacket); 111 client.OutPacket(OurPacket);
105 } 112 }
@@ -108,11 +115,11 @@ namespace OpenSim.world
108 else if (this.updateFlag) 115 else if (this.updateFlag)
109 { 116 {
110 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 117 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
111 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 118 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
112 terse.RegionData.TimeDilation = 64096; 119 terse.RegionData.TimeDilation = 64096;
113 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 120 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
114 terse.ObjectData[0] = this.CreateImprovedBlock(); 121 terse.ObjectData[0] = this.CreateImprovedBlock();
115 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 122 foreach (SimClient client in m_clientThreads.Values)
116 { 123 {
117 client.OutPacket(terse); 124 client.OutPacket(terse);
118 } 125 }
@@ -120,7 +127,7 @@ namespace OpenSim.world
120 } 127 }
121 else if (this.dirtyFlag) 128 else if (this.dirtyFlag)
122 { 129 {
123 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 130 foreach (SimClient client in m_clientThreads.Values)
124 { 131 {
125 UpdateClient(client); 132 UpdateClient(client);
126 } 133 }
@@ -131,11 +138,11 @@ namespace OpenSim.world
131 if (this._physActor != null && this.physicsEnabled) 138 if (this._physActor != null && this.physicsEnabled)
132 { 139 {
133 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 140 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
134 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 141 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
135 terse.RegionData.TimeDilation = 64096; 142 terse.RegionData.TimeDilation = 64096;
136 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 143 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
137 terse.ObjectData[0] = this.CreateImprovedBlock(); 144 terse.ObjectData[0] = this.CreateImprovedBlock();
138 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 145 foreach (SimClient client in m_clientThreads.Values)
139 { 146 {
140 client.OutPacket(terse); 147 client.OutPacket(terse);
141 } 148 }
@@ -255,7 +262,7 @@ namespace OpenSim.world
255 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) 262 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
256 { 263 {
257 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 264 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
258 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 265 objupdate.RegionData.RegionHandle = m_regionHandle;
259 objupdate.RegionData.TimeDilation = 64096; 266 objupdate.RegionData.TimeDilation = 64096;
260 267
261 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 268 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@@ -323,7 +330,7 @@ namespace OpenSim.world
323 { 330 {
324 //need to clean this up as it shares a lot of code with CreateFromPacket() 331 //need to clean this up as it shares a lot of code with CreateFromPacket()
325 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 332 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
326 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 333 objupdate.RegionData.RegionHandle = m_regionHandle;
327 objupdate.RegionData.TimeDilation = 64096; 334 objupdate.RegionData.TimeDilation = 64096;
328 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 335 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
329 336
@@ -480,7 +487,7 @@ namespace OpenSim.world
480 this.primData.LocalID = this.localid; 487 this.primData.LocalID = this.localid;
481 this.primData.Position = this.position; 488 this.primData.Position = this.position;
482 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); 489 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
483 OpenSimRoot.Instance.LocalWorld.localStorage.StorePrim(this.primData); 490 m_world.localStorage.StorePrim(this.primData);
484 } 491 }
485 } 492 }
486 493
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index e6d8921..0d126e6 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -25,10 +25,19 @@ namespace OpenSim.world
25 private Random Rand = new Random(); 25 private Random Rand = new Random();
26 private uint _primCount = 702000; 26 private uint _primCount = 702000;
27 private int storageCount; 27 private int storageCount;
28 private Dictionary<uint, SimClient> m_clientThreads;
29 private ulong m_regionHandle;
30 private string m_regionName;
31 private SimConfig m_cfg;
28 32
29 public World() 33 public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
30 { 34 {
31 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 35 m_clientThreads = clientThreads;
36 m_regionHandle = regionHandle;
37 m_regionName = regionName;
38 m_cfg = cfg;
39
40 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
32 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 41 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
33 42
34 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 43 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
@@ -115,9 +124,9 @@ namespace OpenSim.world
115 HeightmapGenHills hills = new HeightmapGenHills(); 124 HeightmapGenHills hills = new HeightmapGenHills();
116 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 125 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
117 this.phyScene.SetTerrain(this.LandMap); 126 this.phyScene.SetTerrain(this.LandMap);
118 OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap); 127 m_cfg.SaveMap(this.LandMap);
119 128
120 foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) { 129 foreach(SimClient client in m_clientThreads.Values) {
121 this.SendLayerData(client); 130 this.SendLayerData(client);
122 } 131 }
123 } 132 }
@@ -134,7 +143,7 @@ namespace OpenSim.world
134 _primCount = prim.LocalID + 1; 143 _primCount = prim.LocalID + 1;
135 } 144 }
136 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 145 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
137 Primitive nPrim = new Primitive(); 146 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
138 nPrim.CreateFromStorage(prim); 147 nPrim.CreateFromStorage(prim);
139 this.Entities.Add(nPrim.uuid, nPrim); 148 this.Entities.Add(nPrim.uuid, nPrim);
140 } 149 }
@@ -175,7 +184,7 @@ namespace OpenSim.world
175 184
176 public void AddViewerAgent(SimClient AgentClient) { 185 public void AddViewerAgent(SimClient AgentClient) {
177 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 186 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
178 Avatar NewAvatar = new Avatar(AgentClient); 187 Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle );
179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
180 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
181 NewAvatar.SendRegionHandshake(this); 190 NewAvatar.SendRegionHandshake(this);
@@ -187,7 +196,7 @@ namespace OpenSim.world
187 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) 196 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
188 { 197 {
189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 198 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
190 Primitive prim = new Primitive(); 199 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this );
191 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 200 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
192 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 201 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
193 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); 202 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
@@ -210,7 +219,7 @@ namespace OpenSim.world
210 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData ) 219 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData )
211 { 220 {
212 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 221 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
213 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 222 foreach (Entity ent in this.Entities.Values)
214 { 223 {
215 if (ent.localid == Data.ObjectLocalID) 224 if (ent.localid == Data.ObjectLocalID)
216 { 225 {
@@ -220,7 +229,7 @@ namespace OpenSim.world
220 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 229 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
221 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 230 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
222 kill.ObjectData[0].ID = ent.localid; 231 kill.ObjectData[0].ID = ent.localid;
223 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 232 foreach (SimClient client in m_clientThreads.Values)
224 { 233 {
225 client.OutPacket(kill); 234 client.OutPacket(kill);
226 } 235 }
@@ -234,9 +243,9 @@ namespace OpenSim.world
234 } 243 }
235 foreach( libsecondlife.LLUUID uuid in DeRezEnts ) 244 foreach( libsecondlife.LLUUID uuid in DeRezEnts )
236 { 245 {
237 lock (OpenSimRoot.Instance.LocalWorld.Entities) 246 lock (this.Entities)
238 { 247 {
239 OpenSimRoot.Instance.LocalWorld.Entities.Remove(uuid); 248 this.Entities.Remove(uuid);
240 } 249 }
241 } 250 }
242 251